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

解析有问题

上级 e01660d4
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
class="option border" class="option border"
>{{getOrderVac(index)}}</span> >{{getOrderVac(index)}}</span>
<span <span
v-if="(item.isSelected && !currentQuestion.commitFlag) || (!item.isSelected && currentQuestion.commitFlag && item.isCorrect)" v-else-if="(item.isSelected && !currentQuestion.commitFlag) || (!item.isSelected && currentQuestion.commitFlag && item.isCorrect)"
class="option bg" class="option bg"
>{{getOrderVac(index)}}</span> >{{getOrderVac(index)}}</span>
<template v-else> <template v-else>
...@@ -164,23 +164,22 @@ export default { ...@@ -164,23 +164,22 @@ export default {
token: this.userInfo.userToken token: this.userInfo.userToken
}; };
// 计算是否答对了题目(只有多选题,才做相应处理) // 计算是否答对了题目(只有多选题,才做相应处理)
if (this.currentQuestion.typeId == 2) { // if (this.currentQuestion.typeId == 2) {
console.log('isMulti', isMulti);
let isRight = this.currentQuestion.myAnswer == this.currentQuestion.answer; let isRight = this.currentQuestion.myAnswer == this.currentQuestion.answer;
if (isRight) { if (isRight) {
this.currentQuestion.commitFlag = 1; this.currentQuestion.commitFlag = 1;
} else { } else {
this.currentQuestion.commitFlag = 2; this.currentQuestion.commitFlag = 2;
this.currentQuestion.isAnalyzed = true;
} }
this.currentQuestion.isAnalyzed = true; // }
}
this.POST(`onlineexam/practise/commit`, params).then(({ data }) => { this.POST(`onlineexam/practise/commit`, params).then(({ data }) => {
console.log('in commitAnswer res', data); console.log('in commitAnswer res', data);
if(data.resultType == 1) { // if(data.resultType == 1) {
this.currentQuestion.commitFlag = 1; // this.currentQuestion.commitFlag = 1;
} else { // } else {
this.currentQuestion.commitFlag = 2; // this.currentQuestion.commitFlag = 2;
} // }
}).catch( error => { }).catch( error => {
this.currentQuestion.commitFlag = 0; this.currentQuestion.commitFlag = 0;
this.currentQuestion.isAnalyzed = false; this.currentQuestion.isAnalyzed = false;
......
...@@ -40,7 +40,9 @@ export default { ...@@ -40,7 +40,9 @@ export default {
"questionList", "questionList",
"currentQuestion", "currentQuestion",
"totalCount", "totalCount",
"userInfo" "userInfo",
"titleConfig",
"commonConfig",
]) ])
}, },
methods: { methods: {
...@@ -86,7 +88,7 @@ export default { ...@@ -86,7 +88,7 @@ export default {
toggleAnalysis() { toggleAnalysis() {
this.currentQuestion.isAnalyzed = true; this.currentQuestion.isAnalyzed = true;
if(!this.currentQuestion.commitFlag) { if(!this.currentQuestion.commitFlag) {
this.$parent.$refs['questionContentRef'] && this.$parent.refs['questionContentRef'].commitAnswer(this.currentQuestion.typeId == 2); this.commitAnswer();
} }
// this.$store.commit('SET_CURRENT_QUESTION', this.currentQuestion); // this.$store.commit('SET_CURRENT_QUESTION', this.currentQuestion);
}, },
...@@ -98,32 +100,71 @@ export default { ...@@ -98,32 +100,71 @@ export default {
}, },
// 收藏/取消收藏 // 收藏/取消收藏
favor(currentQuestion) { favor() {
let favorFlag = currentQuestion.favorFlag; let favorFlag = this.currentQuestion.favorFlag;
let param = { let param = {
dataType: 2, dataType: 2,
directoryId: currentQuestion.directoryId, directoryId: this.currentQuestion.directoryId,
examTitleId: currentQuestion.titleId, examTitleId: this.currentQuestion.titleId,
operateType: favorFlag == 1 ? 2 : 1, // 操作类型:1:收藏 2:取消收藏 operateType: favorFlag == 1 ? 2 : 1, // 操作类型:1:收藏 2:取消收藏
paperId: currentQuestion.paperId, paperId: this.currentQuestion.paperId,
paperIndex: currentQuestion.paperIndex, paperIndex: this.currentQuestion.paperIndex,
token: this.userInfo.userToken || this.token || 'EFC0A4A5EC4B49FBBBBCD1AD0E46515F', token: this.userInfo.userToken || this.token,
setEntry: true setEntry: true
// userId: 0
}; };
this.currentQuestion.favorFlag = this.currentQuestion.favorFlag == 0 ? 1 : 0; this.currentQuestion.favorFlag = this.currentQuestion.favorFlag == 0 ? 1 : 0;
this.POST("onlineexam/collectExamTitle", param).then(res => { this.POST("onlineexam/collectExamTitle", param).then(res => {
if (res.code == "000000") { if (res.code == "000000") {
if(res.data) { if(res.data) {
let cIndex = this.questionList.findIndex( item => { // let cIndex = this.questionList.findIndex( item => {
return item.titleNo = currentQuestion.titleNo; // return item.titleNo = this.currentQuestion.titleNo;
}); // });
this.questionList[cIndex].favorFlag = favorFlag == 0 ? 1 : 0; // this.questionList[cIndex].favorFlag = favorFlag == 0 ? 1 : 0;
this.currentQuestion.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,
};
// 计算是否答对了题目(只有多选题,才做相应处理)
// 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 = 0;
// }
}).catch( error => {
this.currentQuestion.commitFlag = 0;
this.currentQuestion.isAnalyzed = false;
})
});
}
} }
}; };
</script> </script>
......
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
<section class="question-header-wrapper"> <section class="question-header-wrapper">
<img @click="goBack" class="left" src="../../images/left-array-black.png" alt=""> <img @click="goBack" class="left" src="../../images/left-array-black.png" alt="">
<span class="center">{{title}}</span> <span class="center">{{title}}</span>
<div class="right"> <div class="right" >
<span class="order">{{order}}</span><span class="total">/{{total}}</span> <span v-show="total">
<span class="order">{{order}}</span><span class="total">/{{total}}</span>
</span>
</div> </div>
</section> </section>
</template> </template>
...@@ -16,11 +18,11 @@ export default { ...@@ -16,11 +18,11 @@ export default {
}, },
order: { order: {
type: Number | String, type: Number | String,
default: 1, default: 0,
}, },
total: { total: {
type: Number | String, type: Number | String,
default: 20, default: 0,
} }
}, },
methods: { methods: {
......
const coop = { const coop = {
state: { state: {
userInfo: {appVersion: '343'}, userInfo: {appVersion: "343", userToken: "EFC0A4A5EC4B49FBBBBCD1AD0E46515F"},
statusBarHeight: {}, statusBarHeight: {},
projectTabIndex: 1, projectTabIndex: 1,
jumpURLForI: "", //中华医学会一类跳转地址 jumpURLForI: "", //中华医学会一类跳转地址
......
...@@ -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 || 'EFC0A4A5EC4B49FBBBBCD1AD0E46515F' config.headers['token'] = config.data.token;
if (process.env.BUILD_ENV == "development") { // 本地开发环境 if (process.env.BUILD_ENV == "development") { // 本地开发环境
config.headers['token'] = config.data.token || 'EFC0A4A5EC4B49FBBBBCD1AD0E46515F'; config.headers['token'] = config.data.token;
} }
} }
delete config.data.setEntry; delete config.data.setEntry;
......
import fetch from '@/utils/fetch' import fetch from '@/utils/fetch'
import { getBaseUrl, getApiUrl } from '@/utils/index' import { getBaseUrl, getApiUrl } from '@/utils/index'
import store from '../store';
module.exports = { module.exports = {
data: function () { data: function () {
return { return {
token: null token: 'weewfwefw'
} }
}, },
created: function () { created: function () {
...@@ -110,7 +111,7 @@ module.exports = { ...@@ -110,7 +111,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 || 'EFC0A4A5EC4B49FBBBBCD1AD0E46515F'; 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.token;
delete para.setEntry; delete para.setEntry;
...@@ -148,7 +149,7 @@ module.exports = { ...@@ -148,7 +149,7 @@ module.exports = {
// 通用POST请求 // 通用POST请求
POST(api, para, callback) { POST(api, para, callback) {
let token = para.token || this.token || this.$store.state.user.token || 'EFC0A4A5EC4B49FBBBBCD1AD0E46515F'; 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.token;
delete para.setEntry; delete para.setEntry;
...@@ -162,7 +163,7 @@ module.exports = { ...@@ -162,7 +163,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',
...@@ -172,7 +173,7 @@ module.exports = { ...@@ -172,7 +173,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),
...@@ -183,7 +184,7 @@ module.exports = { ...@@ -183,7 +184,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',
...@@ -222,7 +223,8 @@ module.exports = { ...@@ -222,7 +223,8 @@ module.exports = {
// 校验token,有效则调用回调函数,否则调起原生登陆页面 // 校验token,有效则调用回调函数,否则调起原生登陆页面
commonCheckToken(cb) { 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 => {
...@@ -237,7 +239,7 @@ module.exports = { ...@@ -237,7 +239,7 @@ module.exports = {
// 校验token,有效则调用回调函数,否则使用调起原生登陆页面 // 校验token,有效则调用回调函数,否则使用调起原生登陆页面
checkTokenForNative(cb) { checkTokenForNative(cb) {
let param = { let param = {
token: this.token, token: this.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 => {
......
...@@ -69,6 +69,7 @@ export default { ...@@ -69,6 +69,7 @@ export default {
data() { data() {
return { return {
token: "EFC0A4A5EC4B49FBBBBCD1AD0E46515F", token: "EFC0A4A5EC4B49FBBBBCD1AD0E46515F",
// token: "",
directoryId: "", directoryId: "",
cardType: 3, cardType: 3,
goodsType: 3, goodsType: 3,
...@@ -161,9 +162,8 @@ export default { ...@@ -161,9 +162,8 @@ export default {
methods: { methods: {
...mapActions(["setUserInfo", "handlerQuestionList"]), ...mapActions(["setUserInfo", "handlerQuestionList"]),
init() { init() {
// if (this.commitKind >= 2 && this.commitKind <= 4) { // this.token = "EFC0A4A5EC4B49FBBBBCD1AD0E46515F";
this.currentTitle = titleArray[this.commitKind] || "习题集"; this.currentTitle = titleArray[this.commitKind] || "习题集";
// }
this.$store.commit("SET_COMMON_CONIFG", { this.$store.commit("SET_COMMON_CONIFG", {
// 0: 免费; 1: 收费; 没有绑卡且是收费题库(bindStatus == 0 && freeFlag == 1)可以走免费体验流程 // 0: 免费; 1: 收费; 没有绑卡且是收费题库(bindStatus == 0 && freeFlag == 1)可以走免费体验流程
freeFlag: this.freeFlag, freeFlag: this.freeFlag,
...@@ -311,7 +311,7 @@ export default { ...@@ -311,7 +311,7 @@ export default {
if(isFirst) { if(isFirst) {
this.$store.commit("SET_QUESTION_LIST", []); this.$store.commit("SET_QUESTION_LIST", []);
} }
this.queryParams.token = "EFC0A4A5EC4B49FBBBBCD1AD0E46515F"; this.queryParams.token = this.userInfo.userToken || this.token;
this.queryParams.setEntry = true; this.queryParams.setEntry = true;
this.GET(`portal/titleTest/practise/titles`, this.queryParams).then( this.GET(`portal/titleTest/practise/titles`, this.queryParams).then(
({ data }) => { ({ data }) => {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册