个人消息
This commit is contained in:
22
pages/myself/account/index.js
Normal file
22
pages/myself/account/index.js
Normal file
@@ -0,0 +1,22 @@
|
||||
Page({
|
||||
data: {
|
||||
hasUserAttar: false,
|
||||
userInfo: {},
|
||||
},
|
||||
|
||||
fetchWXAttar(){
|
||||
wx.getUserProfile({
|
||||
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
||||
success: (res) => {
|
||||
console.log(res)
|
||||
this.setData({
|
||||
userInfo: res.userInfo,
|
||||
hasUserAttar: true
|
||||
})
|
||||
},
|
||||
fail: (e) => {
|
||||
console.log(e);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
4
pages/myself/account/index.json
Normal file
4
pages/myself/account/index.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
}
|
||||
}
|
||||
12
pages/myself/account/index.wxml
Normal file
12
pages/myself/account/index.wxml
Normal file
@@ -0,0 +1,12 @@
|
||||
<t-cell wx:if="{{hasUserAttar}}" title="{{userInfo.nickName}}">
|
||||
<view class="avatar" slot="left-icon">
|
||||
<open-data type="userAvatarUrl" />
|
||||
</view>
|
||||
</t-cell>
|
||||
<t-cell wx:else title="{{'用户名'}}" description="点击授权头像信息" bind:tap="fetchWXAttar">
|
||||
<view class="avatar" slot="left-icon">
|
||||
<open-data type="userAvatarUrl" />
|
||||
</view>
|
||||
</t-cell>
|
||||
<t-cell title="昵称" description="{{'浙A88FU7'}}" />
|
||||
<t-cell title="邮箱" description="{{'540344226@qq.com'}}" />
|
||||
6
pages/myself/account/index.wxss
Normal file
6
pages/myself/account/index.wxss
Normal file
@@ -0,0 +1,6 @@
|
||||
.avatar {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -26,6 +26,12 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
viewMyAccount(){
|
||||
wx.navigateTo({
|
||||
url: '/pages/myself/account/index'
|
||||
});
|
||||
},
|
||||
|
||||
viewMyMessage(){
|
||||
wx.navigateTo({
|
||||
url: '/pages/myself/notify/index'
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<open-data type="userAvatarUrl" />
|
||||
</view>
|
||||
</t-cell>
|
||||
<t-cell title="个人信息" hover arrow />
|
||||
<t-cell title="个人信息" hover arrow bind:tap="viewMyAccount"/>
|
||||
<t-cell title="我的消息" hover arrow bind:tap="viewMyMessage"/>
|
||||
<t-cell title="常见问题" hover arrow bind:tap="viewQuestion"/>
|
||||
<t-cell title="关于我们" hover arrow bind:tap="viewAboutUs"/>
|
||||
|
||||
Reference in New Issue
Block a user