提交 fdf7d757 编写于 作者: guangjun.yang's avatar guangjun.yang

通用token校验

上级 354a53c3
...@@ -207,5 +207,19 @@ module.exports = { ...@@ -207,5 +207,19 @@ module.exports = {
return null return null
}, },
// 通用token校验
commonCheckToken(noLoggedCallback) {
let param = {
token: this.token,
setEntry: true
};
this.GET("campaign/admin/task/checkToken", param).then(res => {
if (res.code !== "000000") {
this.goLogin();
} else {
noLoggedCallback && noLoggedCallback()
}
});
}
} }
} }
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
:changeErrorMsg="changeCardErrorMsg" :changeErrorMsg="changeCardErrorMsg"
:isShow="showChangeCard" :isShow="showChangeCard"
@cancle="cancleChangeCard" @cancle="cancleChangeCard"
@confirm="changeCardAction"> @confirm="beforeChangeCardAction">
</ChangeCard> </ChangeCard>
<Loading v-show="showLoading" /> <Loading v-show="showLoading" />
<div> <div>
...@@ -488,12 +488,19 @@ export default { ...@@ -488,12 +488,19 @@ export default {
this.showChangeCard = false; this.showChangeCard = false;
}, },
beforeChangeCardAction(cardKey) {
this.commonCheckToken( () => {
this.changeCardAction(cardKey);
})
},
// 激活 返回值:0绑定失败,1绑定成功 // 激活 返回值:0绑定失败,1绑定成功
changeCardAction(cardKey) { changeCardAction(cardKey) {
let _this = this; let _this = this;
let param = { let param = {
cardKey: cardKey, cardKey: cardKey,
cardType: 2, cardType: 2,
channel: 3,
portalProjectId: this.projectId, portalProjectId: this.projectId,
setEntry: true setEntry: true
}; };
...@@ -599,15 +606,14 @@ export default { ...@@ -599,15 +606,14 @@ export default {
}); });
}, },
// 跳转到原生的购买页面
// TODO 没有购买逻辑了,直接跳转到下载页面
confirm() { confirm() {
// this.$sendBuriedData({ // this.$sendBuriedData({
// component_tag: `882#88203` // component_tag: `882#88203`
// }); // });
let jumpUrl = getWebPageUrl(`profexam/#/goods-detail?goodsId=${this.goodsId}&token=${this.token}`); this.commonCheckToken( () => {
let jumpUrl = getWebPageUrl(`profexam/#/goods-detail?goodsId=${this.cardInfo.id}&token=${this.token}`);
window.location.href = jumpUrl; window.location.href = jumpUrl;
// "https://a.app.qq.com/o/simple.jsp?pkgname=com.picahealth.yunque"; })
}, },
// 首次进入考试时记录(点击‘我知道了’时调用) // 首次进入考试时记录(点击‘我知道了’时调用)
...@@ -626,26 +632,6 @@ export default { ...@@ -626,26 +632,6 @@ export default {
); );
}, },
// token是否失效校验
checkToken() {
let _this = this;
let param = {
token: _this.token,
setEntry: true
};
this.GET("campaign/admin/task/checkToken", param).then(res => {
if (res.code !== "000000") {
//未登录 跳转登录页
rocNative.gotoLogin();
} else {
// if (!_this.premissionFlag) {
// _this.premissionFlag = true;
// _this.permission(); // 提示是否有机构和在申请范围内
// }
}
});
},
//(判断是否加入机构,是否为认证用户,是否在申请范围内) //(判断是否加入机构,是否为认证用户,是否在申请范围内)
permission() { permission() {
let _this = this; let _this = this;
...@@ -703,9 +689,10 @@ export default { ...@@ -703,9 +689,10 @@ export default {
}, },
//去激活 //去激活
changeClick(msg) { changeClick() {
console.log("in changeClick"); this.commonCheckToken( () => {
this.showChangeCard = true; this.showChangeCard = true;
})
}, },
// 弹框按钮事件 // 弹框按钮事件
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册