Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
vite-integral
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a095e093
authored
Aug 11, 2022
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
列表加载问题解决
1 parent
a6dde235
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
src/views/home/index.vue
src/views/home/useHistory.vue
src/views/home/index.vue
View file @
a095e09
...
@@ -146,7 +146,7 @@ let pageData: object = {
...
@@ -146,7 +146,7 @@ let pageData: object = {
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
10
,
pageSize
:
10
,
};
};
let
total
=
ref
<
number
>
(
0
);
let
total
=
ref
<
number
>
(
1
);
// 校验是否登录
// 校验是否登录
const
hasSession
=
()
=>
{
const
hasSession
=
()
=>
{
...
@@ -176,9 +176,9 @@ const logout = () => {
...
@@ -176,9 +176,9 @@ const logout = () => {
const
onLoad
=
async
()
=>
{
const
onLoad
=
async
()
=>
{
loading
.
value
=
true
;
loading
.
value
=
true
;
let
params
=
pageData
;
let
params
=
pageData
;
console
.
log
(
list
.
length
,
total
.
value
);
console
.
log
(
pageData
.
pageNum
,
total
.
value
);
// 如果列表长度小于总长度下拉刷新
// 如果列表长度小于总长度下拉刷新
if
(
list
.
length
<=
total
.
value
)
{
if
(
pageData
.
pageNum
<=
total
.
value
)
{
const
res
=
await
req
(
const
res
=
await
req
(
"scrm.api.renewal.h5.integral.record.list"
,
"scrm.api.renewal.h5.integral.record.list"
,
params
,
params
,
...
@@ -186,7 +186,7 @@ const onLoad = async () => {
...
@@ -186,7 +186,7 @@ const onLoad = async () => {
);
);
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
list
.
push
(...
res
.
data
.
list
);
list
.
push
(...
res
.
data
.
list
);
total
.
value
=
res
.
data
.
total
;
total
.
value
=
res
.
data
.
pages
;
pageData
.
pageNum
++
;
pageData
.
pageNum
++
;
}
else
{
}
else
{
Toast
.
fail
(
"获取积分历史明细失败"
);
Toast
.
fail
(
"获取积分历史明细失败"
);
...
...
src/views/home/useHistory.vue
View file @
a095e09
<
template
>
<
template
>
<div
class=
"info-content"
>
<div
class=
"info-content"
>
<!-- @load="getHistoryList" -->
<van-list
<van-list
finished-text=
"- 没有更多啦 -"
finished-text=
"- 没有更多啦 -"
loading-text=
"加载中..."
loading-text=
"加载中..."
v-model:loading=
"loading"
v-model:loading=
"loading"
:finished=
"finished"
:finished=
"finished"
@
load=
"getHistoryList"
>
>
<template
v-if=
"useList.length == 0"
>
<template
v-if=
"useList.length == 0"
>
<div
class=
"nodata"
:style=
"
{ height: innerHeight + 'px' }">
<div
class=
"nodata"
:style=
"
{ height: innerHeight + 'px' }">
...
@@ -62,7 +62,7 @@ let pageData: object = {
...
@@ -62,7 +62,7 @@ let pageData: object = {
pageNum
:
1
,
pageNum
:
1
,
pageSize
:
10
,
pageSize
:
10
,
};
};
let
total
=
ref
<
number
>
(
0
);
let
total
=
ref
<
number
>
(
1
);
// 获取积分使用记录
// 获取积分使用记录
const
getHistoryList
=
async
()
=>
{
const
getHistoryList
=
async
()
=>
{
...
@@ -70,7 +70,7 @@ const getHistoryList = async () => {
...
@@ -70,7 +70,7 @@ const getHistoryList = async () => {
let
params
=
pageData
;
let
params
=
pageData
;
console
.
log
(
useList
.
length
,
total
.
value
);
console
.
log
(
useList
.
length
,
total
.
value
);
// 如果列表长度小于总长度下拉刷新
// 如果列表长度小于总长度下拉刷新
if
(
useList
.
length
==
0
||
useList
.
length
<
total
.
value
)
{
if
(
pageData
.
pageNum
<=
total
.
value
)
{
const
res
=
await
req
(
const
res
=
await
req
(
"scrm.api.renewal.h5.integral.convert.record.list"
,
"scrm.api.renewal.h5.integral.convert.record.list"
,
params
,
params
,
...
@@ -80,7 +80,7 @@ const getHistoryList = async () => {
...
@@ -80,7 +80,7 @@ const getHistoryList = async () => {
if
(
res
.
code
==
0
)
{
if
(
res
.
code
==
0
)
{
useList
.
push
(...
res
.
data
.
list
);
useList
.
push
(...
res
.
data
.
list
);
total
.
value
=
res
.
data
.
total
;
total
.
value
=
res
.
data
.
pages
;
pageData
.
pageNum
++
;
pageData
.
pageNum
++
;
}
else
{
}
else
{
Toast
.
fail
(
"获取积分历史明细失败"
);
Toast
.
fail
(
"获取积分历史明细失败"
);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment