mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 10:49:36 +08:00
描述:获取个人信息
This commit is contained in:
parent
29b2690d55
commit
939bd28997
@ -11,3 +11,11 @@ export function userProfile(id) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 用户信息
|
||||||
|
export function getUserInfoRq(id) {
|
||||||
|
return request({
|
||||||
|
url: '/wx/getUserInfo?userId=' + id,
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,8 @@ import {
|
|||||||
} from "../../api/common/scan.js"
|
} from "../../api/common/scan.js"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
userProfile
|
userProfile,
|
||||||
|
getUserInfoRq
|
||||||
} from "../../api/user/user.js"
|
} from "../../api/user/user.js"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -157,7 +158,7 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
console.log('onLoad options' , options);
|
console.log('onLoad options', options);
|
||||||
|
|
||||||
let _this = this;
|
let _this = this;
|
||||||
// 轮播图
|
// 轮播图
|
||||||
@ -189,10 +190,15 @@ Page({
|
|||||||
let _this = this
|
let _this = this
|
||||||
let userId = wx.getStorageSync('userId');
|
let userId = wx.getStorageSync('userId');
|
||||||
if (userId) {
|
if (userId) {
|
||||||
userProfile(userId).then(res => {
|
getUserInfoRq(userId).then(res => {
|
||||||
console.log('userProfile', 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({
|
_this.setData({
|
||||||
userDetail: res.data
|
userDetail
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user