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
e4c13551
Commit
e4c13551
authored
Apr 01, 2019
by
穆启卓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改版后的第一版
parent
ac739d1f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
277 additions
and
180 deletions
+277
-180
app.js
app.js
+28
-21
auth_false.png
images/authorization/auth_false.png
+0
-0
auth_true.png
images/authorization/auth_true.png
+0
-0
authorization.js
pages/authorization/authorization.js
+44
-29
authorization.less
pages/authorization/authorization.less
+34
-31
authorization.wxml
pages/authorization/authorization.wxml
+5
-5
authorization.wxss
pages/authorization/authorization.wxss
+34
-31
index.js
pages/index/index.js
+0
-0
index.less
pages/index/index.less
+59
-56
index.wxml
pages/index/index.wxml
+15
-7
index.wxss
pages/index/index.wxss
+58
-0
No files found.
app.js
View file @
e4c13551
...
...
@@ -51,32 +51,39 @@ App({
//pay页面收到分享卡片的时间戳
payLastTimeStmp
:
''
,
code
:
''
,
// 用户微信登录的code
userInfo
:
''
,
// 用户后端登录的userInfo
token
:
''
,
// 用户后端登录的token
userAuth
:
false
,
// 用户信息授权(为了拿unionId)
unionAuth
:
false
,
// unionId授权: 如果为false是需要授权,true是不需要
stepAuth
:
false
,
// 步数授权
},
onLaunch
(
options
)
{
wx
.
login
({
success
:
wxres
=>
{
if
(
wxres
.
code
)
{
this
.
globalData
.
code
=
wxres
.
code
;
wx
.
request
({
url
:
config
.
service
.
hostUrl
+
"/v1/auth_login"
,
data
:
{
js_code
:
wxres
.
code
},
method
:
'POST'
,
success
:
myres
=>
{
this
.
globalData
.
userInfo
=
myres
.
data
.
data
;
this
.
globalData
.
token
=
myres
.
data
.
data
.
token
;
}
});
}
else
{
console
.
log
(
'登录失败!'
+
res
.
errMsg
)
}
}
})
// wx.login({
// success:wxres => {
// if (wxres.code) {
// this.globalData.code = wxres.code;
// wx.request({
// url: config.service.hostUrl + "/v1/auth_login",
// data: {
// js_code: wxres.code
// },
// method: 'POST',
// success:myres => {
// if (myres.data.code === 0) {
// this.globalData.userInfo = myres.data.data;
// this.globalData.token = myres.data.data.token;
// } else if (myres.data.data.code === 401) {
// this.globalData.unionAuth = false;
// }
// }
// });
// } else {
// console.log('登录失败!' + res.errMsg)
// }
// }
// })
app
=
this
;
...
...
images/authorization/auth_false.png
View replaced file @
ac739d1f
View file @
e4c13551
517 Bytes
|
W:
|
H:
617 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
images/authorization/auth_true.png
View replaced file @
ac739d1f
View file @
e4c13551
446 Bytes
|
W:
|
H:
715 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
pages/authorization/authorization.js
View file @
e4c13551
let
app
=
getApp
();
let
getAuthLoading
=
false
;
Page
({
data
:
{
...
...
@@ -5,20 +6,11 @@ Page({
stepAuth
:
false
},
onLoad
(
options
)
{
let
data
=
{};
if
(
options
.
userAuth
===
'true'
)
{
data
.
userAuth
=
true
;
}
else
if
(
options
.
userAuth
===
'false'
)
{
data
.
userAuth
=
false
;
}
if
(
options
.
stepAuth
===
'true'
)
{
data
.
stepAuth
=
true
;
}
else
if
(
options
.
stepAuth
===
'false'
)
{
data
.
stepAuth
=
false
;
}
console
.
log
(
data
)
this
.
setData
(
data
);
onLoad
()
{
this
.
setData
({
userAuth
:
app
.
globalData
.
userAuth
,
stepAuth
:
app
.
globalData
.
stepAuth
});
},
getUserAuth
(
event
)
{
...
...
@@ -26,15 +18,21 @@ Page({
getAuthLoading
=
true
;
if
(
event
.
detail
.
errMsg
===
'getUserInfo:ok'
)
{
console
.
log
(
'getUserAuth:ok'
,
event
.
detail
)
app
.
globalData
.
userAuth
=
true
;
this
.
setData
({
userAuth
:
true
});
setTimeout
(()
=>
{
getAuthLoading
=
false
;
},
100
);
this
.
checkAuth
();
}
else
{
console
.
log
(
'getUserAuth:fail'
,
event
)
wx
.
showModal
({
content
:
'授权失败,请重新点击按钮发起授权'
,
showCancel
:
false
});
}
setTimeout
(()
=>
{
getAuthLoading
=
false
;
},
100
);
},
getStepAuth
()
{
...
...
@@ -43,7 +41,11 @@ Page({
wx
.
authorize
({
scope
:
'scope.werun'
,
success
:()
=>
{
this
.
userAuthorizedStep
();
app
.
globalData
.
stepAuth
=
true
;
this
.
setData
({
stepAuth
:
true
});
this
.
checkAuth
();
},
fail
:()
=>
{
// 调起用户授权窗口失败,因为用户曾经拒绝过,而且在这里不能直接去到openSetting页,需要通过一个弹窗中转过去
...
...
@@ -53,9 +55,24 @@ Page({
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'
])
{
this
.
userAuthorizedStep
();
app
.
globalData
.
stepAuth
=
true
;
this
.
setData
({
stepAuth
:
true
});
}
this
.
checkAuth
();
}
});
}
...
...
@@ -68,15 +85,12 @@ Page({
}
});
},
userAuthorizedStep
()
{
this
.
setData
({
stepAuth
:
true
});
wx
.
getWeRunData
({
success
(
res
)
{
console
.
log
(
'getWeRunData'
,
res
)
}
});
checkAuth
()
{
if
(
app
.
globalData
.
userAuth
&&
app
.
globalData
.
stepAuth
)
{
wx
.
navigateBack
({
delta
:
1
});
}
}
})
\ No newline at end of file
pages/authorization/authorization.less
View file @
e4c13551
.page-container {
width: 100%;
min-height: 100vh;
background: #fff;
display: flex;
flex-direction: column;
align-items: center;
.app-logo {
width:
250
rpx;
height:
250
rpx;
width:
148
rpx;
height:
148
rpx;
border-radius: 50%;
margin-top: 60rpx;
margin-top: 100rpx;
background: #000;
}
.app-name {
font-size:
28
rpx;
font-size:
36
rpx;
line-height: 1;
color: #
000
;
color: #
363636
;
font-weight: bold;
margin-top:
30
rpx;
margin-top:
28
rpx;
}
.title {
width:
710
rpx;
font-size:
28
rpx;
width:
674
rpx;
font-size:
34
rpx;
line-height: 1;
color: #
000
;
color: #
333
;
font-weight: bold;
margin-top:
8
0rpx;
margin-top:
13
0rpx;
}
.explain {
width:
710
rpx;
font-size: 2
6
rpx;
width:
674
rpx;
font-size: 2
8
rpx;
line-height: 1.2;
color: #
000
;
margin-top: 2
0
rpx;
color: #
a5a5a5
;
margin-top: 2
4
rpx;
}
.authorization-container {
width:
71
0rpx;
width:
69
0rpx;
margin-top: 40rpx;
display: flex;
align-items: flex-start;
.authorized-icon {
width:
30
rpx;
height:
30
rpx;
width:
46
rpx;
height:
46
rpx;
flex-shrink: 0;
background: red;
}
.authorization-title-explain {
margin-left: 10rpx;
flex: 1;
margin-left: 20rpx;
.authorization-title {
font-size:
28
rpx;
line-height:
1.2
;
color: #
000
;
font-size:
30
rpx;
line-height:
46rpx
;
color: #
454545
;
font-weight: bold;
}
.authorization-explain {
font-size: 26rpx;
line-height:
1.2
;
color: #
000
;
margin-top:
2
0rpx;
line-height:
40rpx
;
color: #
a5a5a5
;
margin-top:
1
0rpx;
}
}
}
.authorization-btn {
width: 6
5
0rpx;
height:
8
0rpx;
border-radius:
80
rpx;
background:
blue
;
font-size: 3
0
rpx;
line-height:
8
0rpx;
width: 6
9
0rpx;
height:
9
0rpx;
border-radius:
16
rpx;
background:
#51AA38
;
font-size: 3
4
rpx;
line-height:
9
0rpx;
color: #fff;
text-align: center;
margin-top: 120rpx;
...
...
pages/authorization/authorization.wxml
View file @
e4c13551
<navbar showHome="{{false}}" navTitle="{{navTitle}}" navColor="
{{navColor}}
"></navbar>
<navbar showHome="{{false}}" navTitle="{{navTitle}}" navColor="
#fff
"></navbar>
<view class="page-container">
<view class="app-logo"></view>
<view class="app-name">
运动打卡
</view>
<view class="title">请允许
运动打卡
获取以下权限</view>
<view class="explain">以下信息仅用于您登录
运动打卡
,我们将严格保密绝不外泄,更不会对您发送垃圾信息造成骚扰</view>
<view class="app-name">
步步运动赚
</view>
<view class="title">请允许
步步运动赚
获取以下权限</view>
<view class="explain">以下信息仅用于您登录
步步运动赚
,我们将严格保密绝不外泄,更不会对您发送垃圾信息造成骚扰</view>
<view class="authorization-container">
<image class="authorized-icon" src="/images/authorization/auth_{{userAuth?'true':'false'}}.png"></image>
<view class="authorization-title-explain">
<view class="authorization-title">获取您的公开信息(昵称、头像等)</view>
<view class="authorization-explain">需获取您的公开信息,方便您使用
运动打卡
全部功能</view>
<view class="authorization-explain">需获取您的公开信息,方便您使用
步步运动赚
全部功能</view>
</view>
</view>
<view class="authorization-container">
...
...
pages/authorization/authorization.wxss
View file @
e4c13551
.page-container {
width: 100%;
min-height: 100vh;
background: #fff;
display: flex;
flex-direction: column;
align-items: center;
}
.page-container .app-logo {
width:
250
rpx;
height:
250
rpx;
width:
148
rpx;
height:
148
rpx;
border-radius: 50%;
margin-top: 60rpx;
margin-top: 100rpx;
background: #000;
}
.page-container .app-name {
font-size:
28
rpx;
font-size:
36
rpx;
line-height: 1;
color: #
000
;
color: #
363636
;
font-weight: bold;
margin-top:
30
rpx;
margin-top:
28
rpx;
}
.page-container .title {
width:
710
rpx;
font-size:
28
rpx;
width:
674
rpx;
font-size:
34
rpx;
line-height: 1;
color: #
000
;
color: #
333
;
font-weight: bold;
margin-top:
8
0rpx;
margin-top:
13
0rpx;
}
.page-container .explain {
width:
710
rpx;
font-size: 2
6
rpx;
width:
674
rpx;
font-size: 2
8
rpx;
line-height: 1.2;
color: #
000
;
margin-top: 2
0
rpx;
color: #
a5a5a5
;
margin-top: 2
4
rpx;
}
.page-container .authorization-container {
width:
71
0rpx;
width:
69
0rpx;
margin-top: 40rpx;
display: flex;
align-items: flex-start;
}
.page-container .authorization-container .authorized-icon {
width:
30
rpx;
height:
30
rpx;
width:
46
rpx;
height:
46
rpx;
flex-shrink: 0;
background: red;
}
.page-container .authorization-container .authorization-title-explain {
margin-left: 10rpx;
flex: 1;
margin-left: 20rpx;
}
.page-container .authorization-container .authorization-title-explain .authorization-title {
font-size:
28
rpx;
line-height:
1.2
;
color: #
000
;
font-size:
30
rpx;
line-height:
46rpx
;
color: #
454545
;
font-weight: bold;
}
.page-container .authorization-container .authorization-title-explain .authorization-explain {
font-size: 26rpx;
line-height:
1.2
;
color: #
000
;
margin-top:
2
0rpx;
line-height:
40rpx
;
color: #
a5a5a5
;
margin-top:
1
0rpx;
}
.page-container .authorization-btn {
width: 6
5
0rpx;
height:
8
0rpx;
border-radius:
80
rpx;
background:
blue
;
font-size: 3
0
rpx;
line-height:
8
0rpx;
width: 6
9
0rpx;
height:
9
0rpx;
border-radius:
16
rpx;
background:
#51AA38
;
font-size: 3
4
rpx;
line-height:
9
0rpx;
color: #fff;
text-align: center;
margin-top: 120rpx;
...
...
pages/index/index.js
View file @
e4c13551
This diff is collapsed.
Click to expand it.
pages/index/index.less
View file @
e4c13551
...
...
@@ -249,58 +249,61 @@ page {
}
}
}
// .commit-step-popup-bg {
// position: fixed;
// left: 0;
// top: 0;
// right: 0;
// bottom: 0;
// background: rgba(0, 0, 0, .8);
// z-index: 999;
// display: flex;
// align-items: center;
// justify-content: center;
// .commit-step-popup {
// width: 560rpx;
// background: #fff;
// border-radius: 10rpx;
// overflow: hidden;
// .popup-content {
// width: 100%;
// height: 230rpx;
// display: flex;
// align-items: center;
// justify-content: center;
// padding: 0 70rpx;
// box-sizing: border-box;
// font-size: 32rpx;
// line-height: 50rpx;
// color: #585858;
// text-align: center;
// }
// .popup-btn-container {
// width: 100%;
// height: 108rpx;
// box-sizing: border-box;
// display: flex;
// border-top: 2rpx solid #e5e5e5;
// .cancel-btn {
// flex: 1;
// height: 108rpx;
// font-size: 32rpx;
// line-height: 108rpx;
// color: #999;
// text-align: center;
// }
// .confirm-btn {
// flex: 1;
// height: 108rpx;
// font-size: 32rpx;
// line-height: 108rpx;
// color: #25d6da;
// text-align: center;
// border-left: 2rpx solid #e5e5e5;
// }
// }
// }
// }
\ No newline at end of file
.commit-step-popup-bg {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, .8);
z-index: 999;
display: flex;
align-items: center;
justify-content: center;
.commit-step-popup {
width: 560rpx;
background: #fff;
border-radius: 10rpx;
overflow: hidden;
.popup-content {
width: 100%;
height: 230rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 0 70rpx;
box-sizing: border-box;
font-size: 32rpx;
line-height: 50rpx;
color: #585858;
text-align: center;
}
.popup-btn-container {
width: 100%;
height: 108rpx;
box-sizing: border-box;
display: flex;
border-top: 2rpx solid #e5e5e5;
.cancel-btn {
flex: 1;
height: 108rpx;
font-size: 32rpx;
line-height: 108rpx;
color: #999;
text-align: center;
border-right: 2rpx solid #e5e5e5;
}
.confirm-btn {
flex: 1;
height: 108rpx;
font-size: 32rpx;
line-height: 108rpx;
color: #25d6da;
text-align: center;
padding: 0;
margin: 0;
border: none;
}
}
}
}
\ No newline at end of file
pages/index/index.wxml
View file @
e4c13551
...
...
@@ -4,17 +4,16 @@
<image class="today-step-container-bg" src="/images/index/sy_beijing1.png"></image>
<!-- <view class="continuity-days">连续打卡5天</view> -->
<image class="explain" src="/images/index/sy_shuoming.png" bindtap="changeActivityExplainShow"></image>
<view class="today-step-info" bindtap="
getStep
">
<view class="today-step-info" bindtap="
clickStepData
">
<image class="today-step-info-bg" src="/images/index/sy_ybp.png"></image>
<block wx:if="{{
stepAuth
}}">
<block wx:if="{{
currentSteps
}}">
<view class="info-title">今日步数</view>
<view class="today-step-num">{{currentSteps}}</view>
</block>
<view class="info-title" style="margin-top: 200rpx" wx:else>点此获取步数数据</view>
</view>
<view class="get-info-btn" bindtap="getStep">提交步数打卡</view>
<!-- <view class="get-info-btn" bindtap="goAuthorizationPage">点击完成步数打卡</view> -->
<view class="step-progress-container" wx:if="{{stepAuth && targetSteps}}">
<view class="get-info-btn" bindtap="clickStepData">{{userAuth&&stepAuth?'提交步数打卡':'获取步数记录'}}</view>
<view class="step-progress-container" wx:if="{{currentSteps && targetSteps}}">
<view class="today-status">进行中</view>
<view class="today-progress">{{currentSteps}}/{{targetSteps}}<text>步</text></view>
</view>
...
...
@@ -54,4 +53,13 @@
<navigator class="confirm-btn" hover-class="none" open-type="exit" target="miniProgram">确定</navigator>
</view>
</view>
</view> -->
\ No newline at end of file
</view> -->
<view class="commit-step-popup-bg" wx:if="{{showGetUserInfo}}">
<view class="commit-step-popup">
<view class="popup-content">请允许授权获取步数数据</view>
<view class="popup-btn-container">
<view class="cancel-btn" bindtap="showUserInfoPopup">取消</view>
<button class="confirm-btn" plain open-type="getUserInfo" bindgetuserinfo="onGotUserInfo">确定</button>
</view>
</view>
</view>
\ No newline at end of file
pages/index/index.wxss
View file @
e4c13551
...
...
@@ -249,3 +249,61 @@ page {
transform: translateX(-50%);
overflow: visible;
}
.commit-step-popup-bg {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.8);
z-index: 999;
display: flex;
align-items: center;
justify-content: center;
}
.commit-step-popup-bg .commit-step-popup {
width: 560rpx;
background: #fff;
border-radius: 10rpx;
overflow: hidden;
}
.commit-step-popup-bg .commit-step-popup .popup-content {
width: 100%;
height: 230rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 0 70rpx;
box-sizing: border-box;
font-size: 32rpx;
line-height: 50rpx;
color: #585858;
text-align: center;
}
.commit-step-popup-bg .commit-step-popup .popup-btn-container {
width: 100%;
height: 108rpx;
box-sizing: border-box;
display: flex;
border-top: 2rpx solid #e5e5e5;
}
.commit-step-popup-bg .commit-step-popup .popup-btn-container .cancel-btn {
flex: 1;
height: 108rpx;
font-size: 32rpx;
line-height: 108rpx;
color: #999;
text-align: center;
border-right: 2rpx solid #e5e5e5;
}
.commit-step-popup-bg .commit-step-popup .popup-btn-container .confirm-btn {
flex: 1;
height: 108rpx;
font-size: 32rpx;
line-height: 108rpx;
color: #25d6da;
text-align: center;
padding: 0;
margin: 0;
border: none;
}
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