根据配置显示隐藏相关组件

This commit is contained in:
zhl 2019-02-21 17:09:05 +08:00
parent d44c39db63
commit 70387ac8cd
6 changed files with 39 additions and 6 deletions

View File

@ -12,6 +12,9 @@
width: 749rpx; width: 749rpx;
overflow-x: hidden; overflow-x: hidden;
} }
.hidden{
display: none!important;
}
</style> </style>
<script> <script>
@ -55,6 +58,7 @@ export default class extends wepy.app {
let account = wepy.getStorageSync('account'); let account = wepy.getStorageSync('account');
console.log('finish parse jcfw'); console.log('finish parse jcfw');
console.log(account); console.log(account);
jcEvent.emit(jcEvent.events.NEED_UPDATE_CFG, {});
if (this.checkClientLogin()) { if (this.checkClientLogin()) {
this.login(); this.login();
} }
@ -167,5 +171,8 @@ export default class extends wepy.app {
console.info(`[${obj ? 'UPDATE' : 'GET'} GlobalData ${name}]:`, this.globalData[name]); console.info(`[${obj ? 'UPDATE' : 'GET'} GlobalData ${name}]:`, this.globalData[name]);
return this.globalData[name]; return this.globalData[name];
} }
showAll() {
return this.globalData.showAll;
}
} }
</script> </script>

View File

@ -29,6 +29,7 @@ export default {
LOGIN_FINISHED : 'login-finished', LOGIN_FINISHED : 'login-finished',
UPDATE_RECENT_GAMES: 'update-recent-games', UPDATE_RECENT_GAMES: 'update-recent-games',
UPDATE_GAME_STATUS: 'update-game-status', UPDATE_GAME_STATUS: 'update-game-status',
NEED_UPDATE_SCORE: 'need-update-score' NEED_UPDATE_SCORE: 'need-update-score',
NEED_UPDATE_CFG: 'need-update-cfg'
} }
} }

View File

