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

部分功能完善

bug修改
上级 68913c6e
...@@ -54,8 +54,8 @@ export default { ...@@ -54,8 +54,8 @@ export default {
"SET_CURRENT_QUESTION", "SET_CURRENT_QUESTION",
this.questionList[cIndex - 1] || { answerList: [] } this.questionList[cIndex - 1] || { answerList: [] }
); );
console.log(cIndex == 1, this.currentQuestion.titleNo > 2); console.log(cIndex == 1, this.currentQuestion.titleNo >= 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);
} }
} }
...@@ -64,8 +64,8 @@ export default { ...@@ -64,8 +64,8 @@ export default {
// 下一页 // 有可能要触发下分页(后面的个数只有一条) // 下一页 // 有可能要触发下分页(后面的个数只有一条)
// TODO // TODO
next() { next() {
// if (this.currentQuestion.titleNo == this.totalCount) { if (this.currentQuestion.titleNo == this.totalCount
if (this.currentQuestion.titleNo == this.questionList.length // if (this.currentQuestion.titleNo == this.questionList.length
|| this.currentQuestion.titleNo == this.questionList[this.questionList.length - 1].titleNo) { || this.currentQuestion.titleNo == this.questionList[this.questionList.length - 1].titleNo) {
this.$emit("statistics"); this.$emit("statistics");
} else { } else {
...@@ -107,7 +107,7 @@ export default { ...@@ -107,7 +107,7 @@ export default {
operateType: favorFlag == 1 ? 2 : 1, // 操作类型:1:收藏 2:取消收藏 operateType: favorFlag == 1 ? 2 : 1, // 操作类型:1:收藏 2:取消收藏
paperId: currentQuestion.paperId, paperId: currentQuestion.paperId,
paperIndex: currentQuestion.paperIndex, paperIndex: currentQuestion.paperIndex,
token: this.userInfo.userToken || this.token || '93521BDB92774134B2CC18633F2B6D3A', token: this.userInfo.userToken || this.token || 'EFC0A4A5EC4B49FBBBBCD1AD0E46515F',
setEntry: true setEntry: true
// userId: 0 // userId: 0
}; };
......
...@@ -54,7 +54,7 @@ const question = { ...@@ -54,7 +54,7 @@ const question = {
}, },
commonConfig: { commonConfig: {
// 0: 免费; 1: 收费; 没有绑卡且是收费题库(bindStatus == 0 && freeFlag == 1)可以走免费体验流程 // 0: 免费; 1: 收费; 没有绑卡且是收费题库(bindStatus == 0 && freeFlag == 1)可以走免费体验流程
freeFlag: 0, freeFlag: 0,
directoryId: "", directoryId: "",
secondSubjectId: 0, secondSubjectId: 0,
cardType: 3, cardType: 3,
...@@ -97,19 +97,21 @@ const question = { ...@@ -97,19 +97,21 @@ const question = {
// 处理返回的数据 // 处理返回的数据
handlerQuestionList({ commit, state }, rezultData) { handlerQuestionList({ commit, state }, rezultData) {
let questionList = rezultData.practiseTitleModelList || []; let questionList = rezultData.practiseTitleModelList || [];
let handlerList = [], question, option, optionList = [], myAnswer = "", answer = ""; let handlerList = [], question, option, optionList = [], myAnswer = "",
answer = "", questionContent = "";
questionList.forEach( (item, index) => { questionList.forEach((item, index) => {
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.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; let isAnalyzed = question.commitFlag && myAnswer != answer;
question.isAnalyzed = isAnalyzed; question.isAnalyzed = isAnalyzed;
option = {}; option = {};
optionList = []; optionList = [];
question.options.forEach( (text, i) => { question.options.forEach((text, i) => {
option.isCorrect = answer.indexOf(getOrderText(i)) != -1; option.isCorrect = answer.indexOf(getOrderText(i)) != -1;
if(myAnswer.indexOf(getOrderText(i)) != -1) { if (myAnswer.indexOf(getOrderText(i)) != -1) {
option.isSelected = true; option.isSelected = true;
} else { } else {
option.isSelected = false; option.isSelected = false;
...@@ -125,7 +127,7 @@ const question = { ...@@ -125,7 +127,7 @@ const question = {
let newList = concatArray(state.questionList, handlerList, 'titleNo'); let newList = concatArray(state.questionList, handlerList, 'titleNo');
commit("SET_QUESTION_LIST", newList); commit("SET_QUESTION_LIST", newList);
if(rezultData.isFirst) { if (rezultData.isFirst) {
let cIndex = findQuestionIndexNo(handlerList, 'titleNo', rezultData.currentTitleNo || 1); let cIndex = findQuestionIndexNo(handlerList, 'titleNo', rezultData.currentTitleNo || 1);
let titleConfig = { let titleConfig = {
bindStatus: rezultData.bindStatus, // 绑卡状态:0未绑卡 1已绑卡 bindStatus: rezultData.bindStatus, // 绑卡状态:0未绑卡 1已绑卡
...@@ -134,7 +136,7 @@ const question = { ...@@ -134,7 +136,7 @@ const question = {
resultId: rezultData.resultId, // 刷题库轮次ID resultId: rezultData.resultId, // 刷题库轮次ID
totalCount: rezultData.totalCount, // 题目总数 totalCount: rezultData.totalCount, // 题目总数
} }
commit("SET_CURRENT_QUESTION", newList[cIndex] || {titleNo: 1}); commit("SET_CURRENT_QUESTION", newList[cIndex] || { titleNo: 1 });
commit("SET_TITLE_CONIFG", titleConfig); commit("SET_TITLE_CONIFG", titleConfig);
} }
}, },
......
...@@ -14,9 +14,9 @@ service.interceptors.request.use(config => { ...@@ -14,9 +14,9 @@ service.interceptors.request.use(config => {
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 || '93521BDB92774134B2CC18633F2B6D3A' config.headers['token'] = config.data.token || 'EFC0A4A5EC4B49FBBBBCD1AD0E46515F'
if (process.env.BUILD_ENV == "development") { // 本地开发环境 if (process.env.BUILD_ENV == "development") { // 本地开发环境
config.headers['token'] = config.data.token || '93521BDB92774134B2CC18633F2B6D3A'; config.headers['token'] = config.data.token || 'EFC0A4A5EC4B49FBBBBCD1AD0E46515F';
} }
} }
delete config.data.setEntry; delete config.data.setEntry;
......
...@@ -303,7 +303,7 @@ export function getOrderText(index) { ...@@ -303,7 +303,7 @@ export function getOrderText(index) {
// 从数组中查找某个key对应值所在的位置(序号:0开始的) // 从数组中查找某个key对应值所在的位置(序号:0开始的)
export function findQuestionIndexNo(oList, key, keyValue) { export function findQuestionIndexNo(oList, key, keyValue) {
let index = oList.findIndex( item => { let index = oList.findIndex(item => {
return item[key] == keyValue; return item[key] == keyValue;
}); });
return index; return index;
...@@ -311,22 +311,22 @@ export function findQuestionIndexNo(oList, key, keyValue) { ...@@ -311,22 +311,22 @@ export function findQuestionIndexNo(oList, key, keyValue) {
// 对两个数组中的元素进行排序 // 对两个数组中的元素进行排序
export function concatArray(firstArr = [], secondArr = [], key) { export function concatArray(firstArr = [], secondArr = [], key) {
if(firstArr.length == 0) return secondArr; if (firstArr.length == 0) return secondArr;
if(secondArr.length == 0) return []; if (secondArr.length == 0) return [];
let all = [], newArr = [], deleteIndex; let all = [], newArr = [], deleteIndex;
if(firstArr[0][key] == secondArr[0][key]) { if (firstArr[0][key] == secondArr[0][key]) {
return firstArr; return firstArr;
}else if(firstArr[0][key] < secondArr[0][key]) { } else if (firstArr[0][key] < secondArr[0][key]) {
all = firstArr.concat(secondArr); all = firstArr.concat(secondArr);
} else { } else {
all = secondArr.concat(firstArr); all = secondArr.concat(firstArr);
} }
// 从all中去重 // 从all中去重
for(let i = 0; i < all.length; i ++) { for (let i = 0; i < all.length; i++) {
deleteIndex = findQuestionIndexNo(all.slice(i + 1), key, all[i][key]); deleteIndex = findQuestionIndexNo(all.slice(i + 1), key, all[i][key]);
if(deleteIndex >= 0) { if (deleteIndex >= 0) {
all.splice(deleteIndex, 1); all.splice(deleteIndex, 1);
i --; i--;
} }
} }
console.log("in contactArray", all); console.log("in contactArray", all);
......
...@@ -110,7 +110,7 @@ module.exports = { ...@@ -110,7 +110,7 @@ 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 || '93521BDB92774134B2CC18633F2B6D3A'; let token = para.token || this.token || this.$store.state.user.token || 'EFC0A4A5EC4B49FBBBBCD1AD0E46515F';
para.token = token; para.token = token;
delete para.token; delete para.token;
delete para.setEntry; delete para.setEntry;
...@@ -148,7 +148,7 @@ module.exports = { ...@@ -148,7 +148,7 @@ module.exports = {
// 通用POST请求 // 通用POST请求
POST(api, para, callback) { POST(api, para, callback) {
let token = para.token || this.token || this.$store.state.user.token || '93521BDB92774134B2CC18633F2B6D3A'; let token = para.token || this.token || this.$store.state.user.token || 'EFC0A4A5EC4B49FBBBBCD1AD0E46515F';
para.token = token; para.token = token;
delete para.token; delete para.token;
delete para.setEntry; delete para.setEntry;
......
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
}, },
data() { data() {
return { return {
token: "", token: "EFC0A4A5EC4B49FBBBBCD1AD0E46515F",
directoryId: "", directoryId: "",
cardType: 3, cardType: 3,
goodsType: 3, goodsType: 3,
...@@ -311,6 +311,8 @@ export default { ...@@ -311,6 +311,8 @@ export default {
if(isFirst) { if(isFirst) {
this.$store.commit("SET_QUESTION_LIST", []); this.$store.commit("SET_QUESTION_LIST", []);
} }
this.queryParams.token = "EFC0A4A5EC4B49FBBBBCD1AD0E46515F";
this.queryParams.setEntry = true;
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;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册