提交 0e4967b2 编写于 作者: yi.li's avatar yi.li

Merge branch 'dev-question-bank-0916' of...

Merge branch 'dev-question-bank-0916' of 192.168.110.53:com.pica.cloud.education.frontend/pica-professional-exam into dev-question-bank-0916
<template>
<div class="no-question-wrapper">
<img v-if="dataType == 1" src="../../images/question/no-error.png" alt="">
<img v-else-if="dataType == 2" src="../../images/question/no-collect.png" alt="">
<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>{{dataType == 1 ? "您答错的题目会自动记录在这里哦!" : dataType == 2 ? "您收藏的题目会自动记录在这里哦!" : "现在没有题目哦!"}}</span>
<span>{{commitKind == 1 ? "您答错的题目会自动记录在这里哦!" : commitKind == 2 ? "您收藏的题目会自动记录在这里哦!" : "现在没有题目哦!"}}</span>
</div>
</template>
<script>
export default {
props: {
dataType: { // 答题来源 1:错题集 2:收藏 3:题库
commitKind: { // 答题来源 1:错题集 2:收藏 3:题库
type: Number | String,
default: 1
}
......
......@@ -17,9 +17,7 @@
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="option">{{getOrderVac(index)}}.</span>
<span class="content">{{item.text}}</span>
</div>
</article>
......@@ -29,15 +27,22 @@
<span class="type" :class="{'multi': currentQuestion.typeId == 2}">
<span>{{currentQuestion.typeId == 1 ? "单选题" : "多选题"}}</span>
</span>
<span class="content">{{currentQuestion.question}}</span>
<img src="https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png" />
<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" class="option border">{{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
<span v-if="item.isSelected && !currentQuestion.commitFlag" 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.isSelected && item.isCorrect, 'error': item.isSelected && !item.isCorrect}"
>{{currentQuestion.unionType == 2 ? getOrderVac(index) : item.text}}</span>
......@@ -56,11 +61,11 @@
<span class="content">查看病理,了解病史</span>
</div>-->
</article>
<article class="c-btn-wrapper" v-show="currentQuestion.typeId == 2">
<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 || currentQuestion.myAnswer">
<span class="content">正确答案:D</span>
<article class="answer-wrapper" v-show="currentQuestion.isAnalyzed || currentQuestion.commitFlag">
<span class="content">正确答案:{{currentQuestion.answer}}</span>
</article>
<article class="analysis-wrapper" v-show="currentQuestion.isAnalyzed">
<span class="title">解析</span>
......@@ -71,22 +76,8 @@
<script>
import commonSpliteLine from "@/components/common/common-splite-line";
import { mapGetters, mapActions } from "vuex";
let orderVac = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N"
];
import { getOrderText } from "@/utils";
export default {
components: {
commonSpliteLine
......@@ -101,7 +92,6 @@ export default {
...mapGetters([
"questionList",
"currentQuestion",
"currentQuestionIndex",
])
},
data() {
......@@ -115,29 +105,38 @@ export default {
},
methods: {
getOrderVac(index) {
return orderVac[index];
return getOrderText(index);
},
// 选择选项
selectOption(index) {
if(this.currentQuestion.commitFlag) return;
// 只记录当前选项,不提交答案
this.currentQuestion.options[index].selected = true;
this.currentQuestion.options[index].isSelected = true;
// 重新设置答案(myAnswer)
if(this.currentQuestion.typeId == 2) {
// 重新设置答案(myAnswer)
let myAnswer = "";
this.currentQuestion.options.forEach( (item, index) => {
if(item.selected) {
if(item.isSelected) {
myAnswer += this.getOrderVac(index);
}
})
myAnswer = myAnswer.split('').join(',');
this.currentQuestion.myAnswer = myAnswer;
} else {
// 单选题直接设置commitFlag
if(this.currentQuestion.options[index].isCorrect) {
this.currentQuestion.commitFlag = 1;
} else {
this.currentQuestion.commitFlag = 2;
}
this.currentQuestion.myAnswer = this.getOrderVac(index);
this.commit();
this.commitAnswer();
}
this.$forceUpdate();
console.log("in commit", this.currentQuestion.myAnswer);
},
commit() {
commitAnswer() {
let params = {
commitKind: 1, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: 0, // 题库ID
......@@ -147,7 +146,8 @@ export default {
resultId: 1, // 刷题库轮次ID,刷收藏和错题集时为0
rightFlag: 1, // 答题对错:1对 2错
titleId: 1, // 题目ID
}
};
this.currentQuestion.commitFlag = 1;
}
}
};
......@@ -186,15 +186,18 @@ export default {
background: #e6a23c;
}
}
.content {
font-size: 16px;
font-weight: 700;
color: #333333;
// & > img {
// margin-top: 15px !important;
// width: 100% !important;
// }
}
& > img {
margin-top: 15px;
width: 100%;
img {
margin-top: 15px !important;
width: 100% !important;
}
}
.select-wrapper {
......@@ -218,6 +221,11 @@ export default {
border: 1px solid #c7c8c9;
border-radius: 50%;
}
&.bg {
color: #fff;
background: #449284;
border-radius: 50%;
}
}
& > img {
width: 18px;
......
......@@ -10,25 +10,43 @@
<span class="text">收藏</span>
</article>
<article class="right">
<span class="pre" :class="{'disabled': currentQuestionIndex == 0}" @click="previous">上一题</span>
<span class="next" @click="next">下一题</span>
<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 {};
return {
queryParams: {
// commitKind: 1, // 答题来源 1:错题集 2:收藏 3:题库
// directoryId: 0, // 题库ID,获取错题集或收藏时传0
// pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页
// pageSize: 10, // 每页大小
// secondSubjectId: 0, // 二级学科分类ID:用于判断学科下目录免费题数
// titleNo: 0, // 起始或结束题目序号,首次进入页面时传0,系统自动定位到上次做的题
commitKind: 3, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: 1748, // 题库ID,获取错题集或收藏时传0
pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页
pageSize: 5, // 每页大小
secondSubjectId: 106, // 二级学科分类ID:用于判断学科下目录免费题数
titleNo: 0, // 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题
}
};
},
computed: {
...mapGetters([
"dataType",
"commitKind",
"questionList",
"currentQuestion",
"currentQuestionIndex",
"totalCount",
"userInfo"
])
......@@ -37,33 +55,38 @@ export default {
// 上一页 // 有可能要触发上分页(前端的个数只有一条)
// TODO
previous() {
if (this.currentQuestion.order == 1) {
// debugger
if (this.currentQuestion.titleNo == 1) {
Toast("已是第一题");
} else {
let preIndex = this.currentQuestionIndex - 1;
this.$store.commit("SET_CURRENT_QUESTION_INDEX", preIndex);
let cIndex = findQuestionIndexNo(this.questionList, "titleNo", this.currentQuestion.titleNo);
this.$store.commit(
"SET_CURRENT_QUESTION",
this.questionList[preIndex] || { answerList: [] }
this.questionList[cIndex - 1] || { answerList: [] }
);
if(cIndex == 1 && this.currentQuestion.titleNo > 2) {
this.$emit("pageQuestion", 0, this.questionList[0].titleNo);
}
}
},
// 下一页 // 有可能要触发下分页(后面的个数只有一条)
// TODO
next() {
if (this.currentQuestion.order == this.totalCount) {
Toast("已是最后一题");
// if (this.currentQuestion.titleNo == this.totalCount) {
if (this.currentQuestion.titleNo == this.questionList.length) {
// Toast("已是最后一题");
this.$emit("statistics");
} else {
if (this.currentQuestion.order >= this.questionList.length) {
return;
}
let nextIndex = this.currentQuestionIndex + 1;
this.$store.commit("SET_CURRENT_QUESTION_INDEX", nextIndex);
let cIndex = findQuestionIndexNo(this.questionList, 'titleNo', this.currentQuestion.titleNo);
this.$store.commit(
"SET_CURRENT_QUESTION",
this.questionList[nextIndex] || { answerList: [] }
this.questionList[cIndex + 1] || { answerList: [] }
);
if((cIndex == this.questionList.length - 2) && (this.questionList.length < this.totalCount)) {
this.$emit("pageQuestion", 1, this.questionList[this.questionList.length - 1].titleNo);
}
}
},
......@@ -83,16 +106,17 @@ export default {
favor(currentQuestion) {
let favorFlag = currentQuestion.favorFlag;
let param = {
dataType: this.dataType,
dataType: 2,
directoryId: currentQuestion.directoryId,
examTitleId: currentQuestion.examTitleId,
examTitleId: currentQuestion.titleId,
operateType: favorFlag == 1 ? 2 : 1, // 操作类型:1:收藏 2:取消收藏
paperId: currentQuestion.paperId,
paperIndex: currentQuestion.paperIndex,
token: this.userInfo.userToken || this.token,
token: this.userInfo.userToken || this.token || '998E10CD98ED4BCF91A28223270FE8CE',
setEntry: true
// userId: 0
};
this.currentQuestion.favorFlag = this.currentQuestion.favorFlag == 0 ? 1 : 0;
this.POST("onlineexam/collectExamTitle", param).then(res => {
if (res.code == "000000") {
if(res.data) {
......
......@@ -8,11 +8,12 @@ const getters = {
organizationInfo: state => state.coop.organizationInfo,
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,
currentQuestionIndex: state => state.question.currentQuestionIndex,
dataType: state => state.question.dataType,
freeFlag: state => state.question.freeFlag,
totalCount: state => state.question.totalCount,
commitKind: state => state.question.titleConfig.commitKind,
freeFlag: state => state.question.titleConfig.freeFlag,
totalCount: state => state.question.titleConfig.totalCount,
}
export default getters
// 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 } 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: 1, // 答题来源 1:错题集 2:收藏 3:题库
},
titleConfig: {
bindStatus: 0, // 绑卡状态:0未绑卡 1已绑卡
commitKind: 1, // 答题来源 1:错题集 2:收藏 3:题库
currentTitleNo: 0, // 定位答题题目id
resultId: 0, // 刷题库轮次ID
totalCount: 0, // 题目总数
}
},
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;
},
},
actions: {
// 处理返回的数据
handlerQuestionList({ commit, state }, rezultData) {
// debugger
let questionList = rezultData.practiseTitleModelList;
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', rezultData.currentTitleNo || 1);
commit("SET_CURRENT_QUESTION", handlerList[cIndex]);
commit("SET_QUESTION_LIST", handlerList);
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_TITLE_CONIFG", titleConfig);
},
},
}
export default question;
此差异已折叠。
此差异已折叠。
......@@ -11,14 +11,13 @@ const service = axios.create({
// request拦截器
service.interceptors.request.use(config => {
// debugger
if (config.data && config.data.setEntry) {
config.headers['sysCode'] = config.data.sysCode || 10
if(config.data.token){
config.headers['token'] = config.data.token || '47993ED00ECB46CE8D31ECF3AE34B4AA'
if( process.env.BUILD_ENV == "development" ){ // 本地开发环境
config.headers['token'] = config.data.token || '47993ED00ECB46CE8D31ECF3AE34B4AA';
}
if (config.data.token) {
config.headers['token'] = config.data.token || '998E10CD98ED4BCF91A28223270FE8CE'
if (process.env.BUILD_ENV == "development") { // 本地开发环境
config.headers['token'] = config.data.token || '998E10CD98ED4BCF91A28223270FE8CE';
}
}
delete config.data.setEntry;
delete config.data.token;
......@@ -38,7 +37,7 @@ service.interceptors.response.use(
/*
baseUrl时,返回000000为成功
apiUrl时,返回200为成功
*/
*/
if (res.code !== '000000' && response.respCode === 200) {
return Promise.reject('error')
} else {
......
/**
* 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'
const { BUILD_ENV } = process.env;
// 获取SC服务器域名地址
export function getBaseUrl(url) {
return getConfigByEnvType('baseUrl') + url
......@@ -250,14 +271,14 @@ export const getCookie = key => {
};
export function debounce(fn, wait = 50) {
let timer;
return function() {
if (timer) clearTimeout(timer)
let timer;
return function () {
if (timer) clearTimeout(timer)
timer = setTimeout(() => {
fn.apply(this, arguments);
fn.apply(this, arguments);
timer = null;
}, wait)
}
}, wait)
}
}
function decode(input) {
......@@ -275,3 +296,15 @@ export function querystring(query) {
return result;
}
export function getOrderText(index) {
return orderVac[index];
}
export function findQuestionIndexNo(oList, key, keyValue) {
let index = oList.findIndex( item => {
return item[key] == keyValue;
});
return index;
}
......@@ -110,8 +110,10 @@ module.exports = {
// 通用GET请求
GET(api, para, callback, str) {
// debugger
let token = para.token || this.token || this.$store.state.user.token || '';
let token = para.token || this.token || this.$store.state.user.token || '998E10CD98ED4BCF91A28223270FE8CE';
para.token = token;
delete para.token;
delete para.setEntry;
let url = api + this.getUrlPara(para)
return fetch({
url: getBaseUrl(url),
......
<template>
<section class="question-detail-wrapper" :style="{'position': needFixed ? 'fixed': 'static'}">
<question-header :title="currentTitle" :order="currentQuestion.order" :total="totalCount"></question-header>
<question-header :title="currentTitle" :order="currentQuestion.titleNo" :total="titleConfig.totalCount"></question-header>
<article class="body">
<question-content v-show="questionList.length"></question-content>
<no-content v-show="!questionList.length" :listType="dataType"></no-content>
<no-content v-show="!questionList.length" :listType="commitKind"></no-content>
</article>
<!-- <free-tips ></free-tips> -->
<question-footer></question-footer>
<question-footer @statistics="statistics" @pageQuestion="pageQuestion"></question-footer>
<ExperienceDialog :showDialog="experienceDialog" @activeCard="activeCard" @buyCard="buyCard" @close="experienceDialog = false"></ExperienceDialog>
<!-- 去激活 -->
......@@ -41,6 +41,8 @@ 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 } from "@/utils";
let titleArray = ["", "", "免费体验", "错题集", "收藏夹"];
export default {
......@@ -61,7 +63,7 @@ export default {
cardType: 3,
goodsType: 3,
currentTitle: "试题集",
dataType: 1, // 答题来源 1:错题集 2:收藏 3:题库
commitKind: 1, // 答题来源 1:错题集 2:收藏 3:题库
experienceDialog: false, // 体验结束弹框
showChangeCard: false, //是否展示激活弹框,
changeCardErrorMsg: "",
......@@ -78,40 +80,42 @@ export default {
id: 0
},
queryParams: {
commitKind: 1, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: 0, // 题库ID,获取错题集或收藏时传0
commitKind: 3, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: 1748, // 题库ID,获取错题集或收藏时传0
pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页
pageSize: 10, // 每页大小
secondSubjectId: 0, // 二级学科分类ID:用于判断学科下目录免费题数
pageSize: 5, // 每页大小
secondSubjectId: 106, // 二级学科分类ID:用于判断学科下目录免费题数
titleNo: 0, // 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题
}
}
},
computed: {
...mapGetters(['questionList', 'currentQuestion', 'currentQuestionIndex', 'totalCount']),
...mapGetters(['questionList', 'currentQuestion', 'totalCount', 'titleConfig']),
needFixed() {
return this.experienceDialog || this.showChangeCard || this.showBindCardTips;
},
},
created() {
let _this = this;
this.directoryId = this.$route.query.directoryId || 1;
this.commitKind = this.$route.query.commitKind || 1;
this.cardType = this.$route.query.cardType || 3;
this.goodsType = this.$route.query.goodsType || 3;
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.directoryId = this.$route.query.directoryId || 1; // 题库ID,获取错题集或收藏时传0
this.secondSubjectId = this.$route.query.secondSubjectId || 1; // 学科id
this.cardType = this.$route.query.cardType || 3; // 卡类型
this.goodsType = this.$route.query.goodsType || 3; // 商品类型
this.commitKind = this.$route.query.commitKind || 1; // 答题来源 1:错题集 2:收藏 3:题库
this.freeFlag = this.$route.query.freeFlag || 0; // 0: 免费; 1: 收费;
this.currentTitle = this.$route.query.currentTitle || this.currentTitle; // 顶部导航文案
this.init();
window.__getUserInfoForQD = function(param) {
_this.token = param.userToken;
_this.setUserInfo(param);
_this.getQuestionList();
this.getPractiseTitles();
// _this.checkToken();
};
if(__isWeb) {
_this.getQuestionList();
this.getPractiseTitles();
} else {
_this.getUserInfo();
}
......@@ -130,14 +134,43 @@ export default {
},
methods: {
...mapActions(["setUserInfo", "getQuestionList"]),
...mapActions(["setUserInfo", "handlerQuestionList"]),
init() {
if(this.dataType >= 2 && this.dataType <= 4) {
this.currentTitle = titleArray[this.dataType];
if(this.commitKind >= 2 && this.commitKind <= 4) {
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.getUserInfo();
// this.getPractiseTitles();
// this.preJumper();
},
// 开始翻页
pageQuestion(pageFlag, titleNo) {
this.queryParams.pageFlag = pageFlag;
this.queryParams.titleNo = titleNo;
this.getPractiseTitles();
},
// 统计当前信息
statistics() {
let correctNum = 0, errNum = 0, rate = 0;
this.questionList.forEach( item => {
if(item.commitKind) {
}
});
this.experienceDialog = true;
},
//获取用户信息
getUserInfo() {
rocNative.getUserInfo({
......@@ -228,14 +261,42 @@ export default {
},
// 分页获取题目(前、后翻页)
getPractiseTitles(params) {
let param = {
...params,
setEntry: true
};
this.GET(`portal/titleTest/practise/titles`, param).then(({ data }) => {
getPractiseTitles() {
this.GET(`portal/titleTest/practise/titles`, this.queryParams).then(({ data }) => {
this.currentTitleNo = data.currentTitleNo;
this.handlerQuestionList(data);
// this.handlerPractiseData(data.practiseTitleModelList);
console.log(data);
});
},
// 将序号转成字母
getOrderVac(index) {
return getOrderText(index);
},
// 处理返回的数据,并存储到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绑定成功
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册