Commit 472bd14c authored by Damon's avatar Damon

refactor: 分页数据完善

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