From d9cb8e57537fe5764018f53a224f6afceec64f9e Mon Sep 17 00:00:00 2001
From: liuwh <liuwh@hugeinfo.com.cn>
Date: Tue, 24 Mar 2020 09:22:06 +0800
Subject: [PATCH] 提交
---
SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js | 132 ++++++++++++++++++++++++++++++++------------
1 files changed, 96 insertions(+), 36 deletions(-)
diff --git a/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js b/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js
index 496552f..4704e66 100644
--- a/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js
+++ b/SunshineLnsMinApp/pages/fzpxInfo/fzpxInfo.js
@@ -10,17 +10,22 @@
*/
data: {
loading: false,
- peopleInfo: {}
+ peopleInfo: {},
+ signStatus: '',
+ id: "",
+ topattList:[],
+ bottomattList:[]
},
/**
* 生命周期函数--监听页面加载
*/
- onLoad: function(options) {
+ onLoad: function (options) {
var that = this;
that.setData({
id: options.id,
- flag: options.flag,
+ signStatus: options.signStatus || '',
+ flag: options.flag || '',
loading: true
});
wx.showLoading({
@@ -28,7 +33,7 @@
})
wx.request({
url: app.globalData.url + '/api/activity/find?id=' + options.id,
- success: function(res) {
+ success: function (res) {
console.log(res);
that.setData({
loading: false
@@ -37,45 +42,54 @@
if (res.data.code == 0) {
res.data.data.startTime = app.formatDate(res.data.data.startTime)
that.setData({
- activity: res.data.data
+ activity: res.data.data,
+ bottomattList:res.data.data.attList.filter((item)=>(item.associateType==1020)),
+ topattList:res.data.data.attList.filter((item)=>(item.associateType==1000))
})
console.log('传过来', options.flag)
+ console.log('传过来', options.signStatus)
// 处理报名状态
- 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) {
+ if (options.signStatus) {
+ that.setData({
+ signStatus: options.signStatus
+ })
+ } else {sign
+ 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: '活动已结束'
+ })
+ }
+ } else {
that.setData({
canApply: false,
- statusWord: '活动正在进行'
+ statusWord: '报名人数已满'
})
}
- if (res.data.data.activityStatus == 3) {
- that.setData({
- canApply: false,
- statusWord: '活动已结束'
- })
- }
+
} else {
+ //不可报名
+ console.log('不可报名')
that.setData({
canApply: false,
- statusWord: '报名人数已满'
+ statusWord: '您已报名'
})
}
-
- } else {
- //不可报名
- console.log('不可报名')
- that.setData({
- canApply: false,
- statusWord: '您已报名'
- })
}
}
@@ -84,7 +98,7 @@
},
// 跳转
- linkFunction: function() {
+ linkFunction: function () {
wx.showToast({
title: '抱歉,报名人数已满',
icon: 'none',
@@ -93,14 +107,14 @@
},
// 呼叫组织方
- makePhoneCall: function(e) {
+ makePhoneCall: function (e) {
var phone = e.currentTarget.dataset['phone'];
wx.makePhoneCall({
phoneNumber: phone
})
},
- inputChange: function(e) {
+ inputChange: function (e) {
var name = e.currentTarget.dataset.name;
this.setData({
peopleInfo: {
@@ -110,8 +124,54 @@
})
},
+ // 签到
+ 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
+ });
+ },
+
// 提交报名
- submit: function() {
+ submit: function () {
var peopleInfo = this.data.peopleInfo;
var userinfo = wx.getStorageSync("user");
var personId = userinfo.id;
@@ -149,7 +209,7 @@
header: {
"Content-Type": "application/json"
},
- success: function(res) {
+ success: function (res) {
wx.hideLoading();
if (res.data.code == 0) {
wx.reLaunch({
--
Gitblit v1.8.0