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 86f69cf7
authored
Aug 09, 2022
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'huy_v2.8.1' of
http://192.168.3.233:8090/h5/vite-integral
into huy_v2.8.1
2 parents
68582f5e
dbd6fff2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
160 additions
and
56 deletions
src/libs/vant.ts
src/views/home/index.vue
src/views/home/useHistory.vue
src/libs/vant.ts
View file @
86f69cf
import
{
Button
,
Form
,
Field
,
CellGroup
,
List
,
Cell
Button
,
Form
,
Field
,
CellGroup
,
List
,
Cell
,
PullRefresh
}
from
'vant'
export
const
components
=
[
Button
,
Form
,
Field
,
CellGroup
,
List
,
Cell
Button
,
Form
,
Field
,
CellGroup
,
List
,
Cell
,
PullRefresh
]
\ No newline at end of file
src/views/home/index.vue
View file @
86f69cf
...
...
@@ -43,7 +43,10 @@
</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"
>
<img
class=
"top-img"
src=
"@/assets/images/list-info.png"
alt=
""
/>
</div>
...
...
@@ -55,10 +58,22 @@
</div>
</
template
>
<
template
v-else
>
<!-- v-model:loading="loading"
:finished="finished" -->
<van-list
finished-text=
"- 没有更多啦 -"
@
load=
"onLoad"
>
<van-cell
v-for=
"item in list"
:key=
"item.id"
:title=
"item.name"
/>
<van-list
finished-text=
"- 没有更多啦 -"
loading-text=
"加载中..."
@
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>
</template>
</div>
...
...
@@ -69,16 +84,33 @@
<
script
lang=
"ts"
setup
>
import
{
ref
,
reactive
,
onMounted
}
from
"vue"
;
import
{
useRouter
}
from
"vue-router"
;
type
listStyle
=
{
id
?:
number
;
name
?:
string
;
time
?:
string
;
jifen
?:
string
;
};
let
isLogin
=
ref
(
true
);
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
=
()
=>
{
router
.
push
(
"/login"
);
};
// 登出
const
logout
=
()
=>
{
isLogin
.
value
=
false
;
};
const
innerHeight
=
ref
(
window
.
innerHeight
)
console
.
log
(
innerHeight
)
// 跳到积分使用记录页面
const
toUseList
=
()
=>
{
router
.
push
(
"/uselist"
);
...
...
@@ -88,36 +120,33 @@ const toInformation = () => {
router
.
push
(
'/information'
)
}
const
list
=
reactive
([]);
// const loading = ref<boolean>(true);
// const finished = ref<boolean>(false);
const
onload
=
():
void
=>
{
list
.
push
(
{
id
:
"01"
,
name
:
"系统赠送"
,
time
:
"2022-08-01 15:32:37"
,
jifen
:
"+20"
,
},
{
id
:
"02"
,
name
:
"系统赠送1"
,
time
:
"2022-08-01 15:32:37"
,
jifen
:
"+20"
,
},
{
id
:
"03"
,
name
:
"系统赠送2"
,
time
:
"2022-08-01 15:32:37"
,
jifen
:
"-20"
,
// 下拉加载数据
const
onLoad
=
():
void
=>
{
console
.
log
(
id
.
value
);
loading
.
value
=
true
;
setTimeout
(()
=>
{
for
(
let
i
=
0
;
i
<
10
;
i
++
)
{
list
.
push
({
id
:
id
.
value
+
1
,
name
:
"系统赠送"
+
id
.
value
+
i
,
time
:
"2022-08-01 15:32:37"
,
jifen
:
"+20"
,
});
}
id
=
id
.
value
+
1
;
// 加载状态结束
loading
.
value
=
false
;
console
.
log
(
list
.
length
,
"----"
);
// 数据全部加载完成
if
(
list
.
length
>=
40
)
{
finished
.
value
=
true
;
}
);
console
.
log
(
list
,
"----"
);
},
1000
);
};
// 组件挂载完成
onMounted
(()
=>
{
on
l
oad
();
on
L
oad
();
});
</
script
>
...
...
@@ -173,7 +202,7 @@ onMounted(() => {
border-radius
:
4px
;
margin
:
0
16px
28px
;
width
:
calc
(
100%
-
32px
);
//
height
:
300px
;
overflow
:
auto
;
.history-list-top
{
text-align
:
center
;
padding
:
16px
0
;
...
...
@@ -197,6 +226,34 @@ onMounted(() => {
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
{
...
...
src/views/home/useHistory.vue
View file @
86f69cf
<
template
>
<div>
<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=
""
/>
<div
class=
"nodata-word"
>
暂无积分使用记录
</div>
</div>
</
template
>
<
template
v-else
>
<div
class=
"info-content"
>
<div>
<div
class=
"info-content-list"
>
<div
class=
"info-content-list-left"
>
<div
class=
"info-content-left"
>
<div
class=
"info-content-left-top"
>
1000
</div>
<div
class=
"info-content-left-bottom"
>
兑换积分
</div>
<div
class=
"info-content"
:style=
"
{ height: innerHeight + 'px' }">
<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-left"
>
<div
class=
"info-content-left"
>
<div
class=
"info-content-left-top"
>
{{
item
.
jifen
}}
</div>
<div
class=
"info-content-left-bottom"
>
兑换积分
</div>
</div>
</div>
</div>
<div
class=
"right-line"
></div
>
<div
class=
"info-content-lis
t-right"
>
<div
class=
"info-content-right"
>
<div
class=
"info-content-right-top"
>
李四
</div>
<div
class=
"info-content-right-middle"
>
招商银行
</div
>
<div
class=
"info-content-right-bottom"
>
处理时间:2022-08-01 12:10
<div
class=
"right-line"
>
</div>
<div
class=
"info-content-list-right"
>
<div
class=
"info-conten
t-right"
>
<div
class=
"info-content-right-top"
>
{{
item
.
name
}}
</div
>
<div
class=
"info-content-right-middle"
>
{{
item
.
bank
}}
</div>
<div
class=
"info-content-right-bottom"
>
处理时间:
{{
item
.
time
}}
</div>
</div>
</div>
<div
class=
"finish-img"
>
已完成
</div>
</div>
<div
class=
"finish-img"
>
已完成
</div>
</div>
</
div
>
</
van-list
>
</div>
</
template
>
</div>
</template>
<
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
>
<
style
lang=
"scss"
scoped
>
.nodata
{
height
:
500px
;
text-align
:
center
;
background
:
#fff
;
&-img
{
...
...
@@ -60,6 +106,7 @@ const useList = reactive(["1"]);
}
.info-content
{
margin-top
:
20px
;
overflow
:
auto
;
&-list
{
width
:
calc
(
100%
-
32px
);
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