Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
walk_daka_wx
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
穆启卓
walk_daka_wx
Commits
14f061ce
Commit
14f061ce
authored
Apr 11, 2019
by
穆启卓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
授权页加了个直接去setting页的按钮,
二维码进小程序弹窗加了个取消按钮, 改了个授权步数没显示的bug
parent
90225ba4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
41 deletions
+70
-41
authorization.js
pages/authorization/authorization.js
+61
-37
authorization.wxml
pages/authorization/authorization.wxml
+3
-1
index.js
pages/index/index.js
+4
-1
index.wxml
pages/index/index.wxml
+1
-1
project.config.json
project.config.json
+1
-1
No files found.
pages/authorization/authorization.js
View file @
14f061ce
...
@@ -3,13 +3,67 @@ let getAuthLoading = false;
...
@@ -3,13 +3,67 @@ let getAuthLoading = false;
Page
({
Page
({
data
:
{
data
:
{
userAuth
:
false
,
userAuth
:
false
,
stepAuth
:
false
stepAuth
:
false
,
stepGoSetting
:
true
,
// 步数授权是否变成直接去openSetting页的按钮
},
},
onLoad
()
{
onLoad
()
{
wx
.
getSetting
({
success
:(
res
)
=>
{
// 用户信息是否授权
if
(
res
.
authSetting
[
'scope.userInfo'
])
{
// 已授权
app
.
globalData
.
userAuth
=
true
;
}
else
{
// 未授权
app
.
globalData
.
userAuth
=
false
;
}
// 微信步数是否授权
let
stepGoSetting
=
true
;
if
(
res
.
authSetting
[
'scope.werun'
]
===
undefined
)
{
// 未弹出过授权
app
.
globalData
.
stepAuth
=
false
;
stepGoSetting
=
false
;
}
else
if
(
res
.
authSetting
[
'scope.werun'
]
===
false
)
{
// 拒绝过授权
app
.
globalData
.
stepAuth
=
false
;
}
else
if
(
res
.
authSetting
[
'scope.werun'
]
===
true
)
{
// 已授权
app
.
globalData
.
stepAuth
=
true
;
}
else
{
// 未知情况
app
.
globalData
.
stepAuth
=
false
;
}
this
.
setData
({
this
.
setData
({
userAuth
:
app
.
globalData
.
userAuth
,
userAuth
:
app
.
globalData
.
userAuth
,
stepAuth
:
app
.
globalData
.
stepAuth
stepAuth
:
app
.
globalData
.
stepAuth
,
stepGoSetting
:
stepGoSetting
});
}
});
},
goSetting
()
{
wx
.
openSetting
({
success
:(
res
)
=>
{
if
(
res
.
authSetting
[
'scope.userInfo'
])
{
app
.
globalData
.
userAuth
=
true
;
this
.
setData
({
userAuth
:
true
});
}
else
{
app
.
globalData
.
userAuth
=
false
;
this
.
setData
({
userAuth
:
false
});
}
if
(
res
.
authSetting
[
'scope.werun'
])
{
app
.
globalData
.
stepAuth
=
true
;
this
.
setData
({
stepAuth
:
true
});
}
else
{
app
.
globalData
.
stepAuth
=
false
;
this
.
setData
({
stepAuth
:
false
});
}
this
.
checkAuth
();
}
});
});
},
},
...
@@ -25,9 +79,10 @@ Page({
...
@@ -25,9 +79,10 @@ Page({
this
.
checkAuth
();
this
.
checkAuth
();
}
else
{
}
else
{
console
.
log
(
'getUserAuth:fail'
,
event
)
console
.
log
(
'getUserAuth:fail'
,
event
)
wx
.
showModal
({
wx
.
showToast
({
content
:
'授权失败,请重新点击按钮发起授权'
,
title
:
'授权失败,请重新点击按钮发起授权'
,
showCancel
:
false
icon
:
'none'
,
duration
:
1500
});
});
}
}
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -48,39 +103,8 @@ Page({
...
@@ -48,39 +103,8 @@ Page({
this
.
checkAuth
();
this
.
checkAuth
();
},
},
fail
:()
=>
{
fail
:()
=>
{
// 调起用户授权窗口失败,因为用户曾经拒绝过,而且在这里不能直接去到openSetting页,需要通过一个弹窗中转过去
wx
.
showModal
({
content
:
'授权失败,请在接下来的页面中同意授权'
,
showCancel
:
false
,
success
:()
=>
{
wx
.
openSetting
({
success
:(
res
)
=>
{
if
(
res
.
authSetting
[
'scope.userInfo'
])
{
app
.
globalData
.
userAuth
=
true
;
this
.
setData
({
userAuth
:
true
});
}
else
{
app
.
globalData
.
userAuth
=
false
;
this
.
setData
({
userAuth
:
false
});
}
if
(
res
.
authSetting
[
'scope.werun'
])
{
app
.
globalData
.
stepAuth
=
true
;
this
.
setData
({
this
.
setData
({
stepAuth
:
true
stepGoSetting
:
true
});
}
else
{
app
.
globalData
.
stepAuth
=
false
;
this
.
setData
({
stepAuth
:
false
});
}
this
.
checkAuth
();
}
});
}
});
});
},
},
complete
:
()
=>
{
complete
:
()
=>
{
...
...
pages/authorization/authorization.wxml
View file @
14f061ce
...
@@ -19,5 +19,6 @@
...
@@ -19,5 +19,6 @@
</view>
</view>
</view>
</view>
<button class="authorization-btn clear-btn" plain open-type="getUserInfo" bindgetuserinfo="getUserAuth" wx:if="{{!userAuth}}">第一步,授权公开信息</button>
<button class="authorization-btn clear-btn" plain open-type="getUserInfo" bindgetuserinfo="getUserAuth" wx:if="{{!userAuth}}">第一步,授权公开信息</button>
<view class="authorization-btn" bindtap="getStepAuth" wx:elif="{{!stepAuth}}">第二步,授权微信运动步数</view>
<view class="authorization-btn" bindtap="getStepAuth" wx:elif="{{!stepAuth && !stepGoSetting}}">第二步,授权微信运动步数</view>
<view class="authorization-btn" bindtap="goSetting" wx:elif="{{!stepAuth && stepGoSetting}}">第二步,授权微信运动步数</view>
</view>
</view>
\ No newline at end of file
pages/index/index.js
View file @
14f061ce
...
@@ -16,7 +16,7 @@ Page({
...
@@ -16,7 +16,7 @@ Page({
scene
:
1001
scene
:
1001
},
},
on
Load
()
{
on
Show
()
{
this
.
setData
({
this
.
setData
({
scene
:
app
.
globalData
.
scene
scene
:
app
.
globalData
.
scene
});
});
...
@@ -138,6 +138,9 @@ Page({
...
@@ -138,6 +138,9 @@ Page({
scope
:
'scope.werun'
,
scope
:
'scope.werun'
,
success
:()
=>
{
// 授权成功
success
:()
=>
{
// 授权成功
app
.
globalData
.
stepAuth
=
true
;
app
.
globalData
.
stepAuth
=
true
;
this
.
setData
({
stepAuth
:
true
});
if
(
reCheck
)
{
if
(
reCheck
)
{
this
.
data
.
reCheck
=
true
;
this
.
data
.
reCheck
=
true
;
this
.
clickStepData
();
this
.
clickStepData
();
...
...
pages/index/index.wxml
View file @
14f061ce
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
<view class="popup-content" wx:if="{{scene === 1048}}">{{currentSteps>=targetSteps?'恭喜你今日步数已达标,将返回比赛详情页':'提交今日步数成功,将返回比赛详情页'}}</view>
<view class="popup-content" wx:if="{{scene === 1048}}">{{currentSteps>=targetSteps?'恭喜你今日步数已达标,将返回比赛详情页':'提交今日步数成功,将返回比赛详情页'}}</view>
<view class="popup-content" wx:else>{{currentSteps>=targetSteps?'恭喜你今日步数已达标,去比赛详情页同步状态吧':'提交今日步数成功,去继续行走吧'}}</view>
<view class="popup-content" wx:else>{{currentSteps>=targetSteps?'恭喜你今日步数已达标,去比赛详情页同步状态吧':'提交今日步数成功,去继续行走吧'}}</view>
<view class="popup-btn-container">
<view class="popup-btn-container">
<
!-- <view class="cancel-btn" bindtap="changeShowPopup">取消</view> --
>
<
view class="cancel-btn" bindtap="changeShowPopup" wx:if="{{scene === 1048}}">取消</view
>
<navigator class="confirm-btn" hover-class="none" open-type="exit" target="miniProgram" wx:if="{{scene === 1048}}">确定</navigator>
<navigator class="confirm-btn" hover-class="none" open-type="exit" target="miniProgram" wx:if="{{scene === 1048}}">确定</navigator>
<view class="confirm-btn" bindtap="changeShowPopup" wx:else>确定</view>
<view class="confirm-btn" bindtap="changeShowPopup" wx:else>确定</view>
</view>
</view>
...
...
project.config.json
View file @
14f061ce
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
"autoAudits"
:
false
"autoAudits"
:
false
},
},
"compileType"
:
"miniprogram"
,
"compileType"
:
"miniprogram"
,
"libVersion"
:
"2.6.
2
"
,
"libVersion"
:
"2.6.
5
"
,
"appid"
:
"wx035eac0d4d63b3e4"
,
"appid"
:
"wx035eac0d4d63b3e4"
,
"projectname"
:
"walk_daka"
,
"projectname"
:
"walk_daka"
,
"debugOptions"
:
{
"debugOptions"
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment