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

token获取方式等

上级 fba5db07
......@@ -30,7 +30,7 @@
</div>
<span
v-if="!logged"
@click="gotoExamOrCourse(item, portalModule.contentList, index)"
@click="gotoExamOrCourse(item)"
class="text-action text-action-no"
>
{{getActionText(item.status, item.type)}}
......@@ -45,14 +45,14 @@
<img class="key" v-else-if="!hasBindCard && item.trySeeFlag == 1 && !item.trySeeTime" @click="toastToBuy('激活/购买后可学习课程')" src="../../images/cme/phrase2/key.png" alt="">
<span
v-else-if="!hasBindCard && item.trySeeFlag == 1"
@click="gotoExamOrCourse(item, portalModule.contentList, index, true)"
@click="gotoExamOrCourse(item)"
class="text-action"
>
去试看
</span>
<span
v-else
@click="gotoExamOrCourse(item, portalModule.contentList, index)"
@click="gotoExamOrCourse(item)"
class="text-action"
:class="{'text-action-no': item.useFlag == 2}"
>
......@@ -102,7 +102,7 @@ export default {
appVersion: "200",
hocImg: require("../../images/has-owner-cert.png"),
activeNames: [1],
// projectId: 1
token: '',
};
},
props: {
......@@ -139,9 +139,6 @@ export default {
default: 0
}
},
computed: {
...mapGetters(["userInfo"])
},
components: {
MergeTitle,
NoMoreContent,
......@@ -158,13 +155,12 @@ export default {
mounted() {
},
created() {
// this.projectId = this.$route.query.id;
this.token = this.$store.state.user.token;
},
methods: {
// 跳转到考试或课程 type 1: 考试; 2: 课程
// 如果是考试,将根据appVersion判断是新考试还是老考试,如果是301或之前的,都是老考试
gotoExamOrCourse(item, contentList, index, trySee) {
this.$parent.$refs.tcPlayerRef && this.$parent.$refs.tcPlayerRef.pause();
gotoExamOrCourse(item) {
if(!this.logged) {
if(item.type == 1) {
Toast('请前往云鹊医APP参加考试');
......@@ -181,7 +177,6 @@ export default {
// component_tag: `882#${actionCode}#${this.projectId}`
// });
// }
// this.gotoCourse(item, contentList, index, trySee);
let logId = null;
if (item.useFlag == 2) {
if(item.type == 1) {
......@@ -196,7 +191,7 @@ export default {
this.gotoExam(item.id);
logId = '882#88206';
} else if (item.type == 2) {
this.gotoCourse(item, contentList, index, trySee);
this.gotoCourse(item);
logId = '882#88205';
}
if (trySee) {
......@@ -208,13 +203,28 @@ export default {
},
// 跳转到课程
gotoCourse: function(item, contentList, index, trySee) {
gotoCourse(item) {
let _this = this;
let param = {
token: _this.token,
setEntry: true
};
this.GET("campaign/admin/task/checkToken", param).then(res => {
if (res.code !== "000000") {
Toast('登陆后可学习课程');
} else {
jumpToCourse(item);
}
});
},
// 跳转到课程
jumpToCourse: function(item) {
if(!isWeiXin()) {
Toast('请前往云鹊医APP学习课程');
return;
}
let token = localStorage.getItem('token');
let jumpUrl = getWebPageUrl(`profexam/#/course-detail?courseId=${item.id}&projectId=${this.projectId}&token=${token}`);
let jumpUrl = getWebPageUrl(`profexam/#/course-detail?courseId=${item.id}&projectId=${this.projectId}&token=${this.token}`);
window.location.href = jumpUrl;
},
......@@ -238,7 +248,7 @@ export default {
let param = {
expandKeys: activeNames,
setEntry: true,
token: this.userInfo.userToken,
token: this.token,
}
this.POST("portal/portalApp/updateExpandStatus?projectId="+this.projectId, param).then(res => {
});
......
......@@ -189,7 +189,6 @@ import CommonDescription from "@/components/common/common-description";
import CommonSpliteLine from "@/components/common/common-splite-line";
import CellListDetailShare from "@/components/business/cell-list-detail-share";
import CommonTcPlayer from "@/components/common/common-tcplayer";
import Loading from "@/components/common/common-loading";
import BasicInfo from "@/components/cme/basic-info";
......@@ -311,6 +310,7 @@ export default {
needShort: false,
showDownloadButton: false,
uuid: '',
token: ''
};
},
components: {
......@@ -319,7 +319,6 @@ export default {
CommonSpliteLine,
CellListDetailShare,
Loading,
CommonTcPlayer,
BasicInfo,
LearnKnow,
ItemIntro,
......@@ -356,6 +355,7 @@ export default {
}
const { token, info } = this.$store.state.user;
this.token = token;
// 如果有token,但没有用户信息,则获取用户信息
if (token && !info.id) {
this.$store.dispatch('getUserInfo');
......@@ -428,7 +428,6 @@ export default {
if (res.data == 0) {
_this.changeCardErrorMsg = "请输入正确的激活码";
} else {
_this.$refs.tcPlayerRef && _this.$refs.tcPlayerRef.pause();
_this.showChangeCard = false;
Toast("激活成功,开始学习");
_this.getProjectInfoById();
......@@ -494,7 +493,6 @@ export default {
// this.$sendBuriedData({
// component_tag: `882#88203`
// });
this.$refs.tcPlayerRef && this.$refs.tcPlayerRef.pause();
window.location.href =
"https://a.app.qq.com/o/simple.jsp?pkgname=com.picahealth.yunque";
},
......@@ -503,7 +501,7 @@ export default {
firstIntoExamAction() {
let _this = this;
let param = {
token: _this.userInfo.userToken || this.token,
token: _this.token,
setEntry: true
};
this.NEW_POST(`cme/project/${_this.projectId}/firstIntoExam`, param).then(
......@@ -515,28 +513,6 @@ export default {
);
},
// token是否失效校验
checkToken() {
let _this = this;
let param = {
token: _this.userInfo.userToken || _this.token,
setEntry: true
};
this.GET("campaign/admin/task/checkToken", param).then(res => {
if (res.code !== "000000") {
//未登录 跳转登录页
console.log("跳登录", _this.isInfresh);
if (_this.isInfresh) {
rocNative.goBack();
} else {
_this.$refs.tcPlayerRef && _this.$refs.tcPlayerRef.pause();
rocNative.gotoLogin();
}
_this.isInfresh = false;
}
});
},
//去激活
changeClick(msg) {
console.log("in changeClick");
......@@ -630,11 +606,7 @@ export default {
getProjectInfoById() {
let _this = this;
let param = {
// token:
// _this.userInfo.userToken ||
// this.token ||
// "47993ED00ECB46CE8D31ECF3AE34B4AA",
token: this.$store.state.user.token || this.token,
token: _this.token,
setEntry: true
};
let videoUrl = this.$route.query.videoUrl || "";
......@@ -858,73 +830,6 @@ export default {
return 1;
}
},
// 查找没有学习完成的课程或考试
continueStudy() {
let courseIdOrExamId = "";
let portalModuleDTOS = [];
let contentList = [];
let item = {};
let firstItem = null;
outloop: for (let i = 0; i < this.projectComponentDTOS.length; i++) {
portalModuleDTOS = this.projectComponentDTOS[i].portalModuleDTOS;
for (let j = 0; j < portalModuleDTOS.length; j++) {
contentList = portalModuleDTOS[j].contentList;
for (let k = 0; k < contentList.length; k++) {
item = contentList[k];
if (!firstItem && item.id) {
firstItem = item;
}
if (
(item.type == 1 &&
item.id &&
item.useFlag != 2 &&
(item.status == 11 || item.status == 12)) ||
(item.type == 2 &&
item.id &&
item.useFlag != 2 &&
(item.status == 21 || item.status == 22))
) {
this.continueStudyType = item.type;
this.skCourseId = item.id;
break outloop;
}
}
}
}
if (!this.skCourseId) {
this.continueStudyType = firstItem.type;
this.skCourseId = firstItem.id;
}
console.log(
"continueStudyType",
this.continueStudyType,
"skCourseId",
this.skCourseId
);
if (this.continueStudyType == 1) {
this.gotoExamNew();
} else {
this.gotoCourseNew();
}
},
// 跳转到考试
gotoExamNew: function(examId) {
Toast("请前往APP进行考试");
},
// 跳转到课程(H5)
gotoCourseNew: function() {
this.$refs.tcPlayerRef && this.$refs.tcPlayerRef.pause();
window.location.href = "";
},
goBuyKc(type) {
this.$refs.tcPlayerRef && this.$refs.tcPlayerRef.pause();
this.isShowSkDialog = false;
type == 2 && this.confirm();
},
}
};
</script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册