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

token获取方式等

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