|
|
@@ -12,6 +12,7 @@ Page({ |
|
|
|
answerflag: "", |
|
|
|
flagsex: 0, |
|
|
|
useImg:0, |
|
|
|
showReceiptUrl:false, |
|
|
|
items: [{ |
|
|
|
name: 1, |
|
|
|
value: '男', |
|
|
@@ -191,19 +192,45 @@ Page({ |
|
|
|
wx.chooseImage({ |
|
|
|
success(res) { |
|
|
|
const tempFilePaths = res.tempFilePaths |
|
|
|
console.log(config.api.imgUpload) |
|
|
|
console.log(res) |
|
|
|
wx.uploadFile({ |
|
|
|
url: config.api.imgUpload, // 仅为示例,非真实的接口地址 |
|
|
|
url: config.url+config.api.imgUpload, |
|
|
|
filePath: tempFilePaths[0], |
|
|
|
name: 'file', |
|
|
|
header: { |
|
|
|
'token': app.globalData.token |
|
|
|
}, |
|
|
|
success(res) { |
|
|
|
const data = res.data |
|
|
|
console.log(res) |
|
|
|
if (res.statusCode == 200) { |
|
|
|
that.setData({ |
|
|
|
receiptUrl: JSON.parse(res.data).data.url, |
|
|
|
showReceiptUrl: true |
|
|
|
}) |
|
|
|
} else if (res.statusCode == 413) { |
|
|
|
wx.showToast({ |
|
|
|
title: '上传的图片太大,请重新上传', |
|
|
|
icon: "none" |
|
|
|
}) |
|
|
|
that.setData({ |
|
|
|
showReceiptUrl: false |
|
|
|
}) |
|
|
|
} else { |
|
|
|
wx.showToast({ |
|
|
|
title: '请上传正确的图片', |
|
|
|
icon: "none" |
|
|
|
}) |
|
|
|
that.setData({ |
|
|
|
showReceiptUrl: false |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
fail(error) { |
|
|
|
wx.showToast({ |
|
|
|
title: "上传图片失败", |
|
|
|
icon: "none" |
|
|
|
}) |
|
|
|
that.setData({ |
|
|
|
receiptUrl: JSON.parse(res.data).data.url |
|
|
|
showReceiptUrl: false |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
@@ -220,7 +247,8 @@ Page({ |
|
|
|
}).then(res => { |
|
|
|
if (res && res.data && res.data.activity) { |
|
|
|
this.setData({ |
|
|
|
useImg: res.data.activity.useImg |
|
|
|
useImg: res.data.activity.useImg, |
|
|
|
imgDetail: res.data.activity.imgDetail |
|
|
|
}) |
|
|
|
if (res.data && res.data.activity && res.data.activity.question) { |
|
|
|
that.setData({ |
|
|
|