const app = require('../../utils/util.js'); // var util = require('../../utils/md5.js') Page({ data: { imgPath: '', isTrue: true, }, goShenFen() { if (!this.data.isTrue) { wx.request({ url: app.globalData.publicUrl + '/applet/suppleUserInfo', method: "POST", header: { appletsId: wx.getStorageSync('openId') }, data: { headPicPath: this.data.imgPath }, success: (res) => { console.log(res, "111"); wx.redirectTo({ url: '/pages/idCardDetail/idCardDetail', }) } }) } else { wx.showToast({ title: "请点击相机上传照片", icon: 'none', duration: 2000, }) } }, goPhoto() { wx.chooseImage({ count: 1, sizeType: ['compressed'], sourceType: ['camera'], success: (res) => { var tempFilePaths = res.tempFilePaths wx.uploadFile({ url: app.globalData.publicUrl + '/sys/user/upload', filePath: tempFilePaths[0], name: 'uploadFile', formData: { "user": "test", }, header: { appletsId: wx.getStorageSync('openId'), }, success: (res) => { console.log(JSON.parse(res.data), "45454545"); let datas = JSON.parse(res.data) if (datas.code == 0) { this.setData({ imgPath: datas.data, isTrue: false }) } } }) } }) }, closeImage(e) { this.setData({ isTrue: true, imgPath: '', }) }, onLoad: function () {}, })