Commit 472bd14c authored by Damon's avatar Damon

refactor: 分页数据完善

parent 12eaffc5
const UNI_APP = {
apiUrl: 'http://192.168.0.204:8760',
apiUrl: 'http://192.168.0.208:8760',
qn_base_url: 'https://qn-static.banshouhui.com/study/',
qn_asset_url: 'http://deudn.c.pp.cc/',
uUrl: 'http://rest-u.yunya.com/',
......
......@@ -10,7 +10,7 @@ const install = (Vue, vm) => {
'tenant': 'weixiuhui',
'content-type': 'application/json; charset=utf-8',
},
loadingTime: 0,
loadingTime: 800,
originalData: true,
});
......
......@@ -8,7 +8,7 @@
title="答题"
title-bold
></u-navbar>
<view class="u-flex contents" v-if="list.length > 0">
<view class="u-flex contents" v-if="total > 0">
<view class="head" v-if="!daily">
<view class="u-flex tab" v-if="type !== 2">
<view
......@@ -41,6 +41,7 @@
:current="current"
:type="type"
:model="model"
:total="total"
@answerChange="answerChange"
@change="swiperChange"
>
......@@ -76,7 +77,7 @@
<view
class="u-flex default"
v-if="list.length === 0 && [3, 4].includes(type)"
v-if="total === 0 && [3, 4].includes(type)"
>
<view>
<image :src="defaultImg" />
......@@ -169,17 +170,17 @@ export default {
this.$u.api.getQuestionTotal(params).then(res => {
// 列表总长度,一定要在第一次请求列表数据前明确该值
// 否则无法知道下一页是否还有数据
let total = parseInt(res)
let total = parseInt(res) || 0
this.total = total
// 初始化答题卡列表
Utils.initAnswerCardList(total, this)
this.cachePageDataMap = new Map()
// 上次答到了第几题
let index = this.lastIndex
let index = 18
this.refresh(index)
})
// 第一次进入,显示提示
if (this.questionList.length === 0) {
this.show = true
}
......@@ -203,7 +204,7 @@ export default {
icon: 'none',
})
}
if (current == NO_NEXT_PAGE) {
if (this.type === 2) {
this.$u.route({
......@@ -238,6 +239,7 @@ export default {
this.judgeLoadWay(list[0].currentPage - 1, current)
}
// 加载下一页
if (current == list[list.length - 1].index) {
this.judgeLoadWay(list[list.length - 1].currentPage + 1, current)
}
......
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