修改首页错误提示

This commit is contained in:
zhl 2019-03-21 21:21:12 +08:00
parent d2e629560d
commit 46900f5783

View File

@ -183,10 +183,13 @@
}) })
jcEvent.on(jcEvent.events.BUY_VIP_RESULT, this, data => { jcEvent.on(jcEvent.events.BUY_VIP_RESULT, this, data => {
if (data.success) { if (data.success) {
this.showToast('购买成功', 2000, 'success'); wepy.showModal({
content: '购买成功',
showCancel: false
});
this.getUserInfo(); this.getUserInfo();
} else { } else {
this.showToast('购买失败', 2000); this.showTopTips('购买失败')
} }
}) })
/** /**
@ -198,7 +201,7 @@
let timestamp = options.t; let timestamp = options.t;
let now = Date.now(); let now = Date.now();
if (now - timestamp > 60*1000*5) { if (now - timestamp > 60*1000*5) {
this.showToast('加入房间失败', 2000); this.showTopTips('加入房间失败')
} else { } else {
let cfg = wepy.getStorageSync('cfg'); let cfg = wepy.getStorageSync('cfg');
let fcUrl = cfg.fcurl; let fcUrl = cfg.fcurl;
@ -253,7 +256,7 @@
this.current = 0; this.current = 0;
this.records = []; this.records = [];
} }
showTopTips(msg, type = 'info') { showTopTips(msg, type = 'error') {
this.$invoke('zanToptips', 'showZanTopTips', { content: msg, type: type}) this.$invoke('zanToptips', 'showZanTopTips', { content: msg, type: type})
} }
async getRecendGames() { async getRecendGames() {
@ -281,12 +284,9 @@
wepy.navigateTo({ wepy.navigateTo({
url: '/pages/gameInfo?id=' + res.record.gid url: '/pages/gameInfo?id=' + res.record.gid
}) })
} else {
console.log('用户点击辅助操作');
} }
} catch (err) { } catch (err) {
console.log('error get recent games'); console.log('error get recent games');
self.showTopTips('获取游戏失败', 'error');
} }
} }
async myAchieveGames() { async myAchieveGames() {
@ -307,7 +307,6 @@
async getUserInfo() { async getUserInfo() {
try { try {
let res = await http.post('/api/emulated/user_info', {type: 'all'}); let res = await http.post('/api/emulated/user_info', {type: 'all'});
this.debugLog(res);
if (res.userInfo) { if (res.userInfo) {
let user = res.userInfo; let user = res.userInfo;
this.score = user.score; this.score = user.score;
@ -336,6 +335,7 @@
this.$apply(); this.$apply();
} catch (err) { } catch (err) {
console.log('error get user info'); console.log('error get user info');
this.showTopTips('获取用户信息失败');
} }
} }
async getRecords() { async getRecords() {
@ -360,11 +360,12 @@
self.noData = (self.records.length === 0); self.noData = (self.records.length === 0);
self.$apply(); self.$apply();
} else { } else {
this.debugLog('get game data error'); this.showTopTips('获取游戏列表失败');
self.loading = false self.loading = false
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
this.showTopTips('获取游戏列表失败');
self.loading = false self.loading = false
} }
this.$apply(); this.$apply();
@ -424,7 +425,7 @@
shareTicket: res.shareTickets[0] shareTicket: res.shareTickets[0]
}) })
.then(res => { .then(res => {
this.debugLog(res); console.log('分享成功');
}) })
.catch(err => { .catch(err => {
console.log(err) console.log(err)