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 dbd6fff2
authored
Aug 09, 2022
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
积分历史记录页面
1 parent
8a841f4d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
147 additions
and
43 deletions
src/libs/vant.ts
src/views/home/index.vue
src/views/home/useHistory.vue
src/libs/vant.ts
View file @
dbd6fff
import
{
import
{
Button
,
Form
,
Field
,
CellGroup
,
List
,
Cell
Button
,
Form
,
Field
,
CellGroup
,
List
,
Cell
,
PullRefresh
}
from
'vant'
}
from
'vant'
export
const
components
=
[
export
const
components
=
[
Button
,
Form
,
Field
,
CellGroup
,
List
,
Cell
Button
,
Form
,
Field
,
CellGroup
,
List
,
Cell
,
PullRefresh
]
]
\ No newline at end of file
\ No newline at end of file
src/views/home/index.vue
View file @
dbd6fff
...
@@ -43,7 +43,10 @@
...
@@ -43,7 +43,10 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"wrapper-history-list"
:style=
"
{'height': innerHeight - (280 + 10 + 28) + 'px'}">
<div
class=
"wrapper-history-list"
:style=
"
{ height: innerHeight - (280 + 10 + 28) + 'px' }"
>
<div
class=
"history-list-top"
>
<div
class=
"history-list-top"
>
<img
class=
"top-img"
src=
"@/assets/images/list-info.png"
alt=
""
/>
<img
class=
"top-img"
src=
"@/assets/images/list-info.png"
alt=
""
/>
</div>
</div>
...
@@ -55,10 +58,22 @@
...
@@ -55,10 +58,22 @@
</div>
</div>
</
template
>
</
template
>
<
template
v-else
>
<
template
v-else
>
<!-- v-model:loading="loading"
<van-list
:finished="finished" -->
finished-text=
"- 没有更多啦 -"
<van-list
finished-text=
"- 没有更多啦 -"
@
load=
"onLoad"
>
loading-text=
"加载中..."
<van-cell
v-for=
"item in list"
:key=
"item.id"
:title=
"item.name"
/>
@
load=
"onLoad"
v-model:loading=
"loading"
:finished=
"finished"
>
<template
v-for=
"item in list"
:key=
"item.id"
>
<div
class=
"list-content"
>
<div
class=
"list-content-left"
>
<div
class=
"list-content-left-top"
>
{{
item
.
name
}}
</div>
<div
class=
"list-content-left-bottom"
>
{{
item
.
time
}}
</div>
</div>
<div
class=
"list-content-right"
>
{{
item
.
jifen
}}
</div>
</div>
</
template
>
</van-list>
</van-list>
</template>
</template>
</div>
</div>
...
@@ -69,51 +84,65 @@
...
@@ -69,51 +84,65 @@
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
ref
,
reactive
,
onMounted
}
from
"vue"
;
import
{
ref
,
reactive
,
onMounted
}
from
"vue"
;
import
{
useRouter
}
from
"vue-router"
;
import
{
useRouter
}
from
"vue-router"
;
type
listStyle
=
{
id
?:
number
;
name
?:
string
;
time
?:
string
;
jifen
?:
string
;
};
let
isLogin
=
ref
(
true
);
let
isLogin
=
ref
(
true
);
const
router
=
useRouter
();
const
router
=
useRouter
();
// 获取可视区高度
const
innerHeight
=
ref
<
number
>
(
window
.
innerHeight
);
const
list
=
reactive
<
listStyle
>
([]);
let
id
=
ref
<
number
>
(
0
);
const
loading
=
ref
<
boolean
>
(
false
);
const
finished
=
ref
<
boolean
>
(
false
);
// 跳到登录页面
const
toLogin
=
()
=>
{
const
toLogin
=
()
=>
{
router
.
push
(
"/login"
);
router
.
push
(
"/login"
);
};
};
// 登出
const
logout
=
()
=>
{
const
logout
=
()
=>
{
isLogin
.
value
=
false
;
isLogin
.
value
=
false
;
};
};
const
innerHeight
=
ref
(
window
.
innerHeight
)
console
.
log
(
innerHeight
)
// 跳到积分使用记录页面
// 跳到积分使用记录页面
const
toUseList
=
()
=>
{
const
toUseList
=
()
=>
{
router
.
push
(
"/uselist"
);
router
.
push
(
"/uselist"
);
};
};
const
list
=
reactive
([]);
// 下拉加载数据
// const loading = ref<boolean>(true);
const
onLoad
=
():
void
=>
{
// const finished = ref<boolean>(false);
console
.
log
(
id
.
value
);
const
onload
=
():
void
=>
{
loading
.
value
=
true
;
list
.
push
(
setTimeout
(()
=>
{
{
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
id
:
"01"
,
list
.
push
({
name
:
"系统赠送"
,
id
:
id
.
value
+
1
,
time
:
"2022-08-01 15:32:37"
,
name
:
"系统赠送"
+
id
.
value
+
i
,
jifen
:
"+20"
,
},
{
id
:
"02"
,
name
:
"系统赠送1"
,
time
:
"2022-08-01 15:32:37"
,
time
:
"2022-08-01 15:32:37"
,
jifen
:
"+20"
,
jifen
:
"+20"
,
},
});
{
}
id
:
"03"
,
id
=
id
.
value
+
1
;
name
:
"系统赠送2"
,
// 加载状态结束
time
:
"2022-08-01 15:32:37"
,
loading
.
value
=
false
;
jifen
:
"-20"
,
console
.
log
(
list
.
length
,
"----"
);
// 数据全部加载完成
if
(
list
.
length
>=
40
)
{
finished
.
value
=
true
;
}
}
);
},
1000
);
console
.
log
(
list
,
"----"
);
};
};
// 组件挂载完成
// 组件挂载完成
onMounted
(()
=>
{
onMounted
(()
=>
{
on
l
oad
();
on
L
oad
();
});
});
</
script
>
</
script
>
...
@@ -169,7 +198,7 @@ onMounted(() => {
...
@@ -169,7 +198,7 @@ onMounted(() => {
border-radius
:
4px
;
border-radius
:
4px
;
margin
:
0
16px
28px
;
margin
:
0
16px
28px
;
width
:
calc
(
100%
-
32px
);
width
:
calc
(
100%
-
32px
);
//
height
:
300px
;
overflow
:
auto
;
.history-list-top
{
.history-list-top
{
text-align
:
center
;
text-align
:
center
;
padding
:
16px
0
;
padding
:
16px
0
;
...
@@ -193,6 +222,34 @@ onMounted(() => {
...
@@ -193,6 +222,34 @@ onMounted(() => {
margin-top
:
20px
;
margin-top
:
20px
;
}
}
}
}
.list-content
{
display
:
flex
;
justify-content
:
space-between
;
margin
:
0
20px
;
padding
:
16px
0
;
border-bottom
:
1px
solid
#f2f2f2
;
&-left
{
&-top
{
font-size
:
14px
;
font-family
:
PingFangSC-Medium
,
PingFang
SC
;
font-weight
:
500
;
color
:
#333333
;
margin-bottom
:
4px
;
}
&
-bottom
{
font-size
:
12px
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
color
:
#999999
;
}
}
&
-right
{
font-size
:
16px
;
font-family
:
PingFangSC-Semibold
,
PingFang
SC
;
font-weight
:
600
;
color
:
#f37005
;
}
}
}
}
&
-integral
{
&
-integral
{
...
...
src/views/home/useHistory.vue
View file @
dbd6fff
<
template
>
<
template
>
<div>
<div>
<template
v-if=
"useList.length == 0"
>
<template
v-if=
"useList.length == 0"
>
<div
class=
"nodata"
>
<div
class=
"nodata"
:style=
"
{ height: innerHeight + 'px' }"
>
<img
class=
"nodata-img"
src=
"@/assets/images/nodata.png"
alt=
""
/>
<img
class=
"nodata-img"
src=
"@/assets/images/nodata.png"
alt=
""
/>
<div
class=
"nodata-word"
>
暂无积分使用记录
</div>
<div
class=
"nodata-word"
>
暂无积分使用记录
</div>
</div>
</div>
</
template
>
</
template
>
<
template
v-else
>
<
template
v-else
>
<div
class=
"info-content"
>
<div
class=
"info-content"
:style=
"
{ height: innerHeight + 'px' }">
<div>
<van-list
finished-text=
"- 没有更多啦 -"
loading-text=
"加载中..."
@
load=
"getHistoryList"
v-model:loading=
"loading"
:finished=
"finished"
>
<div
v-for=
"item in useList"
:key=
"item.id"
>
<div
class=
"info-content-list"
>
<div
class=
"info-content-list"
>
<div
class=
"info-content-list-left"
>
<div
class=
"info-content-list-left"
>
<div
class=
"info-content-left"
>
<div
class=
"info-content-left"
>
<div
class=
"info-content-left-top"
>
1000
</div>
<div
class=
"info-content-left-top"
>
{{
item
.
jifen
}}
</div>
<div
class=
"info-content-left-bottom"
>
兑换积分
</div>
<div
class=
"info-content-left-bottom"
>
兑换积分
</div>
</div>
</div>
</div>
</div>
<div
class=
"right-line"
></div>
<div
class=
"right-line"
></div>
<div
class=
"info-content-list-right"
>
<div
class=
"info-content-list-right"
>
<div
class=
"info-content-right"
>
<div
class=
"info-content-right"
>
<div
class=
"info-content-right-top"
>
李四
</div>
<div
class=
"info-content-right-top"
>
{{
item
.
name
}}
</div>
<div
class=
"info-content-right-middle"
>
招商银行
</div>
<div
class=
"info-content-right-middle"
>
{{
item
.
bank
}}
</div>
<div
class=
"info-content-right-bottom"
>
<div
class=
"info-content-right-bottom"
>
处理时间:2022-08-01 12:10
处理时间:
{{
item
.
time
}}
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"finish-img"
>
已完成
</div>
<div
class=
"finish-img"
>
已完成
</div>
</div>
</div>
</div>
</div>
</van-list>
</div>
</div>
</
template
>
</
template
>
</div>
</div>
</template>
</template>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
reactive
}
from
"vue"
;
import
{
ref
,
reactive
,
onMounted
}
from
"vue"
;
type
historyList
=
{
id
?:
number
;
jifen
?:
number
;
name
?:
string
;
bank
?:
string
;
time
?:
string
;
};
// 获取可视区高度
const
innerHeight
=
ref
<
number
>
(
window
.
innerHeight
);
const
useList
=
reactive
<
historyList
>
([]);
const
loading
=
ref
<
boolean
>
(
false
);
const
finished
=
ref
<
boolean
>
(
false
);
// 获取积分使用记录
const
getHistoryList
=
():
void
=>
{
loading
.
value
=
true
;
setTimeout
(()
=>
{
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
useList
.
push
({
id
:
i
,
jifen
:
1000
,
name
:
"张三"
,
bank
:
"招商银行(8888)"
,
time
:
"2022-08-01 15:32:37"
,
});
}
// 加载状态结束
loading
.
value
=
false
;
console
.
log
(
list
.
length
,
"----"
);
// 数据全部加载完成
if
(
useList
.
length
>=
40
)
{
finished
.
value
=
true
;
}
},
1000
);
};
const
useList
=
reactive
([
"1"
]);
// 组件挂载完成
onMounted
(()
=>
{
getHistoryList
();
});
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.nodata
{
.nodata
{
height
:
500px
;
text-align
:
center
;
text-align
:
center
;
background
:
#fff
;
background
:
#fff
;
&-img
{
&-img
{
...
@@ -60,6 +106,7 @@ const useList = reactive(["1"]);
...
@@ -60,6 +106,7 @@ const useList = reactive(["1"]);
}
}
.info-content
{
.info-content
{
margin-top
:
20px
;
margin-top
:
20px
;
overflow
:
auto
;
&-list
{
&-list
{
width
:
calc
(
100%
-
32px
);
width
:
calc
(
100%
-
32px
);
height
:
96px
;
height
:
96px
;
...
...
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