123456789101112131415161718192021222324252627282930313233343536373839404142 |
- const {getAllLotteryUser} = require('../../utils/API.js')
- let raw_avatars = []
- let cur_page = 1
- let has_more = true
- Page({
- data: {
- loading: false,
- lottery_user_count: 0,
- lottery_user_avatars: []
- },
- onLoad: function (query) {
- const {id} = query
- getAllLotteryUser(id)
- .then(data => {
- const {
- lottery_user_count,
- lottery_user_avatars
- } = data.data
- raw_avatars = lottery_user_avatars
- this.setData({
- lottery_user_count,
- lottery_user_avatars: raw_avatars.slice(0, cur_page * 24)
- })
- })
- },
- loadMore(){
- if(has_more) {
- cur_page++
- let result = raw_avatars.slice(0, cur_page * 24)
- if(result.length === this.data.lottery_user_avatars.length) {
- has_more = false
- return
- }
- this.setData({
- lottery_user_avatars: result
- })
- }
- }
- })
|