首页增加金币的显示

This commit is contained in:
zhl 2019-02-21 16:27:23 +08:00
parent 6ddd02ad6d
commit d44c39db63
2 changed files with 22 additions and 3 deletions

View File

@ -5,8 +5,11 @@
<view class="container">
<view class="top-view">
<view class="userinfo">
<view class="userinfo-user">
<image class="userinfo-avatar" src="{{avatar}}"/>
<view class="userinfo-nickname">{{ nickname }}</view>
</view>
<view class="userinfo-score">金币: {{score}}</view>
</view>
</view>
<recentGame :gameList.sync="recent_game_list" @gameCellTap.user="gameTap"></recentGame>
@ -167,10 +170,13 @@
let res = await http.post('/api/emulated/user_info', {type: 'all'});
console.log(res);
this.gameSet.clear();
for(let game of res.games) {
this.gameSet.add(game.gid);
if (res.userInfo) {
for(let game of res.userInfo.games) {
this.gameSet.add(game.gid);
}
this.score = res.userInfo.score;
}
this.score = res.score;
this.$apply();
} catch (err) {
console.log('error get user info');

View File

@ -5,6 +5,7 @@ page {
display: flex;
align-items: center;
margin: 10px;
justify-content: space-between;
}
.userinfo-avatar {
@ -57,3 +58,15 @@ page {
font-weight:bold;
padding:13rpx 10rpx;
}
.userinfo-user {
display: flex;
flex-flow: row;
width: 70%;
justify-items:center;
align-items:center;
}
.userinfo-score {
margin-right: 10rpx;
font-size:18px;
color: #aaa;
}