Commit 44820500 by 穆启卓

1

parent 7cbece87
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
height: 148rpx; height: 148rpx;
border-radius: 50%; border-radius: 50%;
margin-top: 100rpx; margin-top: 100rpx;
background: #000;
} }
.app-name { .app-name {
font-size: 36rpx; font-size: 36rpx;
......
<navbar showHome="{{false}}" navTitle="{{navTitle}}" navColor="#fff"></navbar> <navbar showHome="{{false}}" navTitle="{{navTitle}}" navColor="#fff"></navbar>
<view class="page-container"> <view class="page-container">
<view class="app-logo"></view> <image class="app-logo" src="/images/authorization/logo.png"></image>
<view class="app-name">步步运动赚</view> <view class="app-name">步步运动赚</view>
<view class="title">请允许步步运动赚获取以下权限</view> <view class="title">请允许步步运动赚获取以下权限</view>
<view class="explain">以下信息仅用于您登录步步运动赚,我们将严格保密绝不外泄,更不会对您发送垃圾信息造成骚扰</view> <view class="explain">以下信息仅用于您登录步步运动赚,我们将严格保密绝不外泄,更不会对您发送垃圾信息造成骚扰</view>
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
height: 148rpx; height: 148rpx;
border-radius: 50%; border-radius: 50%;
margin-top: 100rpx; margin-top: 100rpx;
background: #000;
} }
.page-container .app-name { .page-container .app-name {
font-size: 36rpx; font-size: 36rpx;
......
...@@ -3,6 +3,7 @@ let app = getApp(); ...@@ -3,6 +3,7 @@ let app = getApp();
Page({ Page({
data: { data: {
userAuth: false, // 用户信息授权(为了拿unionId) userAuth: false, // 用户信息授权(为了拿unionId)
unionAuth: false, // unionId授权: 如果为false是需要授权,true是不需要
stepAuth: false, // 步数授权 stepAuth: false, // 步数授权
// commitStepPopupShow: false, // 同步步数成功弹窗 // commitStepPopupShow: false, // 同步步数成功弹窗
activityExplainShow: false, // 活动说明弹窗 activityExplainShow: false, // 活动说明弹窗
...@@ -13,9 +14,11 @@ Page({ ...@@ -13,9 +14,11 @@ Page({
isFirstReq: true isFirstReq: true
}, },
onShow() { onLoad() {
this.getPageData(); this.getPageData();
}, },
onShow() {
},
getPageData() { getPageData() {
// 1、第一步,先判断用户信息和步数是否授过权 // 1、第一步,先判断用户信息和步数是否授过权
...@@ -36,6 +39,7 @@ Page({ ...@@ -36,6 +39,7 @@ Page({
// 视图层数据赋值 // 视图层数据赋值
this.setData({ this.setData({
userAuth: app.globalData.userAuth, userAuth: app.globalData.userAuth,
unionAuth: app.globalData.unionAuth,
stepAuth: app.globalData.stepAuth stepAuth: app.globalData.stepAuth
}); });
if (app.globalData.unionAuth && app.globalData.stepAuth) { if (app.globalData.unionAuth && app.globalData.stepAuth) {
...@@ -108,6 +112,10 @@ Page({ ...@@ -108,6 +112,10 @@ Page({
} }
} }
}); });
},
fail:(err) => {
console.log(err)
this.getWeRunDataFail(err);
} }
}); });
}, },
...@@ -211,11 +219,24 @@ Page({ ...@@ -211,11 +219,24 @@ Page({
}); });
}, },
fail:(err) => { fail:(err) => {
this.authorizationFail(); console.log(err)
this.getWeRunDataFail(err);
} }
}); });
}, },
// 获取微信步数失败处理,包括未授权、设备不支持等
getWeRunDataFail(err) {
if ('device not support'.indexOf(err)) {
wx.showModal({
content: '设备不支持',
showCancel: false
});
} else {
this.authorizationFail();
}
},
// 显示隐藏用户信息授权弹框 // 显示隐藏用户信息授权弹框
showUserInfoPopup() { showUserInfoPopup() {
this.setData({ this.setData({
...@@ -251,6 +272,9 @@ Page({ ...@@ -251,6 +272,9 @@ Page({
success:myres => { success:myres => {
if (myres.data.code === 0) { if (myres.data.code === 0) {
app.globalData.unionAuth = true; app.globalData.unionAuth = true;
this.setData({
unionAuth: app.globalData.unionAuth
});
app.globalData.userInfo = myres.data.data; app.globalData.userInfo = myres.data.data;
app.globalData.token = myres.data.data.token; app.globalData.token = myres.data.data.token;
this.getClickStepData(); this.getClickStepData();
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
<image class="explain" src="/images/index/sy_shuoming.png" bindtap="changeActivityExplainShow"></image> <image class="explain" src="/images/index/sy_shuoming.png" bindtap="changeActivityExplainShow"></image>
<view class="today-step-info" bindtap="clickStepData"> <view class="today-step-info" bindtap="clickStepData">
<image class="today-step-info-bg" src="/images/index/sy_ybp.png"></image> <image class="today-step-info-bg" src="/images/index/sy_ybp.png"></image>
<block wx:if="{{currentSteps}}"> <block wx:if="{{stepAuth}}">
<view class="info-title">今日步数</view> <view class="info-title">今日步数</view>
<view class="today-step-num">{{currentSteps}}</view> <view class="today-step-num">{{currentSteps}}</view>
</block> </block>
<view class="info-title" style="margin-top: 200rpx" wx:else>点此获取步数数据</view> <view class="info-title" style="margin-top: 200rpx" wx:else>点此获取步数数据</view>
</view> </view>
<view class="get-info-btn" bindtap="clickStepData">{{userAuth&&stepAuth?'提交步数打卡':'获取步数记录'}}</view> <view class="get-info-btn" bindtap="clickStepData">{{unionAuth&&stepAuth?'提交步数打卡':'获取步数记录'}}</view>
<view class="step-progress-container" wx:if="{{currentSteps && targetSteps}}"> <view class="step-progress-container" wx:if="{{targetSteps}}">
<view class="today-status">进行中</view> <view class="today-status">进行中</view>
<view class="today-progress">{{currentSteps}}/{{targetSteps}}<text>步</text></view> <view class="today-progress">{{currentSteps}}/{{targetSteps}}<text>步</text></view>
</view> </view>
......
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