描述:获取个人信息

This commit is contained in:
SelfRidicule 2024-03-28 17:02:58 +08:00
parent 29b2690d55
commit 939bd28997
2 changed files with 19 additions and 5 deletions

View File

@ -11,3 +11,11 @@ export function userProfile(id) {
});
}
// 用户信息
export function getUserInfoRq(id) {
return request({
url: '/wx/getUserInfo?userId=' + id,
method: "get",
});
}

View File

@ -7,7 +7,8 @@ import {
} from "../../api/common/scan.js"
import {
userProfile
userProfile,
getUserInfoRq
} from "../../api/user/user.js"
import {
@ -157,7 +158,7 @@ Page({
},
onLoad(options) {
console.log('onLoad options' , options);
console.log('onLoad options', options);
let _this = this;
// 轮播图
@ -189,10 +190,15 @@ Page({
let _this = this
let userId = wx.getStorageSync('userId');
if (userId) {
userProfile(userId).then(res => {
console.log('userProfile', res);
getUserInfoRq(userId).then(res => {
console.log('getUserInfoRq', res);
let userDetail = res.data;
// 存储用户信息
wx.setStorageSync('openid', userDetail.openid)
wx.setStorageSync('user', userDetail)
wx.setStorageSync('userId', userDetail.id)
_this.setData({
userDetail: res.data
userDetail
})
})
} else {