Commit d99a445b authored by Facius's avatar Facius

improvement: 首页清空数据

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