|
@@ -3,7 +3,7 @@
|
|
|
<div class="error" v-if="state.invited_list.length == 0">
|
|
|
Invite people to hunt treasure with you!
|
|
|
</div>
|
|
|
- <div class="list" v-else>
|
|
|
+ <div class="list" v-else @scroll="handleScroll($event)">
|
|
|
<div class="item" v-for="item in state.invited_list">
|
|
|
<div class="left">
|
|
|
<img :src="item.userInfo.avatarUrl" alt="" />
|
|
@@ -28,25 +28,46 @@ import { inject, onMounted } from 'vue'
|
|
|
var moment = require('moment')
|
|
|
let state = inject('state')
|
|
|
state.invited_list = []
|
|
|
+let page_num = 1
|
|
|
+let page_size = 10
|
|
|
+let list_end = false
|
|
|
|
|
|
onMounted(() => {
|
|
|
+ list()
|
|
|
+})
|
|
|
+
|
|
|
+function handleScroll(e) {
|
|
|
+ if (list_end) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ e = e.target
|
|
|
+ if ((e.clientHeight + e.scrollTop) / e.scrollHeight > .8) {
|
|
|
+ list_end = true
|
|
|
+ page_num++
|
|
|
+ list()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const list = () => {
|
|
|
inviteList({
|
|
|
params: {
|
|
|
inviteCode: state.invite_code,
|
|
|
postId: state.postId,
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
+ pageNum: page_num,
|
|
|
+ pageSize: page_size,
|
|
|
}
|
|
|
|
|
|
}).then((res) => {
|
|
|
if (res.code == 0) {
|
|
|
- state.invited_list = res.data
|
|
|
+ if (res.data.length > 0) {
|
|
|
+ state.invited_list = state.invited_list.concat(res.data)
|
|
|
+ list_end = false
|
|
|
+ } else {
|
|
|
+ list_end = true
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
- // btnStatus()
|
|
|
-})
|
|
|
-
|
|
|
+}
|
|
|
|
|
|
const getTime = (timestamp) => {
|
|
|
let _d1 = moment(new Date().getTime())
|