描述:登录页面优化

This commit is contained in:
SelfRidicule 2024-04-18 09:19:46 +08:00
parent b637200487
commit cc5bc281d0
2 changed files with 34 additions and 16 deletions

View File

@ -278,4 +278,20 @@ App({
} }
}) })
}, },
selfShowMsg(content, url) {
wx.showModal({
title: '提示',
content: content,
confirmText: '确认',
showCancel: false,
success: res => {
if (url) {
wx.navigateTo({
url
})
}
}
})
},
}) })

View File

@ -185,22 +185,24 @@ Page({
if (userId) { if (userId) {
getUserInfoRq(userId).then(res => { getUserInfoRq(userId).then(res => {
console.log('getUserInfoRq', res); console.log('getUserInfoRq', res);
let userDetail = res.data; if (res.code == 0) {
// 存储用户信息 let userDetail = res.data;
wx.setStorageSync('openid', userDetail.openid) // 存储用户信息
wx.setStorageSync('user', userDetail) wx.setStorageSync('openid', userDetail.openid)
wx.setStorageSync('userId', userDetail.id) wx.setStorageSync('user', userDetail)
_this.setData({ wx.setStorageSync('userId', userDetail.id)
userDetail _this.setData({
}) userDetail
// 登录用户是否选择园区 })
_this.userIsPark() // 登录用户是否选择园区
_this.userIsPark()
} else {
app.selfShowMsg(res.msg, '/pages/login/login')
}
}) })
} else { } else {
app.getlogin() app.selfShowMsg('请登录账号', '/pages/login/login')
return
} }
}, },
// 登录用户是否选择园区 // 登录用户是否选择园区
@ -211,9 +213,9 @@ Page({
_this.setData({ _this.setData({
parkName: wx.getStorageSync('parkName') parkName: wx.getStorageSync('parkName')
}) })
getParkRq(parkId).then(res=>{ getParkRq(parkId).then(res => {
console.log('getParkRq' , res); console.log('getParkRq', res);
let bannerList = res.bannerImages.map(item=>item.url) let bannerList = res.bannerImages.map(item => item.url)
_this.setData({ _this.setData({
bannerList bannerList
}) })