From a2d1b9886b00b5f4d4722c3379d3bd4f2f94b421 Mon Sep 17 00:00:00 2001 From: LAPTOP-RI7D261L\Mr Ke <545800322@qq.com> Date: Mon, 09 Mar 2020 17:02:35 +0800 Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/nsjcy/frontEnd/nsjcy --- SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 159 insertions(+), 8 deletions(-) diff --git a/SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js b/SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js index 76bde32..67cc594 100644 --- a/SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js +++ b/SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js @@ -1,26 +1,177 @@ // pages/zhghInfo/zhghInfo.js +var app = getApp(); Page({ /** * 页面的初始数据 */ data: { - + data: {}, + add: app.globalData.imgUrl + '/image/add.svg', + del: app.globalData.imgUrl + '/image/del.svg', + evalList: {}, + id: "", + status: 4, + disabled: false, + taskReport: '' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + var that = this; + console.log(options.id) + wx.showLoading(); + wx.request({ + url: app.globalData.url + '/api/social/find/' + options.id, + success: function (res) { + wx.hideLoading(); + console.log('res', res); + if (res.data.code == 0) { + var dataSet = res.data.data; + var evalList1000 = dataSet.attachments || []; + console.log('37', evalList1000) + var evalList = { + evalList1000, + }; + for (var i in evalList) { + evalList[i] = evalList[i].map(({ + imgPath: pic, + attachmentId: id + }) => ({ + pic, + id + })) + } + console.log('48', evalList) + that.setData({ + data: { + ...res.data.data, + createTime: app.formatDate(res.data.data.createTime), + startTime: app.formatDate(res.data.data.startTime), + endTime: app.formatDate(res.data.data.endTime), + status: res.data.data.status == 0 ? '未开始' : res.data.data.status == 1 ? '进行中' : res.data.data.status == 2 ? '已结束' : res.data.data.status == 99 ? '结束' : '(未知)' + }, + id: res.data.data.id, + evalList, + taskReport: res.data.data.taskReport || '' + }) + } else { + wx.showToast({ + title: res.data.msg, + }) + } + } + }) + }, + //输入框 + inputChange: function (e) { + var taskReport = e.currentTarget.dataset.name; + this.setData({ + taskReport + }) }, - // 跳转 - linkFunction: function () { - wx.showToast({ - title: '提交成功', - icon: 'success', - duration: 2000 + //添加图片 + joinPicture: function (e) { + console.log(e) + var that = this; + console.log(that) + app.joinPicture(e, that, e.currentTarget.dataset.associatetypeid, that.data.id); + }, + + // 删除图片 + clearImg: function (e) { + var that = this; + app.clearImg(e, that); + }, + + //预览图片 + previewImage: function (e) { + app.previewImage(e); + }, + + onPreview(e) { + console.log('onPreview', e) + const { + file, + fileList + } = e.detail + wx.previewImage({ + current: file.url, + urls: fileList.map((n) => n.url), }) }, + onRemove(e) { + const { + file, + fileList + } = e.detail; + let that = this; + var id = e.currentTarget.dataset['id']; + console.log(id); + let { + supplyAttachmentList + } = that.data.item; + wx.showModal({ + content: '确定删除?', + success: (res) => { + if (res.confirm) { + wx.showLoading(); + wx.request({ + url: app.globalData.url + '/api/v1/attachment/deleteByOwnerAtt', + method: 'GET', + data: { + attId: file.id, + owenId: id + }, + success: function (res) { + console.log('res', res); + that.data.item.supplyAttachmentList = supplyAttachmentList.filter((n) => n.uid !== file.uid) + that.setData({ + item: that.data.item + }) + wx.hideLoading(); + } + }) + } + }, + }) + }, + + // 提交 + linkFunction: function () { + var that = this; + wx.showLoading(); + wx.request({ + url: app.globalData.url + '/api/social/submitTask', + method: 'GET', + data: { + taskId: that.data.id, + userId: wx.getStorageSync('id'), + taskReport:that.data.taskReport + }, + success: function (res) { + wx.hideLoading(); + console.log('res', res); + if (res.data.code == 0) { + wx.showToast({ + title: '提交成功', + icon: 'success', + duration: 2000 + }) + wx.navigateBack({ + delta: 1 + }) + } else { + wx.showToast({ + title: res.data.msg, + }) + } + } + }) + + + }, }) \ No newline at end of file -- Gitblit v1.8.0