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

统计功能

判断题
其它bug
上级 71a7cc32
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<article class="content"> <article class="content">
<img class="img-tips" src="../../images/question/note.png" alt=""> <img class="img-tips" src="../../images/question/note.png" alt="">
<p class="tips">您已完成本次免费练习体验</p> <p class="tips">您已完成本次免费练习体验</p>
<p class="status"><span class="cm rn">{{rightNum}}</span>题,错<span class="cm en">{{errorNum}}</span>题,正确率<span class="cm rate">{{rate}}%</span></p> <p class="status"><span class="cm rn">{{statisConfig.rightNum}}</span>题,错<span class="cm en">{{statisConfig.errorNum}}</span>题,正确率<span class="cm rate">{{statisConfig.rate}}%</span></p>
<p class="guide-tips">想体验完整题目,请先激活或购买题库</p> <p class="guide-tips">想体验完整题目,请先激活或购买题库</p>
<div class="btn-wrapper"> <div class="btn-wrapper">
<span class="plain" @click="activeCard">去激活</span> <span class="plain" @click="activeCard">去激活</span>
...@@ -20,22 +20,32 @@ ...@@ -20,22 +20,32 @@
<script> <script>
export default { export default {
props: { props: {
statisConfig: {
type: Object,
default: () => {
return {
rightNum: 0,
errorNum: 0,
rate: 0
}
}
},
showDialog: { showDialog: {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
rightNum: { // rightNum: {
type: Number | String, // type: Number | String,
default: 0, // default: 0,
}, // },
errorNum: { // errorNum: {
type: Number | String, // type: Number | String,
default: 0, // default: 0,
}, // },
rate: { // rate: {
type: Number | String, // type: Number | String,
default: 0, // default: 0,
} // }
}, },
methods: { methods: {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</article> </article>
<article class="title-wrapper"> <article class="title-wrapper">
<span class="type" :class="{'multi': currentQuestion.typeId == 2}"> <span class="type" :class="{'multi': currentQuestion.typeId == 2}">
<span>{{currentQuestion.typeId != 2 ? "单选题" : "多选题"}}</span> <span>{{currentQuestion.typeId == 1 ? "单选题" : currentQuestion.typeId == 2 ? "多选题" : "判断题"}}</span>
</span> </span>
<span class="content" v-html="currentQuestion.question"></span> <span class="content" v-html="currentQuestion.question"></span>
<!-- <img src="https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png" /> --> <!-- <img src="https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png" /> -->
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<span class="content">查看病理,了解病史</span> <span class="content">查看病理,了解病史</span>
</div>--> </div>-->
</article> </article>
<article class="c-btn-wrapper" v-show="currentQuestion.typeId == 2 && !currentQuestion.commitFlag" @click="commitAnswer"> <article class="c-btn-wrapper" v-show="currentQuestion.typeId == 2" @click="commitAnswer(true)">
<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">
...@@ -141,6 +141,7 @@ export default { ...@@ -141,6 +141,7 @@ export default {
// 提交答案 // 提交答案
commitAnswer(isMulti) { commitAnswer(isMulti) {
if(this.currentQuestion.commitFlag) return;
let params = { let params = {
commitKind: this.commonConfig.commitKind, // 答题来源 1:错题集 2:收藏 3:题库 commitKind: this.commonConfig.commitKind, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: this.currentQuestion.directoryId, // 题库ID directoryId: this.currentQuestion.directoryId, // 题库ID
......
...@@ -25,21 +25,13 @@ export default { ...@@ -25,21 +25,13 @@ export default {
data() { data() {
return { return {
queryParams: { 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:题库 commitKind: 3, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: 1748, // 题库ID,获取错题集或收藏时传0 directoryId: 1748, // 题库ID,获取错题集或收藏时传0
pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页 pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页
pageSize: 5, // 每页大小 pageSize: 5, // 每页大小
secondSubjectId: 106, // 二级学科分类ID:用于判断学科下目录免费题数 secondSubjectId: 106, // 二级学科分类ID:用于判断学科下目录免费题数
titleNo: 0, // 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题 titleNo: 0, // 起始或结束题目序号,首次进入页面时传0,系统自动定位到上次做的题
} }
}; };
}, },
computed: { computed: {
...@@ -53,9 +45,7 @@ export default { ...@@ -53,9 +45,7 @@ export default {
}, },
methods: { methods: {
// 上一页 // 有可能要触发上分页(前端的个数只有一条) // 上一页 // 有可能要触发上分页(前端的个数只有一条)
// TODO
previous() { previous() {
// debugger
if (this.currentQuestion.titleNo == 1) { if (this.currentQuestion.titleNo == 1) {
Toast("已是第一题"); Toast("已是第一题");
} else { } else {
...@@ -64,7 +54,7 @@ export default { ...@@ -64,7 +54,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)); 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);
} }
...@@ -75,8 +65,8 @@ export default { ...@@ -75,8 +65,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
// Toast("已是最后一题"); || this.currentQuestion.titleNo == this.questionList[this.questionList.length - 1].titleNo) {
this.$emit("statistics"); this.$emit("statistics");
} else { } else {
let cIndex = findQuestionIndexNo(this.questionList, 'titleNo', this.currentQuestion.titleNo); let cIndex = findQuestionIndexNo(this.questionList, 'titleNo', this.currentQuestion.titleNo);
...@@ -95,6 +85,7 @@ export default { ...@@ -95,6 +85,7 @@ export default {
// 解析 // 解析
toggleAnalysis() { toggleAnalysis() {
this.currentQuestion.isAnalyzed = true; this.currentQuestion.isAnalyzed = true;
this.$parent.refs['questionContentRef'] && this.$parent.refs['questionContentRef'].commitAnswer(this.currentQuestion.typeId == 2);
// this.$store.commit('SET_CURRENT_QUESTION', this.currentQuestion); // this.$store.commit('SET_CURRENT_QUESTION', this.currentQuestion);
}, },
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
:total="titleConfig.totalCount" :total="titleConfig.totalCount"
></question-header> ></question-header>
<article class="body"> <article class="body">
<question-content v-show="questionList.length"></question-content> <question-content ref="questionContentRef" v-show="questionList.length"></question-content>
<no-content v-show="!questionList.length" :listType="commitKind"></no-content> <no-content v-show="!questionList.length" :listType="commitKind"></no-content>
</article> </article>
<!-- <free-tips ></free-tips> --> <!-- <free-tips ></free-tips> -->
<question-footer @statistics="statistics" @pageQuestion="pageQuestion"></question-footer> <question-footer v-show="questionList.length" @statistics="statistics" @pageQuestion="pageQuestion"></question-footer>
<ExperienceDialog <ExperienceDialog
:showDialog="experienceDialog" :showDialog="experienceDialog"
:statisConfig="statisConfig"
@activeCard="activeCard" @activeCard="activeCard"
@buyCard="buyCard" @buyCard="buyCard"
@close="experienceDialog = false" @close="experienceDialog = false"
...@@ -95,14 +96,21 @@ export default { ...@@ -95,14 +96,21 @@ export default {
titleNo: 0, // 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题 titleNo: 0, // 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题
pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页 pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页
pageSize: 5, // 每页大小 pageSize: 5, // 每页大小
},
statisConfig: {
rightNum: 0,
errorNum: 0,
rate: 0
} }
}; };
}, },
computed: { computed: {
...mapGetters([ ...mapGetters([
"userInfo",
"questionList", "questionList",
"currentQuestion", "currentQuestion",
"totalCount", "totalCount",
"commonConfig",
"titleConfig" "titleConfig"
]), ]),
needFixed() { needFixed() {
...@@ -127,27 +135,15 @@ export default { ...@@ -127,27 +135,15 @@ export default {
this.queryParams.directoryId = this.directoryId; this.queryParams.directoryId = this.directoryId;
this.queryParams.secondSubjectId = this.secondSubjectId; this.queryParams.secondSubjectId = this.secondSubjectId;
// queryParams: {
// commitKind: 3, // 答题来源 1:错题集 2:收藏 3:题库
// directoryId: 1748, // 题库ID,获取错题集或收藏时传0
// pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页
// pageSize: 5, // 每页大小
// secondSubjectId: 106, // 二级学科分类ID:用于判断学科下目录免费题数
// titleNo: 0 // 起始或结束题目ID,首次进入页面时传0,系统自动定位到上次做的题
// }
window.__getUserInfoForQD = function(param) { window.__getUserInfoForQD = function(param) {
_this.token = param.userToken; _this.token = param.userToken;
_this.setUserInfo(param); _this.setUserInfo(param);
_this.getPractiseTitles(true); _this.init();
// _this.checkToken();
}; };
if (__isWeb) { if (__isWeb) {
_this.getPractiseTitles(true);
} else {
_this.init(); _this.init();
// _this.getUserInfo(); } else {
this.getUserInfo();
} }
window.__refresh = function() { window.__refresh = function() {
...@@ -177,8 +173,7 @@ export default { ...@@ -177,8 +173,7 @@ export default {
goodsType: this.goodsType, goodsType: this.goodsType,
commitKind: this.commitKind // 答题来源 1:错题集 2:收藏 3:题库 commitKind: this.commitKind // 答题来源 1:错题集 2:收藏 3:题库
}); });
this.getUserInfo(); this.getPractiseTitles(true);
// this.getPractiseTitles();
// this.preJumper(); // this.preJumper();
}, },
...@@ -191,13 +186,34 @@ export default { ...@@ -191,13 +186,34 @@ export default {
// 统计当前信息 // 统计当前信息
statistics() { statistics() {
let correctNum = 0, // 如果是收费的题库(不是错题集或收载),并且没有绑定卡
errNum = 0, console.log(this.commonConfig.freeFlag, this.commitKind == 3, !this.titleConfig.bindStatus);
if(!(this.commonConfig.freeFlag == 1 && this.commitKind == 3 && !this.titleConfig.bindStatus)) {
Toast("已是最后一题");
return;
}
let rightNum = 0,
errorNum = 0,
rate = 0; rate = 0;
this.questionList.forEach(item => { this.questionList.forEach(item => {
if (item.commitKind) { if (item.commitFlag) {
if(item.myAnswer == item.answer) {
rightNum ++;
} else {
errorNum ++;
}
} }
}); });
console.log();
if((rightNum + errorNum) > 0) {
rate = (rightNum * 100 / (rightNum + errorNum)).toFixed(0);
this.statisConfig = {
rightNum,
errorNum,
rate
}
}
this.experienceDialog = true; this.experienceDialog = true;
}, },
...@@ -210,20 +226,21 @@ export default { ...@@ -210,20 +226,21 @@ export default {
// 打开激活弹框 // 打开激活弹框
activeCard() { activeCard() {
this.checkTokenForNative(() => {
this.experienceDialog = false; this.experienceDialog = false;
this.showChangeCard = true; this.showChangeCard = true;
});
}, },
buyCard() { buyCard() {
!__isWeb && this.confirm(); this.checkTokenForNative(() => {
this.confirm();
});
}, },
// 跳转到原生的购买页面 // 跳转到原生的购买页面
confirm() { confirm() {
// this.$sendBuriedData({
// component_tag: `882#88203`
// });
let appVersion = this.userInfo.appVersion || ""; let appVersion = this.userInfo.appVersion || "";
let appVersionNum = appVersion.split(".").join(""); let appVersionNum = appVersion.split(".").join("");
if (appVersionNum < 344) { if (appVersionNum < 344) {
...@@ -256,7 +273,6 @@ export default { ...@@ -256,7 +273,6 @@ export default {
seqNo: 1 seqNo: 1
} }
]; ];
this.$refs.tcPlayerRef && this.$refs.tcPlayerRef.pause();
rocNative.dispatchEventByModuleCode({ rocNative.dispatchEventByModuleCode({
modeCode: "M200", modeCode: "M200",
jsonString: paramList jsonString: paramList
...@@ -292,13 +308,14 @@ export default { ...@@ -292,13 +308,14 @@ export default {
// 分页获取题目(前、后翻页) // 分页获取题目(前、后翻页)
getPractiseTitles(isFirst) { getPractiseTitles(isFirst) {
if(isFirst) {
this.$store.commit("SET_QUESTION_LIST", []);
}
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; data.isFirst = isFirst;
this.handlerQuestionList(data); this.handlerQuestionList(data);
// this.handlerPractiseData(data.practiseTitleModelList);
console.log(data);
} }
); );
}, },
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册