增加vip的显示和玩游戏机制
This commit is contained in:
parent
862c21d47d
commit
16abf40b39
@ -46,7 +46,8 @@ export default class extends wepy.app {
|
|||||||
|
|
||||||
globalData = {
|
globalData = {
|
||||||
userInfo: null,
|
userInfo: null,
|
||||||
gameToken: null
|
gameToken: null,
|
||||||
|
vip: false
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
@ -174,5 +175,11 @@ export default class extends wepy.app {
|
|||||||
showAll() {
|
showAll() {
|
||||||
return this.globalData.showAll;
|
return this.globalData.showAll;
|
||||||
}
|
}
|
||||||
|
isVip() {
|
||||||
|
return this.globalData.vip;
|
||||||
|
}
|
||||||
|
updateVip(vip) {
|
||||||
|
this.globalData.vip = vip;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export default {
|
export default {
|
||||||
// apiBase: 'http://192.168.100.232',
|
apiBase: 'http://192.168.100.232',
|
||||||
apiBase: 'https://ghost-test.kingsome.cn',
|
// apiBase: 'https://ghost-test.kingsome.cn',
|
||||||
hostBase: 'https://pay.kingsome.cn',
|
hostBase: 'https://pay.kingsome.cn',
|
||||||
//游戏页面根路径
|
//游戏页面根路径
|
||||||
gameBase: 'http://192.168.100.232',
|
gameBase: 'http://192.168.100.232',
|
||||||
|
File diff suppressed because one or more lines are too long
@ -86,7 +86,8 @@
|
|||||||
primary: false,
|
primary: false,
|
||||||
secondBtnIconClass: 'icon-coin-yen',
|
secondBtnIconClass: 'icon-coin-yen',
|
||||||
secondBtnTitle: '领取金币'
|
secondBtnTitle: '领取金币'
|
||||||
}
|
},
|
||||||
|
vip: false
|
||||||
};
|
};
|
||||||
methods = {
|
methods = {
|
||||||
imageTap: function(index) {
|
imageTap: function(index) {
|
||||||
@ -116,6 +117,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
onLoad(params) {
|
onLoad(params) {
|
||||||
|
this.vip = this.$parent.isVip();
|
||||||
this.id = decodeURIComponent(params.id);
|
this.id = decodeURIComponent(params.id);
|
||||||
this.showAll = this.$parent.showAll();
|
this.showAll = this.$parent.showAll();
|
||||||
console.log(this.id);
|
console.log(this.id);
|
||||||
@ -144,6 +146,8 @@
|
|||||||
this.baseUrl = cfg.game_base_url;
|
this.baseUrl = cfg.game_base_url;
|
||||||
this.showAll = !cfg ? false : !cfg.hide_main;
|
this.showAll = !cfg ? false : !cfg.hide_main;
|
||||||
this.getUserInfo();
|
this.getUserInfo();
|
||||||
|
this.vip = this.$parent.isVip();
|
||||||
|
this.$apply();
|
||||||
}
|
}
|
||||||
async showBuyMenu() {
|
async showBuyMenu() {
|
||||||
let self = this;
|
let self = this;
|
||||||
@ -217,7 +221,7 @@
|
|||||||
if (this.record.type <= g.gameTypes.length) {
|
if (this.record.type <= g.gameTypes.length) {
|
||||||
this.typeStr = g.gameTypes[this.record.type - 1];
|
this.typeStr = g.gameTypes[this.record.type - 1];
|
||||||
}
|
}
|
||||||
if (this.record.owned) {
|
if (this.record.owned || this.vip) {
|
||||||
this.bottomActionCfg.mainBtnIconClass = 'icon-merge';
|
this.bottomActionCfg.mainBtnIconClass = 'icon-merge';
|
||||||
this.bottomActionCfg.mainBtnTitle = '开始游戏';
|
this.bottomActionCfg.mainBtnTitle = '开始游戏';
|
||||||
this.bottomActionCfg.primary = true;
|
this.bottomActionCfg.primary = true;
|
||||||
|
@ -6,13 +6,19 @@
|
|||||||
<view class="top-view">
|
<view class="top-view">
|
||||||
<view class="userinfo">
|
<view class="userinfo">
|
||||||
<view class="userinfo-user">
|
<view class="userinfo-user">
|
||||||
<image class="userinfo-avatar" src="{{avatar}}"/>
|
<image class="userinfo-avatar" src="{{avatar}}"/>
|
||||||
<view class="userinfo-nickname">{{ nickname }}</view>
|
<view class="userinfo-nickname">{{ nickname }}</view>
|
||||||
|
<view class="vip-view">
|
||||||
|
<image src="{{vipImg}}"></image>
|
||||||
|
<text class="vip-expire-txt">{{expire_str}}</text>
|
||||||
|
<view class="vip-btn zan-btn zan-btn--mini zan-btn--primary zan-btn--plain button-hover {{vip_btn_title ? '' : 'hidden'}}" @tap="buy_vip">
|
||||||
|
{{vip_btn_title}}</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="userinfo-score {{showAll? '' : 'hidden'}}">金币: {{score}}</view>
|
<view class="userinfo-score {{showAll? '' : 'hidden'}}">金币: {{score}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<myGame class="{{(showAll && showMyGame)? '' : 'hidden'}}" :gameList.sync="my_game_list" title="我的游戏" @gameCellTap.user="gameTap"></myGame>
|
<myGame class="{{(showAll && showMyGame && !vip)? '' : 'hidden'}}" :gameList.sync="my_game_list" title="我的游戏" @gameCellTap.user="gameTap"></myGame>
|
||||||
<recentGame class="{{(showAll && showRecent)? '' : 'hidden'}}" :gameList.sync="recent_game_list" title="最近在玩" @gameCellTap.user="gameTap"></recentGame>
|
<recentGame class="{{(showAll && showRecent)? '' : 'hidden'}}" :gameList.sync="recent_game_list" title="最近在玩" @gameCellTap.user="gameTap"></recentGame>
|
||||||
<view class="list-title">
|
<view class="list-title">
|
||||||
<view class="left"><i class="icon-bookmark"></i> 热门游戏</view>
|
<view class="left"><i class="icon-bookmark"></i> 热门游戏</view>
|
||||||
@ -36,6 +42,7 @@
|
|||||||
import recentGame from '../components/recent-game';
|
import recentGame from '../components/recent-game';
|
||||||
import zanLoadmore from '../components/zan-loadmore';
|
import zanLoadmore from '../components/zan-loadmore';
|
||||||
import jcEvent from '../common/jc-event';
|
import jcEvent from '../common/jc-event';
|
||||||
|
import image from '../common/images';
|
||||||
|
|
||||||
export default class Index extends wepy.page {
|
export default class Index extends wepy.page {
|
||||||
mixins = [base, tips];
|
mixins = [base, tips];
|
||||||
@ -65,7 +72,11 @@
|
|||||||
noMore: false,
|
noMore: false,
|
||||||
showAll: false,
|
showAll: false,
|
||||||
showRecent: false,
|
showRecent: false,
|
||||||
showMyGame: false
|
showMyGame: false,
|
||||||
|
vip: false,
|
||||||
|
expire_str: '',
|
||||||
|
vipImg: image.vip_s,
|
||||||
|
vip_btn_title: '激活'
|
||||||
};
|
};
|
||||||
|
|
||||||
methods = {
|
methods = {
|
||||||
@ -78,6 +89,8 @@
|
|||||||
wepy.navigateTo({
|
wepy.navigateTo({
|
||||||
url: '/pages/search'
|
url: '/pages/search'
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
buy_vip() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -195,7 +208,28 @@
|
|||||||
let res = await http.post('/api/emulated/user_info', {type: 'all'});
|
let res = await http.post('/api/emulated/user_info', {type: 'all'});
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if (res.userInfo) {
|
if (res.userInfo) {
|
||||||
this.score = res.userInfo.score;
|
let user = res.userInfo;
|
||||||
|
this.score = user.score;
|
||||||
|
this.vip = user.vip;
|
||||||
|
this.$parent.updateVip(user.vip);
|
||||||
|
if (user.vip) {
|
||||||
|
this.vipImg = image.vip;
|
||||||
|
if (user.vip_expire_day === 99999) {
|
||||||
|
this.expire_str = '(永久)';
|
||||||
|
this.vip_btn_title = '';
|
||||||
|
} else if (user.vip_expire_day === 0){
|
||||||
|
this.expire_str = '(不到1天)';
|
||||||
|
this.vip_btn_title = '续费';
|
||||||
|
} else {
|
||||||
|
this.expire_str = `(${user.vip_expire_day}天)`;
|
||||||
|
this.vip_btn_title = '续费';
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.vip_btn_title = '激活';
|
||||||
|
this.vipImg = image.vip_s;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$apply();
|
this.$apply();
|
||||||
|
@ -69,3 +69,20 @@ page {
|
|||||||
font-size:18px;
|
font-size:18px;
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
}
|
}
|
||||||
|
.vip-view{
|
||||||
|
margin-left: 10rpx;
|
||||||
|
display:flex;
|
||||||
|
align-items:center;
|
||||||
|
|
||||||
|
}
|
||||||
|
.vip-view image{
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
.vip-view .vip-expire-txt {
|
||||||
|
color: #aaa;
|
||||||
|
font-size: 10px;
|
||||||
|
margin-left: 8px;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user