Commit c82fc79e by 穆启卓

步数组队加广告

parent 5d672834
...@@ -54,6 +54,7 @@ App({ ...@@ -54,6 +54,7 @@ App({
userAuth: false, // 用户信息授权(为了拿unionId) userAuth: false, // 用户信息授权(为了拿unionId)
unionAuth: false, // unionId授权: 如果为false是需要授权,true是不需要 unionAuth: false, // unionId授权: 如果为false是需要授权,true是不需要
stepAuth: false, // 步数授权 stepAuth: false, // 步数授权
iphoneX: '', // 手机类型,例如‘iPhone x’
}, },
onLaunch(options) { onLaunch(options) {
...@@ -157,6 +158,7 @@ App({ ...@@ -157,6 +158,7 @@ App({
app.globalData.platform = info.platform app.globalData.platform = info.platform
app.globalData.sWidth = info.screenWidth app.globalData.sWidth = info.screenWidth
app.globalData.wHeight = info.windowHeight app.globalData.wHeight = info.windowHeight
app.globalData.iphoneX = info.model.indexOf('iPhone X') > -1;
if (info.screenHeight / info.screenWidth >= 812 / 375) { if (info.screenHeight / info.screenWidth >= 812 / 375) {
app.globalData.ifIphoneX = true app.globalData.ifIphoneX = true
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
// const host = 'miniapp-testapi.wxatech.com'; // const host = 'miniapp-testapi.wxatech.com';
const host = 'miniapp-api.wxatech.com'; const host = 'miniapp-api.wxatech.com';
const content = 'game-bsdk'; // 步数打卡 // const content = 'game-bsdk'; // 步数打卡
// const content = 'game-team_walk'; // 组队打卡 const content = 'game-team_walk'; // 组队打卡
let appName = ''; let appName = '';
let appTitle = ''; let appTitle = '';
......
...@@ -24,6 +24,7 @@ Page({ ...@@ -24,6 +24,7 @@ Page({
appTitle: '', appTitle: '',
bottomAdId: '', bottomAdId: '',
videoAdId: '', videoAdId: '',
iphoneX: '',
}, },
onShow() { onShow() {
...@@ -37,7 +38,8 @@ Page({ ...@@ -37,7 +38,8 @@ Page({
this.setData({ this.setData({
scene: app.globalData.scene, scene: app.globalData.scene,
appName: config.appName, appName: config.appName,
appTitle: config.appTitle appTitle: config.appTitle,
iphoneX: app.globalData.iphoneX
}); });
this.getAdId(); this.getAdId();
}, },
...@@ -617,27 +619,19 @@ Page({ ...@@ -617,27 +619,19 @@ Page({
method: 'POST', method: 'POST',
success: res2 => { success: res2 => {
if (res2.data.code === 0) { if (res2.data.code === 0) {
if (this.data.targetSteps) { wx.showToast({
wx.showToast({ title: '视频错误,请尝试其他方式赚取步数',
title: '视频错误,请尝试其他方式赚取步数', icon: 'none',
icon: 'none', duration: 2000
duration: 2000 });
}); this.data.bubbleList.forEach(item => {
this.data.bubbleList.forEach(item => { if (item.task_type === 2) {
if (item.task_type === 2) { item.can_watch = false;
item.can_watch = false; }
} });
}); this.setData({
this.setData({ bubbleList: this.data.bubbleList
bubbleList: this.data.bubbleList });
});
} else {
wx.showToast({
title: '报名后将获取步数',
icon: 'none',
duration: 2000
});
}
} }
} }
}); });
...@@ -656,30 +650,26 @@ Page({ ...@@ -656,30 +650,26 @@ Page({
method: 'POST', method: 'POST',
success: res2 => { success: res2 => {
if (res2.data.code === 0) { if (res2.data.code === 0) {
let earnStep = 0;
this.data.bubbleList.forEach(item => {
if (item.task_type === 2) {
earnStep = item.bonus_step;
}
});
this.setData({
bubbleList: this.data.bubbleList
});
if (this.data.targetSteps) { if (this.data.targetSteps) {
wx.showToast({
title: '获取步数成功',
icon: 'none',
duration: 2000
});
let earnStep = 0;
this.data.bubbleList.forEach(item => {
if (item.task_type === 2) {
item.can_watch = false;
earnStep = item.bonus_step;
}
});
this.setData({
bubbleList: this.data.bubbleList
});
this.dynamicDrawCanvas(this.data.currentSteps + earnStep, this.data.targetSteps / 300); this.dynamicDrawCanvas(this.data.currentSteps + earnStep, this.data.targetSteps / 300);
} else { } else {
wx.showToast({ this.setData({
title: '报名后将获取步数', currentSteps: this.data.currentSteps + earnStep
icon: 'none',
duration: 2000
}); });
} }
wx.showModal({
content: `恭喜增加${earnStep}步数成功`,
showCancel: false
});
} }
} }
}); });
......
...@@ -55,9 +55,7 @@ ...@@ -55,9 +55,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="ad-container" wx:if="{{bottomAdId}}"> <ad class="ad-container" style="{{iphoneX ? 'bottom: 42rpx;' : ''}}" wx:if="{{bottomAdId}}" unit-id="{{bottomAdId}}" binderror="bindAdError" bindclose="bindAdClose"></ad>
<ad unit-id="{{bottomAdId}}" binderror="bindAdError" bindclose="bindAdClose"></ad>
</view>
<!-- 活动说明弹窗 --> <!-- 活动说明弹窗 -->
<view class="activity-explain-popup-bg" catchtouchmove wx:if="{{activityExplainShow}}"> <view class="activity-explain-popup-bg" catchtouchmove wx:if="{{activityExplainShow}}">
<view class="activity-explain-popup-container"> <view class="activity-explain-popup-container">
......
...@@ -239,9 +239,10 @@ page { ...@@ -239,9 +239,10 @@ page {
} }
.ad-container { .ad-container {
height: 252rpx; height: 252rpx;
padding: 0 30rpx;
box-sizing: border-box;
position: fixed; position: fixed;
left: 0; left: 0;
right: 0;
bottom: 0; bottom: 0;
} }
.ad-container ad { .ad-container ad {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.6.6", "libVersion": "2.6.6",
"appid": "wx035eac0d4d63b3e4", "appid": "wx41d6ac4f57b878d2",
"projectname": "walk_daka", "projectname": "walk_daka",
"debugOptions": { "debugOptions": {
"hidedInDevtools": [] "hidedInDevtools": []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment