Commit 76aed41f authored by Damon's avatar Damon

refactor: 体验资格 && 每日一练

parent 670ae7af
...@@ -179,7 +179,7 @@ export default { ...@@ -179,7 +179,7 @@ export default {
total: 0, total: 0,
requesting: false, requesting: false,
// 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是 // 1.顺序答题 2.随机练习 3.模拟考试 4.收藏答题 5.错题答题 6.专项练习-单选 7.专项练习-多选 8.专项练习-判断 9.专项练习-答案是
source: 0, source: 1,
recordId: 0, recordId: 0,
// 合格分数 // 合格分数
passPoint: 60, passPoint: 60,
...@@ -213,10 +213,13 @@ export default { ...@@ -213,10 +213,13 @@ export default {
} }
}, },
onLoad(e) { onLoad(e) {
if (e?.source) this.source = parseInt(e.source) if (e?.experience) this.experience = Boolean(e.experience) // 体验资格
if (e?.recordId) this.recordId = e.recordId if (e?.daily) this.daily.status = true // 每日一练
if (e?.passPoint) this.passPoint = parseInt(e.passPoint) if (e?.dailyCount) this.daily.count = parseInt(e.dailyCount) // 打卡天数
if (e?.totalPoint) this.totalPoint = parseInt(e.totalPoint) if (e?.source) this.source = parseInt(e.source) // 来源
if (e?.recordId) this.recordId = e.recordId // 考试ID
if (e?.passPoint) this.passPoint = parseInt(e.passPoint) // 合格分数
if (e?.totalPoint) this.totalPoint = parseInt(e.totalPoint) // 考试总分/总条数
switch (this.source) { switch (this.source) {
case 1: case 1:
case 2: case 2:
...@@ -262,11 +265,11 @@ export default { ...@@ -262,11 +265,11 @@ export default {
this.total = total this.total = total
// 练习模式-初始化答题卡列表 // 练习模式-初始化答题卡列表
if (this.type === 1) Utils.initAnswerCardList(total, this) if (this.source === 1) Utils.initAnswerCardList(total, this)
this.cachePageDataMap = new Map() this.cachePageDataMap = new Map()
// 上次答到了第几题 // 上次答到了第几题
let index = this.type === 1 ? (this.lastIndex || 0) : 0 let index = this.source === 1 ? (this.lastIndex || 0) : 0
this.refresh(index) this.refresh(index)
}) })
}, },
...@@ -395,8 +398,8 @@ export default { ...@@ -395,8 +398,8 @@ export default {
this.show = true this.show = true
} }
// 更新答题卡 // 顺序练习,更新答题卡
if (this.type === 1){ if (this.source === 1){
this.questionList[this.currentIndex] = item this.questionList[this.currentIndex] = item
this.$u.vuex('questionList', this.questionList) this.$u.vuex('questionList', this.questionList)
this.$u.vuex('lastIndex', this.currentIndex) this.$u.vuex('lastIndex', this.currentIndex)
...@@ -426,12 +429,17 @@ export default { ...@@ -426,12 +429,17 @@ export default {
recordId: this.recordId, recordId: this.recordId,
source: this.source source: this.source
} }
this.$u.api.answer([params]) this.$u.api.answer([params]).then(res => {
if (this.source === 2 && res === 10) {
if (this.daily.status) this.dailyComplete()
}
})
}, },
// 每日一练达成 // 每日一练达成
dailyComplete() { dailyComplete() {
this.daily.visible = true this.daily.count = this.daily.count + 1
this.daily.status = false this.daily.status = false
this.daily.visible = true
}, },
// 统计分数 // 统计分数
handPapers(type) { handPapers(type) {
...@@ -470,7 +478,14 @@ export default { ...@@ -470,7 +478,14 @@ export default {
}, },
// 每日一练弹框确认 // 每日一练弹框确认
dailySubmit() { dailySubmit() {
this.daily.visible = false if (this.experience) {
this.$u.route({
type: 'redirect',
url: '/pages/learn/detail',
})
} else {
this.daily.visible = false
}
}, },
// 每日一练弹框取消 // 每日一练弹框取消
dailyCancel() { dailyCancel() {
......
...@@ -151,7 +151,7 @@ function request({ currentPage, size, onSuccess, onFailed }, vm) { ...@@ -151,7 +151,7 @@ function request({ currentPage, size, onSuccess, onFailed }, vm) {
collectionFlag: info.collectionFlag collectionFlag: info.collectionFlag
} }
// 回显已答题目 // 回显已答题目
if (vm.type === 1) { // 练习模式回显 if (vm.source === 1) { // 练习模式回显
const ansItem = vm.questionList.find(v => v.index === item.index) const ansItem = vm.questionList.find(v => v.index === item.index)
questionList.push(ansItem ? ansItem : item) questionList.push(ansItem ? ansItem : item)
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment