Commit d99a445b authored by Facius's avatar Facius

improvement: 首页清空数据

parent e2e85b81
...@@ -148,7 +148,7 @@ export default { ...@@ -148,7 +148,7 @@ export default {
}, },
finishCount() { finishCount() {
return this.questionList.reduce((accumulator, currentValue) => { return this.questionList.reduce((accumulator, currentValue) => {
if (currentValue.id) accumulator++ if (currentValue.submitStatus) accumulator++
return accumulator return accumulator
}, 0) }, 0)
}, },
...@@ -238,9 +238,14 @@ export default { ...@@ -238,9 +238,14 @@ export default {
] ]
}, },
}, },
watch: {
vuex_token(val, oldVal) {
// 监听token变化,如果更新则重新加载页面数据
val && !oldVal && this.initData()
},
},
onLoad() { onLoad() {
this.getProvinceList() this.initData()
this.queryMyQuestionWarehouseDetail('1414854649273384960')
}, },
onShow() { onShow() {
let pages = getCurrentPages() let pages = getCurrentPages()
...@@ -259,6 +264,10 @@ export default { ...@@ -259,6 +264,10 @@ export default {
} }
}, },
methods: { methods: {
initData() {
this.getProvinceList()
this.queryMyQuestionWarehouseDetail('0')
},
// 题库详情 // 题库详情
queryQuestionWarehouseById(id) { queryQuestionWarehouseById(id) {
this.$u.api this.$u.api
...@@ -446,10 +455,16 @@ export default { ...@@ -446,10 +455,16 @@ export default {
}) })
} }
}, },
async getProvinceList() { getProvinceList() {
let res = await this.$u.api.getProvinceList() this.$u.api
console.log(res) .getProvinceList()
this.provinceList = res .then((res) => {
console.log('------------getProvinceList----------', res)
this.provinceList = res || []
})
.catch((err) => {
console.log(err)
})
}, },
setPageInfo(info) { setPageInfo(info) {
var pages = getCurrentPages() var pages = getCurrentPages()
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
</view> </view>
<view class="body-view"> <view class="body-view">
<view class="date-view"> <view class="date-view">
<view class="content-title">每日一练</view> <view class="content-title" id="part-days">每日一练</view>
<view class="date-content"></view> <view class="date-content"></view>
</view> </view>
<view class="charts-view"> <view class="charts-view">
<view class="content-title">练习分析</view> <view class="content-title" id="part-total">练习分析</view>
<view class="range-view"> <view class="range-view">
<view class="range-title">日期范围</view> <view class="range-title">日期范围</view>
<view <view
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<view class="charts-content"> </view> <view class="charts-content"> </view>
</view> </view>
<view class="list-view"> <view class="list-view">
<view class="content-title">模考成绩</view> <view class="content-title" id="part-today">模考成绩</view>
<view class="list-content"> <view class="list-content">
<RecordCell <RecordCell
v-for="(item, index) in showedList" v-for="(item, index) in showedList"
...@@ -87,6 +87,7 @@ export default { ...@@ -87,6 +87,7 @@ export default {
lists: [], lists: [],
showSelect: false, showSelect: false,
showAll: false, showAll: false,
scrollId: null,
items: [ items: [
{ {
title: '近7天', title: '近7天',
...@@ -122,7 +123,12 @@ export default { ...@@ -122,7 +123,12 @@ export default {
return this.showAll ? this.lists : this.lists.slice(0, 2) return this.showAll ? this.lists : this.lists.slice(0, 2)
}, },
}, },
onLoad() { onLoad(e) {
if (e && e.key) {
this.$nextTick(() => {
this.scrollId = 'part-' + e.key
})
}
this.lists = [ this.lists = [
{ time: 36, score: 80, date: new Date().getTime }, { time: 36, score: 80, date: new Date().getTime },
{ time: 100, score: 40, date: new Date().getTime }, { time: 100, score: 40, date: new Date().getTime },
......
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