图片和icon等改为客户端根据规则自己拼接
This commit is contained in:
parent
5af0f7850d
commit
f295eb0a0a
@ -1,10 +1,8 @@
|
||||
export default {
|
||||
// apiBase: 'http://192.168.100.232',
|
||||
// apiBase: 'http://192.168.100.226',
|
||||
apiBase: 'https://ghost-test.kingsome.cn',
|
||||
hostBase: 'https://pay.kingsome.cn',
|
||||
//游戏页面根路径
|
||||
gameBase: 'http://192.168.100.232',
|
||||
version: '1.0.1',
|
||||
cdnBase: 'https://resource.kingsome.cn/emulator/v1.0.0/',
|
||||
version: '1.0.0',
|
||||
gameTypes: ['射击','格斗', '角色扮演','动作角色扮演',
|
||||
'赛车', '动作游戏','策略战棋', '其他',
|
||||
'益智游戏', '体育游戏', '冒险游戏', '模拟战略',
|
||||
|
@ -65,8 +65,11 @@
|
||||
import g from '../common/global';
|
||||
import jcEvent from '../common/jc-event';
|
||||
import zActionSheet from '../components/z-action-sheet'
|
||||
import base from '../mixins/base';
|
||||
import tips from '../mixins/tips';
|
||||
|
||||
export default class GameInfoPage extends wepy.page {
|
||||
mixins = [base, tips];
|
||||
components = {
|
||||
imageSwiper: imageSwiper,
|
||||
gameBottomBar: gameBottomBar,
|
||||
@ -80,7 +83,9 @@
|
||||
typeStr: '其他',
|
||||
tagList: [],
|
||||
score: 0,
|
||||
baseUrl: '',
|
||||
gbaUrl1: '',
|
||||
gbaUrl2: '',
|
||||
fcUrl: '',
|
||||
showAll: false,
|
||||
bottomActionCfg: {
|
||||
hide: false,
|
||||
@ -145,29 +150,23 @@
|
||||
});
|
||||
jcEvent.on(jcEvent.events.NEED_UPDATE_CFG, this, data => {
|
||||
let cfg = wepy.getStorageSync('cfg');
|
||||
this.baseUrl = cfg.game_base_url;
|
||||
this.gbaUrl1 = cfg.gbaurl1;
|
||||
this.gbaUrl2 = cfg.gbaurl2;
|
||||
this.fcUrl = cfg.fcurl;
|
||||
this.showAll = !cfg ? false : !cfg.hide_main;
|
||||
this.$apply();
|
||||
})
|
||||
jcEvent.on(jcEvent.events.BUY_ITEM_RESULT, this, data => {
|
||||
this.zActionSheetCfg.hide = true;
|
||||
if (data.success) {
|
||||
wepy.showToast({
|
||||
title: '开通成功',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
this.showToast('开通成功', 2000);
|
||||
self.record.owned = true;
|
||||
self.bottomActionCfg.mainBtnIconClass = 'icon-merge';
|
||||
self.bottomActionCfg.mainBtnTitle = '开始游戏';
|
||||
self.bottomActionCfg.primary = true;
|
||||
jcEvent.emit(jcEvent.events.UPDATE_GAME_STATUS, {gid: self.id});
|
||||
} else {
|
||||
wepy.showToast({
|
||||
title: '开通失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
this.showToast('开通失败', 2000)
|
||||
}
|
||||
self.$apply();
|
||||
});
|
||||
@ -175,7 +174,9 @@
|
||||
}
|
||||
onShow() {
|
||||
let cfg = wepy.getStorageSync('cfg');
|
||||
this.baseUrl = cfg.game_base_url;
|
||||
this.gbaUrl1 = cfg.gbaurl1;
|
||||
this.gbaUrl2 = cfg.gbaurl2;
|
||||
this.fcUrl = cfg.fcurl;
|
||||
this.showAll = !cfg ? false : !cfg.hide_main;
|
||||
this.getUserInfo();
|
||||
this.vip = this.$parent.isVip();
|
||||
@ -190,9 +191,16 @@
|
||||
http.post('/api/emulated/play_game', { gid: this.id })
|
||||
.then(res => {
|
||||
console.log('success update game history');
|
||||
// let url = `${g.gameBase}/gba/${this.id}`;
|
||||
jcEvent.emit(jcEvent.events.UPDATE_RECENT_GAMES, {});
|
||||
let url = `${this.baseUrl}/id=${this.id}`;
|
||||
let url;
|
||||
if (this.record.category === 'fc') {
|
||||
url = `${this.fcUrl}/id=${this.id}`;
|
||||
} else {
|
||||
url = `${this.gbaUrl1}/id=${this.id}`;
|
||||
if (this.record.fixed) {
|
||||
url = `${this.gbaUrl2}/id=${this.id}`;
|
||||
}
|
||||
}
|
||||
wepy.navigateTo({
|
||||
url: '/pages/game?link=' + url
|
||||
});
|
||||
@ -205,21 +213,13 @@
|
||||
try {
|
||||
let res = await http.post(`/api/emulated/buy_game`, { gid: this.id });
|
||||
if (res.errcode === 0) {
|
||||
wepy.showToast({
|
||||
title: '开通成功',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
this.showToast('开通成功', 2000);
|
||||
jcEvent.emit(jcEvent.events.UPDATE_GAME_STATUS, {gid: this.id});
|
||||
this.getRecord();
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('buy game error');
|
||||
wepy.showToast({
|
||||
title: '开通失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
this.showToast('开通失败', 2000);
|
||||
}
|
||||
}
|
||||
async getRecord() {
|
||||
@ -228,7 +228,10 @@
|
||||
let res = await http.post(`/api/emulated/game_info`, { gid: this.id });
|
||||
if (res.errcode === 0) {
|
||||
this.record = res.record;
|
||||
this.imageList = this.record.pics;
|
||||
this.record.icon = `${g.cdnBase}${this.record.gid}/1.png`;
|
||||
for(let i = 0; i < this.record.pic_count; i ++) {
|
||||
this.imageList.push(`${g.cdnBase}${this.record.gid}/${i}.png`);
|
||||
}
|
||||
if (this.record.type <= g.gameTypes.length) {
|
||||
this.typeStr = g.gameTypes[this.record.type - 1];
|
||||
}
|
||||
|
@ -50,6 +50,7 @@
|
||||
import zanLoadmore from '../components/zan-loadmore';
|
||||
import jcEvent from '../common/jc-event';
|
||||
import image from '../common/images';
|
||||
import global from '../common/global';
|
||||
|
||||
export default class Index extends wepy.page {
|
||||
mixins = [base, tips];
|
||||
@ -162,18 +163,10 @@
|
||||
})
|
||||
jcEvent.on(jcEvent.events.BUY_VIP_RESULT, this, data => {
|
||||
if (data.success) {
|
||||
wepy.showToast({
|
||||
title: '购买成功',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
this.showToast('购买成功', 2000);
|
||||
this.getUserInfo();
|
||||
} else {
|
||||
wepy.showToast({
|
||||
title: '购买失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
this.showToast('购买失败', 2000);
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -210,6 +203,9 @@
|
||||
async getRecendGames() {
|
||||
try {
|
||||
let res = await http.post('/api/emulated/recent_games');
|
||||
for(let obj of res.records) {
|
||||
obj.icon = `${global.cdnBase}${obj.gid}/1.png`;
|
||||
}
|
||||
this.recent_game_list = res.records;
|
||||
this.showRecent = this.recent_game_list.length > 0;
|
||||
this.$apply();
|
||||
@ -220,6 +216,9 @@
|
||||
async getMyGames() {
|
||||
try {
|
||||
let res = await http.post('/api/emulated/my_games');
|
||||
for(let obj of res.records) {
|
||||
obj.icon = `${global.cdnBase}${obj.gid}/1.png`;
|
||||
}
|
||||
this.my_game_list = res.records;
|
||||
this.showMyGame = this.my_game_list.length > 0;
|
||||
this.$apply();
|
||||
@ -272,6 +271,8 @@
|
||||
}
|
||||
self.current += 10;
|
||||
for (let obj of res.records) {
|
||||
(obj.open) && (obj.owned = true);
|
||||
obj.icon = `${global.cdnBase}${obj.gid}/1.png`;
|
||||
self.records.push(obj);
|
||||
}
|
||||
self.loading = false;
|
||||
|
@ -179,6 +179,8 @@
|
||||
}
|
||||
self.current += 10;
|
||||
for (let obj of res.records) {
|
||||
(obj.open) && (obj.owned = true);
|
||||
obj.icon = `${global.cdnBase}${obj.gid}/1.png`;
|
||||
self.records.push(obj);
|
||||
}
|
||||
self.loading = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user