我的页面
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' });
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -6,8 +6,8 @@
|
||||
src="./images/logo.png"
|
||||
/>
|
||||
<view class="flex-col items-start flex-1 self-start group_2 ml-8">
|
||||
<text class="text">user</text>
|
||||
<text class="font text_2 mt-28">15888610253</text>
|
||||
<text class="text">{{ nickName }}</text>
|
||||
<text class="font text_2 mt-28">{{ phoneNumber }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="self-start font_2 text_3 mt-19">平台服务</text>
|
||||
@ -45,5 +45,5 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-col justify-start items-center text-wrapper"><text class="font_2 text_7">退出登录</text></view>
|
||||
<view class="flex-col justify-start items-center text-wrapper" bind:tap="logOut"><text class="font_2 text_7">退出登录</text></view>
|
||||
</view>
|
Reference in New Issue
Block a user