diff --git a/src/pages/index.wpy b/src/pages/index.wpy index bf8e77b..502e430 100644 --- a/src/pages/index.wpy +++ b/src/pages/index.wpy @@ -5,8 +5,11 @@ + {{ nickname }} + + 金币: {{score}} @@ -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'); diff --git a/src/style/index.wxss b/src/style/index.wxss index 8a8b306..2a82400 100644 --- a/src/style/index.wxss +++ b/src/style/index.wxss @@ -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; +}