From d44c39db63f5c8dd6bd3417a0fb2600f021e0a1d Mon Sep 17 00:00:00 2001 From: zhl Date: Thu, 21 Feb 2019 16:27:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=A2=9E=E5=8A=A0=E9=87=91?= =?UTF-8?q?=E5=B8=81=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index.wpy | 12 +++++++++--- src/style/index.wxss | 13 +++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) 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; +}