@ -11,7 +11,7 @@
<view class="title">{{item.name}}</view> <view class="title">{{item.name}}</view>
<view class="content">{{item.introduce}}</view> <view class="content">{{item.introduce}}</view>
</view> </view>
<view class="left-btn"> <view class="left-btn {{showAll ? '' : 'hidden'}}">
<view wx:if="{{item.owned}}" class="zan-btn zan-btn--mini zan-btn--plain zan-btn--primary "> <view wx:if="{{item.owned}}" class="zan-btn zan-btn--mini zan-btn--plain zan-btn--primary ">
去玩 去玩
</view> </view>
@ -28,7 +28,11 @@
props = { props = {
item: { item: {
type: Object, type: Object,
defalut: null default: null
},
showAll: {
type: Boolean,
default: false
} }
} }
data = { data = {

View File

@ -71,6 +71,8 @@ var SDKManage = function() {
var cb = function(res) { var cb = function(res) {
console.log('getGameConfig'); console.log('getGameConfig');
console.log(res);
wx.setStorageSync('cfg', res);
setTimeout(() => { setTimeout(() => {
self.doLogin(); self.doLogin();
}, 10); }, 10);

View File

@ -51,7 +51,7 @@
</view> </view>
</view> </view>
</view> </view>
<gameBottomBar :config.sync="bottomActionCfg" @bottomMainTap.user="bottomMainTap" <gameBottomBar class="{{showAll? '' : 'hidden'}}" :config.sync="bottomActionCfg" @bottomMainTap.user="bottomMainTap"
@bottomSecondTap.user="bottomSecondTap"/> @bottomSecondTap.user="bottomSecondTap"/>
</template> </template>
@ -77,6 +77,7 @@
typeStr: '其他', typeStr: '其他',
tagList: [], tagList: [],
score: 0, score: 0,
showAll: false,
bottomActionCfg: { bottomActionCfg: {
hide: false, hide: false,
mainBtnIconClass: 'icon-cart', mainBtnIconClass: 'icon-cart',
@ -115,6 +116,7 @@
onLoad(params) { onLoad(params) {
this.id = decodeURIComponent(params.id); this.id = decodeURIComponent(params.id);
this.showAll = this.$parent.showAll();
console.log(this.id); console.log(this.id);
let self = this; let self = this;
jcEvent.on(jcEvent.events.BUY_GAME_SUCCESS, this, data => { jcEvent.on(jcEvent.events.BUY_GAME_SUCCESS, this, data => {
@ -128,9 +130,16 @@
jcEvent.on(jcEvent.events.NEED_UPDATE_SCORE, this, data => { jcEvent.on(jcEvent.events.NEED_UPDATE_SCORE, this, data => {
this.getUserInfo(); 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(); this.getRecord();
} }
onShow() { onShow() {
let cfg = wepy.getStorageSync('cfg');
this.showAll = !cfg ? false : !cfg.hide_main;
this.getUserInfo(); this.getUserInfo();
} }
async showBuyMenu() { async showBuyMenu() {
@ -240,6 +249,7 @@
onUnload() { onUnload() {
jcEvent.remove(jcEvent.events.BUY_GAME_SUCCESS, this); jcEvent.remove(jcEvent.events.BUY_GAME_SUCCESS, this);
jcEvent.remove(jcEvent.events.NEED_UPDATE_SCORE, this); jcEvent.remove(jcEvent.events.NEED_UPDATE_SCORE, this);
jcEvent.remove(jcEvent.events.NEED_UPDATE_CFG, this);
} }
async requestAd(text) { async requestAd(text) {
try { try {

View File

@ -18,7 +18,7 @@
<view class="right" @tap="toSearch"><i class="icon-search"></i> 搜索</view> <view class="right" @tap="toSearch"><i class="icon-search"></i> 搜索</view>
</view> </view>
<repeat for="{{records}}" item="item" > <repeat for="{{records}}" item="item" >
<recordCell :item="item" @gameCellTap.user="gameTap"/> <recordCell :item="item" @gameCellTap.user="gameTap" :showAll.sync = 'showAll'/>
</repeat> </repeat>
<zanLoadmore :loading.sync="loading" :nodata.sync="noData" :nomore.sync="noMore" nodata_str="暂无数据"></zanLoadmore> <zanLoadmore :loading.sync="loading" :nodata.sync="noData" :nomore.sync="noMore" nodata_str="暂无数据"></zanLoadmore>
<toast/> <toast/>
@ -60,7 +60,8 @@
loading: false, loading: false,
noData: true, noData: true,
noMore: false, noMore: false,
gameSet: new Set() gameSet: new Set(),
showAll: false
}; };
methods = { methods = {
@ -130,6 +131,11 @@
jcEvent.on(jcEvent.events.NEED_UPDATE_SCORE, this, data => { jcEvent.on(jcEvent.events.NEED_UPDATE_SCORE, this, data => {
this.getUserInfo(); 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() { getAllData() {
this.getRecords(); this.getRecords();
@ -141,8 +147,11 @@
jcEvent.remove(jcEvent.events.UPDATE_RECENT_GAMES, this); jcEvent.remove(jcEvent.events.UPDATE_RECENT_GAMES, this);
jcEvent.remove(jcEvent.events.UPDATE_GAME_STATUS, this); jcEvent.remove(jcEvent.events.UPDATE_GAME_STATUS, this);
jcEvent.remove(jcEvent.events.NEED_UPDATE_SCORE, this); jcEvent.remove(jcEvent.events.NEED_UPDATE_SCORE, this);
jcEvent.remove(jcEvent.events.NEED_UPDATE_CFG, this);
} }
onShow() { onShow() {
let cfg = wepy.getStorageSync('cfg');
this.showAll = !cfg ? false : !cfg.hide_main;
let userInfo = this.$parent.getUserInfo(); let userInfo = this.$parent.getUserInfo();
console.log(userInfo); console.log(userInfo);
if (userInfo) { if (userInfo) {