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, "000"); } }) wx.redirectTo({ url: '/pages/idCardDetail/idCardDetail', }) } else { wx.showToast({ title: "请上传照片", icon: 'none', duration: 2000, }) } // 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, "000"); // } // }) // wx.redirectTo({ // url: '/pages/idCardDetail/idCardDetail', // }) }, goPhoto() { var that = this; wx.chooseImage({ count: 1, sizeType: ['compressed'], sourceType: ['camera'], success: function (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: function (res) { console.log(JSON.parse(res.data), "45454545"); let datas = JSON.parse(res.data) if (datas.code == 0) { that.setData({ imgPath: datas.data, isTrue: false }) } } }) } }) }, closeImage(e) { this.setData({ isTrue: true, imgPath: '', }) }, onLoad: function () {}, })