var util = require('../../utils/util.js') Page({ /** * 页面的初始数据 */ data: { serverUrl: getApp().globalData.serverUrl, items: [ { name: '1', value: '正在整改中'}, { name: '2', value: '已整改完成' }, ], cjryname:"", cjry:"", yhtp1: [], zghtp1: [], jcwt:"", zgqk:"", }, bindjcwtInput: function (e) { this.data.jcwt = e.detail.value }, bindzgqkInput: function (e) { this.data.zgqk = e.detail.value }, bindcfnrInput: function (e) { this.data.cfnr = e.detail.value }, radioChange: function (e) { this.data.jczt = e.detail.value }, deleteImage: function (e) { var that = this; var yhtp1 = that.data.yhtp1; var index = e.currentTarget.dataset.index; //获取当前长按图片下标 wx.showModal({ title: '系统提醒', content: '确定要删除此图片吗?', success: function (res) { if (res.confirm) { yhtp1.splice(index, 1); } else if (res.cancel) { return false; } that.setData({ yhtp1: yhtp1 }); } }) }, chooseImage: function () { var that = this wx.chooseImage({ count: 9, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], success: function (res) { console.log(that.data.yhtp1.concat(res.tempFilePaths)) that.setData({ yhtp1: that.data.yhtp1.concat(res.tempFilePaths) }) } }) }, previewImage: function (e) { var current = e.target.dataset.src wx.previewImage({ current: current, urls: this.data.yhtp1 }) }, //上传图片 upimg:function(x,y){ var that=this if(x { if (res.confirm) { wx.showLoading({ title: '正在提交...', }) wx.request({ url: getApp().globalData.serverUrl + 'api/checkproject?a=addjob&jobid=' + this.data.jobid, header: { 'content-type': 'application/json', // 'Cookie': getApp().globalData.sessionId, }, method: 'POST', data:jobdata , success: res => { if (res.statusCode === 200) { wx.hideLoading(); wx.navigateBack() } } }); } } }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var checkperson = true this.getGcdetail(options.id); this.setData({ jobid: options.id, }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { this.setData({ cjryname: "", cjry: "", cjrs:0 }), this.data.cfnr="" }, /** * 生命周期函数--监听页面显示 */ onShow: function () { let lst = getApp().globalData.selectPeopleList let nst = [] let nst1 = [] if (lst) { for (var i = 0; i < lst.length; i++) { nst.push(lst[i]['name']) nst1.push(lst[i]['id']) } this.setData({ cjryname: nst.join(','), cjry: nst1.join(','), cjrs: nst1.length }) } }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, getGcdetail: function (id) { wx.showLoading({ title: '加载中', }), wx.request({ url: this.data.serverUrl + 'api/checkproject?a=checkjobdetail&id=' + id, header: { 'content-type': 'application/json', // 默认值 'Cookie': getApp().globalData.sessionId, }, data: { }, success: res => { wx.hideLoading(); console.log(res.data); if (res.statusCode === 200) { var yhdata = res.data //格式化隐患信息 if(yhdata.yhtp!=null) { for (var i = 0; i < yhdata.yhtp.length; i++) { yhdata.yhtp[i] = this.data.serverUrl + yhdata.yhtp[i]; } } this.setData(yhdata) } } }); }, })