132 lines
2.1 KiB
TypeScript
132 lines
2.1 KiB
TypeScript
// pages/visitor/visitor.ts
|
|
import { visitRecord } from '../../apis/report'
|
|
const app = getApp<IAppOption>()
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
id: '',
|
|
name: '',
|
|
listQuery: {
|
|
current: 1
|
|
},
|
|
isMember: app.memberVerify(),
|
|
list: [],
|
|
showCard: true,
|
|
total: 0
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options: any) {
|
|
const isMember = app.memberVerify()
|
|
const { id, name } = options
|
|
wx.setNavigationBarTitle({
|
|
title: name
|
|
})
|
|
// if(isMember) {
|
|
// wx.setNavigationBarColor({
|
|
// backgroundColor: '#313035',
|
|
// frontColor: '#FFFFF'
|
|
// })
|
|
// }
|
|
this.setData({
|
|
id,
|
|
name,
|
|
isMember,
|
|
})
|
|
this.setData({
|
|
list: [],
|
|
['listQuery.current']: 1
|
|
})
|
|
this.getList()
|
|
},
|
|
getList() {
|
|
visitRecord({
|
|
...this.data.listQuery,
|
|
id: this.data.id
|
|
}).then((res:any) => {
|
|
this.setData({
|
|
total: res.d.total
|
|
})
|
|
const list = res.d.records
|
|
if (list.length) {
|
|
this.setData({
|
|
list: this.data.list.concat(list)
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
icon: 'none',
|
|
title: '没有更多了!'
|
|
})
|
|
}
|
|
})
|
|
},
|
|
hideCard() {
|
|
this.setData({
|
|
showCard: false
|
|
})
|
|
},
|
|
|
|
jumpMember() {
|
|
wx.navigateTo({
|
|
url: '/pages/member/member'
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
this.setData({
|
|
['listQuery.current']: this.data.listQuery.current + 1
|
|
})
|
|
this.getList()
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
})
|
|
|
|
export {} |