From 326bdb73c590cb669af344cfdc4ee6f02bf1b0a8 Mon Sep 17 00:00:00 2001
From: Mr Ke <kelq@hugeinfo.com.cn>
Date: Wed, 27 May 2020 10:16:11 +0800
Subject: [PATCH] 链接指纹是杯页面
---
SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js | 116 +++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 74 insertions(+), 42 deletions(-)
diff --git a/SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js b/SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js
index f44c2d3..f703e13 100644
--- a/SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js
+++ b/SunshineLnsMinApp/pages/zhghInfo/zhghInfo.js
@@ -11,21 +11,21 @@
del: app.globalData.imgUrl + '/image/del.svg',
evalList: {},
id: "",
- status: 4,
+ status: null,
disabled: false,
- taskReport: ''
+ 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) {
+ success: function(res) {
wx.hideLoading();
console.log('res', res);
if (res.data.code == 0) {
@@ -37,26 +37,30 @@
};
for (var i in evalList) {
evalList[i] = evalList[i].map(({
- imgPath: pic,
- attachmentId: id
+ 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 ? '未开始' : res.data.data.status == 1 ? '进行中' : res.data.data.status == 2 ? '已结束' : res.data.data.status == 99 ? '结束' : '(未知)',
-
+ 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 || ''
+ taskReport: res.data.data.taskReport || '',
+ socialTaskObject: res.data.data.socialTaskObject
})
} else {
wx.showToast({
@@ -67,16 +71,20 @@
})
},
//输入框
- inputChange: function (e) {
+ inputChange: function(e) {
console.log(e)
+ var that = this;
var taskReport = e.detail.value;
this.setData({
- taskReport
+ socialTaskObject: {
+ ...that.data.socialTaskObject,
+ taskReport
+ }
})
},
//添加图片
- joinPicture: function (e) {
+ joinPicture: function(e) {
console.log(e)
var that = this;
console.log(that)
@@ -84,13 +92,13 @@
},
// 删除图片
- clearImg: function (e) {
+ clearImg: function(e) {
var that = this;
app.clearImg(e, that);
},
//预览图片
- previewImage: function (e) {
+ previewImage: function(e) {
app.previewImage(e);
},
@@ -128,7 +136,7 @@
attId: file.id,
owenId: id
},
- success: function (res) {
+ success: function(res) {
console.log('res', res);
that.data.item.supplyAttachmentList = supplyAttachmentList.filter((n) => n.uid !== file.uid)
that.setData({
@@ -142,37 +150,61 @@
})
},
+ // 跳转
+ 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 () {
+ 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,
- })
+ 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,
+ })
+ }
}
- }
- })
+ })
+
+ }
},
--
Gitblit v1.8.0