[水感应客户端最新]
This commit is contained in:
118
pages/report/index.js
Normal file
118
pages/report/index.js
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
data: {
|
||||
userLogin : false,
|
||||
listArr : [], // 商品列表
|
||||
page : {}, // 分页信息
|
||||
lodingStats : false, // 加载状态
|
||||
disabled : false, // 支付按钮
|
||||
payCode : '', // code获取openid
|
||||
openId : '', // openid
|
||||
payStatus : false, // 支付弹框
|
||||
catchtouchmove: false
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
},
|
||||
|
||||
onShow() {
|
||||
wx.login({
|
||||
success: res => {
|
||||
this.setData({
|
||||
payCode: res.code
|
||||
})
|
||||
// 获取openid
|
||||
this.openInfo()
|
||||
}
|
||||
})
|
||||
|
||||
// 获取登录状态
|
||||
if(wx.getStorageSync("token") != ''){
|
||||
this.setData({
|
||||
userLogin: true,
|
||||
disabled : false
|
||||
})
|
||||
|
||||
// 获取检测结果列表
|
||||
this.aiInfo();
|
||||
} else {
|
||||
this.setData({
|
||||
userLogin: false
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 检测结果列表
|
||||
*/
|
||||
aiInfo (page){
|
||||
wx.$api.health.aiList({
|
||||
page: page || 1
|
||||
}).then(res => {
|
||||
let listArr = this.data.listArr,
|
||||
newData = []
|
||||
if(page == 1 || page == undefined) listArr = []
|
||||
newData = listArr.concat(res.data.data)
|
||||
this.setData({
|
||||
listArr : newData,
|
||||
page : res.data.page,
|
||||
lodingStats : false
|
||||
})
|
||||
wx.stopPullDownRefresh()
|
||||
}).catch(err => { })
|
||||
},
|
||||
|
||||
/**
|
||||
* openid
|
||||
*/
|
||||
openInfo() {
|
||||
wx.$api.auth.codeOpenid({code: this.data.payCode}).then(res => {
|
||||
this.setData({
|
||||
openId: res.data
|
||||
})
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 处理未登录时的转跳
|
||||
*/
|
||||
assessGo(){
|
||||
if(wx.getStorageSync("token") != ''){
|
||||
wx.navigateTo({
|
||||
url: '/pages/index/assess/assess?code=' + this.data.openId
|
||||
})
|
||||
}else{
|
||||
// 去登录
|
||||
wx.navigateTo({
|
||||
url: "/pages/login/index"
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
// 获取检测结果列表
|
||||
this.aiInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 上拉加载
|
||||
*/
|
||||
onReachBottom(){
|
||||
this.setData({
|
||||
lodingStats: true
|
||||
})
|
||||
let pageNumber = this.data.page.current
|
||||
if(this.data.page.has_more){
|
||||
pageNumber++
|
||||
// 获取检测结果列表
|
||||
this.aiInfo(pageNumber);
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user