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

通用token校验

上级 354a53c3
......@@ -207,5 +207,19 @@ module.exports = {
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 @@
:changeErrorMsg="changeCardErrorMsg"
:isShow="showChangeCard"
@cancle="cancleChangeCard"
@confirm="changeCardAction">
@confirm="beforeChangeCardAction">
</ChangeCard>
<Loading v-show="showLoading" />
<div>
......@@ -488,12 +488,19 @@ export default {
this.showChangeCard = false;
},
beforeChangeCardAction(cardKey) {
this.commonCheckToken( () => {
this.changeCardAction(cardKey);
})
},
// 激活 返回值:0绑定失败,1绑定成功
changeCardAction(cardKey) {
let _this = this;
let param = {
cardKey: cardKey,
cardType: 2,
channel: 3,
portalProjectId: this.projectId,
setEntry: true
};
......@@ -599,15 +606,14 @@ export default {
});
},
// 跳转到原生的购买页面
// TODO 没有购买逻辑了,直接跳转到下载页面
confirm() {
// this.$sendBuriedData({
// 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;
// "https://a.app.qq.com/o/simple.jsp?pkgname=com.picahealth.yunque";
})
},
// 首次进入考试时记录(点击‘我知道了’时调用)
......@@ -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() {
let _this = this;
......@@ -703,9 +689,10 @@ export default {
},
//去激活
changeClick(msg) {
console.log("in changeClick");
changeClick() {
this.commonCheckToken( () => {
this.showChangeCard = true;
})
},
// 弹框按钮事件
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册