修改游戏页面相关提示

This commit is contained in:
zhl 2019-03-21 21:30:30 +08:00
parent 46900f5783
commit b9e9162580
2 changed files with 20 additions and 8 deletions

View File

@ -29,17 +29,17 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"current": 2, "current": 0,
"list": [ "list": [
{ {
"id": 0, "id": 0,
"name": "支付返回", "name": "支付返回",
"pathName": "pages/gameInfo", "pathName": "pages/gameInfo",
"query": "id=1100309", "query": "id=7100715",
"scene": 1038, "scene": 1038,
"referrerInfo": { "referrerInfo": {
"appId": "wxbf333d56b4de3905", "appId": "wxbf333d56b4de3905",
"extraData": "{ \"type\": \"item\", \"event_type\": \"pay_result\", \"success\": true, \"gid\": 1100309 }" "extraData": "{ \"type\": \"item\", \"event_type\": \"pay_result\", \"success\": true, \"gid\": 7100715 }"
} }
}, },
{ {

View File

@ -50,6 +50,7 @@
收起 收起
</view> </view>
</view> </view>
<zanToptips/>
</view> </view>
<gameBottomBar class="{{showAll? '' : 'hidden'}}" :config.sync="bottomActionCfg" @bottomMainTap.user="bottomMainTap" <gameBottomBar class="{{showAll? '' : 'hidden'}}" :config.sync="bottomActionCfg" @bottomMainTap.user="bottomMainTap"
@bottomSecondTap.user="bottomSecondTap"/> @bottomSecondTap.user="bottomSecondTap"/>
@ -68,13 +69,15 @@
import base from '../mixins/base'; import base from '../mixins/base';
import tips from '../mixins/tips'; import tips from '../mixins/tips';
import cfg from '../mixins/cfg'; import cfg from '../mixins/cfg';
import zanToptips from '../components/zan-toptips'
export default class GameInfoPage extends wepy.page { export default class GameInfoPage extends wepy.page {
mixins = [base, tips, cfg]; mixins = [base, tips, cfg];
components = { components = {
imageSwiper: imageSwiper, imageSwiper: imageSwiper,
gameBottomBar: gameBottomBar, gameBottomBar: gameBottomBar,
zActionSheet: zActionSheet zActionSheet: zActionSheet,
zanToptips: zanToptips
}; };
data = { data = {
id: '', id: '',
@ -167,7 +170,10 @@
jcEvent.on(jcEvent.events.BUY_ITEM_RESULT, this, data => { jcEvent.on(jcEvent.events.BUY_ITEM_RESULT, this, data => {
this.zActionSheetCfg.hide = true; this.zActionSheetCfg.hide = true;
if (data.success) { if (data.success) {
this.showToast('开通成功', 2000, 'success'); wepy.showModal({
content: '购买成功',
showCancel: false
});
self.zActionSheetCfg.hide = true; self.zActionSheetCfg.hide = true;
self.record.owned = true; self.record.owned = true;
self.bottomActionCfg.mainBtnIconClass = 'icon-merge'; self.bottomActionCfg.mainBtnIconClass = 'icon-merge';
@ -176,7 +182,7 @@
self.$apply(); self.$apply();
jcEvent.emit(jcEvent.events.UPDATE_GAME_STATUS, {gid: self.id}); jcEvent.emit(jcEvent.events.UPDATE_GAME_STATUS, {gid: self.id});
} else { } else {
this.showToast('开通失败', 2000) this.showTopTips('开通失败')
} }
self.$apply(); self.$apply();
}); });
@ -198,6 +204,9 @@
this.zActionSheetCfg.showBuy = this.$showBuy(); this.zActionSheetCfg.showBuy = this.$showBuy();
this.$apply(); this.$apply();
} }
showTopTips(msg, type = 'error') {
this.$invoke('zanToptips', 'showZanTopTips', { content: msg, type: type})
}
async showBuyMenu() { async showBuyMenu() {
this.zActionSheetCfg.params = `token=${this.$parent.getGlobalDate('gameToken')}&gid=${this.id}`; this.zActionSheetCfg.params = `token=${this.$parent.getGlobalDate('gameToken')}&gid=${this.id}`;
this.zActionSheetCfg.goldTitle = `金币开通(${this.$getExtCfg(this.record.category + '_price')})`; this.zActionSheetCfg.goldTitle = `金币开通(${this.$getExtCfg(this.record.category + '_price')})`;
@ -234,7 +243,10 @@
try { try {
let res = await http.post(`/api/emulated/buy_game`, { gid: this.id }); let res = await http.post(`/api/emulated/buy_game`, { gid: this.id });
if (res.errcode === 0) { if (res.errcode === 0) {
this.showToast('开通成功', 2000, 'success'); wepy.showModal({
content: '开通成功',
showCancel: false
});
this.zActionSheetCfg.hide = true; this.zActionSheetCfg.hide = true;
this.$apply(); this.$apply();
jcEvent.emit(jcEvent.events.UPDATE_GAME_STATUS, {gid: this.id}); jcEvent.emit(jcEvent.events.UPDATE_GAME_STATUS, {gid: this.id});
@ -242,7 +254,7 @@
} }
} catch (err) { } catch (err) {
console.log('buy game error'); console.log('buy game error');
this.showToast('开通失败', 2000); this.showTopTips('开通失败')
} }
} }
async getRecord() { async getRecord() {