跳转到广告游戏时,获取最新的分享人数

This commit is contained in:
zhl 2019-03-04 12:19:01 +08:00
parent 0d71b0a182
commit baa020f8cb
5 changed files with 42 additions and 8 deletions

View File

@ -193,5 +193,8 @@ export default class extends wepy.app {
updateVip(vip) { updateVip(vip) {
this.globalData.vip = vip; this.globalData.vip = vip;
} }
getShareCount(cb) {
sdkManage.getAchievInviteeNum(cb);
}
} }
</script> </script>

View File

@ -151,7 +151,7 @@ var SDKManage = function() {
} }
} }
if (cb) { if (cb) {
cb(); cb(invitee_nums);
} }
}; };
jcshare.getAchievInviteeNum(callback); jcshare.getAchievInviteeNum(callback);
@ -167,7 +167,7 @@ var SDKManage = function() {
this.logincbarr = [ this.logincbarr = [
this.gamelogin.bind(this), this.gamelogin.bind(this),
// this.wxGetUseInfo.bind(this), // this.wxGetUseInfo.bind(this),
// this.checkSharedata.bind(this), this.checkSharedata.bind(this),
// redis 配置 // redis 配置
this.getGameConfig.bind(this) this.getGameConfig.bind(this)
// 获取分享配置 // 获取分享配置

View File

@ -127,7 +127,7 @@
}, },
actionSheetGold() { actionSheetGold() {
if (this.score < this.record.score) { if (this.score < this.record.score) {
this.requestAd('金币不足, ') this.requestAd('金币不足')
} else { } else {
this.buyGame(); this.buyGame();
} }

View File

@ -290,5 +290,29 @@
this.noData = false; this.noData = false;
this.noMore = true; this.noMore = true;
} }
onShareAppMessage() {
let self = this;
let account = wepy.getStorageSync('account');
return {
title: '来玩啊',
path: `/pages/index?isShare=1&inviter_id=${account.account_id}`,
imageUrl: 'https://resource.kingsome.cn/dalmatian/wapp/share.jpg',
success: function (res) {
wepy.getShareInfo({
shareTicket: res.shareTickets[0]
})
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err)
})
},
fail: function (res) {
// 分享失败
console.log(res)
}
}
}
} }
</script> </script>

View File

@ -28,10 +28,11 @@
padding: 10px; padding: 10px;
font-size:18px; font-size:18px;
color:#777; color:#777;
flex-flow:column;
line-height:32px;
} }
.msg-action-bar { .msg-action-bar {
height: 80rpx; height: 100rpx;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
border-top: 1rpx solid #e5e5e5; border-top: 1rpx solid #e5e5e5;
@ -57,7 +58,8 @@
<view class="background-view"></view> <view class="background-view"></view>
<view class="msg-box"> <view class="msg-box">
<view class="msg-title"> <view class="msg-title">
<text>{{text}}是否跳转到爆冰达人,领取3金币</text> <text>{{text}}</text>
<text>是否跳转到爆冰达人,领取3金币</text>
</view> </view>
<view class="msg-action-bar"> <view class="msg-action-bar">
<view class="msg-action-btn" @tap="cancel"><text>取消</text></view> <view class="msg-action-btn" @tap="cancel"><text>取消</text></view>
@ -66,7 +68,7 @@
target="miniProgram" target="miniProgram"
open-type="navigate" open-type="navigate"
app-id="wxc02bad35ad26165e" app-id="wxc02bad35ad26165e"
path="?aid={{aid}}&version=product&share_count=0" path="?aid={{aid}}&version=product&share_count={{shareCount}}"
extra-data="" extra-data=""
version="release" version="release"
> >
@ -87,7 +89,8 @@
components = {}; components = {};
data = { data = {
text: '', text: '',
aid: '11' aid: '11',
shareCount: 0
}; };
methods = { methods = {
cancel: function() { cancel: function() {
@ -99,6 +102,10 @@
this.text = decodeURIComponent(params.text); this.text = decodeURIComponent(params.text);
this.aid = decodeURIComponent(params.aid); this.aid = decodeURIComponent(params.aid);
console.log(`aid : ${this.aid}`); console.log(`aid : ${this.aid}`);
let self = this;
this.$parent.getShareCount(count => {
self.shareCount = count;
});
this.$apply(); this.$apply();
} }