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

分页获取题目

上级 b1bb00c8
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
<section class="qeustion-content-wrapper"> <section class="qeustion-content-wrapper">
<article class="public-title" v-show="currentQuestion.unionType"> <article class="public-title" v-show="currentQuestion.unionType">
<p class="text" v-show="currentQuestion.unionType == 1"> <p class="text" v-show="currentQuestion.unionType == 1">
我们建议使用 CDN 引入 Element 的永固在机舱在链接 {{currentQuestion.unionQuestion}}
地址上锁定版本,以免将来 Element 升级时受到非兼容
性更新的影响。例如,如需锁定版本为 1.4.8如需锁定版
本为 1.4.8
</p> </p>
<article <article
class="select-wrapper" class="select-wrapper"
...@@ -32,8 +29,8 @@ ...@@ -32,8 +29,8 @@
</article> </article>
<article class="select-wrapper"> <article class="select-wrapper">
<div class="item" v-for="(item, index) in currentQuestion.options" :key="index" @click="selectOption(index)"> <div class="item" v-for="(item, index) in currentQuestion.options" :key="index" @click="selectOption(index)">
<span v-if="!item.isSelected" class="option border">{{getOrderVac(index)}}</span> <span v-if="!item.isSelected && !((item.isSelected && !currentQuestion.commitFlag) || (!item.isSelected && currentQuestion.commitFlag && item.isCorrect))" class="option border">{{getOrderVac(index)}}</span>
<span v-if="item.isSelected && !currentQuestion.commitFlag" class="option bg">{{getOrderVac(index)}}</span> <span v-if="(item.isSelected && !currentQuestion.commitFlag) || (!item.isSelected && currentQuestion.commitFlag && item.isCorrect)" class="option bg">{{getOrderVac(index)}}</span>
<template v-else> <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/correct.png" alt />
<img v-if="item.isSelected && !item.isCorrect" src="../../images/question/error.png" alt /> <img v-if="item.isSelected && !item.isCorrect" src="../../images/question/error.png" alt />
...@@ -44,7 +41,7 @@ ...@@ -44,7 +41,7 @@
>{{currentQuestion.unionType == 2 ? getOrderVac(index) : item.text}}</span> >{{currentQuestion.unionType == 2 ? getOrderVac(index) : item.text}}</span>
<span v-else <span v-else
class="content" class="content"
:class="{'select': item.isSelected && item.isCorrect, 'error': item.isSelected && !item.isCorrect}" :class="{'select': item.isCorrect, 'error': item.isSelected && !item.isCorrect}"
>{{currentQuestion.unionType == 2 ? getOrderVac(index) : item.text}}</span> >{{currentQuestion.unionType == 2 ? getOrderVac(index) : item.text}}</span>
</div> </div>
...@@ -64,12 +61,12 @@ ...@@ -64,12 +61,12 @@
<article class="c-btn-wrapper" v-show="currentQuestion.typeId == 2 && !currentQuestion.commitFlag" @click="commitAnswer"> <article class="c-btn-wrapper" v-show="currentQuestion.typeId == 2 && !currentQuestion.commitFlag" @click="commitAnswer">
<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 || currentQuestion.commitFlag"> <article class="answer-wrapper" v-show="currentQuestion.isAnalyzed">
<span class="content">正确答案:{{currentQuestion.answer}}</span> <span class="content">正确答案:{{currentQuestion.answer}}</span>
</article> </article>
<article class="analysis-wrapper" v-show="currentQuestion.isAnalyzed"> <article class="analysis-wrapper" v-show="currentQuestion.isAnalyzed">
<span class="title">解析</span> <span class="title">解析</span>
<div class="content" v-html="analysisContent"></div> <div class="content" v-html="currentQuestion.intro"></div>
</article> </article>
</section> </section>
</template> </template>
...@@ -132,6 +129,9 @@ export default { ...@@ -132,6 +129,9 @@ export default {
} else { } else {
this.currentQuestion.commitFlag = 2; 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.currentQuestion.myAnswer = this.getOrderVac(index);
this.commitAnswer(); this.commitAnswer();
} }
...@@ -181,6 +181,9 @@ export default { ...@@ -181,6 +181,9 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.qeustion-content-wrapper { .qeustion-content-wrapper {
img {
width: 98% !important;
}
font-size: 14px; font-size: 14px;
.public-title { .public-title {
.text { .text {
......
...@@ -64,6 +64,7 @@ export default { ...@@ -64,6 +64,7 @@ export default {
"SET_CURRENT_QUESTION", "SET_CURRENT_QUESTION",
this.questionList[cIndex - 1] || { answerList: [] } this.questionList[cIndex - 1] || { answerList: [] }
); );
console.log(this.currentQuestion.isAnalyzed || (this.currentQuestion.commitFlag == 2));
if(cIndex == 1 && this.currentQuestion.titleNo > 2) { if(cIndex == 1 && this.currentQuestion.titleNo > 2) {
this.$emit("pageQuestion", 0, this.questionList[0].titleNo); this.$emit("pageQuestion", 0, this.questionList[0].titleNo);
} }
...@@ -83,6 +84,7 @@ export default { ...@@ -83,6 +84,7 @@ export default {
"SET_CURRENT_QUESTION", "SET_CURRENT_QUESTION",
this.questionList[cIndex + 1] || { answerList: [] } 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)) { if((cIndex == this.questionList.length - 2) && (this.questionList.length < this.totalCount)) {
this.$emit("pageQuestion", 1, this.questionList[this.questionList.length - 1].titleNo); this.$emit("pageQuestion", 1, this.questionList[this.questionList.length - 1].titleNo);
} }
...@@ -92,7 +94,7 @@ export default { ...@@ -92,7 +94,7 @@ export default {
// 解析 // 解析
toggleAnalysis() { toggleAnalysis() {
this.currentQuestion.isAnalyzed = !this.currentQuestion.isAnalyzed; this.currentQuestion.isAnalyzed = true;
// this.$store.commit('SET_CURRENT_QUESTION', this.currentQuestion); // this.$store.commit('SET_CURRENT_QUESTION', this.currentQuestion);
}, },
......
...@@ -96,7 +96,6 @@ const question = { ...@@ -96,7 +96,6 @@ const question = {
// 处理返回的数据 // 处理返回的数据
handlerQuestionList({ commit, state }, rezultData) { handlerQuestionList({ commit, state }, rezultData) {
// debugger
let questionList = rezultData.practiseTitleModelList || []; let questionList = rezultData.practiseTitleModelList || [];
let handlerList = [], question, option, optionList = [], myAnswer = "", answer = ""; let handlerList = [], question, option, optionList = [], myAnswer = "", answer = "";
...@@ -104,7 +103,8 @@ const question = { ...@@ -104,7 +103,8 @@ const question = {
myAnswer = item.myAnswer; myAnswer = item.myAnswer;
answer = item.answer; answer = item.answer;
question = JSON.parse(JSON.stringify(item)); question = JSON.parse(JSON.stringify(item));
question.isAnalyzed = false; let isAnalyzed = question.commitFlag && myAnswer != answer;
question.isAnalyzed = isAnalyzed;
option = {}; option = {};
optionList = []; optionList = [];
question.options.forEach( (text, i) => { question.options.forEach( (text, i) => {
...@@ -122,8 +122,11 @@ const question = { ...@@ -122,8 +122,11 @@ const question = {
handlerList.push(question); handlerList.push(question);
}); });
console.log('in handlerList', handlerList); console.log('in handlerList', handlerList);
let cIndex = findQuestionIndexNo(handlerList, 'titleNo', rezultData.currentTitleNo || 1);
let newList = concatArray(state.questionList, handlerList, 'titleNo'); 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 = { let titleConfig = {
bindStatus: rezultData.bindStatus, // 绑卡状态:0未绑卡 1已绑卡 bindStatus: rezultData.bindStatus, // 绑卡状态:0未绑卡 1已绑卡
commitKind: rezultData.commitKind, // 答题来源 1:错题集 2:收藏 3:题库 commitKind: rezultData.commitKind, // 答题来源 1:错题集 2:收藏 3:题库
...@@ -132,8 +135,8 @@ const question = { ...@@ -132,8 +135,8 @@ const question = {
totalCount: rezultData.totalCount, // 题目总数 totalCount: rezultData.totalCount, // 题目总数
} }
commit("SET_CURRENT_QUESTION", newList[cIndex] || {titleNo: 1}); commit("SET_CURRENT_QUESTION", newList[cIndex] || {titleNo: 1});
commit("SET_QUESTION_LIST", newList);
commit("SET_TITLE_CONIFG", titleConfig); commit("SET_TITLE_CONIFG", titleConfig);
}
}, },
}, },
......
...@@ -123,61 +123,15 @@ export default { ...@@ -123,61 +123,15 @@ export default {
this.init(); this.init();
let firstArr = [
{
titleNo: 1,
name: "11"
},
{
titleNo: 2,
name: "11"
},
{
titleNo: 3,
name: "11"
},
{
titleNo: 4,
name: "11"
},
{
titleNo: 5,
name: "11"
}
];
let secondArr = [
{
titleNo: 3,
name: "11"
},
{
titleNo: 4,
name: "11"
},
{
titleNo: 5,
name: "11"
},
{
titleNo: 6,
name: "11"
},
{
titleNo: 7,
name: "11"
}
];
window.__getUserInfoForQD = function(param) { window.__getUserInfoForQD = function(param) {
_this.token = param.userToken; _this.token = param.userToken;
_this.setUserInfo(param); _this.setUserInfo(param);
this.getPractiseTitles(); this.getPractiseTitles(true);
// _this.checkToken(); // _this.checkToken();
}; };
if (__isWeb) { if (__isWeb) {
this.getPractiseTitles(); this.getPractiseTitles(true);
} else { } else {
_this.getUserInfo(); _this.getUserInfo();
} }
...@@ -323,10 +277,11 @@ export default { ...@@ -323,10 +277,11 @@ export default {
}, },
// 分页获取题目(前、后翻页) // 分页获取题目(前、后翻页)
getPractiseTitles() { getPractiseTitles(isFirst) {
this.GET(`portal/titleTest/practise/titles`, this.queryParams).then( this.GET(`portal/titleTest/practise/titles`, this.queryParams).then(
({ data }) => { ({ data }) => {
this.currentTitleNo = data.currentTitleNo; this.currentTitleNo = data.currentTitleNo;
data.isFirst = isFirst;
this.handlerQuestionList(data); this.handlerQuestionList(data);
// this.handlerPractiseData(data.practiseTitleModelList); // this.handlerPractiseData(data.practiseTitleModelList);
console.log(data); console.log(data);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册