Commit 1f839e1b authored by Damon's avatar Damon

perf: 答题数据不存到storage,只存已答数量

parent 216aa567
...@@ -274,6 +274,7 @@ export default { ...@@ -274,6 +274,7 @@ export default {
: false : false
if (check) { if (check) {
this.$u.vuex(`lastIndex.${this.questionWarehouseId}`, 0) this.$u.vuex(`lastIndex.${this.questionWarehouseId}`, 0)
this.$u.vuex(`answerCount.${this.questionWarehouseId}`, 0)
this.$u.vuex(`questionList.${this.questionWarehouseId}`, []) this.$u.vuex(`questionList.${this.questionWarehouseId}`, [])
} }
} else if (this.source === 4) { } else if (this.source === 4) {
...@@ -473,6 +474,7 @@ export default { ...@@ -473,6 +474,7 @@ export default {
`questionList.${this.questionWarehouseId}`, `questionList.${this.questionWarehouseId}`,
this.questionList[this.questionWarehouseId] this.questionList[this.questionWarehouseId]
) )
this.$u.vuex(`lastIndex.${this.questionWarehouseId}`, this.currentIndex) this.$u.vuex(`lastIndex.${this.questionWarehouseId}`, this.currentIndex)
// 统计是否达满所有试题 // 统计是否达满所有试题
...@@ -484,6 +486,7 @@ export default { ...@@ -484,6 +486,7 @@ export default {
0 0
) )
this.$u.vuex(`answerCount.${this.questionWarehouseId}`, this.count)
if (this.count === this.total) { if (this.count === this.total) {
this.$nextTick(() => { this.$nextTick(() => {
return this.$u.toast('您已经答完全部试题') return this.$u.toast('您已经答完全部试题')
......
...@@ -15,11 +15,11 @@ let saveStateKeys = [ ...@@ -15,11 +15,11 @@ let saveStateKeys = [
'vuex_token', 'vuex_token',
'openId', 'openId',
'searchHistory', 'searchHistory',
'questionList',
'lastIndex', 'lastIndex',
'tipStatus', 'tipStatus',
'questionWarehouseId', 'questionWarehouseId',
'relationId', // 绑卡用 'relationId', // 绑卡用
'answerCount'
] ]
// 保存变量到本地存储中 // 保存变量到本地存储中
...@@ -45,7 +45,7 @@ const store = new Vuex.Store({ ...@@ -45,7 +45,7 @@ const store = new Vuex.Store({
openId: lifeData.openId ? lifeData.openId : '', openId: lifeData.openId ? lifeData.openId : '',
relationId: lifeData.relationId ? lifeData.relationId : '', // 绑卡用 relationId: lifeData.relationId ? lifeData.relationId : '', // 绑卡用
searchHistory: lifeData.searchHistory ? lifeData.searchHistory : [], // 搜索历史记录 searchHistory: lifeData.searchHistory ? lifeData.searchHistory : [], // 搜索历史记录
questionList: lifeData.questionList ? lifeData.questionList : {}, // 练习列表 answerCount: lifeData.answerCount ? lifeData.answerCount : {},// 已回答题数
lastIndex: lifeData.lastIndex ? lifeData.lastIndex : {}, // 上次做到第几题 lastIndex: lifeData.lastIndex ? lifeData.lastIndex : {}, // 上次做到第几题
tipStatus: lifeData.tipStatus ? lifeData.tipStatus : false, // 滑动提示 tipStatus: lifeData.tipStatus ? lifeData.tipStatus : false, // 滑动提示
questionWarehouseId: lifeData.questionWarehouseId questionWarehouseId: lifeData.questionWarehouseId
...@@ -53,6 +53,7 @@ const store = new Vuex.Store({ ...@@ -53,6 +53,7 @@ const store = new Vuex.Store({
: '1414854649273384960', // 科目ID : '1414854649273384960', // 科目ID
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式 // 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
vuex_version: '1.0.0', vuex_version: '1.0.0',
questionList: {}, // 练习列表
beginTime: null // 考试开始时间 beginTime: null // 考试开始时间
}, },
mutations: { mutations: {
......
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