增加vip的显示和玩游戏机制
This commit is contained in:
parent
862c21d47d
commit
16abf40b39
@ -46,7 +46,8 @@ export default class extends wepy.app {
|
||||
|
||||
globalData = {
|
||||
userInfo: null,
|
||||
gameToken: null
|
||||
gameToken: null,
|
||||
vip: false
|
||||
}
|
||||
|
||||
constructor () {
|
||||
@ -174,5 +175,11 @@ export default class extends wepy.app {
|
||||
showAll() {
|
||||
return this.globalData.showAll;
|
||||
}
|
||||
isVip() {
|
||||
return this.globalData.vip;
|
||||
}
|
||||
updateVip(vip) {
|
||||
this.globalData.vip = vip;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -1,6 +1,6 @@
|
||||
export default {
|
||||
// apiBase: 'http://192.168.100.232',
|
||||
apiBase: 'https://ghost-test.kingsome.cn',
|
||||
apiBase: 'http://192.168.100.232',
|
||||
// apiBase: 'https://ghost-test.kingsome.cn',
|
||||
hostBase: 'https://pay.kingsome.cn',
|
||||
//游戏页面根路径
|
||||
gameBase: 'http://192.168.100.232',
|
||||
|
File diff suppressed because one or more lines are too long
@ -86,7 +86,8 @@
|
||||
primary: false,
|
||||
secondBtnIconClass: 'icon-coin-yen',
|
||||
secondBtnTitle: '领取金币'
|
||||
}
|
||||
},
|
||||
vip: false
|
||||
};
|
||||
methods = {
|
||||
imageTap: function(index) {
|
||||
@ -116,6 +117,7 @@
|
||||
};
|
||||
|
||||
onLoad(params) {
|
||||
this.vip = this.$parent.isVip();
|
||||
this.id = decodeURIComponent(params.id);
|
||||
this.showAll = this.$parent.showAll();
|
||||
console.log(this.id);
|
||||
@ -144,6 +146,8 @@
|
||||
this.baseUrl = cfg.game_base_url;
|
||||
this.showAll = !cfg ? false : !cfg.hide_main;
|
||||
this.getUserInfo();
|
||||
this.vip = this.$parent.isVip();
|
||||
this.$apply();
|
||||
}
|
||||
async showBuyMenu() {
|
||||
let self = this;
|
||||
@ -217,7 +221,7 @@
|
||||
if (this.record.type <= g.gameTypes.length) {
|
||||
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.mainBtnTitle = '开始游戏';
|
||||
this.bottomActionCfg.primary = true;
|
||||
|
@ -6,13 +6,19 @@
|
||||
<view class="top-view">
|
||||
<view class="userinfo">
|
||||
<view class="userinfo-user">
|
||||
<image class="userinfo-avatar" src="{{avatar}}"/>
|
||||
<view class="userinfo-nickname">{{ nickname }}</view>
|
||||
<image class="userinfo-avatar" src="{{avatar}}"/>
|
||||
<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 class="userinfo-score {{showAll? '' : 'hidden'}}">金币: {{score}}</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>
|
||||
<view class="list-title">
|
||||
<view class="left"><i class="icon-bookmark"></i> 热门游戏</view>
|
||||
@ -36,6 +42,7 @@
|
||||
import recentGame from '../components/recent-game';
|
||||
import zanLoadmore from '../components/zan-loadmore';
|
||||
import jcEvent from '../common/jc-event';
|
||||
import image from '../common/images';
|
||||
|
||||
export default class Index extends wepy.page {
|
||||
mixins = [base, tips];
|
||||
@ -65,7 +72,11 @@
|
||||
noMore: false,
|
||||
showAll: false,
|
||||
showRecent: false,
|
||||
showMyGame: false
|
||||
showMyGame: false,
|
||||
vip: false,
|
||||
expire_str: '',
|
||||
vipImg: image.vip_s,
|
||||
vip_btn_title: '激活'
|
||||
};
|
||||
|
||||
methods = {
|
||||
@ -78,6 +89,8 @@
|
||||
wepy.navigateTo({
|
||||
url: '/pages/search'
|
||||
})
|
||||
},
|
||||
buy_vip() {
|
||||
}
|
||||
};
|
||||
|
||||
@ -195,7 +208,28 @@
|
||||
let res = await http.post('/api/emulated/user_info', {type: 'all'});
|
||||
console.log(res);
|
||||
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();
|
||||
|
@ -69,3 +69,20 @@ page {
|
||||
font-size:18px;
|
||||
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