From 0ec802e93557b2b1422ddbd68aafa994fa68f455 Mon Sep 17 00:00:00 2001
From: Mr Ke <kelq@hugeinfo.com.cn>
Date: Wed, 27 May 2020 10:04:29 +0800
Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/nsjcy/frontEnd/nsjcy
---
SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js | 199 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 192 insertions(+), 7 deletions(-)
diff --git a/SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js b/SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js
index 76bde32..f703e13 100644
--- a/SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js
+++ b/SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js
@@ -1,26 +1,211 @@
// 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: null,
+ disabled: false,
+ socialTaskObject: {}
},
/**
* 生命周期函数--监听页面加载
*/
- onLoad: function (options) {
+ 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(({
+ url: pic,
+ uid: id
+ }) => ({
+ pic,
+ id
+ }))
+ }
+ console.log('48', evalList)
+ console.log('48', res.data.data.status)
+ 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 ? '正常' : '暂停',
+ },
+ disabled: res.data.data.status == 2 ? true : false,
+ status: res.data.data.status,
+ id: res.data.data.id,
+ evalList,
+ taskReport: res.data.data.taskReport || '',
+ socialTaskObject: res.data.data.socialTaskObject
+ })
+ } else {
+ wx.showToast({
+ title: res.data.msg,
+ })
+ }
+ }
+ })
+ },
+ //输入框
+ inputChange: function(e) {
+ console.log(e)
+ var that = this;
+ var taskReport = e.detail.value;
+ this.setData({
+ socialTaskObject: {
+ ...that.data.socialTaskObject,
+ taskReport
+ }
+ })
+ },
+
+ //添加图片
+ 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 () {
- wx.showToast({
- title: '提交成功',
- icon: 'success',
- duration: 2000
+ linkcFunction: function(event) {
+ var that = this;
+ var status = that.data.status;
+ var str = event.currentTarget.dataset['str'];
+ var id = event.currentTarget.dataset['id'];
+ wx.navigateTo({
+ url: '../' + str + '/' + str + '?id=' + id + '&status=' + status
})
},
+
+ // 提交
+ linkFunction: function() {
+ var that = this;
+ wx.showLoading();
+ var data = {
+ taskId: that.data.id,
+ userId: wx.getStorageSync('id'),
+ taskReport: that.data.socialTaskObject.taskReport
+ }
+ console.log(that.data.data.startTime)
+ console.log(app.formatDate(new Date()))
+ if (app.formatDate(new Date()) < that.data.data.startTime) {
+ wx.hideLoading();
+ return app.showModal("任务还未开始,暂时无法提交");
+ } else {
+ wx.request({
+ url: app.globalData.url + '/api/social/submitTask',
+ method: 'GET',
+ data: {
+ taskId: that.data.id,
+ userId: wx.getStorageSync('id'),
+ taskReport: that.data.socialTaskObject.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