From 70387ac8cdc136b1d79d833ff6a2d93e79957c7c Mon Sep 17 00:00:00 2001 From: zhl Date: Thu, 21 Feb 2019 17:09:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E9=85=8D=E7=BD=AE=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=9A=90=E8=97=8F=E7=9B=B8=E5=85=B3=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.wpy | 7 +++++++ src/common/jc-event.js | 3 ++- src/components/game-cell.wpy | 8 ++++++-- src/jcfw/SDKManage.js | 2 ++ src/pages/gameInfo.wpy | 12 +++++++++++- src/pages/index.wpy | 13 +++++++++++-- 6 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/app.wpy b/src/app.wpy index b557383..df82844 100644 --- a/src/app.wpy +++ b/src/app.wpy @@ -12,6 +12,9 @@ width: 749rpx; overflow-x: hidden; } + .hidden{ + display: none!important; + } diff --git a/src/common/jc-event.js b/src/common/jc-event.js index cf8a95c..98d7fe6 100644 --- a/src/common/jc-event.js +++ b/src/common/jc-event.js @@ -29,6 +29,7 @@ export default { LOGIN_FINISHED : 'login-finished', UPDATE_RECENT_GAMES: 'update-recent-games', UPDATE_GAME_STATUS: 'update-game-status', - NEED_UPDATE_SCORE: 'need-update-score' + NEED_UPDATE_SCORE: 'need-update-score', + NEED_UPDATE_CFG: 'need-update-cfg' } } diff --git a/src/components/game-cell.wpy b/src/components/game-cell.wpy index 4b413f1..1106498 100644 --- a/src/components/game-cell.wpy +++ b/src/components/game-cell.wpy @@ -11,7 +11,7 @@ {{item.name}} {{item.introduce}} - + 去玩 @@ -28,7 +28,11 @@ props = { item: { type: Object, - defalut: null + default: null + }, + showAll: { + type: Boolean, + default: false } } data = { diff --git a/src/jcfw/SDKManage.js b/src/jcfw/SDKManage.js index 3ddaec5..7137150 100755 --- a/src/jcfw/SDKManage.js +++ b/src/jcfw/SDKManage.js @@ -71,6 +71,8 @@ var SDKManage = function() { var cb = function(res) { console.log('getGameConfig'); + console.log(res); + wx.setStorageSync('cfg', res); setTimeout(() => { self.doLogin(); }, 10); diff --git a/src/pages/gameInfo.wpy b/src/pages/gameInfo.wpy index f4c80a0..2883281 100644 --- a/src/pages/gameInfo.wpy +++ b/src/pages/gameInfo.wpy @@ -51,7 +51,7 @@ - @@ -77,6 +77,7 @@ typeStr: '其他', tagList: [], score: 0, + showAll: false, bottomActionCfg: { hide: false, mainBtnIconClass: 'icon-cart', @@ -115,6 +116,7 @@ onLoad(params) { this.id = decodeURIComponent(params.id); + this.showAll = this.$parent.showAll(); console.log(this.id); let self = this; jcEvent.on(jcEvent.events.BUY_GAME_SUCCESS, this, data => { @@ -128,9 +130,16 @@ jcEvent.on(jcEvent.events.NEED_UPDATE_SCORE, this, data => { this.getUserInfo(); }); + jcEvent.on(jcEvent.events.NEED_UPDATE_CFG, this, data => { + let cfg = wepy.getStorageSync('cfg'); + this.showAll = !cfg ? false : !cfg.hide_main; + this.$apply(); + }) this.getRecord(); } onShow() { + let cfg = wepy.getStorageSync('cfg'); + this.showAll = !cfg ? false : !cfg.hide_main; this.getUserInfo(); } async showBuyMenu() { @@ -240,6 +249,7 @@ onUnload() { jcEvent.remove(jcEvent.events.BUY_GAME_SUCCESS, this); jcEvent.remove(jcEvent.events.NEED_UPDATE_SCORE, this); + jcEvent.remove(jcEvent.events.NEED_UPDATE_CFG, this); } async requestAd(text) { try { diff --git a/src/pages/index.wpy b/src/pages/index.wpy index 502e430..90a4737 100644 --- a/src/pages/index.wpy +++ b/src/pages/index.wpy @@ -18,7 +18,7 @@ 搜索 - + @@ -60,7 +60,8 @@ loading: false, noData: true, noMore: false, - gameSet: new Set() + gameSet: new Set(), + showAll: false }; methods = { @@ -130,6 +131,11 @@ jcEvent.on(jcEvent.events.NEED_UPDATE_SCORE, this, data => { this.getUserInfo(); }) + jcEvent.on(jcEvent.events.NEED_UPDATE_CFG, this, data => { + let cfg = wepy.getStorageSync('cfg'); + this.showAll = !cfg ? false : !cfg.hide_main; + this.$apply(); + }) } getAllData() { this.getRecords(); @@ -141,8 +147,11 @@ jcEvent.remove(jcEvent.events.UPDATE_RECENT_GAMES, this); jcEvent.remove(jcEvent.events.UPDATE_GAME_STATUS, this); jcEvent.remove(jcEvent.events.NEED_UPDATE_SCORE, this); + jcEvent.remove(jcEvent.events.NEED_UPDATE_CFG, this); } onShow() { + let cfg = wepy.getStorageSync('cfg'); + this.showAll = !cfg ? false : !cfg.hide_main; let userInfo = this.$parent.getUserInfo(); console.log(userInfo); if (userInfo) {