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

1、开发激活/购买流程(内部逻辑)

2、部分弹框UI及交互
3、对接部分修改的接口
上级 5c12572a
<template> <template>
<section class="experience-dialog-wrapper"> <section class="experience-dialog-wrapper">
<van-overlay :show="experienceDialog" class="v-overlay-q"> <van-overlay :show="showDialog" class="v-overlay-q">
<section class="loading-wrapper" > <section class="loading-wrapper" >
<article class="content"> <article class="content">
<img class="img-tips" src="../../images/question/note.png" alt=""> <img class="img-tips" src="../../images/question/note.png" alt="">
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<span class="primary" @click="buyCard">去购买</span> <span class="primary" @click="buyCard">去购买</span>
</div> </div>
</article> </article>
<img class="bt-close" src="../../images/question/close.png" alt=""> <img class="bt-close" @click="close" src="../../images/question/dialog-close.png" alt="">
</section> </section>
</van-overlay> </van-overlay>
</section> </section>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<script> <script>
export default { export default {
props: { props: {
experienceDialog: { showDialog: {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
...@@ -44,6 +44,9 @@ export default { ...@@ -44,6 +44,9 @@ export default {
}, },
buyCard() { buyCard() {
this.$emit('buyCard'); this.$emit('buyCard');
},
close() {
this.$emit('close');
} }
}, },
} }
......
...@@ -215,8 +215,8 @@ module.exports = { ...@@ -215,8 +215,8 @@ module.exports = {
e.target.src = 'https://file.yunqueyi.com/File/doctor_default.png'; e.target.src = 'https://file.yunqueyi.com/File/doctor_default.png';
}, },
// 通用token校验 // 校验token,有效则调用回调函数,否则调起原生登陆页面
commonCheckToken(noLoggedCallback) { commonCheckToken(cb) {
let param = { let param = {
token: this.token, token: this.token,
setEntry: true setEntry: true
...@@ -225,28 +225,24 @@ module.exports = { ...@@ -225,28 +225,24 @@ module.exports = {
if (res.code !== "000000") { if (res.code !== "000000") {
this.goLogin(); this.goLogin();
} else { } else {
noLoggedCallback && noLoggedCallback() cb && cb()
} }
}); });
}, },
// 通用token校验 // 校验token,有效则调用回调函数,否则使用调起原生登陆页面
commonNativeCheckToken(noLoggedCallback) { checkTokenForNative(cb) {
let param = { let param = {
token: this.token, token: this.token,
setEntry: true setEntry: true
}; };
this.GET("campaign/admin/task/checkToken", param).then(res => { this.GET("campaign/admin/task/checkToken", param).then(res => {
if (res.code !== "000000") { if (res.code !== "000000") {
this.goLogin(); rocNative.gotoLogin();
} else { } else {
noLoggedCallback && noLoggedCallback() cb && cb()
} }
}); });
}, },
// rocNative.gotoLogin();
} }
} }
...@@ -428,9 +428,9 @@ export default { ...@@ -428,9 +428,9 @@ export default {
} }
return getWebPageUrl(path); return getWebPageUrl(path);
}, },
// 绑定项目和订单的关系 // 绑定项目和订单的关系(idType=1)
createRelation(projectId, orderId) { createRelation(projectId, orderId) {
this.POST(`cme/projectCard/correlation/${projectId}/${orderId}`, {channel: 3}).then(res => { this.POST(`cme/projectCard/correlation/1/${projectId}/${orderId}`, {channel: 3}).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
// //
} else { } else {
......
...@@ -394,7 +394,7 @@ export default { ...@@ -394,7 +394,7 @@ export default {
let param = { let param = {
setEntry: true setEntry: true
}; };
this.GET(`cme/projectCard/queryNoUsedCard/3`, param).then(({ data }) => { this.GET(`cme/projectCard/queryNoUsedCard/${this.project.goodsType}/${this.project.cardType}`, param).then(({ data }) => {
this.hasNoUsedCard = data.hasNoUsedCard; this.hasNoUsedCard = data.hasNoUsedCard;
if (data.hasNoUsedCard == 1) { if (data.hasNoUsedCard == 1) {
this.cmeCardModels = data.cmeCardModels[0] || {}; this.cmeCardModels = data.cmeCardModels[0] || {};
...@@ -407,8 +407,11 @@ export default { ...@@ -407,8 +407,11 @@ export default {
changeCardAction(cardKey, isInTips) { changeCardAction(cardKey, isInTips) {
let _this = this; let _this = this;
let param = { let param = {
idType: 1,
cardKey: cardKey, cardKey: cardKey,
cardType: 3, cardType: this.project.cardType || 3,
goodsType: this.project.goodsType || 3,
channel: 1,
portalProjectId: this.projectId, portalProjectId: this.projectId,
setEntry: true setEntry: true
}; };
...@@ -553,12 +556,14 @@ export default { ...@@ -553,12 +556,14 @@ export default {
getCardInfoByProvinceId(provinceId) { getCardInfoByProvinceId(provinceId) {
let param = { let param = {
area: provinceId + "", area: provinceId + "",
cardType: 3, cardType: this.project.cardType || 3,
pageNum: 1, cardTypeList: [ this.project.cardType || 3],
pageSize: 1 goodsType: this.project.goodsType,
// pageNum: 1,
// pageSize: 1
}; };
param.setEntry = true; param.setEntry = true;
this.POST("trade/goods/cardList", param).then(res => { this.POST("trade/goods/cardList_v2", param).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
this.showLoading = false; this.showLoading = false;
this.cardInfo = (res.data && res.data[0]) || { id: 0, name: "职称考精讲课程卡" }; this.cardInfo = (res.data && res.data[0]) || { id: 0, name: "职称考精讲课程卡" };
......
...@@ -114,7 +114,7 @@ export default { ...@@ -114,7 +114,7 @@ export default {
orderId: this.orderId, orderId: this.orderId,
setEntry: true setEntry: true
}; };
this.GET(`cme/projectCard/status/${this.projectId}/${this.orderId}`, param).then(({ data }) => { this.GET(`cme/projectCard/status/1/${this.projectId}/${this.orderId}`, param).then(({ data }) => {
this.loading = false; this.loading = false;
this.bindStatus = data; this.bindStatus = data;
// 绑定成功 // 绑定成功
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<no-content v-show="!questionList.length" :type="listType"></no-content> <no-content v-show="!questionList.length" :type="listType"></no-content>
</article> </article>
<question-footer></question-footer> <question-footer></question-footer>
<ExperienceDialog :experienceDialog="experienceDialog" @activeCard="activeCard" @buyCard="buyCard"></ExperienceDialog> <ExperienceDialog :showDialog="experienceDialog" @activeCard="activeCard" @buyCard="buyCard" @close="experienceDialog = false"></ExperienceDialog>
<!-- 去激活 --> <!-- 去激活 -->
<ChangeCard <ChangeCard
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
></CourseDialog> ></CourseDialog>
<Loading v-show="showLoading" /> <Loading v-show="showLoading" />
<div class="pt-60"></div> <div class="pt-70"></div>
</section> </section>
</template> </template>
<script> <script>
...@@ -56,6 +56,9 @@ export default { ...@@ -56,6 +56,9 @@ export default {
data() { data() {
return { return {
// token: "", // mixns里有 // token: "", // mixns里有
questionBankId: "",
cardType: 3,
goodsType: 3,
currentTitle: "试题集", currentTitle: "试题集",
listType: 1, // 1: 正常做题; 2: 免费体验; 3: 错题集; 4: 收藏夹, listType: 1, // 1: 正常做题; 2: 免费体验; 3: 错题集; 4: 收藏夹,
experienceDialog: true, // 体验弹框 experienceDialog: true, // 体验弹框
...@@ -84,6 +87,9 @@ export default { ...@@ -84,6 +87,9 @@ export default {
}, },
created() { created() {
let _this = this; let _this = this;
this.questionBankId = this.$route.query.questionBankId || 1;
this.cardType = this.$route.query.cardType || 3;
this.goodsType = this.$route.query.goodsType || 3;
this.listType = this.$route.query.listType || 1; this.listType = this.$route.query.listType || 1;
this.currentTitle = this.$route.query.currentTitle || this.currentTitle; this.currentTitle = this.$route.query.currentTitle || this.currentTitle;
this.init(); this.init();
...@@ -93,7 +99,6 @@ export default { ...@@ -93,7 +99,6 @@ export default {
_this.setUserInfo(param); _this.setUserInfo(param);
_this.getQuestionList(); _this.getQuestionList();
// _this.checkToken(); // _this.checkToken();
// _this.getProjectInfoById();
}; };
if(__isWeb) { if(__isWeb) {
_this.getQuestionList(); _this.getQuestionList();
...@@ -145,10 +150,9 @@ export default { ...@@ -145,10 +150,9 @@ export default {
return; return;
} }
// 直接传入职称考项目ID(projectId) // 直接传入题库ID(questionBankId)
let projectId = this.project.projectId;
let pageUrl = getWebPageUrl( let pageUrl = getWebPageUrl(
`/profexam/#/index?id=${projectId}&projectName=${this.project.projectName}&profexamProjectId=${projectId}` `/profexam/#/question-detail?id=${this.questionBankId}&bankName=${this.bankName}&questionBankId=${this.questionBankId}`
); );
let paramList = [ let paramList = [
{ {
...@@ -167,7 +171,6 @@ export default { ...@@ -167,7 +171,6 @@ export default {
{ {
key: "courseUrl", key: "courseUrl",
value: encodeURIComponent(pageUrl), value: encodeURIComponent(pageUrl),
// value: projectId,
type: 4, type: 4,
seqNo: 1 seqNo: 1
} }
...@@ -187,7 +190,7 @@ export default { ...@@ -187,7 +190,7 @@ export default {
// 激活前 // 激活前
beforeChangeCardAction(cardKey, isInTips) { beforeChangeCardAction(cardKey, isInTips) {
this.commonCheckToken(() => { this.checkTokenForNative(() => {
this.changeCardAction(cardKey, isInTips); this.changeCardAction(cardKey, isInTips);
}); });
}, },
...@@ -211,10 +214,12 @@ export default { ...@@ -211,10 +214,12 @@ export default {
changeCardAction(cardKey, isInTips) { changeCardAction(cardKey, isInTips) {
let _this = this; let _this = this;
let param = { let param = {
idType: 2,
cardKey: cardKey, cardKey: cardKey,
cardType: 3, cardType: this.cardType || 3,
channel: 3, goodsType: this.goodsType || 3,
portalProjectId: this.projectId, channel: 1,
portalProjectId: this.questionBankId,
setEntry: true setEntry: true
}; };
_this.changeCardErrorMsg = ""; _this.changeCardErrorMsg = "";
...@@ -231,8 +236,9 @@ export default { ...@@ -231,8 +236,9 @@ export default {
} }
} else { } else {
_this.showChangeCard = false; _this.showChangeCard = false;
Toast("激活成功,开始学习"); Toast("激活成功,开始练习");
_this.getProjectInfoById(); // 重新获取题库内容(从头开始)
// _this.getProjectInfoById();
} }
} else { } else {
Toast(res.message); Toast(res.message);
...@@ -254,7 +260,7 @@ export default { ...@@ -254,7 +260,7 @@ export default {
let param = { let param = {
setEntry: true setEntry: true
}; };
this.GET(`cme/projectCard/queryNoUsedCard/3`, param).then(({ data }) => { this.GET(`cme/projectCard/queryNoUsedCard/${this.goodsType}/${this.cardType}`, param).then(({ data }) => {
this.hasNoUsedCard = data.hasNoUsedCard; this.hasNoUsedCard = data.hasNoUsedCard;
if (data.hasNoUsedCard == 1) { if (data.hasNoUsedCard == 1) {
this.cmeCardModels = data.cmeCardModels[0] || {}; this.cmeCardModels = data.cmeCardModels[0] || {};
...@@ -267,13 +273,16 @@ export default { ...@@ -267,13 +273,16 @@ export default {
getCardInfoByProvinceId(provinceId) { getCardInfoByProvinceId(provinceId) {
let param = { let param = {
area: provinceId + "", area: provinceId + "",
cardType: 3, cardType: this.cardType || 3,
pageNum: 1, cardTypeList: [ this.cardType || 3],
pageSize: 1 goodsType: this.goodsType,
// pageNum: 1,
// pageSize: 1
}; };
param.setEntry = true; param.setEntry = true;
this.POST("trade/goods/cardList", param).then(res => { this.POST("trade/goods/cardList_v2", param).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
this.showLoading = false;
this.cardInfo = (res.data && res.data[0]) || { id: 0, name: "职称考精讲课程卡" }; this.cardInfo = (res.data && res.data[0]) || { id: 0, name: "职称考精讲课程卡" };
this.subContent = `您已购买“${this.cardInfo.goodsName}”,是否用此卡绑定并激活当前课程。学习卡激活码一旦使用,不可更改不可退回` this.subContent = `您已购买“${this.cardInfo.goodsName}”,是否用此卡绑定并激活当前课程。学习卡激活码一旦使用,不可更改不可退回`
} }
...@@ -286,8 +295,8 @@ export default { ...@@ -286,8 +295,8 @@ export default {
<style lang="less" scoped> <style lang="less" scoped>
.question-detail-wrapper { .question-detail-wrapper {
padding-top: 68px; padding-top: 68px;
.pt-60 { .pt-70 {
padding-bottom: 60px; padding-bottom: 70px;
} }
} }
</style> </style>
\ No newline at end of file
...@@ -466,7 +466,7 @@ export default { ...@@ -466,7 +466,7 @@ export default {
let param = { let param = {
setEntry: true setEntry: true
}; };
this.GET(`cme/projectCard/queryNoUsedCard/3`, param).then(({ data }) => { this.GET(`cme/projectCard/queryNoUsedCard/${this.project.goodsType}/${this.project.cardType}`, param).then(({ data }) => {
this.hasNoUsedCard = data.hasNoUsedCard; this.hasNoUsedCard = data.hasNoUsedCard;
if (data.hasNoUsedCard == 1) { if (data.hasNoUsedCard == 1) {
this.cmeCardModels = data.cmeCardModels[0] || {}; this.cmeCardModels = data.cmeCardModels[0] || {};
...@@ -479,8 +479,10 @@ export default { ...@@ -479,8 +479,10 @@ export default {
changeCardAction(cardKey, isInTips) { changeCardAction(cardKey, isInTips) {
let _this = this; let _this = this;
let param = { let param = {
idType: 1,
cardKey: cardKey, cardKey: cardKey,
cardType: 3, cardType: this.project.cardType || 3,
goodsType: this.project.goodsType || 3,
channel: 3, channel: 3,
portalProjectId: this.projectId, portalProjectId: this.projectId,
setEntry: true setEntry: true
...@@ -539,12 +541,14 @@ export default { ...@@ -539,12 +541,14 @@ export default {
getCardInfoByProvinceId(provinceId) { getCardInfoByProvinceId(provinceId) {
let param = { let param = {
area: provinceId + "", area: provinceId + "",
cardType: 3, cardType: this.project.cardType || 3,
pageNum: 1, cardTypeList: [ this.project.cardType || 3],
pageSize: 1 goodsType: this.project.goodsType,
// pageNum: 1,
// pageSize: 1
}; };
param.setEntry = true; param.setEntry = true;
this.POST("trade/goods/cardList", param).then(res => { this.POST("trade/goods/cardList_v2", param).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
this.showLoading = false; this.showLoading = false;
this.cardInfo = (res.data && res.data[0]) || { id: 0, name: "职称考精讲课程卡" }; this.cardInfo = (res.data && res.data[0]) || { id: 0, name: "职称考精讲课程卡" };
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册