From a92f3c4d10bebbdc55270e72ccd97cd1ba7d4e28 Mon Sep 17 00:00:00 2001 From: LAPTOP-RI7D261L\Mr Ke <545800322@qq.com> Date: Wed, 26 Feb 2020 16:40:55 +0800 Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/nsjcy/frontEnd/nsjcy --- SunshineLnsMinApp/pages/activityDetail/activityDetail.js | 112 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 83 insertions(+), 29 deletions(-) diff --git a/SunshineLnsMinApp/pages/activityDetail/activityDetail.js b/SunshineLnsMinApp/pages/activityDetail/activityDetail.js index b2e3e5d..37c5a5d 100644 --- a/SunshineLnsMinApp/pages/activityDetail/activityDetail.js +++ b/SunshineLnsMinApp/pages/activityDetail/activityDetail.js @@ -14,14 +14,16 @@ flag: true, hiddenApply: true, // canApply: true, - statusWord: '' - + statusWord: '', + signStatus: '', + id: "" }, onLoad: function (options) { var that = this; that.setData({ id: options.id, + signStatus: options.signStatus || '', flag: options.flag }) @@ -37,42 +39,48 @@ console.log('传过来',options.flag) // 处理报名状态 - if(options.flag == 'true') { - //可报名 - console.log('可报名') - if (res.data.data.activityPersonNum < res.data.data.activityPersonQuota) { - if (res.data.data.activityStatus == 1) { - that.setData({ - canApply: true - }) + if (options.signStatus) { + that.setData({ + signStatus: options.signStatus + }) + }else{ + if(options.flag == 'true') { + //可报名 + console.log('可报名') + if (res.data.data.activityPersonNum < res.data.data.activityPersonQuota) { + if (res.data.data.activityStatus == 1) { + that.setData({ + canApply: true + }) + } + if (res.data.data.activityStatus == 2) { + that.setData({ + canApply: false, + statusWord: '活动正在进行' + }) + } + if (res.data.data.activityStatus == 3) { + that.setData({ + canApply: false, + statusWord: '活动已结束' + }) + } } - if (res.data.data.activityStatus == 2) { + else{ that.setData({ canApply: false, - statusWord: '活动正在进行' + statusWord: '报名人数已满' }) } - if (res.data.data.activityStatus == 3) { - that.setData({ - canApply: false, - statusWord: '活动已结束' - }) - } - } - else{ + + }else{ + //不可报名 + console.log('不可报名') that.setData({ canApply: false, - statusWord: '报名人数已满' + statusWord: '您已报名' }) } - - }else{ - //不可报名 - console.log('不可报名') - that.setData({ - canApply: false, - statusWord: '您已报名' - }) } } @@ -80,6 +88,52 @@ }) }, + // 签到 + sign: function () { + var id = this.data.id; + var userinfo = wx.getStorageSync("user"); + var userId = userinfo.id; + // 只允许从相机扫码 + wx.scanCode({ + onlyFromCamera: true, + success(res) { + console.log(res) + wx.showLoading({ + title: '识别中', + }) + wx.request({ + url: app.globalData.url + '/api/activity/sign?id'+id+'&code='+res.result+'&userId='+userId, + method: 'GET', + header: { + "Content-Type": "application/json" + }, + success: function (res) { + wx.hideLoading(); + if (res.data.code == 0) { + wx.showToast({ + title: '签到成功!', + icon: 'success', + duration: 2000 + }) + } else { + wx.showToast({ + title: '报名失败,请稍后重试!', + icon: 'none' + }) + } + } + }) + } + }) + }, + + // 返回 + goBack: function () { + wx.navigateBack({ + delta: 1 + }); + }, + apply: function () { // wx.navigateTo({ // url: '../apply/apply', -- Gitblit v1.8.0