846 lines
21 KiB
846 lines
21 KiB
var Api = require('../../../utils/common.js'); |
|
var re = require('../../../utils/request.js'); |
|
var WxParse = require('../../../wxParse/wxParse.js'); |
|
var dateTimePicker = require('../../dateTimePicker.js'); |
|
var util = require('../../../utils/util.js'); |
|
Page({ |
|
|
|
/** |
|
* 页面的初始数据 |
|
*/ |
|
data: { |
|
|
|
dateTime:'', |
|
dateTimeArray:'', |
|
startT:'', |
|
isFree:1, |
|
dateTimeTwo:'', |
|
dateTimeArrayTwo:'', |
|
startTTwo:'', |
|
|
|
dateTimeThree:'', |
|
dateTimeArrayThree:'', |
|
startTThree:'', |
|
|
|
dateTimeFour:'', |
|
dateTimeArrayFour:'', |
|
startTFour:'', |
|
year: new Date().getFullYear(), |
|
clubId: '', |
|
endRegisterTime: '2021-06-01', |
|
startTime: util.getNowDate(new Date()), |
|
endTime: util.getNowDate(new Date()), |
|
nofree: true, |
|
flag: true, |
|
array:[], |
|
index:0, |
|
activityName: '', |
|
costReq: '', |
|
address: '', |
|
addrLat: '', |
|
addrLon: '', |
|
createdTel:'', |
|
costList:[], |
|
isFree: '1', //kaishi |
|
imgIndex: 0, |
|
imageLength: 0, |
|
firstCon: '', |
|
dataList: [], |
|
uploaderList: [],//fengmian |
|
showList: [], |
|
uploaderNum: 0, |
|
showUpload: true, |
|
uploaderListfront:[],//idcardfront |
|
showListfront: [], |
|
uploaderNumfront: 0, |
|
showUploadfront:true, |
|
insurancePrice: '', |
|
insuranceType: '0', |
|
hidden: true, |
|
isLimit :'', |
|
items: [//退款 |
|
{ value: '0', name: '活动开始前均可申请退款', checked: 'true' }, |
|
{ value: '1', name: '指定时间钱可申请退款' }, |
|
{ value: '2', name: '不可退款' }, |
|
], |
|
ifchoose: true, |
|
refundType: '0', |
|
refundTime: '2021-04-01', |
|
isCheck: '0', |
|
taghidden: true, |
|
// questionReq: [], |
|
addtag: '', |
|
isUpdateRegister: '0', |
|
isSmsNotify: '0', |
|
isJoin: '0', |
|
isShowRegister:'0', |
|
isShowSponsor:'0' |
|
}, |
|
bindstartDateChange: function (e) { |
|
this.setData({ |
|
startRegisterTime: e.detail.value |
|
}) |
|
}, |
|
bindendDateChange: function (e) { |
|
this.setData({ |
|
endRegisterTime: e.detail.value |
|
}) |
|
}, |
|
bindstartTimeChange: function (e) { |
|
this.setData({ |
|
startTime: e.detail.value |
|
}) |
|
}, |
|
bindendTimeChange: function (e) { |
|
this.setData({ |
|
endTime: e.detail.value |
|
}) |
|
}, |
|
peoplelimitInput: function (e) { |
|
this.setData({ |
|
isLimit: e.detail.value |
|
}) |
|
}, |
|
safeInput: function (e) { |
|
this.setData({ |
|
insurancePrice: e.detail.value |
|
}) |
|
}, |
|
feeInput: function (e) { |
|
this.setData({ |
|
isLimitSelect: e.detail.value |
|
}) |
|
}, |
|
telInput: function (e) { |
|
this.setData({ |
|
createdTel: e.detail.value |
|
}) |
|
}, |
|
helpInput: function (e) { |
|
this.setData({ |
|
isHelpRegister: e.detail.value |
|
}) |
|
}, |
|
insuranceTypeChange(e) { |
|
this.setData({ |
|
insuranceType: e.detail.value |
|
}) |
|
}, |
|
addrequired: function () { |
|
this.setData({ |
|
taghidden: false |
|
}) |
|
}, |
|
addtags: function (e) { |
|
this.setData({ |
|
addtag: e.detail.value, |
|
}) |
|
}, |
|
tagcancel: function () { |
|
this.setData({ |
|
taghidden: true |
|
}); |
|
}, |
|
tagconfirm: function () { |
|
var that = this; |
|
if (that.data.addtag) { |
|
that.setData({ |
|
questionReq: that.data.questionReq.concat(that.data.addtag), |
|
taghidden: true, |
|
addtag: '' |
|
}) |
|
} else { |
|
wx.showToast({ |
|
title: '输入有误', |
|
icon: 'none', |
|
duration: 1000 |
|
}) |
|
} |
|
}, |
|
tobackmoney: function () { |
|
var that = this; |
|
that.setData({ |
|
hidden: false |
|
}) |
|
}, |
|
cancel: function () { |
|
var that = this; |
|
that.setData({ |
|
hidden: true |
|
}) |
|
}, |
|
confirm: function () { |
|
var that = this; |
|
that.setData({ |
|
hidden: true |
|
}) |
|
}, |
|
tomessage: function () { |
|
// wx.navigateTo({ |
|
// url: '../messageset/messageset' |
|
// }) |
|
this.setData({ |
|
isSmsNotify: e.detail.value |
|
}) |
|
}, |
|
radioChange(e) { |
|
this.setData({ |
|
isFree: e.detail.value |
|
}) |
|
if (e.detail.value == '0') { |
|
this.setData({ |
|
nofree: true |
|
}) |
|
} else { |
|
this.setData({ |
|
nofree: false |
|
}) |
|
} |
|
}, |
|
tochooseAddress: function () { |
|
var that = this; |
|
wx.chooseLocation({ |
|
success(res) { |
|
that.setData({ |
|
address: res.address, |
|
addrLat: res.latitude, |
|
addrLon: res.longitude |
|
}) |
|
} |
|
}) |
|
}, |
|
checkChange: function (e) { |
|
this.setData({ |
|
isCheck: e.detail.value |
|
}) |
|
}, |
|
registerChange: function (e) { |
|
this.setData({ |
|
isUpdateRegister: e.detail.value |
|
}) |
|
}, |
|
showregisterChange: function (e) { |
|
this.setData({ |
|
isShowRegister: e.detail.value |
|
}) |
|
}, |
|
sponsorChange: function (e) { |
|
this.setData({ |
|
isShowSponsor: e.detail.value |
|
}) |
|
}, |
|
isJoinChange: function (e) { |
|
this.setData({ |
|
isJoin: e.detail.value |
|
}) |
|
}, |
|
nameInput: function (e) { |
|
this.setData({ |
|
activityName: e.detail.value, |
|
}) |
|
}, |
|
addressInput: function(e){ |
|
this.setData({ |
|
address: e.detail.value, |
|
}) |
|
}, |
|
appleChange: function (e) { |
|
this.setData({ |
|
isAppletNotify: e.detail.value, |
|
}) |
|
}, |
|
backChange(e) { |
|
console.log(e.detail.value) |
|
this.setData({ |
|
refundType: e.detail.value |
|
}) |
|
if (e.detail.value == 1) { |
|
this.setData({ |
|
ifchoose: false |
|
}) |
|
} else { |
|
this.setData({ |
|
ifchoose: true |
|
}) |
|
} |
|
}, |
|
bindDateChange: function (e) { |
|
this.setData({ |
|
refundTime: e.detail.value |
|
}) |
|
}, |
|
custname: function (e) { |
|
this.setData({ |
|
costName: e.detail.value, |
|
}) |
|
}, |
|
custmoney: function (e) { |
|
this.setData({ |
|
cost: e.detail.value, |
|
}) |
|
}, |
|
custintro: function (e) { |
|
this.setData({ |
|
costExplain: e.detail.value, |
|
}) |
|
}, |
|
bindPickerChange: function(e) { |
|
var that = this; |
|
that.setData({ |
|
index: e.detail.value, |
|
clubId:that.data.array[e.detail.value].clubId |
|
}) |
|
}, |
|
/** |
|
* 生命周期函数--监听页面加载 |
|
*/ |
|
//获取时间日期 |
|
|
|
changeDateTime(e) { |
|
this.setData({ |
|
dateTime: e.detail.value |
|
}) |
|
|
|
var startT = dateTimePicker.formatPickerDateTime(this.data.dateTimeArray, this.data.dateTime) |
|
console.log(startT); |
|
this.setData({ |
|
startT: startT |
|
}) |
|
}, |
|
|
|
// 时间Two |
|
changeDateTimeTwo(e) { |
|
this.setData({ |
|
dateTimeTwo: e.detail.value |
|
}) |
|
|
|
var startTTwo = dateTimePicker.formatPickerDateTime(this.data.dateTimeArrayTwo, this.data.dateTimeTwo) |
|
// console.log(startTTwo); |
|
this.setData({ |
|
startTTwo: startTTwo |
|
}) |
|
}, |
|
|
|
// 时间Three |
|
changeDateTimeThree(e) { |
|
this.setData({ |
|
dateTimeThree: e.detail.value |
|
}) |
|
|
|
var startTThree = dateTimePicker.formatPickerDateTime(this.data.dateTimeArrayThree, this.data.dateTimeThree) |
|
|
|
console.log(startTThree); |
|
this.setData({ |
|
startTThree: startTThree |
|
}) |
|
}, |
|
|
|
// 时间Four |
|
changeDateTimeFour(e) { |
|
this.setData({ |
|
dateTimeFour: e.detail.value |
|
}) |
|
|
|
var startTFour = dateTimePicker.formatPickerDateTime(this.data.dateTimeArrayFour, this.data.dateTimeFour) |
|
this.setData({ |
|
startTFour: startTFour |
|
}) |
|
}, |
|
onLoad: function (options) { |
|
|
|
var nowDate = util.formatTimeTwo(new Date()); |
|
// 时间ONE |
|
var start = nowDate; |
|
var obj = dateTimePicker.dateTimePicker(new Date().getFullYear(),this.data.year, start); |
|
this.setData({ |
|
dateTime: obj.dateTime, |
|
dateTimeArray: obj.dateTimeArray |
|
}); |
|
var startT = dateTimePicker.formatPickerDateTime(this.data.dateTimeArray,this.data.dateTime) |
|
console.log(startT); |
|
this.setData({ |
|
startT: startT |
|
}) |
|
|
|
// 时间Two |
|
var startTwo = nowDate; |
|
var objTwo = dateTimePicker.dateTimePicker(new Date().getFullYear(),this.data.year,startTwo); |
|
this.setData({ |
|
dateTimeTwo: objTwo.dateTime, |
|
dateTimeArrayTwo: objTwo.dateTimeArray |
|
}); |
|
var startTTwo = dateTimePicker.formatPickerDateTime(this.data.dateTimeArray,this.data.dateTime) |
|
console.log(startTTwo); |
|
this.setData({ |
|
startTTwo: startTTwo |
|
}) |
|
|
|
// 时间three |
|
var startThree= nowDate; |
|
var objThree = dateTimePicker.dateTimePicker(new Date().getFullYear(),this.data.year,startThree); |
|
this.setData({ |
|
dateTimeThree: objThree.dateTime, |
|
dateTimeArrayThree: objThree.dateTimeArray |
|
}); |
|
var startTThree = dateTimePicker.formatPickerDateTime(this.data.dateTimeArray,this.data.dateTime) |
|
this.setData({ |
|
startTThree: startTThree |
|
}) |
|
|
|
|
|
// 时间Four |
|
var startFour= nowDate; |
|
var objFour = dateTimePicker.dateTimePicker(new Date().getFullYear(),this.data.year,startFour); |
|
this.setData({ |
|
dateTimeFour: objFour.dateTime, |
|
dateTimeArrayFour: objFour.dateTimeArray |
|
}); |
|
var startTFour = dateTimePicker.formatPickerDateTime(this.data.dateTimeArray,this.data.dateTime) |
|
this.setData({ |
|
startTFour: startTFour |
|
}) |
|
this.getClubHave(); |
|
|
|
|
|
}, |
|
getClubHave:function(){ |
|
var that = this; |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
re.request(Api.getClubHave(), '', header).then((res) => { |
|
let datas = res.data.data; |
|
if(datas.length > 0){ |
|
that.data.clubId = datas[0].clubId; |
|
} |
|
that.setData({ |
|
array: datas, |
|
}) |
|
}) |
|
}, |
|
/*勾选协议 */ |
|
xieyi: function (e) { |
|
this.setData({ |
|
checked: !this.data.checked |
|
}) |
|
}, |
|
//查看协议 |
|
seexcieyi: function () { |
|
var that = this; |
|
that.setData({ |
|
flag: false |
|
}) |
|
that.self(); |
|
}, |
|
//看完协议了 |
|
know: function () { |
|
var that = this; |
|
that.setData({ |
|
flag: true |
|
}) |
|
}, |
|
self: function () { |
|
var that = this; |
|
var header = {}; |
|
var postData = { |
|
type: 2 |
|
}; |
|
// re.request(Api.getAgreement(), postData, header).then((res) => { |
|
// var ftext = res.data.data[0].content; |
|
// WxParse.wxParse('ftext', 'html', ftext, that, 5); |
|
// }) |
|
}, |
|
// 删除图片 |
|
clearImg: function (e) { |
|
var nowList = []; //新数据 |
|
var nowListshow = []; //新数据 |
|
var uploaderList = this.data.uploaderList; //原数据 |
|
var showList = this.data.showList; //原数据 |
|
|
|
for (let i = 0; i < uploaderList.length; i++) { |
|
if (i == e.currentTarget.dataset.index) { |
|
continue; |
|
} else { |
|
nowList.push(uploaderList[i]); |
|
nowListshow.push(showList[i]); |
|
} |
|
} |
|
this.setData({ |
|
uploaderNum: this.data.uploaderNum - 1, |
|
uploaderList: nowList, |
|
showUpload: true, |
|
showList: nowListshow |
|
}) |
|
}, |
|
//展示图片 |
|
showImg: function (e) { |
|
var that = this; |
|
wx.previewImage({ |
|
urls: that.data.uploaderList, |
|
current: that.data.uploaderList[e.currentTarget.dataset.index] |
|
}) |
|
}, |
|
//上传图片 |
|
upload: function (e) { |
|
var that = this; |
|
wx.chooseImage({ |
|
count: 1 - that.data.uploaderNum, // 默认3 |
|
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 |
|
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 |
|
success: function (res) { |
|
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 |
|
let tempFilePaths = res.tempFilePaths; |
|
let uploaderList = that.data.uploaderList.concat(tempFilePaths); |
|
if (uploaderList.length == 1) { |
|
that.setData({ |
|
showUpload: false |
|
}) |
|
} |
|
that.setData({ |
|
uploaderList: uploaderList, |
|
uploaderNum: uploaderList.length, |
|
}) |
|
|
|
for (var i = 0; i < tempFilePaths.length; i++) { |
|
wx.showLoading({ |
|
title: `正在上传第${i + 1}张图片`, |
|
mask: true |
|
}); |
|
wx.uploadFile({ |
|
url: Api.uploadImg(), |
|
filePath: res.tempFilePaths[i], |
|
name: 'file', |
|
formData: { |
|
}, |
|
success: function (res) { |
|
wx.hideLoading(); |
|
var sss = JSON.parse(res.data); |
|
let showList = that.data.showList.concat(sss.msg); |
|
that.setData({ |
|
showList: showList |
|
}); |
|
} |
|
}) |
|
} |
|
} |
|
}) |
|
}, |
|
// 删除Logofront图片 |
|
clearImgfront: function (e) { |
|
var nowList = []; //新数据 |
|
var nowListshowfront = []; //新数据 |
|
var uploaderListfront = this.data.uploaderListfront; //原数据 |
|
var showListfront = this.data.showListfront; //原数据 |
|
|
|
for (let i = 0; i < uploaderListfront.length; i++) { |
|
if (i == e.currentTarget.dataset.index) { |
|
continue; |
|
} else { |
|
nowList.push(uploaderListfront[i]); |
|
nowListshowfront.push(showListfront[i]); |
|
} |
|
} |
|
this.setData({ |
|
uploaderNum: this.data.uploaderNum - 1, |
|
uploaderListfront: nowList, |
|
showUploadfront: true, |
|
showListfront:nowListshowfront |
|
}) |
|
}, |
|
//展示图片 |
|
showImgfront: function (e) { |
|
var that = this; |
|
wx.previewImage({ |
|
urls: that.data.uploaderListfront, |
|
current: that.data.uploaderListfront[e.currentTarget.dataset.index] |
|
}) |
|
}, |
|
//上传图片 |
|
uploadfront: function (e) { |
|
var that = this; |
|
wx.chooseImage({ |
|
count: 1 - that.data.uploaderNum, // 默认3 |
|
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 |
|
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 |
|
success: function (res) { |
|
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 |
|
let tempFilePaths = res.tempFilePaths; |
|
let uploaderListfront = that.data.uploaderListfront.concat(tempFilePaths); |
|
if (uploaderListfront.length == 1) { |
|
that.setData({ |
|
showUploadfront: false |
|
}) |
|
} |
|
that.setData({ |
|
uploaderListfront: uploaderListfront, |
|
uploaderNum: uploaderListfront.length, |
|
}) |
|
|
|
for(var i=0;i<tempFilePaths.length;i++){ |
|
wx.uploadFile({ |
|
url: Api.uploadImg(), |
|
filePath: res.tempFilePaths[i], |
|
name: 'file', |
|
formData: { |
|
}, |
|
success: function (res) { |
|
var sss = JSON.parse(res.data); |
|
console.log(sss) |
|
let showListfront = that.data.showListfront.concat(sss.msg); |
|
that.setData({ |
|
showListfront:showListfront |
|
}) |
|
} |
|
}) |
|
} |
|
} |
|
}) |
|
}, |
|
// 创建活动 |
|
setActive: function () { |
|
var that = this; |
|
var content = []; |
|
let costLists = []; |
|
let costListItem = {}; |
|
content.push(that.data.firstCon); |
|
let datalist = that.data.dataList; |
|
for(var i=0;i<datalist.length;i++){ |
|
content.push(datalist[i].picaddr); |
|
content.push(datalist[i].value); |
|
} |
|
costListItem = {cost:that.data.cost,costExplain:that.data.costExplain,costName:that.data.costName |
|
// , isHaveInsurance |
|
} |
|
costLists.push(costListItem); |
|
var postData = { |
|
activityAddr: that.data.address, |
|
activityContent: JSON.stringify(content), |
|
activityName: that.data.activityName, |
|
addrLat: that.data.addrLat, |
|
addrLon: that.data.addrLon, |
|
clubId: that.data.clubId, |
|
isLimitSelect:that.data.isLimitSelect?that.data.isLimitSelect:-1, |
|
isHelpRegister:that.data.isHelpRegister?that.data.isHelpRegister:-1, |
|
costReq: [],//费用信息列表 |
|
coverFirstImage: that.data.showList[0] ? that.data.showList[0] : '', |
|
activityLogo: that.data.showListfront[0] ? that.data.showListfront[0] : '', |
|
endRegisterTime: that.data.startTTwo, |
|
endTime: that.data.startTFour, |
|
insurancePrice: that.data.insurancePrice, |
|
insuranceType: that.data.insuranceType, |
|
createdTel:that.data.createdTel, |
|
isAppletNotify: '1', |
|
isCheck: that.data.isCheck, |
|
isFree: that.data.isFree?that.data.isFree:1, |
|
isLimit: that.data.isLimit, |
|
isJoin: that.data.isJoin, |
|
isShowRegister: that.data.isShowRegister, |
|
isShowSponsor: that.data.isShowSponsor, |
|
isSmsNotify: that.data.isSmsNotify, |
|
isUpdateRegister: that.data.isUpdateRegister, |
|
publishStatus: '1', |
|
// questionReq: that.data.questionReq, |
|
refundTime: that.data.refundTime, |
|
refundType: that.data.refundType, |
|
startRegisterTime: that.data.startT, |
|
startTime: that.data.startTThree, |
|
// costList:JSON.stringify(costLists) |
|
costListString:JSON.stringify(costLists), |
|
questionListString:'[]' |
|
}; |
|
// console.log('send active data:', postData); |
|
// return; |
|
var header = { |
|
token: wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
if(!this.data.checked){ |
|
wx.showToast({ |
|
title: '请先阅读并同意此协议', |
|
icon: 'none', |
|
duration: 1500 |
|
}) |
|
}else{ |
|
re.request(Api.createActive(), postData, header).then((res) => { |
|
console.log(res) |
|
wx.showToast({ |
|
title: '提交成功', |
|
icon: 'none', |
|
duration: 1500 |
|
}) |
|
setTimeout(function(){ |
|
wx.navigateBack({ |
|
delta: 1 |
|
}) |
|
},1500) |
|
}) |
|
} |
|
}, |
|
/** |
|
* 生命周期函数--监听页面初次渲染完成 |
|
*/ |
|
onReady: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面显示 |
|
*/ |
|
onShow: function (e) { |
|
var that = this; |
|
}, |
|
/** |
|
* 输入监听 |
|
*/ |
|
inputCon: function (e) { |
|
let that = this; |
|
if (0 === e.currentTarget.id - 0) {//第一个文本框的输入监听 |
|
that.data.firstCon = e.detail.value; |
|
} else { |
|
that.data.dataList[e.currentTarget.id - 1].value = e.detail.value; |
|
} |
|
}, |
|
/** |
|
* 失去焦点监听 |
|
* 根据失去监听的input的位置来判断图片的插入位置 |
|
*/ |
|
outBlur: function (e) { |
|
let that = this; |
|
that.data.imgIndex = e.currentTarget.id - 0; |
|
}, |
|
/** |
|
* 添加图片 |
|
*/ |
|
addImg: function () { |
|
var that = this; |
|
//这里考虑到性能,对于图片张数做了限制 |
|
if (that.data.dataList.length >= 4) {//超过四张 |
|
wx.showModal({ |
|
title: '提示', |
|
content: '最多只能添加四张图片哦', |
|
confirmText: "我知道了", |
|
confirmColor: "#ef8383", |
|
showCancel: false, |
|
success: function (res) { |
|
if (res.confirm) { |
|
} else if (res.cancel) { |
|
} |
|
} |
|
}) |
|
} else {//添加图片 |
|
wx.showActionSheet({ |
|
itemList: ['从相册选择', '拍照'], |
|
itemColor: '#ef8383', |
|
success: function (res) { |
|
var choseType = res.tapIndex == 0 ? "album" : res.tapIndex == 1 ? "camera" : ""; |
|
if (choseType != "") { |
|
wx.chooseImage({ |
|
sizeType: ['original'],//原图 |
|
sourceType: [choseType], |
|
count: 1,//每次添加一张 |
|
success: function (res) { |
|
let tempFilePaths = res.tempFilePaths; |
|
for(var i=0;i<tempFilePaths.length;i++){ |
|
wx.uploadFile({ |
|
url: Api.uploadImg(), |
|
filePath:tempFilePaths[i], |
|
name: 'file', |
|
formData: { |
|
}, |
|
success: function (res) { |
|
var sss = JSON.parse(res.data); |
|
var info = { |
|
pic:tempFilePaths[0],//存储本地地址 |
|
picaddr:sss.msg, |
|
temp: true,//标记是否是临时图片 |
|
value: '',//存储图片下方相邻的输入框的内容 |
|
} |
|
that.data.dataList.splice(that.data.imgIndex, 0, info);//方法自行百度 |
|
that.setData({ |
|
dataList: that.data.dataList, |
|
}) |
|
} |
|
}) |
|
} |
|
} |
|
}) |
|
} |
|
}, |
|
fail: function (res) { |
|
console.log(res.errMsg) |
|
} |
|
}) |
|
} |
|
}, |
|
/** |
|
* 删除图片 |
|
*/ |
|
deletedImg: function (e) { |
|
let that = this; |
|
let index = e.currentTarget.dataset.index; |
|
wx.showActionSheet({ |
|
itemList: ['删除图片'], |
|
success: function (res) { |
|
if (res.tapIndex === 0) {//点击删除图片 |
|
if (index === 0 && that.data.dataList[index].value != null) {//删除第一张,要与最上方的textarea合并 |
|
that.data.firstCon = that.data.firstCon + that.data.dataList[index].value; |
|
} else if (index > 0 && that.data.dataList[index].value != null) { |
|
that.data.dataList[index - 1].value = that.data.dataList[index - 1].value + that.data.dataList[index].value; |
|
} |
|
that.data.dataList.splice(index, 1); |
|
that.setData({ |
|
firstCon: that.data.firstCon, |
|
dataList: that.data.dataList |
|
}) |
|
} |
|
}, |
|
fail: function (res) { |
|
console.log(res.errMsg) |
|
} |
|
}) |
|
}, |
|
//失败警告 |
|
do_fail: function (a) { |
|
wx.showToast({ |
|
title: a, |
|
icon: 'none', |
|
duration: 1000 |
|
}) |
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面隐藏 |
|
*/ |
|
onHide: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面卸载 |
|
*/ |
|
onUnload: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
*/ |
|
onPullDownRefresh: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面上拉触底事件的处理函数 |
|
*/ |
|
onReachBottom: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 用户点击右上角分享 |
|
*/ |
|
onShareAppMessage: function () { |
|
|
|
} |
|
}) |