|
|
@@ -80,8 +80,6 @@ Page({ |
|
|
|
* 提交信息-注册 |
|
|
|
*/ |
|
|
|
formSubmit2(e) { |
|
|
|
console.log(this.data.cityList[0][e.detail.value.city[0]]); |
|
|
|
return; |
|
|
|
console.log('form发生了submit事件,携带数据为:', e.detail.value) |
|
|
|
if (e.detail.value.name == "" || e.detail.value.name == null) { |
|
|
|
wx.showToast({icon:'none',title: '请输入您的姓名'}) |
|
|
@@ -228,34 +226,33 @@ Page({ |
|
|
|
chooseImage(e){ |
|
|
|
var list=this.data.photoList; |
|
|
|
wx.chooseImage({ |
|
|
|
count:1, |
|
|
|
count: 3-this.data.photoList.length, |
|
|
|
sizeType: ['original'], //可选择原图 |
|
|
|
sourceType: ['album', 'camera'], //可选择性开放访问相册、相机 |
|
|
|
success: res => { |
|
|
|
wx.uploadFile({ |
|
|
|
url: app.globalData.urlRoot + "upload/uploadImage", |
|
|
|
header:{"OPENID": app.globalData.openid}, |
|
|
|
filePath: res.tempFilePaths[0], |
|
|
|
name: "file", |
|
|
|
success: res => { |
|
|
|
console.log(res) |
|
|
|
if(res.data){ |
|
|
|
console.log(JSON.parse(res.data)); |
|
|
|
var json=JSON.parse(res.data); |
|
|
|
if(json.code==200){ |
|
|
|
console.log(json.data[0].url); |
|
|
|
if(e.currentTarget.dataset.value>-1){ |
|
|
|
list[e.currentTarget.dataset.value]=json.data[0].url; |
|
|
|
}else{ |
|
|
|
list.push(json.data[0].url); |
|
|
|
for (let i = 0; i < res.tempFilePaths.length; i++) { |
|
|
|
wx.uploadFile({ |
|
|
|
url: app.globalData.urlRoot + "upload/uploadImage", |
|
|
|
header: { "OPENID": app.globalData.openid }, |
|
|
|
filePath: res.tempFilePaths[i], |
|
|
|
name: "file", |
|
|
|
success: res => { |
|
|
|
if (res.data) { |
|
|
|
var json = JSON.parse(res.data); |
|
|
|
if (json.code == 200) { |
|
|
|
if (e.currentTarget.dataset.value > -1) { |
|
|
|
list[e.currentTarget.dataset.value] = json.data[0].url; |
|
|
|
} else { |
|
|
|
list.push(json.data[0].url); |
|
|
|
} |
|
|
|
this.setData({ photoList: list }); |
|
|
|
} else { |
|
|
|
wx.showToast({ icon: 'none', title: '图片上传失败' }) |
|
|
|
} |
|
|
|
this.setData({photoList:list}); |
|
|
|
}else{ |
|
|
|
wx.showToast({icon:'none',title: '图片上传失败'}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
@@ -429,5 +426,12 @@ Page({ |
|
|
|
*/ |
|
|
|
onShareAppMessage: function() { |
|
|
|
return app.sharePack(); |
|
|
|
}, |
|
|
|
deleteImg:function(e){ |
|
|
|
var index = e.currentTarget.dataset.index; |
|
|
|
this.data.photoList.splice(index,1); |
|
|
|
this.setData({ |
|
|
|
photoList: this.data.photoList |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |