修改首页错误提示

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