Browse Source

增加活动取消报名

master
xuxu 5 years ago
parent
commit
6f7449d577
  1. 14
      models/artice.js
  2. 47
      pages/article/index.js
  3. 16
      pages/article/index.wxml

14
models/artice.js

@ -5,6 +5,7 @@ const ArticeConst = {
artice_url: '/api/content/queryById', artice_url: '/api/content/queryById',
artice_add_remove_collect_url: '/api/content/addOrDeleteCollection', artice_add_remove_collect_url: '/api/content/addOrDeleteCollection',
artice_online_url: '/api/content/signin', artice_online_url: '/api/content/signin',
cancel_artice_online_url: '/api/content/signout',
} }
class ArticeModel extends HTTP { class ArticeModel extends HTTP {
@ -48,6 +49,19 @@ class ArticeModel extends HTTP {
} }
this.request(params) this.request(params)
} }
// 在线报名
cancelOnlineSign(aId, success) {
let params = {
url: ArticeConst.cancel_artice_online_url,
success: success,
method: Method.GET,
data: {
contentId: aId
}
}
this.request(params)
}
} }
export { ArticeModel } export { ArticeModel }

47
pages/article/index.js

@ -23,6 +23,7 @@ Page({
disable: true, disable: true,
readNum: 0, readNum: 0,
collectNum: 0, collectNum: 0,
flag:5
}, },
onClickCollect () { onClickCollect () {
// 收藏功能 // 收藏功能
@ -83,6 +84,12 @@ Page({
wx.setNavigationBarTitle({ wx.setNavigationBarTitle({
title: data.title, title: data.title,
}) })
if(data.flag == 0 || data.flag == 1){
var disable = false;
}else{
var disable = true;
}
this.setData({ this.setData({
nodes: data.content, nodes: data.content,
title: data.title, title: data.title,
@ -90,10 +97,11 @@ Page({
image: data.titlePic, image: data.titlePic,
origin: data.source, origin: data.source,
isStar: data.isCollection ? true : false, isStar: data.isCollection ? true : false,
showBtn: data.typeFlag >= 2 ? true : false, // showBtn: data.typeFlag >= 2 ? true : false,
disable: data.typeFlag == 3 ? true : false, disable: disable,
readNum: data.readNum, readNum: data.readNum,
collectNum: data.collectNum, collectNum: data.collectNum,
flag:data.flag
}, () => { }, () => {
wx.hideLoading() wx.hideLoading()
}) })
@ -115,7 +123,6 @@ Page({
}, },
onlineSignApi () { onlineSignApi () {
artice.onlineSign(this.data.aId, res => { artice.onlineSign(this.data.aId, res => {
console.log(res)
if(res.code == 200){ if(res.code == 200){
console.log(res.code); console.log(res.code);
wx.showToast({ wx.showToast({
@ -124,7 +131,7 @@ Page({
}) })
} }
if(res.code != 200){ if(res.code != 200){
console.log(res.code); // console.log(res.code);
this.setData({ this.setData({
disable: false disable: false
}) })
@ -133,8 +140,38 @@ Page({
icon: 'none' icon: 'none'
}) })
} }
// this.fetchArticeApi() this.fetchArticeApi()
}) })
}, },
cancelSignApi () {
this.setData({
disable: true
})
if (store.hasBindUserInfo()) {
artice.cancelOnlineSign(this.data.aId, res => {
if(res.code == 200){
wx.showToast({
title: res.message,
icon: 'none'
})
}else{
this.setData({
disable: false
})
wx.showToast({
title: res.message,
icon: 'none'
})
}
this.fetchArticeApi()
})
} else {
wx.redirectTo({
url: '/pages/weChatAuth/index',
})
}
}
}) })

16
pages/article/index.wxml

@ -19,8 +19,20 @@
<view class="collect_num">收藏:{{collectNum}}</view> <view class="collect_num">收藏:{{collectNum}}</view>
</view> </view>
</view> </view>
<view class="page_footer" wx:if="{{showBtn}}"> <view class="page_footer">
<e-ibutton title="{{disable ? '已报名' : '在线报名'}}" bind:onTap="onlineSubmit" disable="{{disable}}"/> <!-- <e-ibutton title="{{disable ? '已报名' : '在线报名'}}" bind:onTap="onlineSubmit" disable="{{disable}}"/> -->
<block wx:if="{{ flag == 0 }}">
<e-ibutton title="在线报名" bind:onTap="onlineSubmit" disable="{{disable}}"/>
</block>
<block wx:if="{{ flag == 1 }}">
<e-ibutton title="取消报名" bind:onTap="cancelSignApi" disable="{{disable}}"/>
</block>
<block wx:if="{{ flag == 2 }}">
<e-ibutton title="已报名" bind:onTap="onlineSubmit" disable="true"/>
</block>
<block wx:if="{{ flag == 3 }}">
<e-ibutton title="在线报名" bind:onTap="onlineSubmit" disable="true"/>
</block>
</view> </view>
</view> </view>

Loading…
Cancel
Save