浏览代码

授权页面完成

packages
HolyKnightIX 2 年前
父节点
当前提交
a49379efe9
共有 2 个文件被更改,包括 23 次插入1 次删除
  1. +22
    -0
      pages/setUserInfo/index.js
  2. +1
    -1
      pages/setUserInfo/index.wxml

+ 22
- 0
pages/setUserInfo/index.js 查看文件

@@ -12,6 +12,7 @@ Page({
data: {
navigationBarHeight,
avatarUrl: defaultAvatarUrl,
nickName: '',
theme: wx.getSystemInfoSync().theme,
typeLsit: {},
},
@@ -75,10 +76,31 @@ Page({
}
},

getUserInfo(token) {
let that = this;
Http.get({
url: config.api.getScore,
data: {
token: token
}
}).then(res => {
console.log(res, 'res');
this.setData({
avatarUrl: res.data.avatarUrl,
nickName: res.data.nickName
})
}).catch(err => {
console.log(err, 'err');
})
},

/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if (app.globalData.token) {
this.getUserInfo(app.globalData.token)
}
this.getType(),
wx.onThemeChange((result) => {
this.setData({


+ 1
- 1
pages/setUserInfo/index.wxml 查看文件

@@ -10,7 +10,7 @@
</view>
<form bindsubmit="formSubmit" class="form">
<text class="nickName">昵称</text>
<input type="nickname" name='nickname' class="input" placeholder="请输入昵称" />
<input type="nickname" name='nickname' class="input" placeholder="请输入昵称" value='{{nickName}}' />
<button class="submit" type="primary" form-type='submit'>确定</button>
</form>
</view>

正在加载...
取消
保存