绚火健康

This commit is contained in:
2023-08-15 17:18:15 +08:00
commit 32cc588ae7
200 changed files with 8924 additions and 0 deletions

66
pages/user/index.js Normal file
View File

@@ -0,0 +1,66 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
userLogin: false,
userData: '', // 用户信息
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取登录状态
if(wx.getStorageSync("token") != ''){
this.setData({
userLogin: true
})
// 获取用户信息
this.userInfo();
return
}
this.setData({
userLogin: false
})
},
/**
* 用户信息
*/
userInfo() {
wx.$api.user.userIndex().then(res => {
this.setData({
userData: res.data
})
console.log(res)
}).catch(err => {})
},
/**
* 处理未登录时的转跳
*/
userNav(e){
let pageUrl = e.currentTarget.dataset.url
if(wx.getStorageSync("token") != ''){
wx.navigateTo({
url: pageUrl
})
}else{
// 去登录
wx.navigateTo({
url: "/pages/login/index"
})
}
}
})