Commit 4922cbfe authored by Damon's avatar Damon

feat: 滑动提示

parent 7744dd92
...@@ -218,10 +218,6 @@ export default { ...@@ -218,10 +218,6 @@ export default {
break; break;
} }
// 第一次进入,显示提示
if (this.questionList.length === 0) {
this.show = true
}
this.init() this.init()
}, },
methods: { methods: {
...@@ -374,7 +370,15 @@ export default { ...@@ -374,7 +370,15 @@ export default {
item.result = status item.result = status
item.errShow = this.type === 2 ? true : status === 'fail' item.errShow = this.type === 2 ? true : status === 'fail'
item.userAnswer = userAnswer item.userAnswer = userAnswer
// 保存答案
if(this.model === 1) this.saveAnswer(item) if(this.model === 1) this.saveAnswer(item)
// 滑动提示
if (!this.tipStatus && status === 'fail') {
this.$u.vuex('tipStatus', true)
this.show = true
}
// 更新答题卡 // 更新答题卡
if (this.type === 1){ if (this.type === 1){
this.questionList[this.currentIndex] = item this.questionList[this.currentIndex] = item
...@@ -395,7 +399,7 @@ export default { ...@@ -395,7 +399,7 @@ export default {
// 如果回答错误或者是考试模式,自动进入下一题 // 如果回答错误或者是考试模式,自动进入下一题
if ((status === 'pass' && this.model !== 2) || this.type === 2) { if ((status === 'pass' && this.model !== 2) || this.type === 2) {
if (this.currentIndex + 1 > this.total - 1) { // 最后一题回答后 if (this.currentIndex + 1 > this.total - 1) { // 最后一题回答后
if (this.type === 2) { if (this.type === 2) { // 统计分数,交卷
this.handPapers(1) this.handPapers(1)
this.submit() this.submit()
} }
......
...@@ -12,7 +12,7 @@ try{ ...@@ -12,7 +12,7 @@ try{
} }
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名 // 需要永久存储,且下次APP启动需要取出的,在state中的变量名
let saveStateKeys = ['userInfo', 'vuex_token', 'openId', 'searchHistory', 'questionList', 'lastIndex']; let saveStateKeys = ['userInfo', 'vuex_token', 'openId', 'searchHistory', 'questionList', 'lastIndex', 'tipStatus'];
// 保存变量到本地存储中 // 保存变量到本地存储中
const saveLifeData = function(key, value){ const saveLifeData = function(key, value){
...@@ -38,6 +38,7 @@ const store = new Vuex.Store({ ...@@ -38,6 +38,7 @@ const store = new Vuex.Store({
searchHistory: lifeData.searchHistory ? lifeData.searchHistory : [], // 搜索历史记录 searchHistory: lifeData.searchHistory ? lifeData.searchHistory : [], // 搜索历史记录
questionList: lifeData.questionList ? lifeData.questionList : [], // 练习列表 questionList: lifeData.questionList ? lifeData.questionList : [], // 练习列表
lastIndex: lifeData.lastIndex ? lifeData.lastIndex : 0, // 上次做到第几题 lastIndex: lifeData.lastIndex ? lifeData.lastIndex : 0, // 上次做到第几题
tipStatus: lifeData.tipStatus ? lifeData.tipStatus : false, // 滑动提示
// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式 // 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
vuex_version: '1.0.0', vuex_version: '1.0.0',
}, },
......
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