我的页面
This commit is contained in:
@ -1,18 +1,73 @@
|
||||
// pages/personCenter/accountSetting/accountSetting.js
|
||||
const { baseUrl } = require("../../../request");
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
nickName: "",
|
||||
userAvatar: "",
|
||||
phoneNumber: ""
|
||||
},
|
||||
|
||||
logOut() {
|
||||
wx.request({
|
||||
url: baseUrl + '/userInfo/mini/logout',
|
||||
method: 'GET',
|
||||
header: {
|
||||
Authorization: wx.getStorageSync('token')
|
||||
},
|
||||
success: res => {
|
||||
if (res.data.code === 1) {
|
||||
wx.showToast({
|
||||
title: '退出登录',
|
||||
icon: 'success'
|
||||
})
|
||||
wx.reLaunch({
|
||||
url: '/pages/loginModule/pwdLogin/pwdLogin',
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.showToast({ title: '网络错误,请重试', icon: 'none' });
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const token = wx.getStorageSync('token');
|
||||
|
||||
// 获取用户信息
|
||||
wx.request({
|
||||
url: baseUrl + '/userInfo/get/jwt',
|
||||
method: 'GET',
|
||||
header: {
|
||||
Authorization: token
|
||||
},
|
||||
success: res => {
|
||||
if (res.data.code === 1) {
|
||||
this.setData({
|
||||
nickName: res.data.data.nickName,
|
||||
// TODO 头像未连接
|
||||
userAvatar: res.data.data.userAvatar,
|
||||
phoneNumber: res.data.data.phoneNumber,
|
||||
userAccount: res.data.data.userAccount
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
wx.showToast({ title: '网络错误,请重试', icon: 'none' });
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user