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

Merge branch 'dev-question-bank-0916' into release

* dev-question-bank-0916: (58 commits)
  分享使用shareContent字段值
  在全局上加上断行设置
  仿真模拟,刷题助考更安心!
  n一张题库卡可以解锁一个二类学科的所有题目
  您答错的题目会自动记录在这里哦
  如果没有找到,则不做后面操作
  点击购买时,关闭弹框 多选可以取消
  loading只在第一次加载或者返回刷新时才用
  激活并去练习
  添加部分埋点
  调整高度
  样式再调整
  共题干图片支持 样式
  解决样式问题
  单选等标志样式
  免费学习的提示及跳转
  直接传商品id
  没有引入函数
  配置有问题
  传入seqNo字段
  ...

# Conflicts:
#	src/views/merge-detail.vue
#	src/views/share-merge-detail.vue
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
default: "" default: ""
}, },
projectId: { projectId: {
type: String, type: String | Number,
default: "" default: ""
}, },
limitTimes: { limitTimes: {
...@@ -232,6 +232,12 @@ export default { ...@@ -232,6 +232,12 @@ export default {
font-weight: 700; font-weight: 700;
color: rgba(51, 51, 51, 1); color: rgba(51, 51, 51, 1);
line-height: 26px; line-height: 26px;
display: inline-block;
max-width: 230px;
height: 36px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} }
} }
.nav-part { .nav-part {
......
<template>
<div class="fixed-qb-header">
<div class="header-info" :class="!isWeb ? 'top-set' : ''">
<div class="info-first">
<img v-if="directoryInfo.avatarImageUrl" :src="directoryInfo.avatarImageUrl">
<img v-if="!directoryInfo.avatarImageUrl" src="../../images/question/portrait.png">
<div class="infor">
<p class="name">{{directoryInfo.name}} 医生</p>
<p class="question-result">已做题<span>{{directoryInfo.finishedNum}}</span>错误题<span class="err">{{directoryInfo.wrongTitle}}</span>正确率<span class="suc">{{directoryInfo.correctRatio}}%</span></p>
</div>
</div>
<div class="info-second">
<div class="item" @click="wrongBook(1)"><img src="../../images/question/text.png">错题集<span v-if="directoryInfo.wrongTitleBook">({{directoryInfo.wrongTitleBook}})</span></div>
<div class="item" @click="wrongBook(2)"><img src="../../images/question/heart-h.png">收藏<span v-if="directoryInfo.collectTitleBook">({{directoryInfo.collectTitleBook}})</span></div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
isWeb: window.__isWeb,
}
},
props: {
directoryInfo: {
type: Object,
default: () => {}
},
},
methods: {
wrongBook(type) {
this.$emit('handlerBook',type)
},
},
}
</script>
<style lang="less" scoped>
.fixed-qb-header{
position: relative;
.header-info{
position: fixed;
z-index: 200;
background-color: #FFFFFF;
padding: 0 16px;
box-sizing: border-box;
width: 100%;
&.top-set{
top: 73px;
}
.info-first{
display: flex;
padding: 20px 0;
img{
width: 44px;
height: 44px;
border-radius: 50%;
}
.infor{
margin-left: 12px;
.name{
color: #373839;
font-size: 18px;
font-weight: 700;
line-height: 22px;
}
.question-result{
font-size: 14px;
color: #676869;
line-height: 16px;
margin-top: 9px;
span{
margin-left: 3px;
margin-right: 15px;
color: #373839;
&.err{
color: #ED3131;
}
&.suc{
color: #449284;
}
}
}
}
}
.info-second{
display: flex;
justify-content: space-between;
align-items: center;
.item{
width: 165.5px;
height: 40px;
/*line-height: 40px;*/
text-align: center;
border-radius: 6px;
background-color: #F8F9FA;
font-size: 14px;
font-weight: 700;
color: #373839;
display: flex;
align-items: center;
justify-content: center;
img{
width: 20px;
height: 20px;
margin-right: 8px;
}
span{
font-size: 12px;
margin-left: 2px;
height: 40px;
line-height: 40px;
}
}
}
}
}
</style>
<template>
<section class="experience-dialog-wrapper">
<van-overlay :show="showDialog" class="v-overlay-q">
<section class="loading-wrapper" >
<article class="content">
<img class="img-tips" src="../../images/question/note.png" alt="">
<p class="tips">您已完成本次免费练习体验</p>
<p class="status"><span class="cm rn">{{statisConfig.rightNum}}</span>题,错<span class="cm en">{{statisConfig.errorNum}}</span>题,正确率<span class="cm rate">{{statisConfig.rate}}%</span></p>
<p class="guide-tips">想体验完整题目,请先激活或购买题库</p>
<div class="btn-wrapper">
<span class="plain" @click="activeCard">去激活</span>
<span class="primary" @click="buyCard">去购买</span>
</div>
</article>
<img class="bt-close" @click="close" src="../../images/question/dialog-close.png" alt="">
</section>
</van-overlay>
</section>
</template>
<script>
export default {
props: {
statisConfig: {
type: Object,
default: () => {
return {
rightNum: 0,
errorNum: 0,
rate: 0
}
}
},
showDialog: {
type: Boolean,
default: true,
},
// rightNum: {
// type: Number | String,
// default: 0,
// },
// errorNum: {
// type: Number | String,
// default: 0,
// },
// rate: {
// type: Number | String,
// default: 0,
// }
},
methods: {
activeCard() {
this.$emit('activeCard');
},
buyCard() {
this.$emit('buyCard');
},
close() {
this.$emit('close');
}
},
}
</script>
<style lang="less" scoped>
.experience-dialog-wrapper {
.v-overlay-q {
.loading-wrapper {
text-align: center;
position: fixed;
top: 50%;
left: 50%;
width: 300px;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
.content {
display: flex;
flex-direction: column;
align-items: center;
font-size: 14px;
padding: 20px 15px 30px;
background-color: #ffffff;
border-radius: 3px;
.img-tips {
width: 80px;
height: 80px;
}
.tips {
margin: 10px 0;
font-size: 16px;
font-weight: 700;
color: #373839;
}
.status {
font-size: 13px;
color: #676869;
.cm {
font-size: 18px;
font-weight: 700;
padding: 0 4px;
}
.rn {
color: #373839;
}
.en {
color: #ED3131;
}
.rate {
color: #449284;
}
}
.guide-tips {
margin: 4px 0 30px;
font-size: 12px;
color: #979899;
}
.btn-wrapper {
display: flex;
flex-direction: row;
align-content: center;
& > span {
width: 115px;
height: 40px;
line-height: 40px;
font-size: 16px;
font-weight: 700;
border-radius: 20px;
&.plain {
border: 1px solid #449284;
color: #449284;
margin-right: 10px;
}
&.primary {
color: #FFFFFF;
background: #449284;
}
}
}
}
.bt-close {
margin-top: 20px;
width: 30px;
height: 30px;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="free-tips-wrapper">
<div class="left">
<img src="../../images/question/warning-h.png" alt />
<span class="text">免费练习{{total}}题,解锁全部题目需完成购买</span>
</div>
<img class="right" @click="buyCard" src="../../images/question/arror-right.png" alt />
</div>
</template>
<script>
export default {
props: {
total: {
type: String | Number,
default: 5
}
},
methods: {
buyCard() {
this.$emit("buyCard");
}
},
}
</script>
<style lang="less" scoped>
.free-tips-wrapper {
width: 100%;
position: fixed;
left: 0;
bottom: 60px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
height: 40px;
line-clamp: 40px;
padding-left: 15px;
background: #FEFAF5;
.left {
display: flex;
flex-direction: row;
align-items: center;
& > img {
width: 13px;
height: 13px;
margin-right: 4px;
}
& > span {
font-size: 13px;
color: #E6A23C;
}
}
.right {
padding: 10px 15px;
width: 15px;
height: 15px;
}
}
</style>
\ No newline at end of file
<template>
<div class="no-question-wrapper">
<img v-if="commitKind == 1" src="../../images/question/no-error.png" alt="">
<img v-else-if="commitKind == 2" src="../../images/question/no-collect.png" alt="">
<img v-else src="../../images/question/no-collect.png" alt="">
<span>{{commitKind == 1 ? "您答错的题目会自动记录在这里哦!" : commitKind == 2 ? "您收藏的题目会自动记录在这里哦!" : "那些题目都去哪儿了!?"}}</span>
</div>
</template>
<script>
export default {
props: {
commitKind: { // 答题来源 1:错题集 2:收藏 3:题库
type: Number | String,
default: 1
}
}
}
</script>
<style lang="less" scoped>
.no-question-wrapper {
display: flex;
flex-direction: column;
align-items: center;
padding-top: 100px;
img {
width: 120px;
height: 120px;
}
span {
font-size: 15px;
color: #999999;
}
}
</style>
\ No newline at end of file
<template>
<section class="qeustion-content-wrapper">
<article class="public-title" v-show="currentQuestion.unionType">
<p class="text" v-show="currentQuestion.unionType == 1" v-html="currentQuestion.unionQuestion"></p>
<article
class="select-wrapper"
style="padding: 10px 15px 20px;"
v-show="currentQuestion.unionType == 2"
>
<div class="item" v-for="(item, index) in currentQuestion.options" :key="index">
<span class="option">{{getOrderVac(index)}}.</span>
<span class="content">{{item.text}}</span>
</div>
</article>
<commonSpliteLine></commonSpliteLine>
</article>
<article class="title-wrapper">
<span class="type" :class="{'multi': currentQuestion.typeId == 2, 'top-1': isAndroid}">
<span :class="{'top-2': isAndroid}">{{currentQuestion.typeId == 1 ? "单选题" : currentQuestion.typeId == 2 ? "多选题" : "判断题"}}</span>
</span>
<span class="content" v-html="currentQuestion.question"></span>
<!-- <img src="https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png" /> -->
</article>
<article class="select-wrapper">
<div
class="item"
v-for="(item, index) in currentQuestion.options"
:key="index"
@click="selectOption(index)"
>
<span
v-if="!item.isSelected && !((item.isSelected && !currentQuestion.commitFlag) || (!item.isSelected && currentQuestion.commitFlag && item.isCorrect))"
class="option border"
>{{getOrderVac(index)}}</span>
<span
v-else-if="(item.isSelected && !currentQuestion.commitFlag) || (!item.isSelected && currentQuestion.commitFlag && item.isCorrect)"
class="option bg"
>{{getOrderVac(index)}}</span>
<template v-else>
<img v-if="item.isSelected && item.isCorrect" src="../../images/question/correct.png" alt />
<img v-if="item.isSelected && !item.isCorrect" src="../../images/question/error.png" alt />
</template>
<span
v-if="!currentQuestion.commitFlag"
class="content"
:class="{'select': item.isSelected}"
>{{currentQuestion.unionType == 2 ? getOrderVac(index) : item.text}}</span>
<span
v-else
class="content"
:class="{'select': item.isCorrect, 'error': item.isSelected && !item.isCorrect}"
>{{currentQuestion.unionType == 2 ? getOrderVac(index) : item.text}}</span>
</div>
</article>
<article
class="c-btn-wrapper"
v-show="currentQuestion.typeId == 2 && !currentQuestion.commitFlag"
@click="commitAnswer()"
>
<van-button size="large" round color="#449284">确 认</van-button>
</article>
<article class="answer-wrapper" v-show="currentQuestion.isAnalyzed">
<span class="content">正确答案:{{currentQuestion.answer}}</span>
</article>
<article class="analysis-wrapper" v-show="currentQuestion.isAnalyzed">
<span class="title">解析</span>
<div v-if="currentQuestion.intro" class="content" v-html="currentQuestion.intro"></div>
<div class="no-intro" v-else>
<img src="../../images/question/no-analysis.png" alt />
<span class="text">暂无相关解析</span>
</div>
</article>
</section>
</template>
<script>
import commonSpliteLine from "@/components/common/common-splite-line";
import { mapGetters, mapActions } from "vuex";
import { getOrderText } from "@/utils";
export default {
components: {
commonSpliteLine
},
props: {
questionObj: {
type: Array,
default: () => {}
}
},
computed: {
...mapGetters([
"questionList",
"currentQuestion",
"commonConfig",
"titleConfig",
"userInfo"
])
},
data() {
return {
isAndroid: window.__isAndroid
};
},
methods: {
// 将序号转成字母
getOrderVac(index) {
return getOrderText(index);
},
// 选择选项
selectOption(index) {
if (this.currentQuestion.commitFlag) return;
// 多选题 -- 重新设置答案(myAnswer)
if (this.currentQuestion.typeId == 2) {
// 只记录当前选项,不提交答案
this.currentQuestion.options[index].isSelected = !this.currentQuestion.options[index].isSelected;
let myAnswer = "";
this.currentQuestion.options.forEach((item, index) => {
if (item.isSelected) {
myAnswer += this.getOrderVac(index);
}
});
myAnswer = myAnswer.split("").join(",");
this.currentQuestion.myAnswer = myAnswer;
} else {
this.currentQuestion.options[index].isSelected = true;
// 单选题或者判断题直接设置commitFlag
if (this.currentQuestion.options[index].isCorrect) {
this.currentQuestion.commitFlag = 1;
} else {
this.currentQuestion.commitFlag = 2;
}
let myAnswer = this.getOrderVac(index);
let isAnalyzed =
this.currentQuestion.commitFlag &&
myAnswer != this.currentQuestion.answer;
this.currentQuestion.isAnalyzed = isAnalyzed;
this.currentQuestion.myAnswer = this.getOrderVac(index);
this.commitAnswer();
}
this.$forceUpdate();
console.log("in commit", this.currentQuestion.myAnswer);
},
// 提交答案
commitAnswer() {
this.checkTokenForNative( () => {
let params = {
commitKind: this.commonConfig.commitKind, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: this.currentQuestion.directoryId, // 题库ID
myAnswer: this.currentQuestion.myAnswer, // 我的答案,单选时单个答案,如A;多选答案,按照顺序使用
paperId: this.currentQuestion.paperId, // 试卷ID
paperIndex: this.currentQuestion.paperIndex, // 试卷索引(随机试卷的第n套)
resultId: this.titleConfig.resultId, // 刷题库轮次ID,刷收藏和错题集时为0
// rightFlag: 1, // 答题对错:1对 2错
titleId: this.currentQuestion.titleId, // 题目ID
titleNo: this.currentQuestion.titleNo, // 题目ID
setEntry: true,
token: this.userInfo.userToken
};
// 计算是否答对了题目(只有多选题,才做相应处理)
// if (this.currentQuestion.typeId == 2) {
let isRight = this.currentQuestion.myAnswer == this.currentQuestion.answer;
if (isRight) {
this.currentQuestion.commitFlag = 1;
} else {
this.currentQuestion.commitFlag = 2;
this.currentQuestion.isAnalyzed = true;
}
// }
this.POST(`onlineexam/practise/commit`, params).then(({ data }) => {
console.log('in commitAnswer res', data);
// if(data.resultType == 1) {
// this.currentQuestion.commitFlag = 1;
// } else {
// this.currentQuestion.commitFlag = 2;
// }
}).catch( error => {
this.currentQuestion.commitFlag = 0;
this.currentQuestion.isAnalyzed = false;
})
});
}
}
};
</script>
<style lang="less" scoped>
.qeustion-content-wrapper {
// img {
// width: 98% !important;
// }
font-size: 14px;
.public-title {
.text {
padding: 20px 15px;
font-size: 14px;
color: #373839;
}
}
.title-wrapper {
padding: 20px 15px 15px;
.type {
position: relative;
top: 2.8px;
left: 0;
display: inline-block;
width: 47px;
height: 16px;
line-height: 12px;
margin-right: 4px;
border-radius: 2px;
background: #5890dd;
font-size: 12px;
& > span {
position: absolute;
top: 2px;
left: 4.5px;
color: #ffffff;
&.top-2 {
top: 2.8px;
}
}
&.multi {
background: #e6a23c;
}
&.top-1 {
top: 1px;
}
}
.content {
font-size: 16px;
font-weight: 700;
color: #333333;
// & > img {
// margin-top: 15px !important;
// width: 100% !important;
// }
}
img {
margin-top: 15px !important;
width: 100% !important;
}
}
.select-wrapper {
padding: 0 15px 8px;
.item {
display: flex;
// height: 40px;
// line-height: 1.2;
font-size: 16px;
align-items: center;
padding: 8px 0;
.option {
display: block;
width: 20px;
height: 20px;
line-height: 20px;
text-align: center;
margin-right: 10px;
color: #373839;
&.border {
border: 1px solid #c7c8c9;
border-radius: 50%;
}
&.bg {
color: #fff;
background: #449284;
border-radius: 50%;
}
}
& > img {
width: 18px;
height: 18px;
margin-right: 10px;
}
.select {
color: #449284;
}
.error {
color: #ed3131;
}
}
}
.c-btn-wrapper {
padding: 20px 15px;
}
.answer-wrapper {
margin: 20px 15px;
border-radius: 6px;
height: 40px;
line-height: 40px;
background: #f8f9fa;
.content {
margin: 10px 0;
height: 16px;
line-height: 1;
font-size: 16px;
font-weight: 700;
padding: 0 15px;
}
}
.analysis-wrapper {
padding: 15px 15px 30px;
.title {
display: flex;
height: 16px;
line-height: 1;
margin-bottom: 15px;
font-size: 16px;
font-weight: 700;
color: #373839;
&::before {
display: inline-block;
content: "";
height: 16px;
width: 3px;
margin-right: 9px;
background: #f68367;
border-radius: 3px;
}
}
.content {
font-size: 14px;
font-weight: 400;
color: #373839;
& > img {
width: 100% !important;
}
}
.no-intro {
display: flex;
flex-direction: column;
align-items: center;
padding: 60px 0 120px;
img {
width: 100px;
height: 100px;
}
.text {
height: 12px;
line-height: 12px;
font-size: 12px;
color: #999999;
}
}
}
}
</style>
\ No newline at end of file
<template>
<section class="qeustion-footer-wrapper">
<article class="left" @click="toggleAnalysis()">
<img src="../../images/question/analysis.png" alt />
<span class="text">解析</span>
</article>
<article class="center" @click="toggleCollect()">
<img v-show="currentQuestion.favorFlag == 0" src="../../images/question/heart-b.png" alt />
<img v-show="currentQuestion.favorFlag != 0" src="../../images/question/heart.png" alt />
<span class="text">收藏</span>
</article>
<article class="right">
<span class="pre" :class="{'disabled': currentQuestion.titleNo == 1}" @click="previous">上一题</span>
<span class="next" :class="{'disabled': currentQuestion.titleNo == totalCount}" @click="next">下一题</span>
</article>
</section>
</template>
<script>
import { Toast } from "vant";
import { mapGetters, mapActions } from "vuex";
import { findQuestionIndexNo } from "@/utils";
export default {
props: {},
data() {
return {
queryParams: {
commitKind: 3, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: 1748, // 题库ID,获取错题集或收藏时传0
pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页
pageSize: 5, // 每页大小
secondSubjectId: 106, // 二级学科分类ID:用于判断学科下目录免费题数
titleNo: 0, // 起始或结束题目序号,首次进入页面时传0,系统自动定位到上次做的题
}
};
},
computed: {
...mapGetters([
"commitKind",
"questionList",
"currentQuestion",
"totalCount",
"userInfo",
"titleConfig",
"commonConfig",
])
},
methods: {
// 上一页 // 有可能要触发上分页(前端的个数只有一条)
previous() {
if(!this.canRun()) return;
this.$sendBuriedData({
component_tag: `886#88601`
});
if (this.currentQuestion.titleNo == 1) {
Toast("已是第一题");
} else {
let cIndex = findQuestionIndexNo(this.questionList, "titleNo", this.currentQuestion.titleNo);
// 如果没有找到,则不做后面操作
if(!this.questionList[cIndex - 1]) return;
this.$store.commit(
"SET_CURRENT_QUESTION",
this.questionList[cIndex - 1] || { answerList: [] }
);
console.log(cIndex == 1, this.currentQuestion.titleNo >= 2);
if(cIndex == 1 && this.currentQuestion.titleNo >= 2) {
this.$emit("pageQuestion", 0, this.questionList[0].titleNo);
}
}
},
// 下一页 // 有可能要触发下分页(后面的个数只有一条)
next() {
if(!this.canRun()) return;
this.$sendBuriedData({
component_tag: `886#88602`
});
if (this.currentQuestion.titleNo == this.totalCount
// if (this.currentQuestion.titleNo == this.questionList.length
|| this.currentQuestion.titleNo == this.questionList[this.questionList.length - 1].titleNo) {
this.$emit("statistics");
} else {
let cIndex = findQuestionIndexNo(this.questionList, 'titleNo', this.currentQuestion.titleNo);
this.$store.commit(
"SET_CURRENT_QUESTION",
this.questionList[cIndex + 1] || { answerList: [] }
);
console.log(this.currentQuestion.isAnalyzed || (this.currentQuestion.commitFlag == 2));
if((cIndex == this.questionList.length - 2) && (this.questionList.length < this.totalCount)) {
this.$emit("pageQuestion", 1, this.questionList[this.questionList.length - 1].titleNo);
}
}
},
// 解析
toggleAnalysis() {
this.currentQuestion.isAnalyzed = true;
if(!this.currentQuestion.commitFlag) {
this.commitAnswer();
} else {
setTimeout(() => {
this.$emit("scrollTop");
}, 200);
}
this.$sendBuriedData({
component_tag: `886#88603`
});
},
// 收藏/不收藏
toggleCollect() {
this.favor(this.currentQuestion);
// this.$store.commit('SET_CURRENT_QUESTION', this.currentQuestion);
},
// 收藏/取消收藏
favor() {
if(!this.canRun()) return;
let favorFlag = this.currentQuestion.favorFlag;
let sPoint = favorFlag == 1 ? "88605" : "88604";
this.$sendBuriedData({
component_tag: `886#${sPoint}`
});
let param = {
dataType: 2,
directoryId: this.currentQuestion.directoryId,
examTitleId: this.currentQuestion.titleId,
operateType: favorFlag == 1 ? 2 : 1, // 操作类型:1:收藏 2:取消收藏
paperId: this.currentQuestion.paperId,
paperIndex: this.currentQuestion.paperIndex,
token: this.userInfo.userToken || this.token,
setEntry: true
};
this.currentQuestion.favorFlag = this.currentQuestion.favorFlag == 0 ? 1 : 0;
this.POST("onlineexam/collectExamTitle", param).then(res => {
if (res.code == "000000") {
if(res.data) {
// let cIndex = this.questionList.findIndex( item => {
// return item.titleNo = this.currentQuestion.titleNo;
// });
// this.questionList[cIndex].favorFlag = favorFlag == 0 ? 1 : 0;
// this.currentQuestion.favorFlag = favorFlag == 0 ? 1 : 0;
}
}
});
},
// 提交答案
commitAnswer() {
this.checkTokenForNative( () => {
let params = {
commitKind: this.commonConfig.commitKind, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: this.currentQuestion.directoryId, // 题库ID
myAnswer: this.currentQuestion.myAnswer, // 我的答案,单选时单个答案,如A;多选答案,按照顺序使用
paperId: this.currentQuestion.paperId, // 试卷ID
paperIndex: this.currentQuestion.paperIndex, // 试卷索引(随机试卷的第n套)
resultId: this.titleConfig.resultId, // 刷题库轮次ID,刷收藏和错题集时为0
// rightFlag: 1, // 答题对错:1对 2错
titleId: this.currentQuestion.titleId, // 题目ID
titleNo: this.currentQuestion.titleNo, // 题目ID
setEntry: true,
token: this.userInfo.userToken,
};
let isRight = this.currentQuestion.myAnswer == this.currentQuestion.answer;
if (isRight) {
this.currentQuestion.commitFlag = 1;
} else {
this.currentQuestion.commitFlag = 2;
}
this.currentQuestion.isAnalyzed = true;
// this.$forceUpdate();
setTimeout(() => {
this.$emit("scrollTop");
}, 200);
this.POST(`onlineexam/practise/commit`, params).then(({ data }) => {
console.log('in commitAnswer res', data);
// if(data.resultType == 1) {
// this.currentQuestion.commitFlag = 1;
// } else {
// this.currentQuestion.commitFlag = 0;
// }
}).catch( error => {
this.currentQuestion.commitFlag = 0;
this.currentQuestion.isAnalyzed = false;
})
});
}
}
};
</script>
<style lang="less" scoped>
.qeustion-footer-wrapper {
position: fixed;
width: 100%;
left: 0;
bottom: 0;
display: flex;
height: 60px;
flex-direction: row;
justify-content: space-between;
align-items: center;
background: #ffffff;
font-size: 14px;
box-shadow: 0px -2px 10px 0px rgba(0, 0, 0, 0.1);
padding: 0 5px 0 15px;
.left {
display: flex;
flex-direction: column;
margin-left: 10px;
align-items: center;
& > img {
width: 18px;
height: 18px;
}
.text {
font-size: 12px;
}
}
.center {
display: flex;
flex-direction: column;
align-items: center;
& > img {
width: 18px;
height: 18px;
}
.text {
font-size: 12px;
}
}
.right {
display: flex;
flex-direction: row;
align-items: center;
text-align: center;
width: 210px;
color: #373839;
span {
display: inline-block;
width: 100px;
height: 40px;
line-height: 40px;
&.pre {
border-radius: 20px 0 0 20px;
border: 1px solid #979899;
&.disabled {
color: #979899;
}
}
&.next {
border-radius: 0 20px 20px 0;
border: 1px solid #979899;
border-left: 0px;
}
}
}
}
</style>
\ No newline at end of file
<template>
<section class="question-header-wrapper">
<img @click="goBack" class="left" src="../../images/left-array-black.png" alt="">
<span class="center">{{title}}</span>
<div class="right" >
<span v-show="total">
<span class="order">{{order}}</span><span class="total">/{{total}}</span>
</span>
</div>
</section>
</template>
<script>
export default {
props: {
title: {
type: String,
default: "第一篇 基础知识",
},
order: {
type: Number | String,
default: 0,
},
total: {
type: Number | String,
default: 0,
}
},
methods: {
//返回
goBack() {
this.$router.back(-1);
// rocNative.goBack();
},
},
}
</script>
<style lang="less" scoped>
.question-header-wrapper {
width: 100%;
// box-sizing: content-box;
position: fixed;
top: 0;
left: 0;
z-index: 1;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 28px 15px 0;
// padding-top: 28px;
// margin: 0 15px;
background: #fff;
.left {
height: 25px;
}
.center {
height: 40px;
line-height: 40px;
font-size: 17px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
color: #000000;
padding: 0 10px;
}
.right {
min-width: 60px;
font-size: 14px;
text-align: right;
span {
&.order {
color: #373839;
font-weight: 700;
}
&.total {
color: #979899;
}
}
}
}
</style>
\ No newline at end of file
...@@ -9,6 +9,9 @@ const notFound = r => require.ensure([], () => r(require('../views/not-found')), ...@@ -9,6 +9,9 @@ const notFound = r => require.ensure([], () => r(require('../views/not-found')),
const goodsDetail = r => require.ensure([], () => r(require('../views/goods-detail')), 'goods-detail') const goodsDetail = r => require.ensure([], () => r(require('../views/goods-detail')), 'goods-detail')
const purchaseRezult = r => require.ensure([], () => r(require('../views/purchase-rezult')), 'purchase-rezult') const purchaseRezult = r => require.ensure([], () => r(require('../views/purchase-rezult')), 'purchase-rezult')
const questionBank = r => require.ensure([], () => r(require('../views/question-bank')), 'question-bank')
const questionDetail = r => require.ensure([], () => r(require('../views/question-detail')), 'question-detail')
export default [{ export default [{
path: '/', path: '/',
component: App, component: App,
...@@ -53,5 +56,13 @@ export default [{ ...@@ -53,5 +56,13 @@ export default [{
path: '/prezult', path: '/prezult',
component: purchaseRezult component: purchaseRezult
}, },
{
path: '/question-bank',
component: questionBank
},
{
path: '/question-detail',
component: questionDetail
},
] ]
}] }]
...@@ -7,5 +7,14 @@ const getters = { ...@@ -7,5 +7,14 @@ const getters = {
positionInfo: state => state.coop.positionInfo, positionInfo: state => state.coop.positionInfo,
organizationInfo: state => state.coop.organizationInfo, organizationInfo: state => state.coop.organizationInfo,
logged: state => !!(state.user.token && state.user.info.id), logged: state => !!(state.user.token && state.user.info.id),
// 刷题相关
commonConfig: state => state.question.commonConfig,
titleConfig: state => state.question.titleConfig,
questionList: state => state.question.questionList,
currentQuestion: state => state.question.currentQuestion,
commitKind: state => state.question.titleConfig.commitKind,
freeFlag: state => state.question.titleConfig.freeFlag,
totalCount: state => state.question.titleConfig.totalCount,
canRunNext: state => state.question.canRunNext,
} }
export default getters export default getters
...@@ -2,6 +2,7 @@ import Vue from 'vue' ...@@ -2,6 +2,7 @@ import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import coop from './modules/coop' import coop from './modules/coop'
import user from './modules/user' import user from './modules/user'
import question from './modules/question'
import getters from './getters' import getters from './getters'
Vue.use(Vuex) Vue.use(Vuex)
...@@ -10,6 +11,7 @@ const store = new Vuex.Store({ ...@@ -10,6 +11,7 @@ const store = new Vuex.Store({
modules: { modules: {
coop, coop,
user, user,
question
}, },
getters getters
}) })
......
const coop = { const coop = {
state: { state: {
userInfo: {appVersion: '343'}, userInfo: {appVersion: "344", userToken: "BEE0545CD53A43DBA2E86C97B3394EB2"},
statusBarHeight: {}, statusBarHeight: {},
projectTabIndex: 1, projectTabIndex: 1,
jumpURLForI: "", //中华医学会一类跳转地址 jumpURLForI: "", //中华医学会一类跳转地址
......
// import fetch from '@/utils/fetch';
// import { getBaseUrl } from '@/utils/index'
// import { setCookie, getCookie, delCookie } from '@/utils/index';
// import { envConfig } from '@/utils/env-config';
import { findQuestionIndexNo, getOrderText, concatArray } from "@/utils";
const question = {
state: {
currentTitle: "题库",
questionList: [],
currentQuestion: {
isAnalyzed: false,
options: [ // 从options加工出来
{
isCorrect: false,
isSelected: true,
text: "进行分析评估",
},
{
isCorrect: false,
isSelected: false,
text: "进行分析评估",
},
{
isCorrect: true,
isSelected: true,
text: "进行分析评估",
},
{
isCorrect: false,
isSelected: false,
text: "进行分析评估",
},
],
titleId: 1,
titleNo: 1, // 题序,从1开始
typeId: 1, // 题目类型ID 1-单选,2-多选,3-判断
unionId: "", // 联合类型题目,分组唯一标识
unionType: 1, // 0普通题型 1-共用题干; 2-共用选项
unionQuestion: "", // 共用题干
question: '题干内容<img src="https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png" />', // 题干内容
config: "", // 选项
answer: "", // 正确答案
intro: "", // 题目解析
score: 0, // 题目分值
myAnswer: "", // 我的答案
commitFlag: 0, // 0还未做 1做对了 2做错了
favorFlag: 0, // 0未收藏 1已收藏
pictureFlag: "", // 0没有图 1有图
questionStreamType: "", // 题干内流媒体类型:0-文本,1-图片,2-视频,3-音频
directoryId: 0, // 题库ID
paperId: "", // 试卷ID
paperIndex: "", // 试卷索引
},
commonConfig: {
// 0: 免费; 1: 收费; 没有绑卡且是收费题库(bindStatus == 0 && freeFlag == 1)可以走免费体验流程
freeFlag: 0,
directoryId: "",
secondSubjectId: 0,
cardType: 3,
goodsType: 3,
commitKind: 3, // 答题来源 1:错题集 2:收藏 3:题库
},
titleConfig: {
bindStatus: 0, // 绑卡状态:0未绑卡 1已绑卡
commitKind: 3, // 答题来源 1:错题集 2:收藏 3:题库
currentTitleNo: 0, // 定位答题题目id
resultId: 0, // 刷题库轮次ID
totalCount: 0, // 题目总数
},
canRunNext: true,
},
mutations: {
SET_COMMON_CONIFG: (state, payload) => {
state.commonConfig = payload;
},
SET_TITLE_CONIFG: (state, payload) => {
state.titleConfig = payload;
},
SET_COMMIT_KIND: (state, payload) => {
state.titleConfig.commitKind = payload;
},
SET_FREE_FLAG: (state, payload) => {
state.titleConfig.freeFlag = payload;
},
SET_TOTAL_COUNT: (state, payload) => {
state.titleConfig.totalCount = payload;
},
SET_QUESTION_LIST: (state, payload) => {
state.questionList = payload;
},
SET_CURRENT_QUESTION: (state, payload) => {
state.currentQuestion = payload;
},
SET_CAN_RUN_NEXT: (state, payload) => {
state.canRunNext = payload;
},
},
actions: {
// 处理返回的数据
handlerQuestionList({ commit, state }, rezultData) {
let questionList = rezultData.practiseTitleModelList || [];
let handlerList = [], question, option, optionList = [], myAnswer = "",
answer = "", questionContent = "";
questionList.forEach((item, index) => {
myAnswer = item.myAnswer;
answer = item.answer;
question = JSON.parse(JSON.stringify(item));
question.unionQuestion = question.unionQuestion.replace(/<img/, '<img style="max-width:98%;"');
question.question = question.question.replace(/<img/, '<img style="max-width:98%;"');
question.intro = question.intro.replace(/<img/, '<img style="max-width:98%;"');
let isAnalyzed = question.commitFlag && myAnswer != answer;
question.isAnalyzed = isAnalyzed;
option = {};
optionList = [];
question.options.forEach((text, i) => {
option.isCorrect = answer.indexOf(getOrderText(i)) != -1;
if (myAnswer.indexOf(getOrderText(i)) != -1) {
option.isSelected = true;
} else {
option.isSelected = false;
}
option.text = text;
optionList.push(JSON.parse(JSON.stringify(option)));
});
question.options = optionList;
console.log('handlerList', index);
handlerList.push(question);
});
console.log('in handlerList', handlerList);
let newList = concatArray(state.questionList, handlerList, 'titleNo');
commit("SET_QUESTION_LIST", newList);
if (rezultData.isFirst) {
let cIndex = findQuestionIndexNo(handlerList, 'titleNo', rezultData.currentTitleNo || 1);
let titleConfig = {
bindStatus: rezultData.bindStatus, // 绑卡状态:0未绑卡 1已绑卡
commitKind: rezultData.commitKind, // 答题来源 1:错题集 2:收藏 3:题库
currentTitleNo: rezultData.currentTitleNo, // 定位答题题目id
resultId: rezultData.resultId, // 刷题库轮次ID
totalCount: rezultData.totalCount, // 题目总数
}
commit("SET_CURRENT_QUESTION", newList[cIndex] || { titleNo: 1 });
commit("SET_TITLE_CONIFG", titleConfig);
}
},
},
}
export default question;
...@@ -6,6 +6,7 @@ img { ...@@ -6,6 +6,7 @@ img {
} }
body, div, span, header, footer, nav, section, aside, article, ul, dl, dt, dd, li, a, p, h1, h2, h3, h4,h5, h6, i, b, textarea, button, input, select, figure, figcaption { body, div, span, header, footer, nav, section, aside, article, ul, dl, dt, dd, li, a, p, h1, h2, h3, h4,h5, h6, i, b, textarea, button, input, select, figure, figcaption {
word-break: break-all;
padding: 0; padding: 0;
margin: 0; margin: 0;
list-style: none; list-style: none;
......
...@@ -184,3 +184,10 @@ ...@@ -184,3 +184,10 @@
width: 40px !important; width: 40px !important;
height: 40px !important; height: 40px !important;
} }
.van-button--large {
height: 44px !important;
line-height: 42px !important;
}
.van-button__text {
font-weight: 700 !important;
}
\ No newline at end of file
...@@ -11,17 +11,16 @@ const service = axios.create({ ...@@ -11,17 +11,16 @@ const service = axios.create({
// request拦截器 // request拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
// debugger
if (config.data && config.data.setEntry) { if (config.data && config.data.setEntry) {
config.headers['sysCode'] = config.data.sysCode || 10 config.headers['sysCode'] = config.data.sysCode || 10
if(config.data.token){ if (config.data.token) {
config.headers['token'] = config.data.token || '47993ED00ECB46CE8D31ECF3AE34B4AA' config.headers['token'] = config.data.token;
if( process.env.BUILD_ENV == "development" ){ // 本地开发环境 if (process.env.BUILD_ENV == "development") { // 本地开发环境
config.headers['token'] = config.data.token || '47993ED00ECB46CE8D31ECF3AE34B4AA'; config.headers['token'] = config.data.token;
}
} }
delete config.data.setEntry; delete config.data.setEntry;
delete config.data.token; delete config.data.token;
}
config.headers['deviceInfo'] = JSON.stringify({ "app_channel": "", "app_mac": "", "app_uuid": "", "app_version": "", "device_brand": "", "device_ip": "", "device_model": "", "device_net": "", "device_ops": "", "resolution_wh": "", "system_level": "", "device_type": '10' }) config.headers['deviceInfo'] = JSON.stringify({ "app_channel": "", "app_mac": "", "app_uuid": "", "app_version": "", "device_brand": "", "device_ip": "", "device_model": "", "device_net": "", "device_ops": "", "resolution_wh": "", "system_level": "", "device_type": '10' })
} }
......
/** /**
* Created by Anndy Yang on 19/02/28. * Created by Anndy Yang on 19/02/28.
*/ */
let orderVac = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S"
];
import { envConfig } from '@/utils/env-config' import { envConfig } from '@/utils/env-config'
const { BUILD_ENV } = process.env; const { BUILD_ENV } = process.env;
// 获取SC服务器域名地址 // 获取SC服务器域名地址
export function getBaseUrl(url) { export function getBaseUrl(url) {
return getConfigByEnvType('baseUrl') + url return getConfigByEnvType('baseUrl') + url
...@@ -262,7 +283,7 @@ export const getCookie = key => { ...@@ -262,7 +283,7 @@ export const getCookie = key => {
export function debounce(fn, wait = 50) { export function debounce(fn, wait = 50) {
let timer; let timer;
return function() { return function () {
if (timer) clearTimeout(timer) if (timer) clearTimeout(timer)
timer = setTimeout(() => { timer = setTimeout(() => {
fn.apply(this, arguments); fn.apply(this, arguments);
...@@ -286,3 +307,41 @@ export function querystring(query) { ...@@ -286,3 +307,41 @@ export function querystring(query) {
return result; return result;
} }
export function getOrderText(index) {
return orderVac[index];
}
// 从数组中查找某个key对应值所在的位置(序号:0开始的)
export function findQuestionIndexNo(oList, key, keyValue) {
let index = oList.findIndex(item => {
return item[key] == keyValue;
});
return index;
}
// 对两个数组中的元素进行排序
export function concatArray(firstArr = [], secondArr = [], key) {
if (firstArr.length == 0) return secondArr;
if (secondArr.length == 0) return [];
let all = [], newArr = [], deleteIndex;
if (firstArr[0][key] == secondArr[0][key]) {
return firstArr;
} else if (firstArr[0][key] < secondArr[0][key]) {
all = firstArr.concat(secondArr);
} else {
all = secondArr.concat(firstArr);
}
// 从all中去重
for (let i = 0; i < all.length; i++) {
deleteIndex = findQuestionIndexNo(all.slice(i + 1), key, all[i][key]);
if (deleteIndex >= 0) {
all.splice(deleteIndex, 1);
i--;
}
}
console.log("in contactArray", all);
return all;
}
import fetch from '@/utils/fetch' import fetch from '@/utils/fetch'
import { getBaseUrl, getApiUrl } from '@/utils/index' import { getBaseUrl, getApiUrl } from '@/utils/index';
import { mapGetters } from 'vuex';
// import store from '../store';
module.exports = { module.exports = {
data: function () { data: function () {
return { return {
token: null token: 'weewfwefw'
} }
}, },
created: function () { created: function () {
...@@ -15,9 +18,13 @@ module.exports = { ...@@ -15,9 +18,13 @@ module.exports = {
// alert('this.token' + this.token) // alert('this.token' + this.token)
this.token = this.getUrlKey('token') || (query && query.token) this.token = this.getUrlKey('token') || (query && query.token)
}, },
mounted() { computed: {
...mapGetters(['canRunNext'])
},
mounted() {
}, },
methods: { methods: {
getUrlPara(obj) { getUrlPara(obj) {
let dataStr = '' let dataStr = ''
...@@ -110,8 +117,10 @@ module.exports = { ...@@ -110,8 +117,10 @@ module.exports = {
// 通用GET请求 // 通用GET请求
GET(api, para, callback, str) { GET(api, para, callback, str) {
// debugger // debugger
let token = para.token || this.token || this.$store.state.user.token || ''; let token = para.token || this.token || this.$store.state.user.token || this.$store.state.coop.userInfo.userToken;
para.token = token; para.token = token;
delete para.token;
delete para.setEntry;
let url = api + this.getUrlPara(para) let url = api + this.getUrlPara(para)
return fetch({ return fetch({
url: getBaseUrl(url), url: getBaseUrl(url),
...@@ -146,8 +155,10 @@ module.exports = { ...@@ -146,8 +155,10 @@ module.exports = {
// 通用POST请求 // 通用POST请求
POST(api, para, callback) { POST(api, para, callback) {
let token = para.token || this.token || this.$store.state.user.token || ''; let token = para.token || this.token || this.$store.state.user.token || this.$store.state.coop.userInfo.userToken;
para.token = token; para.token = token;
delete para.token;
delete para.setEntry;
return fetch({ return fetch({
url: getBaseUrl(api), url: getBaseUrl(api),
method: 'post', method: 'post',
...@@ -158,7 +169,7 @@ module.exports = { ...@@ -158,7 +169,7 @@ module.exports = {
// 通用POST请求 // 通用POST请求
NEW_POST(api, para, callback) { NEW_POST(api, para, callback) {
// para.token = para.token || this.token || '00175A13D70D4234822D90AC3C74202C' // para.token = para.token || this.token || this.$store.state.coop.userInfo.userToken;
return fetch({ return fetch({
url: getBaseUrl(api), url: getBaseUrl(api),
method: 'post', method: 'post',
...@@ -168,7 +179,7 @@ module.exports = { ...@@ -168,7 +179,7 @@ module.exports = {
// 通用GET请求 // 通用GET请求
API_GET(api, para, callback) { API_GET(api, para, callback) {
para.token = para.token || this.token || '00175A13D70D4234822D90AC3C74202C' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token para.token = para.token || this.token || this.$store.state.coop.userInfo.userToken; //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
let url = api + this.getUrlPara(para) let url = api + this.getUrlPara(para)
return fetch({ return fetch({
url: getApiUrl(url), url: getApiUrl(url),
...@@ -179,7 +190,7 @@ module.exports = { ...@@ -179,7 +190,7 @@ module.exports = {
// 通用POST请求 // 通用POST请求
API_POST(api, para, callback) { API_POST(api, para, callback) {
para.token = para.token || this.token || '00175A13D70D4234822D90AC3C74202C' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token para.token = para.token || this.token || this.$store.state.coop.userInfo.userToken; //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
return fetch({ return fetch({
url: getApiUrl(api), url: getApiUrl(api),
method: 'post', method: 'post',
...@@ -215,20 +226,50 @@ module.exports = { ...@@ -215,20 +226,50 @@ 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,
token: this.token || this.$store.state.user.token || this.$store.state.coop.userInfo.userToken,
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(); this.goLogin();
} else { } else {
noLoggedCallback && noLoggedCallback() cb && cb()
} }
}); });
},
// 校验token,有效则调用回调函数,否则使用调起原生登陆页面
checkTokenForNative(cb) {
let param = {
token: this.token || this.$store.state.coop.userInfo.userToken,
setEntry: true
};
this.GET("campaign/admin/task/checkToken", param).then(res => {
if (res.code !== "000000") {
rocNative.gotoLogin();
} else {
cb && cb()
} }
});
},
// 防止重复点击的最简单实现
canRun(delayTime = 500){
if(this.canRunNext) {
this.$store.commit('SET_CAN_RUN_NEXT', false);
setTimeout( () => {
this.$store.commit('SET_CAN_RUN_NEXT', true)
}, delayTime);
console.log('in canRan ', this.canRunNext);
return true;
} else {
console.log('in canRan', this.canRunNext);
return false;
}
}
} }
} }
...@@ -221,11 +221,14 @@ export default { ...@@ -221,11 +221,14 @@ export default {
// goodsType= 3 and cardType = 3 职称考课程卡 // goodsType= 3 and cardType = 3 职称考课程卡
let sharePrice = goods.preferentialPrice || goods.costPrice; let sharePrice = goods.preferentialPrice || goods.costPrice;
let shareDesc = "¥" + (sharePrice / 100).toFixed(2); let shareDesc = "¥" + (sharePrice / 100).toFixed(2);
if(goods.goodsType == 2) { shareDesc += goods.shareContent || "";
shareDesc += "\n可申请5学分,自学资料性质,由医院录入!"; // if(goods.goodsType == 2) {
} else if(goods.goodsType == 3 && goods.cardType == 3) { // shareDesc += "\n可申请5学分,自学资料性质,由医院录入!";
shareDesc += "\n卫健委正规授权,在职医师专业解读,大量实用病例分析!"; // } else if(goods.goodsType == 3 && goods.cardType == 3) {
} // shareDesc += "\n卫健委正规授权,在职医师专业解读,大量实用病例分析!";
// } else if(goods.goodsType == 3 && goods.cardType == 4) {
// shareDesc += "\n仿真模拟,刷题助考更安心!";
// }
let shareUrl = getWebPageUrl( let shareUrl = getWebPageUrl(
`profexam/#/goods-detail?goodsId=${this.goods.id}` `profexam/#/goods-detail?goodsId=${this.goods.id}`
); );
...@@ -465,9 +468,9 @@ export default { ...@@ -465,9 +468,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 {
......
...@@ -284,9 +284,10 @@ export default { ...@@ -284,9 +284,10 @@ export default {
cardNo: "", cardNo: "",
cardKey: "", cardKey: "",
cardType: 3, cardType: 3,
orderId: 0 orderId: 0,
}, },
subContent: ``, subContent: "",
hasNoUsedCard: false,
}; };
}, },
components: { components: {
...@@ -390,11 +391,11 @@ export default { ...@@ -390,11 +391,11 @@ export default {
}, },
// 查询是否买过类似的卡,但还没有绑定 // 查询是否买过类似的卡,但还没有绑定
async hasNoUsedCardAction() { hasNoUsedCardAction() {
let param = { let param = {
setEntry: true setEntry: true
}; };
await 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 +408,11 @@ export default { ...@@ -407,8 +408,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 +557,12 @@ export default { ...@@ -553,12 +557,12 @@ 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,
}; };
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: "职称考精讲课程卡" };
...@@ -903,16 +907,24 @@ export default { ...@@ -903,16 +907,24 @@ export default {
}, 200); }, 200);
// 请求成功后统计,获取项目名
this.$sendBuriedData({
component_tag: `882#88201#${_this.projectId}#${_this.project.projectName}`
});
// 如果 hasBindCard 为false,则获取卡信息 0:未绑卡 1:已绑卡 // 如果 hasBindCard 为false,则获取卡信息 0:未绑卡 1:已绑卡
if (!_this.hasBindCard) { if (!_this.hasBindCard) {
_this.preJumper(); _this.preJumper();
_this.hasNoUsedCardAction(); _this.hasNoUsedCardAction();
} }
<<<<<<< HEAD
// 请求成功后统计,获取项目名 // 请求成功后统计,获取项目名
this.$sendBuriedData({ this.$sendBuriedData({
component_tag: `882#88201#${_this.projectId}#${_this.project.projectName}` component_tag: `882#88201#${_this.projectId}#${_this.project.projectName}`
}); });
=======
>>>>>>> dev-question-bank-0916
} }
}); });
}, },
......
...@@ -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;
// 绑定成功 // 绑定成功
......
<template>
<div class="question-bank-wrap">
<CommonNavbar
ref="navBarCom"
:bgColor="bgColor"
v-if="isShowNavbar"
:title="navTitle"
:isFixNavbar="isFixNavbar"
borderStyle="1px solid #fff"
></CommonNavbar>
<DirectoryInfo
:directoryInfo="directoryInfo"
@handlerBook="handlerBook"
></DirectoryInfo>
<div class="question-bank-content" :class="!isWeb ? 'add-padding' : ''">
<div class="question-intro" v-if="directoryInfo.directoryImageUrl || directoryInfo.directoryIntro">
<img v-if="directoryInfo.directoryImageUrl" :src="directoryInfo.directoryImageUrl">
<p v-if="directoryInfo.directoryIntro">{{directoryInfo.directoryIntro}}</p>
</div>
<div class="course-list" v-if="subDirectoryModelList && subDirectoryModelList.length > 0">
<p class="title"><span class="line"></span>考点</p>
<div class="course-item" v-for="(item, index) in subDirectoryModelList" :key="index">
<div class="left-c">
<p class="title-c">{{item.directoryName}}</p>
<p class="join-c" v-if="!bindStatus">{{item.joinUserNum}}人已参与</p>
<div class="progress-course" v-else>
<div class="progress-w"><van-progress :percentage="item.finishedRatio" :stroke-width="6" color="#449284" :show-pivot="false"/></div>
<span class="mg-set">{{item.finishedRatio}}%</span><span>{{item.sumTitle}}</span>
</div>
</div>
<div class="right-btn">
<span v-if="!bindStatus && (item.freeFlag == 0)" @click="goStudy(item, '开始练习')">开始练习</span>
<span v-if="!bindStatus && (item.freeFlag == 1) && (item.freePractice > 0)" @click="goStudy(item, '免费练习')">免费练习</span>
<img v-if="!bindStatus && (item.freeFlag == 1) && (item.freePractice == 0)" src="../images/question/lock.png" @click="unlockHand">
<span v-if="bindStatus == 1" @click="goStudy(item, setTxt(item.finishedRatio))">{{setTxt(item.finishedRatio)}}</span>
</div>
</div>
</div>
</div>
<BindCardButton
v-if="!bindStatus"
:cardInfo="cardInfo"
@changeClick="changeClick"
@gotoBuy="confirm"
></BindCardButton>
<ChangeCard
:changeErrorMsg="changeCardErrorMsg"
:isShow="showChangeCard"
@cancle="cancleChangeCard"
@confirm="beforeChangeCardAction">
</ChangeCard>
<CourseDialog
:subContent="subContent"
confirmBtnText="激活并去学习"
needSubContent
:isShowDialog="showBindCardTips"
@handlerAction="handlerAction"
></CourseDialog>
<Loading v-show="showLoading" />
</div>
</template>
<script>
import CommonNavbar from "@/components/common/common-navbar";
import BindCardButton from "@/components/cme/bind-card-button";
import ChangeCard from "@/components/cme/change-card";
import CourseDialog from "@/components/course/course-dialog";
import Loading from "@/components/common/common-loading";
import DirectoryInfo from "@/components/question/directory-info";
import {Progress, Toast} from 'vant';
import { mapGetters, mapActions } from "vuex";
import { getWebPageUrl } from "@/utils/index";
export default {
components: {
CommonNavbar,
BindCardButton,
ChangeCard,
Progress,
CourseDialog,
Loading,
DirectoryInfo
},
data() {
return {
token: '',
isWeb: window.__isWeb,
isInfresh: false,
bgColor: "#fff",
isShowNavbar: true,
navTitle: '',
isFixNavbar: false,
secondSubjectId: null,
directoryInfo: {
finishedNum: 0,
wrongTitle: 0,
correctRatio: 0,
},
subDirectoryModelList: [],
userId: null,
bindStatus: 0,
cardInfo: {
id: 0
},
subContent: '',
cmeCardModels: {},
showBindCardTips: false,
showChangeCard: false,
changeCardErrorMsg: "",
hasNoUsedCard: false,
showLoading: false
}
},
created() {
let _this = this;
_this.secondSubjectId = _this.$route.query.secondSubjectId || 106;
window.__getUserInfoQB = function(param) {
console.log("__getUserInfoQB", param);
_this.token = param.userToken;
_this.userMobile = param.userMobile;
_this.setUserInfo(param);
_this.initData();
};
_this.getUserInfo();
if (_this.isWeb) {
_this.initData();
}
window.__refresh = function() {
_this.isInfresh = true;
_this.getUserInfo();
};
window.__getPositionData = function(param) {
console.log(param);
// _this.showLoading = false;
param.setEntry = true;
_this.getProvinceIdByPosition(param);
};
},
mounted() {},
computed: {
...mapGetters(["userInfo"]),
setTxt() {
let txt = '';
return function (val) {
if (val == 0) {
txt = '开始练习';
}else if (val == 100) {
txt = '重新练习';
}else {
txt = '继续练习';
}
return txt;
}
},
},
methods: {
...mapActions(["setUserInfo"]),
//获取用户信息
getUserInfo() {
rocNative.getUserInfo({
__funcName: "__getUserInfoQB"
});
},
initData() {
let param = {
token: this.token,
setEntry: true
};
this.showLoading = true;
this.GET(`portal/titleTest/user/getBrushTitleInfo/${this.secondSubjectId}`, param).then(res => {
if (res.code == "000000") {
this.directoryInfo = JSON.parse(JSON.stringify(res.data));
const { subDirectoryModelList, userId, cardType, goodsType, organizationId, provinceId, bindStatus, firstSubjectCodeName, secondSubjectName, secondSubjectCode } = this.directoryInfo;
this.subDirectoryModelList = subDirectoryModelList;
this.userId = userId;
this.bindStatus = bindStatus;
this.navTitle = `${firstSubjectCodeName}-${secondSubjectName}${secondSubjectCode}`;
setTimeout(() => {
this.showLoading = false;
}, 100);
//获取底部卡信息
// 如果 bindStatus 为false,则获取卡信息 0:未绑卡 1:已绑卡
if (!this.bindStatus) {
this.preJumper();
// 查询有无已买未激活的卡
this.hasNoUsedCardAction();
}
} else {
this.$toast(res.message);
}
});
},
// token是否失效校验
checkToken() {
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 {
rocNative.gotoLogin();
}
this.isInfresh = false;
}else {
}
});
},
// 跳转前判断是否有机构,否则使用定位信息
preJumper() {
// TODO 测试代码
if (window.__isWeb) {
this.getCardInfoByProvinceId(310);
} else {
if (this.directoryInfo.organizationId != 0 && this.directoryInfo.provinceId != 0) {
this.getCardInfoByProvinceId(this.directoryInfo.provinceId);
} else {
this.getPositionData();
}
}
},
// 根据省ID,获取学习卡信息
getCardInfoByProvinceId(provinceId) {
let param = {
area: provinceId + "",
cardType: this.directoryInfo.cardType || 3,
cardTypeList: [ this.directoryInfo.cardType || 3],
goodsType: this.directoryInfo.goodsType,
};
param.setEntry = true;
this.POST("trade/goods/cardList_v2", param).then(res => {
if (res.code == "000000") {
// this.showLoading = false;
this.cardInfo = (res.data && res.data[0]) || { id: 0, name: "职称考精讲课程卡" };
this.subContent = `您已购买“${this.cardInfo.goodsName}”,是否用此卡绑定并激活当前课程。学习卡激活码一旦使用,不可更改不可退回`
}
});
},
// 获取地理位置信息
getPositionData() {
// this.showLoading = true;
console.log("getPositionData");
rocNative.getPositionData({
__funcName: "__getPositionData"
});
},
// 根据位置信息获取省ID
getProvinceIdByPosition(param) {
param.setEntry = true;
this.POST("aggregate/cme/convertLocationToProvinceId", param)
.then(res => {
if (res.code == "000000") {
this.getCardInfoByProvinceId(res.data);
}
}
);
},
// 查询是否买过类似的卡,但还没有绑定激活
hasNoUsedCardAction() {
let param = {
setEntry: true
};
this.GET(`cme/projectCard/queryNoUsedCard/${this.directoryInfo.goodsType}/${this.directoryInfo.cardType}`, param).then(({ data }) => {
//hasNoUsedCard是否有购买未使用的学习卡:1有,0没有
this.hasNoUsedCard = data.hasNoUsedCard;
if (data.hasNoUsedCard == 1) {
this.cmeCardModels = data.cmeCardModels[0] || {};
this.showBindCardTips = true;
}
});
},
// 处理提示信息框
handlerAction(type) {
if(type == 1) {
this.$sendBuriedData({
component_tag: `885#88518`
});
this.showBindCardTips = false;
} else {
this.$sendBuriedData({
component_tag: `885#88519`
});
this.beforeChangeCardAction(this.cmeCardModels.cardKey, true)
}
},
//错题集或收藏夹
handlerBook(val) {
let commitKind = null,currentTitle = '';
if (val == 1) {
commitKind = 1;
currentTitle = '错题集';
this.$sendBuriedData({
component_tag: `885#88501`
});
}else if (val == 2) {
commitKind = 2;
currentTitle = '收藏';
this.$sendBuriedData({
component_tag: `885#88502`
});
}
this.checkTokenForNative(() => {
this.$router.push({
path: '/question-detail',
query: {
directoryId: 0,
secondSubjectId: this.secondSubjectId,
cardType: this.directoryInfo.cardType,
goodsType : this.directoryInfo.goodsType,
commitKind : commitKind,
freeFlag: 1,
currentTitle: currentTitle,
seqNo: 0,
cardId: this.cardInfo.id,
}
})
});
},
//去激活
changeClick() {
this.checkTokenForNative(() => {
this.showChangeCard = true;
});
this.$sendBuriedData({
component_tag: `885#88516`
});
},
//去购买操作-先校验登录
confirm() {
this.checkTokenForNative(() => {
this.confirmGoBuy();
})
this.$sendBuriedData({
component_tag: `885#88517`
});
},
confirmGoBuy() {
let appVersion = this.userInfo.appVersion || "";
let appVersionNum = appVersion.split(".").join("");
if (appVersionNum < 344) {
this.$toast("请您下载新版本App");
return;
}
// 直接传入职称考项目ID(projectId)
let pageUrl = getWebPageUrl(
`/profexam/#/question-bank?id=${this.secondSubjectId}&secondSubjectId=${this.secondSubjectId}`
);
let paramList = [
{
key: "className",
value:
"com.picahealth.yunque.activitys.studycard.StudyCardDetailActivity###PicaDo.LearningCardVC",
type: 4,
seqNo: 1
},
{
key: "goodId",
value: this.cardInfo.id,
type: 4,
seqNo: 1
},
{
key: "courseUrl",
value: encodeURIComponent(pageUrl),
// value: projectId,
type: 4,
seqNo: 1
}
];
rocNative.dispatchEventByModuleCode({
modeCode: "M200",
jsonString: paramList
});
},
//确认激活操作-先校验登录
beforeChangeCardAction(cardKey, isInTips) {
this.checkTokenForNative(() => {
this.changeCardAction(cardKey, isInTips);
});
},
changeCardAction(cardKey, isInTips) {
let param = {
idType: 2,
cardKey: cardKey,
cardType: this.directoryInfo.cardType,
goodsType: this.directoryInfo.goodsType,
channel: 1,
portalProjectId: this.secondSubjectId,
setEntry: true
};
this.changeCardErrorMsg = "";
this.POST("cme/projectCard/bind", param).then(res => {
isInTips && (this.showBindCardTips = false);
if (res.code == "000000") {
if(res.data == 0) {
if(isInTips) {
Toast(res.message);
} else {
this.changeCardErrorMsg = "请输入正确的激活码";
}
} else {
this.showChangeCard = false;
Toast("激活成功,开始学习");
this.initData();
}
} else {
Toast(res.message);
}
}).catch( e => {
console.log('in catch', isInTips);
if(isInTips) {
Toast("无效的激活码");
this.showBindCardTips = false;
} else {
this.changeCardErrorMsg = "请输入正确的激活码";
}
});
},
//关闭激活弹层
cancleChangeCard() {
this.showChangeCard = false;
},
//各种练习
goStudy(obj, btnText) {
this.checkTokenForNative(() => {
this.$router.push({
path: '/question-detail',
query: {
directoryId: obj.directoryId,
secondSubjectId: this.secondSubjectId,
cardType: this.directoryInfo.cardType,
goodsType : this.directoryInfo.goodsType,
commitKind : 3,
freeFlag: obj.freeFlag,
currentTitle: obj.directoryName,
seqNo: obj.seqNo,
cardId: this.cardInfo.id,
}
})
});
let sPoint = ""
if(btnText === "免费练习" || btnText === "开始练习") {
sPoint = "88503";
} else if(btnText === "继续练习") {
sPoint = "88504";
} else if(btnText === "重新练习") {
sPoint = "88505";
}
if(sPoint) {
this.$sendBuriedData({
component_tag: `885#${sPoint}#${obj.directoryId}#${obj.directoryName}`
});
}
},
//解锁
unlockHand() {
this.$toast('购买后可练习');
this.$sendBuriedData({
component_tag: `885#88515`
});
},
},
}
</script>
<style lang="less" scoped>
.question-bank-wrap{
background-color: #FFFFFF;
width: 100%;
padding-bottom: 60px;
box-sizing: border-box;
.question-bank-content{
padding: 126px 16px 0;
box-sizing: border-box;
position: relative;
&.add-padding{
padding-top: 135px;
}
.question-intro{
margin-top: 15px;
background-color: #FFFFFF;
box-sizing: border-box;
box-shadow: 0 1px 12px 0 rgba(0, 0, 0, 0.05);
border-radius: 12px;
img{
width: 100%;
border-radius: 6px 6px 0 0;
display: block;
max-height: 80px;
}
p{
color: #676869;
font-size: 12px;
line-height: 18px;
padding: 12px;
/*&:first-child{
margin-top: 12px;
}*/
}
}
.course-list{
margin-top: 30px;
.title{
font-size: 18px;
line-height: 22px;
color: #373839;
.line{
display: inline-block;
width: 3px;
height: 15px;
background-color: #F68367;
border-radius: 1.5px;
margin-right: 8px;
margin-bottom: -1px;
}
}
.course-item{
padding: 20px 0;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #E7E8E9;
.left-c{
/*flex: 1;*/
width: 230px;
.title-c{
font-size: 15px;
color: #333333;
font-weight: 700;
line-height: 22px;
}
.join-c{
font-size: 12px;
color: #979899;
line-height: 14px;
margin-top: 7px;
}
.progress-course{
margin-top: 8px;
font-size: 12px;
color: #979899;
display: flex;
align-items: center;
.progress-w{
width: 100px;
}
.mg-set{
margin-left: 6px;
margin-right: 10px;
}
}
}
.right-btn{
display: flex;
align-items: center;
span{
display: inline-block;
height: 25px;
line-height: 23px;
padding: 0 6px;
color: #449284;
border: 1px solid #449284;
border-radius: 15px;
font-size: 12px;
font-weight: 700;
box-sizing: border-box;
}
img{
width: 15px;
height: 15px;
margin-right: 22.5px;
}
}
}
}
}
}
</style>
<template>
<section class="question-detail-wrapper" :style="{'position': needFixed ? 'fixed': 'static'}">
<question-header
:title="currentTitle"
:order="currentQuestion.titleNo"
:total="titleConfig.totalCount"
></question-header>
<article class="body">
<question-content ref="questionContentRef" v-show="questionList.length"></question-content>
<no-content v-show="!questionList.length" :commitKind="commitKind"></no-content>
</article>
<free-tips v-show="showFreeTips" :total="titleConfig.totalCount" @buyCard="buyCard(2)"></free-tips>
<question-footer v-show="questionList.length" @statistics="statistics" @scrollTop="scrollTop" @pageQuestion="pageQuestion"></question-footer>
<ExperienceDialog
:showDialog="experienceDialog"
:statisConfig="statisConfig"
@activeCard="activeCard"
@buyCard="buyCard(1)"
@close="closeExpDialog"
></ExperienceDialog>
<!-- 去激活 -->
<ChangeCard
:changeErrorMsg="changeCardErrorMsg"
:isShow="showChangeCard"
@cancle="cancleChangeCard"
@confirm="beforeChangeCardAction"
></ChangeCard>
<!-- 主动提示:激活并去学习 -->
<CourseDialog
:subContent="subContent"
confirmBtnText="激活并去练习"
needSubContent
:isShowDialog="showBindCardTips"
@handlerAction="handlerAction"
></CourseDialog>
<Loading v-show="showLoading" />
<div class="pt-70" :class="{'pt-110': showFreeTips}"></div>
</section>
</template>
<script>
import QuestionHeader from "@/components/question/question-header";
import QuestionContent from "@/components/question/question-content";
import QuestionFooter from "@/components/question/question-footer";
import noContent from "@/components/question/no-content";
import ExperienceDialog from "@/components/question/experience-dialog";
import FreeTips from "@/components/question/free-tips";
import Loading from "@/components/common/common-loading";
import CourseDialog from "@/components/course/course-dialog";
import ChangeCard from "@/components/cme/change-card";
import { mapGetters, mapActions } from "vuex";
import { Toast } from "vant";
import { findQuestionIndexNo, contactArray, getWebPageUrl } from "@/utils";
let titleArray = ["", "错题集", "收藏夹", "题库"];
export default {
components: {
QuestionHeader,
QuestionContent,
QuestionFooter,
noContent,
ExperienceDialog,
Loading,
CourseDialog,
ChangeCard,
FreeTips
},
data() {
return {
token: "",
directoryId: "",
cardType: 3,
goodsType: 3,
currentTitle: "试题集",
commitKind: 1, // 答题来源 1:错题集 2:收藏 3:题库
experienceDialog: false, // 体验结束弹框
showChangeCard: false, //是否展示激活弹框,
changeCardErrorMsg: "",
showBindCardTips: false,
cmeCardModels: {
cardNo: "",
cardKey: "",
cardType: 3,
orderId: 0
},
subContent: "",
showLoading: false,
cardInfo: {
id: 0
},
queryParams: {
commitKind: 3, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: 1748, // 题库ID,获取错题集或收藏时传0
secondSubjectId: 106, // 二级学科分类ID:用于判断学科下目录免费题数
titleNo: 0, // 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题
pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页
pageSize: 5, // 每页大小
seqNo: 1,
},
statisConfig: {
rightNum: 0,
errorNum: 0,
rate: 0
}
};
},
computed: {
...mapGetters([
"userInfo",
"questionList",
"currentQuestion",
"totalCount",
"commonConfig",
"titleConfig"
]),
needFixed() {
return (
this.experienceDialog || this.showChangeCard || this.showBindCardTips
);
},
showFreeTips() {
return this.commonConfig.freeFlag == 1 && this.commitKind == 3 && !this.titleConfig.bindStatus
}
},
created() {
let _this = this;
this.directoryId = this.$route.query.directoryId || 1748; // 题库ID,获取错题集或收藏时传0
this.secondSubjectId = this.$route.query.secondSubjectId || 106; // 学科id
this.cardId = this.$route.query.cardId || 3;
this.cardType = this.$route.query.cardType || 3; // 卡类型
this.goodsType = this.$route.query.goodsType || 3; // 商品类型
this.commitKind = this.$route.query.commitKind || 3; // 答题来源 1:错题集 2:收藏 3:题库
this.freeFlag = this.$route.query.freeFlag || 0; // 0: 免费; 1: 收费;
this.currentTitle = this.$route.query.currentTitle || this.currentTitle; // 顶部导航文案
if(this.commitKind == 3) {
titleArray[3] = this.currentTitle;
}
this.queryParams.commitKind = this.commitKind;
this.queryParams.directoryId = this.directoryId;
this.queryParams.secondSubjectId = this.secondSubjectId;
this.queryParams.seqNo = this.$route.query.seqNo || 0;
window.__getUserInfoForQD = function(param) {
_this.token = param.userToken;
_this.setUserInfo(param);
_this.init();
};
if (__isWeb) {
_this.init();
} else {
this.getUserInfo();
}
window.__refresh = function() {
// _this.isInfresh = true;
_this.getUserInfo();
};
window.__getPositionData = function(param) {
console.log(param);
// _this.showLoading = false;
param.setEntry = true;
_this.getProvinceIdByPosition(param);
};
},
methods: {
...mapActions(["setUserInfo", "handlerQuestionList"]),
init() {
this.currentTitle = titleArray[this.commitKind] || "习题集";
this.$store.commit("SET_COMMON_CONIFG", {
// 0: 免费; 1: 收费; 没有绑卡且是收费题库(bindStatus == 0 && freeFlag == 1)可以走免费体验流程
freeFlag: this.freeFlag,
directoryId: this.directoryId,
secondSubjectId: this.secondSubjectId,
cardType: this.cardType,
goodsType: this.goodsType,
commitKind: this.commitKind // 答题来源 1:错题集 2:收藏 3:题库
});
this.getPractiseTitles(true);
// this.preJumper();
},
// 开始翻页
pageQuestion(pageFlag, titleNo) {
this.queryParams.pageFlag = pageFlag;
this.queryParams.titleNo = titleNo;
this.getPractiseTitles();
},
// 统计当前信息
statistics() {
// 如果是收费的题库(不是错题集或收载),并且没有绑定卡
console.log(this.commonConfig.freeFlag, this.commitKind == 3, !this.titleConfig.bindStatus);
if(!this.showFreeTips) {
Toast("已是最后一题");
return;
}
let rightNum = 0,
errorNum = 0,
rate = 0;
this.questionList.forEach(item => {
if (item.commitFlag) {
if(item.myAnswer == item.answer) {
rightNum ++;
} else {
errorNum ++;
}
}
});
console.log();
if((rightNum + errorNum) > 0) {
rate = (rightNum * 100 / (rightNum + errorNum)).toFixed(0);
this.statisConfig = {
rightNum,
errorNum,
rate
}
}
this.experienceDialog = true;
},
//获取用户信息
getUserInfo() {
rocNative.getUserInfo({
__funcName: "__getUserInfoForQD"
});
},
// 去激活(体验完弹窗-打开激活弹框)
activeCard() {
this.$sendBuriedData({
component_tag: `886#88606`
});
this.checkTokenForNative(() => {
this.experienceDialog = false;
this.showChangeCard = true;
});
},
// 去购买(体验完弹窗-跳转到购买页面)
buyCard(type) {
console.log("in buyCard", type);
this.checkTokenForNative(() => {
this.confirmGoBuy();
});
if(type == 1) {
this.$sendBuriedData({
component_tag: `886#88607`
});
} else if(type == 2) {
this.$sendBuriedData({
component_tag: `886#88609`
});
}
},
// 跳转到(原生)购买页面
confirmGoBuy() {
let appVersion = this.userInfo.appVersion || "";
let appVersionNum = appVersion.split(".").join("");
if (appVersionNum < 344) {
this.$toast("请您下载新版本App");
return;
}
// 直接传入学科ID(secondSubjectId)
let pageUrl = getWebPageUrl(
`/profexam/#/question-bank?id=${this.secondSubjectId}&secondSubjectId=${this.secondSubjectId}`
);
let paramList = [
{
key: "className",
value:
"com.picahealth.yunque.activitys.studycard.StudyCardDetailActivity###PicaDo.LearningCardVC",
type: 4,
seqNo: 1
},
{
key: "goodId",
value: this.cardId,
type: 4,
seqNo: 1
},
{
key: "courseUrl",
value: encodeURIComponent(pageUrl),
// value: projectId,
type: 4,
seqNo: 1
}
];
rocNative.dispatchEventByModuleCode({
modeCode: "M200",
jsonString: paramList
});
},
// 关闭体验完弹窗
closeExpDialog() {
this.experienceDialog = false;
this.$sendBuriedData({
component_tag: `886#88608`
});
},
// 关闭激活弹框
cancleChangeCard() {
this.showChangeCard = false;
},
// 激活前
beforeChangeCardAction(cardKey, isInTips) {
this.checkTokenForNative(() => {
this.changeCardAction(cardKey, isInTips);
});
},
// 处理提示信息框
handlerAction(type) {
if (type == 1) {
// this.$sendBuriedData({
// component_tag: `882#88219`
// });
this.showBindCardTips = false;
} else {
// this.$sendBuriedData({
// component_tag: `882#88218`
// });
this.beforeChangeCardAction(this.cmeCardModels.cardKey, true);
}
},
// 分页获取题目(前、后翻页)
getPractiseTitles(isFirst) {
if(isFirst) {
this.$store.commit("SET_QUESTION_LIST", []);
}
this.showLoading = true;
this.queryParams.token = this.userInfo.userToken || this.token;
this.queryParams.setEntry = true;
this.GET(`portal/titleTest/practise/titles`, this.queryParams).then(({ data }) => {
this.currentTitleNo = data.currentTitleNo;
data.isFirst = isFirst;
this.handlerQuestionList(data);
setTimeout(() => {
this.showLoading = false;
}, 100);
});
},
// 处理返回的数据,并存储到store中
handlerPractiseData(questionList) {
let handlerList = [],
question,
option,
optionList = [],
myAnswer = "",
answer = "";
questionList.forEach((item, index) => {
question = JSON.parse(JSON.stringify(item));
question.isAnalyzed = false;
option = {};
optionList = [];
question.options.forEach((text, i) => {
option.isCorrect = false;
option.isSelected = false;
option.text = text;
optionList.push(JSON.parse(JSON.stringify(option)));
});
question.options = optionList;
console.log("handlerList", index);
handlerList.push(question);
});
console.log("in handlerList", handlerList);
let cIndex = findQuestionIndexNo(
handlerList,
"titleNo",
this.currentTitleNo
);
this.$store.commit("SET_CURRENT_QUESTION", handlerList[cIndex]);
this.$store.commit("SET_QUESTION_LIST", handlerList);
},
// 激活Action 返回值:0绑定失败,1绑定成功
changeCardAction(cardKey, isInTips) {
let _this = this;
let param = {
idType: 2,
cardKey: cardKey,
cardType: this.cardType || 3,
goodsType: this.goodsType || 3,
channel: 1,
portalProjectId: this.directoryId,
setEntry: true
};
_this.changeCardErrorMsg = "";
this.POST("cme/projectCard/bind", param)
.then(res => {
isInTips && (_this.showBindCardTips = false);
console.log("in res", res, isInTips);
if (res.code == "000000") {
if (!res.data) {
if (isInTips) {
Toast(res.message);
} else {
_this.changeCardErrorMsg = "请输入正确的激活码";
}
} else {
_this.showChangeCard = false;
Toast("激活成功,开始练习");
// 重新获取题库内容(从头开始)
// _this.getProjectInfoById();
}
} else {
Toast(res.message);
}
})
.catch(e => {
console.log("in catch", isInTips);
if (isInTips) {
Toast("无效的激活码");
_this.showBindCardTips = false;
} else {
_this.changeCardErrorMsg = "请输入正确的激活码";
}
});
},
// 根据位置信息获取省ID
getProvinceIdByPosition(param) {
param.setEntry = true;
this.POST("aggregate/cme/convertLocationToProvinceId", param).then(
res => {
if (res.code == "000000") {
this.getCardInfoByProvinceId(res.data);
}
}
);
},
// 跳转前判断是否有机构,否则使用定位信息
preJumper() {
// TODO 测试代码
if (window.__isWeb) {
this.getCardInfoByProvinceId(310);
} else {
if (this.organizationId != 0 && this.provinceId != 0) {
this.getCardInfoByProvinceId(this.provinceId);
} else {
this.getPositionData();
}
}
},
// 根据省ID,获取学习卡信息
getCardInfoByProvinceId(provinceId) {
let param = {
area: provinceId + "",
cardType: this.cardType || 3,
cardTypeList: [this.cardType || 3],
goodsType: this.goodsType
};
param.setEntry = true;
this.POST("trade/goods/cardList_v2", param).then(res => {
if (res.code == "000000") {
this.showLoading = false;
this.cardInfo = (res.data && res.data[0]) || {
id: 0,
name: "题库卡"
};
this.subContent = `您已购买${this.cardInfo.goodsName}”,是否用此卡绑定并激活当前题库。题库卡激活码一旦使用,不可更改不可退回`;
}
});
},
// 获取地理位置信息
getPositionData() {
console.log("getPositionData");
rocNative.getPositionData({
__funcName: "__getPositionData"
});
},
// 滚动到最上面
scrollTop() {
console.log("in scrollTop");
window.scrollTo(0, 2000);
}
}
};
</script>
<style lang="less" scoped>
.question-detail-wrapper {
padding-top: 68px;
.pt-70 {
padding-bottom: 70px;
}
.pt-110 {
padding-bottom: 110px;
}
}
</style>
\ No newline at end of file
<template>
<section class="question-detail-wrapper" :style="{'position': needFixed ? 'fixed': 'static'}">
<question-header
:title="currentTitle"
:order="currentQuestion.titleNo"
:total="titleConfig.totalCount"
></question-header>
<article class="body">
<question-content ref="questionContentRef" v-show="questionList.length"></question-content>
<no-content v-show="!questionList.length" :commitKind="commitKind"></no-content>
</article>
<free-tips v-show="showFreeTips" :total="titleConfig.totalCount" @buyCard="buyCard(2)"></free-tips>
<question-footer v-show="questionList.length" @statistics="statistics" @scrollTop="scrollTop" @pageQuestion="pageQuestion"></question-footer>
<ExperienceDialog
:showDialog="experienceDialog"
:statisConfig="statisConfig"
@activeCard="activeCard"
@buyCard="buyCard(1)"
@close="closeExpDialog"
></ExperienceDialog>
<!-- 去激活 -->
<ChangeCard
:changeErrorMsg="changeCardErrorMsg"
:isShow="showChangeCard"
@cancle="cancleChangeCard"
@confirm="beforeChangeCardAction"
></ChangeCard>
<Loading v-show="showLoading" />
<div class="pt-70" :class="{'pt-110': showFreeTips}"></div>
</section>
</template>
<script>
import QuestionHeader from "@/components/question/question-header";
import QuestionContent from "@/components/question/question-content";
import QuestionFooter from "@/components/question/question-footer";
import noContent from "@/components/question/no-content";
import ExperienceDialog from "@/components/question/experience-dialog";
import FreeTips from "@/components/question/free-tips";
import Loading from "@/components/common/common-loading";
import CourseDialog from "@/components/course/course-dialog";
import ChangeCard from "@/components/cme/change-card";
import { mapGetters, mapActions } from "vuex";
import { Toast } from "vant";
import { findQuestionIndexNo, contactArray, getWebPageUrl } from "@/utils";
let titleArray = ["", "错题集", "收藏夹", "题库"];
export default {
components: {
QuestionHeader,
QuestionContent,
QuestionFooter,
noContent,
ExperienceDialog,
Loading,
CourseDialog,
ChangeCard,
FreeTips
},
data() {
return {
token: "",
directoryId: "",
cardType: 3,
goodsType: 3,
currentTitle: "试题集",
commitKind: 1, // 答题来源 1:错题集 2:收藏 3:题库
experienceDialog: false, // 体验结束弹框
showChangeCard: false, //是否展示激活弹框,
changeCardErrorMsg: "",
cmeCardModels: {
cardNo: "",
cardKey: "",
cardType: 3,
orderId: 0
},
subContent: "",
showLoading: false,
cardInfo: {
id: 0
},
queryParams: {
commitKind: 3, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: 1748, // 题库ID,获取错题集或收藏时传0
secondSubjectId: 106, // 二级学科分类ID:用于判断学科下目录免费题数
titleNo: 0, // 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题
pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页
pageSize: 5, // 每页大小
seqNo: 1,
},
statisConfig: {
rightNum: 0,
errorNum: 0,
rate: 0
}
};
},
computed: {
...mapGetters([
"userInfo",
"questionList",
"currentQuestion",
"totalCount",
"commonConfig",
"titleConfig"
]),
needFixed() {
return (
this.experienceDialog || this.showChangeCard
);
},
showFreeTips() {
return this.commonConfig.freeFlag == 1 && this.commitKind == 3 && !this.titleConfig.bindStatus
}
},
created() {
let _this = this;
this.directoryId = this.$route.query.directoryId || 1748; // 题库ID,获取错题集或收藏时传0
this.secondSubjectId = this.$route.query.secondSubjectId || 106; // 学科id
this.cardId = this.$route.query.cardId || 3;
this.cardType = this.$route.query.cardType || 3; // 卡类型
this.goodsType = this.$route.query.goodsType || 3; // 商品类型
this.commitKind = this.$route.query.commitKind || 3; // 答题来源 1:错题集 2:收藏 3:题库
this.freeFlag = this.$route.query.freeFlag || 0; // 0: 免费; 1: 收费;
this.currentTitle = this.$route.query.currentTitle || this.currentTitle; // 顶部导航文案
if(this.commitKind == 3) {
titleArray[3] = this.currentTitle;
}
this.queryParams.commitKind = this.commitKind;
this.queryParams.directoryId = this.directoryId;
this.queryParams.secondSubjectId = this.secondSubjectId;
this.queryParams.seqNo = this.$route.query.seqNo || 0;
window.__getUserInfoForQD = function(param) {
_this.token = param.userToken;
_this.setUserInfo(param);
_this.init();
};
if (__isWeb) {
_this.init();
} else {
this.getUserInfo();
}
window.__refresh = function() {
// _this.isInfresh = true;
_this.getUserInfo();
};
},
methods: {
...mapActions(["setUserInfo", "handlerQuestionList"]),
init() {
this.currentTitle = titleArray[this.commitKind] || "习题集";
this.$store.commit("SET_COMMON_CONIFG", {
// 0: 免费; 1: 收费; 没有绑卡且是收费题库(bindStatus == 0 && freeFlag == 1)可以走免费体验流程
freeFlag: this.freeFlag,
directoryId: this.directoryId,
secondSubjectId: this.secondSubjectId,
cardType: this.cardType,
goodsType: this.goodsType,
commitKind: this.commitKind // 答题来源 1:错题集 2:收藏 3:题库
});
this.getPractiseTitles(true);
},
// 开始翻页
pageQuestion(pageFlag, titleNo) {
this.queryParams.pageFlag = pageFlag;
this.queryParams.titleNo = titleNo;
this.getPractiseTitles();
},
// 统计当前信息
statistics() {
// 如果是收费的题库(不是错题集或收载),并且没有绑定卡
console.log(this.commonConfig.freeFlag, this.commitKind == 3, !this.titleConfig.bindStatus);
if(!this.showFreeTips) {
Toast("已是最后一题");
return;
}
let rightNum = 0,
errorNum = 0,
rate = 0;
this.questionList.forEach(item => {
if (item.commitFlag) {
if(item.myAnswer == item.answer) {
rightNum ++;
} else {
errorNum ++;
}
}
});
console.log();
if((rightNum + errorNum) > 0) {
rate = (rightNum * 100 / (rightNum + errorNum)).toFixed(0);
this.statisConfig = {
rightNum,
errorNum,
rate
}
}
this.experienceDialog = true;
},
//获取用户信息
getUserInfo() {
rocNative.getUserInfo({
__funcName: "__getUserInfoForQD"
});
},
// 去激活(体验完弹窗-打开激活弹框)
activeCard() {
this.$sendBuriedData({
component_tag: `886#88606`
});
this.checkTokenForNative(() => {
this.experienceDialog = false;
this.showChangeCard = true;
});
},
// 去购买(体验完弹窗-跳转到购买页面)
buyCard(type) {
console.log("in buyCard", type);
this.checkTokenForNative(() => {
this.confirmGoBuy();
});
if(type == 1) {
this.$sendBuriedData({
component_tag: `886#88607`
});
} else if(type == 2) {
this.$sendBuriedData({
component_tag: `886#88609`
});
}
},
// 跳转到(原生)购买页面
confirmGoBuy() {
let appVersion = this.userInfo.appVersion || "";
let appVersionNum = appVersion.split(".").join("");
if (appVersionNum < 344) {
this.$toast("请您下载新版本App");
return;
}
this.experienceDialog = false;
// 直接传入学科ID(secondSubjectId)
let pageUrl = getWebPageUrl(
`/profexam/#/question-bank?id=${this.secondSubjectId}&secondSubjectId=${this.secondSubjectId}`
);
let paramList = [
{
key: "className",
value:
"com.picahealth.yunque.activitys.studycard.StudyCardDetailActivity###PicaDo.LearningCardVC",
type: 4,
seqNo: 1
},
{
key: "goodId",
value: this.cardId,
type: 4,
seqNo: 1
},
{
key: "courseUrl",
value: encodeURIComponent(pageUrl),
// value: projectId,
type: 4,
seqNo: 1
}
];
rocNative.dispatchEventByModuleCode({
modeCode: "M200",
jsonString: paramList
});
},
// 关闭体验完弹窗
closeExpDialog() {
this.experienceDialog = false;
this.$sendBuriedData({
component_tag: `886#88608`
});
},
// 关闭激活弹框
cancleChangeCard() {
this.showChangeCard = false;
},
// 激活前
beforeChangeCardAction(cardKey) {
this.checkTokenForNative(() => {
this.changeCardAction(cardKey);
});
},
// 分页获取题目(前、后翻页)
getPractiseTitles(isFirst) {
if(isFirst) {
this.$store.commit("SET_QUESTION_LIST", []);
}
isFirst && (this.showLoading = true);
this.queryParams.token = this.userInfo.userToken || this.token;
this.queryParams.setEntry = true;
this.GET(`portal/titleTest/practise/titles`, this.queryParams).then(({ data }) => {
this.currentTitleNo = data.currentTitleNo;
data.isFirst = isFirst;
this.handlerQuestionList(data);
setTimeout(() => {
this.showLoading = false;
}, 100);
});
},
// 处理返回的数据,并存储到store中
handlerPractiseData(questionList) {
let handlerList = [],
question,
option,
optionList = [],
myAnswer = "",
answer = "";
questionList.forEach((item, index) => {
question = JSON.parse(JSON.stringify(item));
question.isAnalyzed = false;
option = {};
optionList = [];
question.options.forEach((text, i) => {
option.isCorrect = false;
option.isSelected = false;
option.text = text;
optionList.push(JSON.parse(JSON.stringify(option)));
});
question.options = optionList;
console.log("handlerList", index);
handlerList.push(question);
});
console.log("in handlerList", handlerList);
let cIndex = findQuestionIndexNo(
handlerList,
"titleNo",
this.currentTitleNo
);
this.$store.commit("SET_CURRENT_QUESTION", handlerList[cIndex]);
this.$store.commit("SET_QUESTION_LIST", handlerList);
},
// 激活Action 返回值:0绑定失败,1绑定成功
changeCardAction(cardKey) {
let _this = this;
let param = {
idType: 2,
cardKey: cardKey,
cardType: this.cardType || 3,
goodsType: this.goodsType || 3,
channel: 1,
portalProjectId: this.directoryId,
setEntry: true
};
_this.changeCardErrorMsg = "";
this.POST("cme/projectCard/bind", param)
.then(res => {
if (res.code == "000000") {
if (!res.data) {
_this.changeCardErrorMsg = "请输入正确的激活码";
} else {
_this.showChangeCard = false;
Toast("激活成功,开始练习");
// 重新获取题库内容(从头开始)
_this.init();
}
} else {
Toast(res.message);
}
})
.catch(e => {
_this.changeCardErrorMsg = "请输入正确的激活码";
});
},
// 滚动到最上面
scrollTop() {
console.log("in scrollTop");
window.scrollTo(0, 2000);
}
}
};
</script>
<style lang="less" scoped>
.question-detail-wrapper {
padding-top: 68px;
.pt-70 {
padding-bottom: 70px;
}
.pt-110 {
padding-bottom: 110px;
}
}
</style>
\ No newline at end of file
...@@ -158,6 +158,7 @@ ...@@ -158,6 +158,7 @@
></ChangeCard> ></ChangeCard>
<Loading v-show="showLoading" /> <Loading v-show="showLoading" />
<!-- 主动提示:激活并去学习 -->
<CourseDialog <CourseDialog
:subContent="subContent" :subContent="subContent"
confirmBtnText="激活并去学习" confirmBtnText="激活并去学习"
...@@ -306,7 +307,8 @@ export default { ...@@ -306,7 +307,8 @@ export default {
cardType: 3, cardType: 3,
orderId: 0 orderId: 0
}, },
subContent: ``, subContent: "",
hasNoUsedCard: false,
}; };
}, },
components: { components: {
...@@ -461,11 +463,11 @@ export default { ...@@ -461,11 +463,11 @@ export default {
}, },
// 查询是否买过类似的卡,但还没有绑定 // 查询是否买过类似的卡,但还没有绑定
async hasNoUsedCardAction() { hasNoUsedCardAction() {
let param = { let param = {
setEntry: true setEntry: true
}; };
await 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] || {};
...@@ -478,8 +480,10 @@ export default { ...@@ -478,8 +480,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
...@@ -538,12 +542,14 @@ export default { ...@@ -538,12 +542,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: "职称考精讲课程卡" };
...@@ -786,12 +792,15 @@ export default { ...@@ -786,12 +792,15 @@ export default {
_this.showLoading = false; _this.showLoading = false;
}, 800); }, 800);
<<<<<<< HEAD
// 如果 hasBindCard 为false,则获取卡信息 0:未绑卡 1:已绑卡 // 如果 hasBindCard 为false,则获取卡信息 0:未绑卡 1:已绑卡
if (!_this.hasBindCard) { if (!_this.hasBindCard) {
_this.preJumper(); _this.preJumper();
_this.logged && _this.hasNoUsedCardAction(); _this.logged && _this.hasNoUsedCardAction();
} }
=======
>>>>>>> dev-question-bank-0916
// 请求成功后统计,获取项目名 // 请求成功后统计,获取项目名
// this.$sendBuriedData({ // this.$sendBuriedData({
// component_tag: `882#88201#${_this.projectId}#${_this.project.projectName}` // component_tag: `882#88201#${_this.projectId}#${_this.project.projectName}`
...@@ -815,6 +824,12 @@ export default { ...@@ -815,6 +824,12 @@ export default {
console.log("share success..."); console.log("share success...");
} }
); );
// 如果 hasBindCard 为false,则获取卡信息 0:未绑卡 1:已绑卡
if (!_this.hasBindCard) {
_this.preJumper();
_this.logged && _this.hasNoUsedCardAction();
}
} else { } else {
_this.showLoading = false; _this.showLoading = false;
_this.$router.replace("/not-found?fromPage=2"); _this.$router.replace("/not-found?fromPage=2");
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册