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

刷题库页面

上级 438dd4c3
...@@ -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: {
......
<template> <template>
<div class="no-question-wrapper"> <div class="no-question-wrapper">
<img v-if="type == 3" src="../../images/question/no-error.png" alt=""> <img v-if="dataType == 1" src="../../images/question/no-error.png" alt="">
<img v-else-if="type == 4" src="../../images/question/no-collect.png" alt=""> <img v-else-if="dataType == 2" src="../../images/question/no-collect.png" alt="">
<img v-else src="../../images/question/no-collect.png" alt=""> <img v-else src="../../images/question/no-collect.png" alt="">
<span>{{type == 3 ? "您答错的题目会自动记录在这里哦!" : type == 4 ? "您收藏的题目会自动记录在这里哦!" : "现在没有题目哦!"}}</span> <span>{{dataType == 1 ? "您答错的题目会自动记录在这里哦!" : dataType == 2 ? "您收藏的题目会自动记录在这里哦!" : "现在没有题目哦!"}}</span>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
props: { props: {
type: { // 1: 正常做题; 2: 免费体验; 3: 错题集; 4: 收藏夹 dataType: { // 答题来源 1:错题集 2:收藏 3:题库
type: Number | String, type: Number | String,
default: 1 default: 1
} }
......
<template> <template>
<section class="qeustion-content-wrapper"> <section class="qeustion-content-wrapper">
<article class="public-title" v-show="currentQuestion.isPublic"> <article class="public-title" v-show="currentQuestion.unionType">
<p class="text"> <p class="text" v-show="currentQuestion.unionType == 1">
我们建议使用 CDN 引入 Element 的永固在机舱在链接 我们建议使用 CDN 引入 Element 的永固在机舱在链接
地址上锁定版本,以免将来 Element 升级时受到非兼容 地址上锁定版本,以免将来 Element 升级时受到非兼容
性更新的影响。例如,如需锁定版本为 1.4.8如需锁定版 性更新的影响。例如,如需锁定版本为 1.4.8如需锁定版
本为 1.4.8 本为 1.4.8
</p> </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 v-if="!item.isSelected" class="option">{{getOrderVac(index)}}.</span>
<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 />
<span class="content">{{item.text}}</span>
</div>
</article>
<commonSpliteLine></commonSpliteLine> <commonSpliteLine></commonSpliteLine>
</article> </article>
<article class="title-wrapper"> <article class="title-wrapper">
<span class="type" :class="{'multi': currentQuestion.type == 2}"><span>{{currentQuestion.type == 1 ? "单选题" : "多选题"}}</span></span> <span class="type" :class="{'multi': currentQuestion.typeId == 2}">
<span class="content">医师接到“危急值”报告后做法错误的?</span> <span>{{currentQuestion.typeId == 1 ? "单选题" : "多选题"}}</span>
<img src="https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png"> </span>
<span class="content">{{currentQuestion.question}}</span>
<img src="https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png" />
</article> </article>
<article class="select-wrapper"> <article class="select-wrapper">
<div class="item" v-for="(item, index) in currentQuestion.answerList" :key="index"> <div class="item" v-for="(item, index) in currentQuestion.options" :key="index" @click="selectOption(index)">
<span class="option">{{getOrderVac(index)}}</span> <span v-if="!item.isSelected" class="option border">{{getOrderVac(index)}}</span>
<span class="content">{{item.text}}</span> <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 />
<span
class="content"
:class="{'select': item.isSelected && item.isCorrect, 'error': item.isSelected && !item.isCorrect}"
>{{currentQuestion.unionType == 2 ? getOrderVac(index) : item.text}}</span>
</div> </div>
<div class="item"> <!-- <div class="item">
<!-- <span class="option">B</span> -->
<img src="../../images/question/error.png" alt=""> <img src="../../images/question/error.png" alt="">
<span class="content">积极采取救治措施</span> <span class="content">积极采取救治措施</span>
</div> </div>
<div class="item"> <div class="item">
<!-- <span class="option">C</span> -->
<img src="../../images/question/correct.png" alt=""> <img src="../../images/question/correct.png" alt="">
<span class="content select">向上级医师报告</span> <span class="content select">向上级医师报告</span>
</div> </div>
<div class="item"> <div class="item">
<span class="option">D</span> <span class="option">D</span>
<span class="content">查看病理,了解病史</span> <span class="content">查看病理,了解病史</span>
</div> </div>-->
</article> </article>
<article class="c-btn-wrapper" v-show="currentQuestion.type == 2"> <article class="c-btn-wrapper" v-show="currentQuestion.typeId == 2">
<van-button size="large" round color="#449284">确 认</van-button> <van-button size="large" round color="#449284">确 认</van-button>
</article> </article>
<article class="answer-wrapper" v-show="currentQuestion.isAnalyzed"> <article class="answer-wrapper" v-show="currentQuestion.isAnalyzed || currentQuestion.myAnswer">
<span class="content">正确答案:D</span> <span class="content">正确答案:D</span>
</article> </article>
<article class="analysis-wrapper" v-show="currentQuestion.isAnalyzed"> <article class="analysis-wrapper" v-show="currentQuestion.isAnalyzed">
...@@ -49,8 +70,23 @@ ...@@ -49,8 +70,23 @@
</template> </template>
<script> <script>
import commonSpliteLine from "@/components/common/common-splite-line"; import commonSpliteLine from "@/components/common/common-splite-line";
import { mapGetters, mapActions } from 'vuex'; import { mapGetters, mapActions } from "vuex";
let orderVac = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N"]; let orderVac = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N"
];
export default { export default {
components: { components: {
commonSpliteLine commonSpliteLine
...@@ -62,8 +98,12 @@ export default { ...@@ -62,8 +98,12 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['questionList', 'currentQuestion', 'currentQuestionIndex', 'questionTotal']), ...mapGetters([
}, "questionList",
"currentQuestion",
"currentQuestionIndex",
])
},
data() { data() {
return { return {
analysisContent: `商户支付的订单号由商户自定义生成,仅支持使用字 母、数字、中划线-、下划线_、竖线|、 analysisContent: `商户支付的订单号由商户自定义生成,仅支持使用字 母、数字、中划线-、下划线_、竖线|、
...@@ -76,8 +116,40 @@ export default { ...@@ -76,8 +116,40 @@ export default {
methods: { methods: {
getOrderVac(index) { getOrderVac(index) {
return orderVac[index]; return orderVac[index];
},
// 选择选项
selectOption(index) {
// 只记录当前选项,不提交答案
this.currentQuestion.options[index].selected = true;
if(this.currentQuestion.typeId == 2) {
// 重新设置答案(myAnswer)
let myAnswer = "";
this.currentQuestion.options.forEach( (item, index) => {
if(item.selected) {
myAnswer += this.getOrderVac(index);
}
})
myAnswer = myAnswer.split('').join(',');
this.currentQuestion.myAnswer = myAnswer;
} else {
this.currentQuestion.myAnswer = this.getOrderVac(index);
this.commit();
}
console.log("in commit", this.currentQuestion.myAnswer);
},
commit() {
let params = {
commitKind: 1, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: 0, // 题库ID
myAnswer: this.currentQuestion.myAnswer, // 我的答案,单选时单个答案,如A;多选答案,按照顺序使用
paperId: 1, // 试卷ID
paperIndex: 1, // 试卷索引(随机试卷的第n套)
resultId: 1, // 刷题库轮次ID,刷收藏和错题集时为0
rightFlag: 1, // 答题对错:1对 2错
titleId: 1, // 题目ID
}
} }
}, }
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
...@@ -102,7 +174,7 @@ export default { ...@@ -102,7 +174,7 @@ export default {
line-height: 12px; line-height: 12px;
margin-right: 4px; margin-right: 4px;
border-radius: 2px; border-radius: 2px;
background: #5890DD; background: #5890dd;
font-size: 12px; font-size: 12px;
& > span { & > span {
position: absolute; position: absolute;
...@@ -111,7 +183,7 @@ export default { ...@@ -111,7 +183,7 @@ export default {
color: #ffffff; color: #ffffff;
} }
&.multi { &.multi {
background: #E6A23C; background: #e6a23c;
} }
} }
...@@ -126,24 +198,26 @@ export default { ...@@ -126,24 +198,26 @@ export default {
} }
} }
.select-wrapper { .select-wrapper {
padding: 0 15px; padding: 0 15px 8px;
.item { .item {
display: flex; display: flex;
// height: 40px; // height: 40px;
line-height: 1.2; // line-height: 1.2;
font-size: 16px; font-size: 16px;
align-items: center; align-items: center;
padding: 10px 0; padding: 8px 0;
.option { .option {
display: block; display: block;
width: 20px; width: 20px;
height: 20px; height: 20px;
line-height: 20px; line-height: 20px;
text-align: center; text-align: center;
border: 1px solid #C7C8C9;
border-radius: 50%;
margin-right: 10px; margin-right: 10px;
color: #373839; color: #373839;
&.border {
border: 1px solid #c7c8c9;
border-radius: 50%;
}
} }
& > img { & > img {
width: 18px; width: 18px;
...@@ -153,8 +227,10 @@ export default { ...@@ -153,8 +227,10 @@ export default {
.select { .select {
color: #449284; color: #449284;
} }
.error {
color: #ed3131;
}
} }
} }
.c-btn-wrapper { .c-btn-wrapper {
padding: 20px 15px; padding: 20px 15px;
...@@ -164,7 +240,7 @@ export default { ...@@ -164,7 +240,7 @@ export default {
border-radius: 6px; border-radius: 6px;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
background: #F8F9FA; background: #f8f9fa;
.content { .content {
margin: 10px 0; margin: 10px 0;
height: 16px; height: 16px;
...@@ -186,11 +262,11 @@ export default { ...@@ -186,11 +262,11 @@ export default {
color: #373839; color: #373839;
&::before { &::before {
display: inline-block; display: inline-block;
content: ''; content: "";
height: 16px; height: 16px;
width: 3px; width: 3px;
margin-right: 9px; margin-right: 9px;
background: #F68367; background: #f68367;
border-radius: 3px; border-radius: 3px;
} }
} }
......
<template> <template>
<section class="qeustion-footer-wrapper"> <section class="qeustion-footer-wrapper">
<article class="left" @click="toggleAnalysis()"> <article class="left" @click="toggleAnalysis()">
<img src="../../images/question/analysis.png" alt=""> <img src="../../images/question/analysis.png" alt />
<span class="text">解析</span> <span class="text">解析</span>
</article> </article>
<article class="center" @click="toggleCollect()"> <article class="center" @click="toggleCollect()">
<img v-show="!currentQuestion.isCollected" src="../../images/question/heart-b.png" alt=""> <img v-show="currentQuestion.favorFlag == 0" src="../../images/question/heart-b.png" alt />
<img v-show="currentQuestion.isCollected" src="../../images/question/heart.png" alt=""> <img v-show="currentQuestion.favorFlag != 0" src="../../images/question/heart.png" alt />
<span class="text">收藏</span> <span class="text">收藏</span>
</article> </article>
<article class="right"> <article class="right">
<span class="pre" :class="{'disabled': currentQuestionIndex == 0}" @click="previous">上一题</span> <span class="pre" :class="{'disabled': currentQuestionIndex == 0}" @click="previous">上一题</span>
<span class="next" @click="next">下一题</span> <span class="next" @click="next">下一题</span>
</article> </article>
</section> </section>
</template> </template>
<script> <script>
import { Toast } from 'vant'; import { Toast } from "vant";
import { mapGetters, mapActions } from 'vuex'; import { mapGetters, mapActions } from "vuex";
export default { export default {
props: { props: {},
},
data() { data() {
return { return {};
}
}, },
computed: { computed: {
...mapGetters(['questionList', 'currentQuestion', 'currentQuestionIndex', 'questionTotal']), ...mapGetters([
"dataType",
"questionList",
"currentQuestion",
"currentQuestionIndex",
"totalCount",
"userInfo"
])
}, },
methods: { methods: {
// 上一页 // 有可能要触发上分页(前端的个数只有一条) // 上一页 // 有可能要触发上分页(前端的个数只有一条)
// TODO // TODO
previous() { previous() {
if(this.currentQuestion.order == 1) { if (this.currentQuestion.order == 1) {
Toast('已是第一题'); Toast("已是第一题");
} else { } else {
let preIndex = this.currentQuestionIndex - 1; let preIndex = this.currentQuestionIndex - 1;
this.$store.commit('SET_CURRENT_QUESTION_INDEX', preIndex); this.$store.commit("SET_CURRENT_QUESTION_INDEX", preIndex);
this.$store.commit('SET_CURRENT_QUESTION', this.questionList[preIndex] || {answerList: []}); this.$store.commit(
"SET_CURRENT_QUESTION",
this.questionList[preIndex] || { answerList: [] }
);
} }
}, },
// 下一页 // 有可能要触发下分页(后面的个数只有一条) // 下一页 // 有可能要触发下分页(后面的个数只有一条)
// TODO // TODO
next() { next() {
if(this.currentQuestion.order == this.questionTotal) { if (this.currentQuestion.order == this.totalCount) {
Toast('已是最后一题'); Toast("已是最后一题");
} else { } else {
if(this.currentQuestion.order >= this.questionList.length) { if (this.currentQuestion.order >= this.questionList.length) {
return; return;
} }
let nextIndex = this.currentQuestionIndex + 1; let nextIndex = this.currentQuestionIndex + 1;
this.$store.commit('SET_CURRENT_QUESTION_INDEX', nextIndex); this.$store.commit("SET_CURRENT_QUESTION_INDEX", nextIndex);
this.$store.commit('SET_CURRENT_QUESTION', this.questionList[nextIndex] || {answerList: []}); this.$store.commit(
"SET_CURRENT_QUESTION",
this.questionList[nextIndex] || { answerList: [] }
);
} }
}, },
...@@ -67,11 +75,38 @@ export default { ...@@ -67,11 +75,38 @@ export default {
// 收藏/不收藏 // 收藏/不收藏
toggleCollect() { toggleCollect() {
this.currentQuestion.isCollected = !this.currentQuestion.isCollected; this.favor(this.currentQuestion);
// this.$store.commit('SET_CURRENT_QUESTION', this.currentQuestion); // this.$store.commit('SET_CURRENT_QUESTION', this.currentQuestion);
},
// 收藏/取消收藏
favor(currentQuestion) {
let favorFlag = currentQuestion.favorFlag;
let param = {
dataType: this.dataType,
directoryId: currentQuestion.directoryId,
examTitleId: currentQuestion.examTitleId,
operateType: favorFlag == 1 ? 2 : 1, // 操作类型:1:收藏 2:取消收藏
paperId: currentQuestion.paperId,
paperIndex: currentQuestion.paperIndex,
token: this.userInfo.userToken || this.token,
setEntry: true
// userId: 0
};
this.POST("onlineexam/collectExamTitle", param).then(res => {
if (res.code == "000000") {
if(res.data) {
let cIndex = this.questionList.findIndex( item => {
return item.titleNo = currentQuestion.titleNo;
});
this.questionList[cIndex].favorFlag = favorFlag == 0 ? 1 : 0;
this.currentQuestion.favorFlag = favorFlag == 0 ? 1 : 0;
}
}
});
} }
}, }
} };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.qeustion-footer-wrapper { .qeustion-footer-wrapper {
......
...@@ -7,9 +7,12 @@ const getters = { ...@@ -7,9 +7,12 @@ 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),
// 刷题相关
questionList: state => state.question.questionList, questionList: state => state.question.questionList,
currentQuestion: state => state.question.currentQuestion, currentQuestion: state => state.question.currentQuestion,
currentQuestionIndex: state => state.question.currentQuestionIndex, currentQuestionIndex: state => state.question.currentQuestionIndex,
questionTotal: state => state.question.questionTotal, dataType: state => state.question.dataType,
freeFlag: state => state.question.freeFlag,
totalCount: state => state.question.totalCount,
} }
export default getters export default getters
...@@ -5,18 +5,17 @@ ...@@ -5,18 +5,17 @@
const question = { const question = {
state: { state: {
dataType: 0,
freeFlag: 0,
bindStatus: 0, // 绑卡状态:0未绑卡 1已绑卡
questionList: [], questionList: [],
currentQuestion: { currentQuestion: {
id: 1,
type: 1, // 1: 单选题; 2: 多选题
isPublic: 0, // 0: 通用; 1: 共题干; 2: 共答案;
order: 1, order: 1,
isAnalyzed: false, isAnalyzed: false,
isCollected: false, options: [ // 从options加工出来
answerList: [
{ {
isCorrect: false, isCorrect: false,
isSelected: false, isSelected: true,
text: "进行分析评估", text: "进行分析评估",
}, },
{ {
...@@ -26,7 +25,7 @@ const question = { ...@@ -26,7 +25,7 @@ const question = {
}, },
{ {
isCorrect: true, isCorrect: true,
isSelected: false, isSelected: true,
text: "进行分析评估", text: "进行分析评估",
}, },
{ {
...@@ -34,12 +33,40 @@ const question = { ...@@ -34,12 +33,40 @@ const question = {
isSelected: false, isSelected: false,
text: "进行分析评估", text: "进行分析评估",
}, },
] ],
titleId: 1,
titleNo: 1, // 题序,从1开始
typeId: 1, // 题目类型ID 1-单选,2-多选,3-判断
unionId: "", // 联合类型题目,分组唯一标识
unionType: 1, // 0普通题型 1-共用题干; 2-共用选项
unionQuestion: "", // 共用题干
question: "题干内容", // 题干内容
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: "", // 试卷索引
}, },
currentQuestionIndex: 0, currentQuestionIndex: 0,
questionTotal: 30, totalCount: 30,
resultId: 0,
currentTitleNo: "",
commitKind: 1, // 答题来源 1:错题集 2:收藏 3:题库
}, },
mutations: { mutations: {
SET_DATA_TYPE: (state, payload) => {
state.dataType = payload;
},
SET_FREE_FLAG: (state, payload) => {
state.freeFlag = payload;
},
SET_QUESTION_LIST: (state, payload) => { SET_QUESTION_LIST: (state, payload) => {
state.questionList = payload; state.questionList = payload;
}, },
...@@ -49,23 +76,19 @@ const question = { ...@@ -49,23 +76,19 @@ const question = {
SET_CURRENT_QUESTION_INDEX: (state, payload) => { SET_CURRENT_QUESTION_INDEX: (state, payload) => {
state.currentQuestionIndex = payload; state.currentQuestionIndex = payload;
}, },
SET_QUESTION_TOTAL: (state, payload) => { SET_TOTAL_COUNT: (state, payload) => {
state.questionTotal = payload; state.totalCount = payload;
}, },
}, },
actions: { actions: {
// 获取用户信息 // 获取用户信息
async getQuestionList({ commit }, params) { async getQuestionList({ commit, state }, params) {
console.log(params); console.log(params);
let currentList = [ let currentList = [
{ {
id: 1,
type: 1,
isPublic: 0,
order: 1, order: 1,
isAnalyzed: false, isAnalyzed: false,
isCollected: false, options: [
answerList: [
{ {
isCorrect: false, isCorrect: false,
isSelected: false, isSelected: false,
...@@ -86,16 +109,31 @@ const question = { ...@@ -86,16 +109,31 @@ const question = {
isSelected: false, isSelected: false,
text: "进行分析评估", text: "进行分析评估",
}, },
] ],
titleId: 1,
titleNo: 1, // 题序,从1开始
typeId: 1, // 题目类型ID 1-单选,2-多选,3-判断
unionId: "", // 联合类型题目,分组唯一标识
unionType: 0, // 0普通题型 1-共用题干; 2-共用选项
unionQuestion: "", // 共用题干
question: "题干内容", // 题干内容
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: "", // 试卷索引
}, },
{ {
id: 2,
type: 2,
isPublic: 0,
order: 2, order: 2,
isAnalyzed: false, isAnalyzed: false,
isCollected: false, options: [
answerList: [
{ {
isCorrect: false, isCorrect: false,
isSelected: false, isSelected: false,
...@@ -116,16 +154,31 @@ const question = { ...@@ -116,16 +154,31 @@ const question = {
isSelected: false, isSelected: false,
text: "进行分析评3", text: "进行分析评3",
}, },
] ],
titleId: 1,
titleNo: 1, // 题序,从1开始
typeId: 1, // 题目类型ID 1-单选,2-多选,3-判断
unionId: "", // 联合类型题目,分组唯一标识
unionType: 2, // 0普通题型 1-共用题干; 2-共用选项
unionQuestion: "", // 共用题干
question: "题干内容", // 题干内容
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: "", // 试卷索引
}, },
{ {
id: 3,
type: 1,
isPublic: 1,
order: 3, order: 3,
isAnalyzed: false, isAnalyzed: false,
isCollected: false, options: [
answerList: [
{ {
isCorrect: false, isCorrect: false,
isSelected: false, isSelected: false,
...@@ -146,16 +199,32 @@ const question = { ...@@ -146,16 +199,32 @@ const question = {
isSelected: false, isSelected: false,
text: "进行分析评估3", text: "进行分析评估3",
}, },
] ],
question: "题干内容", // 题干内容
titleId: 1, //
titleNo: 1, // 题序,从1开始
typeId: 1, // 题目类型ID 1-单选,2-多选,3-判断
unionId: "", // 联合类型题目,分组唯一标识
unionType: 1, // 0普通题型 1-共用题干; 2-共用选项
unionQuestion: "", // 共用题干
question: "题干内容", // 题干内容
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: "", // 试卷索引
}, },
{ {
id: 4,
type: 2,
isPublic: 2,
order: 4, order: 4,
isAnalyzed: false, isAnalyzed: false,
isCollected: false, options: [
answerList: [
{ {
isCorrect: false, isCorrect: false,
isSelected: false, isSelected: false,
...@@ -176,13 +245,32 @@ const question = { ...@@ -176,13 +245,32 @@ const question = {
isSelected: false, isSelected: false,
text: "进行分析评估4", text: "进行分析评估4",
}, },
] ],
titleId: 1,
titleNo: 1, // 题序,从1开始
typeId: 2, // 题目类型ID 1-单选,2-多选,3-判断
unionId: "", // 联合类型题目,分组唯一标识
unionType: 1, // 0普通题型 1-共用题干; 2-共用选项
unionQuestion: "", // 共用题干
question: "题干内容", // 题干内容
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: "", // 试卷索引
}, },
]; ];
commit('SET_QUESTION_LIST', currentList); commit('SET_QUESTION_LIST', currentList);
commit('SET_CURRENT_QUESTION', currentList[0] || {answerList:[]}); // commit('SET_CURRENT_QUESTION', currentList[0] || {options:[]});
commit('SET_CURRENT_QUESTION_INDEX', 0); commit('SET_CURRENT_QUESTION_INDEX', 0);
commit('SET_QUESTION_TOTAL', 30); commit('SET_TOTAL_COUNT', 30);
}, },
}, },
......
...@@ -19,10 +19,10 @@ service.interceptors.request.use(config => { ...@@ -19,10 +19,10 @@ service.interceptors.request.use(config => {
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 || '47993ED00ECB46CE8D31ECF3AE34B4AA';
} }
delete config.data.setEntry;
delete config.data.token;
} }
delete config.data.setEntry;
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' })
} }
return config return config
......
...@@ -559,8 +559,6 @@ export default { ...@@ -559,8 +559,6 @@ export default {
cardType: this.project.cardType || 3, cardType: this.project.cardType || 3,
cardTypeList: [ this.project.cardType || 3], cardTypeList: [ this.project.cardType || 3],
goodsType: this.project.goodsType, goodsType: this.project.goodsType,
// pageNum: 1,
// pageSize: 1
}; };
param.setEntry = true; param.setEntry = true;
this.POST("trade/goods/cardList_v2", param).then(res => { this.POST("trade/goods/cardList_v2", param).then(res => {
......
<template> <template>
<section class="question-detail-wrapper" :style="{'position': needFixed ? 'fixed': 'static'}"> <section class="question-detail-wrapper" :style="{'position': needFixed ? 'fixed': 'static'}">
<question-header :title="currentTitle" :order="currentQuestion.order" :total="questionTotal"></question-header> <question-header :title="currentTitle" :order="currentQuestion.order" :total="totalCount"></question-header>
<article class="body"> <article class="body">
<question-content v-show="questionList.length"></question-content> <question-content v-show="questionList.length"></question-content>
<no-content v-show="!questionList.length" :type="listType"></no-content> <no-content v-show="!questionList.length" :listType="dataType"></no-content>
</article> </article>
<!-- <free-tips ></free-tips> -->
<question-footer></question-footer> <question-footer></question-footer>
<ExperienceDialog :showDialog="experienceDialog" @activeCard="activeCard" @buyCard="buyCard" @close="experienceDialog = false"></ExperienceDialog> <ExperienceDialog :showDialog="experienceDialog" @activeCard="activeCard" @buyCard="buyCard" @close="experienceDialog = false"></ExperienceDialog>
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
<!-- 主动提示:激活并去学习 --> <!-- 主动提示:激活并去学习 -->
<CourseDialog <CourseDialog
:subContent="subContent" :subContent="subContent"
confirmBtnText="激活并去习" confirmBtnText="激活并去习"
needSubContent needSubContent
:isShowDialog="showBindCardTips" :isShowDialog="showBindCardTips"
@handlerAction="handlerAction" @handlerAction="handlerAction"
...@@ -56,14 +57,13 @@ export default { ...@@ -56,14 +57,13 @@ export default {
data() { data() {
return { return {
// token: "", // mixns里有 // token: "", // mixns里有
questionBankId: "", directoryId: "",
cardType: 3, cardType: 3,
goodsType: 3, goodsType: 3,
currentTitle: "试题集", currentTitle: "试题集",
listType: 1, // 1: 正常做题; 2: 免费体验; 3: 错题集; 4: 收藏夹, dataType: 1, // 答题来源 1:错题集 2:收藏 3:题库
experienceDialog: true, // 体验弹框 experienceDialog: false, // 体验结束弹框
showChangeCard: false, //是否展示激活弹框,
showChangeCard: false, //是否展示激活弹框,
changeCardErrorMsg: "", changeCardErrorMsg: "",
showBindCardTips: false, showBindCardTips: false,
cmeCardModels: { cmeCardModels: {
...@@ -77,20 +77,30 @@ export default { ...@@ -77,20 +77,30 @@ export default {
cardInfo: { cardInfo: {
id: 0 id: 0
}, },
queryParams: {
commitKind: 1, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: 0, // 题库ID,获取错题集或收藏时传0
pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页
pageSize: 10, // 每页大小
secondSubjectId: 0, // 二级学科分类ID:用于判断学科下目录免费题数
titleNo: 0, // 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题
}
} }
}, },
computed: { computed: {
...mapGetters(['questionList', 'currentQuestion', 'currentQuestionIndex', 'questionTotal']), ...mapGetters(['questionList', 'currentQuestion', 'currentQuestionIndex', 'totalCount']),
needFixed() { needFixed() {
return this.experienceDialog || this.showChangeCard || this.showBindCardTips; return this.experienceDialog || this.showChangeCard || this.showBindCardTips;
}, },
}, },
created() { created() {
let _this = this; let _this = this;
this.questionBankId = this.$route.query.questionBankId || 1; this.directoryId = this.$route.query.directoryId || 1;
this.commitKind = this.$route.query.commitKind || 1;
this.cardType = this.$route.query.cardType || 3; this.cardType = this.$route.query.cardType || 3;
this.goodsType = this.$route.query.goodsType || 3; this.goodsType = this.$route.query.goodsType || 3;
this.listType = this.$route.query.listType || 1; this.dataType = this.$route.query.dataType || 1;
this.freeFlag = this.$route.query.freeFlag || 0; // 0: 免费; 1: 收费;
this.currentTitle = this.$route.query.currentTitle || this.currentTitle; this.currentTitle = this.$route.query.currentTitle || this.currentTitle;
this.init(); this.init();
...@@ -111,13 +121,21 @@ export default { ...@@ -111,13 +121,21 @@ export default {
_this.getUserInfo(); _this.getUserInfo();
}; };
window.__getPositionData = function(param) {
console.log(param);
// _this.showLoading = false;
param.setEntry = true;
_this.getProvinceIdByPosition(param);
};
}, },
methods: { methods: {
...mapActions(["setUserInfo", "getQuestionList"]), ...mapActions(["setUserInfo", "getQuestionList"]),
init() { init() {
if(this.listType >= 2 && this.listType <= 4) { if(this.dataType >= 2 && this.dataType <= 4) {
this.currentTitle = titleArray[this.listType]; this.currentTitle = titleArray[this.dataType];
} }
// this.preJumper();
}, },
//获取用户信息 //获取用户信息
...@@ -150,9 +168,9 @@ export default { ...@@ -150,9 +168,9 @@ export default {
return; return;
} }
// 直接传入题库ID(questionBankId) // 直接传入题库ID(directoryId)
let pageUrl = getWebPageUrl( let pageUrl = getWebPageUrl(
`/profexam/#/question-detail?id=${this.questionBankId}&bankName=${this.bankName}&questionBankId=${this.questionBankId}` `/profexam/#/question-detail?id=${this.directoryId}&bankName=${this.bankName}&directoryId=${this.directoryId}`
); );
let paramList = [ let paramList = [
{ {
...@@ -182,7 +200,6 @@ export default { ...@@ -182,7 +200,6 @@ export default {
}); });
}, },
// 关闭激活弹框 // 关闭激活弹框
cancleChangeCard() { cancleChangeCard() {
this.showChangeCard = false; this.showChangeCard = false;
...@@ -210,6 +227,17 @@ export default { ...@@ -210,6 +227,17 @@ export default {
} }
}, },
// 分页获取题目(前、后翻页)
getPractiseTitles(params) {
let param = {
...params,
setEntry: true
};
this.GET(`portal/titleTest/practise/titles`, param).then(({ data }) => {
});
},
// 激活Action 返回值:0绑定失败,1绑定成功 // 激活Action 返回值:0绑定失败,1绑定成功
changeCardAction(cardKey, isInTips) { changeCardAction(cardKey, isInTips) {
let _this = this; let _this = this;
...@@ -219,7 +247,7 @@ export default { ...@@ -219,7 +247,7 @@ export default {
cardType: this.cardType || 3, cardType: this.cardType || 3,
goodsType: this.goodsType || 3, goodsType: this.goodsType || 3,
channel: 1, channel: 1,
portalProjectId: this.questionBankId, portalProjectId: this.directoryId,
setEntry: true setEntry: true
}; };
_this.changeCardErrorMsg = ""; _this.changeCardErrorMsg = "";
...@@ -269,6 +297,32 @@ export default { ...@@ -269,6 +297,32 @@ export default {
}); });
}, },
// 根据位置信息获取省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,获取学习卡信息 // 根据省ID,获取学习卡信息
getCardInfoByProvinceId(provinceId) { getCardInfoByProvinceId(provinceId) {
let param = { let param = {
...@@ -276,19 +330,26 @@ export default { ...@@ -276,19 +330,26 @@ export default {
cardType: this.cardType || 3, cardType: this.cardType || 3,
cardTypeList: [ this.cardType || 3], cardTypeList: [ this.cardType || 3],
goodsType: this.goodsType, goodsType: this.goodsType,
// pageNum: 1,
// pageSize: 1
}; };
param.setEntry = true; param.setEntry = true;
this.POST("trade/goods/cardList_v2", 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: "题库卡" };
this.subContent = `您已购买${this.cardInfo.goodsName}”,是否用此卡绑定并激活当前课程。学习卡激活码一旦使用,不可更改不可退回` this.subContent = `您已购买${this.cardInfo.goodsName}”,是否用此卡绑定并激活当前题库。题库卡激活码一旦使用,不可更改不可退回`;
} }
}); });
}, },
// 获取地理位置信息
getPositionData() {
console.log("getPositionData");
rocNative.getPositionData({
__funcName: "__getPositionData"
});
},
}, },
} }
</script> </script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册