diff --git a/models/artice.js b/models/artice.js
index 4027b54..64d80c7 100644
--- a/models/artice.js
+++ b/models/artice.js
@@ -5,6 +5,7 @@ const ArticeConst = {
artice_url: '/api/content/queryById',
artice_add_remove_collect_url: '/api/content/addOrDeleteCollection',
artice_online_url: '/api/content/signin',
+ cancel_artice_online_url: '/api/content/signout',
}
class ArticeModel extends HTTP {
@@ -48,6 +49,19 @@ class ArticeModel extends HTTP {
}
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 }
\ No newline at end of file
diff --git a/pages/article/index.js b/pages/article/index.js
index edb759a..8e9b373 100644
--- a/pages/article/index.js
+++ b/pages/article/index.js
@@ -23,6 +23,7 @@ Page({
disable: true,
readNum: 0,
collectNum: 0,
+ flag:5
},
onClickCollect () {
// 收藏功能
@@ -83,6 +84,12 @@ Page({
wx.setNavigationBarTitle({
title: data.title,
})
+
+ if(data.flag == 0 || data.flag == 1){
+ var disable = false;
+ }else{
+ var disable = true;
+ }
this.setData({
nodes: data.content,
title: data.title,
@@ -90,10 +97,11 @@ Page({
image: data.titlePic,
origin: data.source,
isStar: data.isCollection ? true : false,
- showBtn: data.typeFlag >= 2 ? true : false,
- disable: data.typeFlag == 3 ? true : false,
+ // showBtn: data.typeFlag >= 2 ? true : false,
+ disable: disable,
readNum: data.readNum,
collectNum: data.collectNum,
+ flag:data.flag
}, () => {
wx.hideLoading()
})
@@ -115,7 +123,6 @@ Page({
},
onlineSignApi () {
artice.onlineSign(this.data.aId, res => {
- console.log(res)
if(res.code == 200){
console.log(res.code);
wx.showToast({
@@ -124,7 +131,7 @@ Page({
})
}
if(res.code != 200){
- console.log(res.code);
+ // console.log(res.code);
this.setData({
disable: false
})
@@ -133,8 +140,38 @@ Page({
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',
+ })
+ }
+
+ }
})
\ No newline at end of file
diff --git a/pages/article/index.wxml b/pages/article/index.wxml
index 0579ca0..9a8ac42 100644
--- a/pages/article/index.wxml
+++ b/pages/article/index.wxml
@@ -19,8 +19,20 @@
收藏:{{collectNum}}
-