Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
store-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit fdb1bb4f
authored
Oct 16, 2022
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
登录ui改版
1 parent
865db9cf
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
180 additions
and
74 deletions
api/usersApi/UsersApi.js
pages/authentication/login.scss
pages/authentication/login/login.js
pages/authentication/login/login.json
pages/authentication/login/login.scss
pages/authentication/login/login.wxml
pages/authentication/register/register.js
pages/authentication/register/register.json
pages/authentication/register/register.wxml
pages/authentication/registerInfo/registerInfo.js
pages/authentication/registerSuccess/registerSuccess.js
pages/tab/discovery/discovery.js
pages/tab/discovery/discovery.wxml
utils/request/environment.js
api/usersApi/UsersApi.js
View file @
fdb1bb4
...
...
@@ -45,11 +45,13 @@ class UsersApi {
}
/**授权手机号登录 */
async
authUserPhone
(
detail
,
loginToken
)
{
console
.
log
(
221
)
if
(
!
loginToken
)
{
wx
.
$api
.
showToast
(
'缺少loginToken'
)
Promise
.
reject
()
return
}
console
.
log
(
111
)
if
(
detail
.
errMsg
&&
detail
.
errMsg
==
'getPhoneNumber:fail user deny'
)
Promise
.
reject
()
delete
detail
.
errMsg
if
(
detail
.
iv
&&
detail
.
encryptedData
)
{
...
...
pages/authentication/login.scss
View file @
fdb1bb4
.login-bg
{
position
:
absolute
;
bottom
:
0
;
left
:
0
;
top
:
0
;
}
.container
{
height
:
100vh
;
background-color
:
#fff
;
display
:
flex
;
flex-direction
:
column
;
position
:
relative
;
.salutation-wrap
{
padding
:
112
rpx
96rpx
0
;
padding
:
96
rpx
96rpx
0
;
flex
:
1
;
.salutation
{
height
:
88rpx
;
...
...
@@ -24,18 +29,28 @@
color
:
#333333
;
line-height
:
64rpx
;
}
.logo
{
width
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-top
:
80rpx
;
.logo-img
{
width
:
480rpx
;
height
:
480rpx
;
border
:
1rpx
dashed
#E2E2E2
;
}
}
}
.footer
{
width
:
100%
;
height
:
850rpx
;
background-size
:
100%
100%
;
margin-top
:
120rpx
;
.login-wrap
{
width
:
100%
;
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
flex-wrap
:
nowrap
;
margin-top
:
500rpx
;
.login-btn
{
width
:
590rpx
;
height
:
88rpx
;
...
...
@@ -52,8 +67,9 @@
}
.phone-btn
{
margin-top
:
40rpx
;
background
:
#
F9F9F9
;
background
:
#
fff
;
color
:
#1B233D
;
border
:
2rpx
solid
#DCDFE6
;
}
}
}
...
...
pages/authentication/login/login.js
View file @
fdb1bb4
// pages/login.js
const
navStyle
=
"background-color: transparent;"
;
import
USERAPI
from
'~/api/usersApi/index'
import
{
selectAccountLogin
,
...
...
@@ -10,29 +10,34 @@ Page({
* 页面的初始数据
*/
data
:
{
navStyle
,
padHeight
:
0
,
headerHeight
:
0
,
loginMethod
:
0
,
formData
:{
phone
:
'
13097951885
'
,
code
:
'
8888
'
phone
:
''
,
code
:
''
},
authorized
:
false
},
navbarReady
(
e
)
{
let
{
height
}
=
e
.
detail
;
this
.
setData
({
headerHeight
:
height
,
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad
(
options
)
{
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady
()
{
this
.
init
()
},
/**页面初始化 */
async
init
()
{
try
{
const
{
...
...
@@ -67,26 +72,26 @@ Page({
})
},
inputBindFocus
(
e
){
if
(
this
.
data
.
padHeight
)
return
;
this
.
setData
({
padHeight
:
e
.
detail
.
height
})
this
.
pageScrollToBottom
()
},
inputBindBlur
(){
this
.
setData
({
padHeight
:
0
})
},
pageScrollToBottom
()
{
wx
.
createSelectorQuery
().
select
(
'.container'
).
boundingClientRect
(
function
(
rect
)
{
// 使页面滚动到底部
wx
.
pageScrollTo
({
scrollTop
:
rect
.
height
})
}).
exec
()
},
//
inputBindFocus(e){
//
if(this.data.padHeight) return;
//
this.setData({
//
padHeight: e.detail.height
//
})
//
this.pageScrollToBottom()
//
},
//
inputBindBlur(){
//
this.setData({
//
padHeight: 0
//
})
//
},
//
pageScrollToBottom() {
//
wx.createSelectorQuery().select('.container').boundingClientRect(function(rect) {
//
// 使页面滚动到底部
//
wx.pageScrollTo({
//
scrollTop: rect.height
//
})
//
}).exec()
//
},
handleLogin
(){
const
{
formData
...
...
@@ -95,12 +100,15 @@ Page({
mobile
:
formData
.
phone
,
code
:
formData
.
code
}
if
(
this
.
data
.
showLoading
)
return
;
this
.
setShowLoading
(
true
)
USERAPI
.
phoneSmsLogin
(
obj
).
then
(({
code
,
data
,
message
,
errId
})
=>
{
this
.
setShowLoading
(
false
)
if
(
code
==
'0'
)
{
this
.
checkLoginUserInfo
(
data
)
}
else
if
(
errId
==
'30990103'
)
{
...
...
@@ -111,6 +119,7 @@ Page({
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
}
}).
catch
(
err
=>
{
this
.
setShowLoading
(
false
)
wx
.
$api
.
showToast
(
'系统异常'
)
})
},
...
...
@@ -131,15 +140,22 @@ Page({
sessionId
})
},
switchLoginMethod
(){
switchLoginMethod
(
e
){
const
{
type
}
=
e
.
target
.
dataset
this
.
setData
({
loginMethod
:
1
loginMethod
:
type
})
},
input
(
e
){
const
{
value
}
=
e
.
detail
const
{
name
}
=
e
.
target
.
dataset
console
.
log
(
e
,
this
.
data
.
formData
,
'88'
)
this
.
setData
({
[
`formData.
${
name
}
`
]
:
value
})
let
a
=
this
.
validate
.
methods
.
tel
(
formData
.
phone
)
console
.
log
(
a
)
},
/**获取验证码 */
getSmsCode
()
{
...
...
@@ -187,16 +203,23 @@ Page({
})
},
1
e3
)
},
setShowLoading
(
val
){
this
.
setData
({
showLoading
:
val
})
},
wxLogin
({
detail
})
{
if
(
!
detail
.
code
)
return
if
(
!
detail
.
code
||
this
.
data
.
showLoading
)
return
this
.
setShowLoading
(
true
)
USERAPI
.
authUserPhone
(
detail
,
this
.
loginToken
).
then
(({
code
,
data
,
message
,
errId
})
=>
{
this
.
setShowLoading
(
false
)
if
(
code
==
'0'
){
this
.
checkLoginUserInfo
(
data
)
}
else
if
(
errId
==
'30990103'
){
...
...
@@ -209,6 +232,7 @@ Page({
}).
catch
(({
errMsg
})
=>
{
this
.
setShowLoading
(
false
)
wx
.
$api
.
showToast
(
'系统异常'
)
})
},
...
...
pages/authentication/login/login.json
View file @
fdb1bb4
{
"usingComponents"
:
{},
"navigation
BarTitleText"
:
"登录
"
"navigation
Style"
:
"custom
"
}
\ No newline at end of file
pages/authentication/login/login.scss
View file @
fdb1bb4
...
...
@@ -9,7 +9,15 @@
color
:
#333333
;
}
.login-input-wrap
{
margin-top
:
450rpx
!
important
;
.login-title
{
width
:
590rpx
;
text-align
:
left
;
font-weight
:
500
;
font-size
:
48rpx
;
color
:
#333333
;
line-height
:
64rpx
;
margin-bottom
:
80rpx
;
}
.phone
,
.code
{
background-color
:
#fff
;
display
:
flex
;
...
...
@@ -19,10 +27,10 @@
text-align
:
left
!
important
;
}
.phone
{
margin-bottom
:
24
rpx
;
margin-bottom
:
48
rpx
;
}
.code
{
margin-bottom
:
50
rpx
;
margin-bottom
:
128
rpx
;
}
.code-btn
{
width
:
180rpx
;
...
...
@@ -33,8 +41,21 @@
border-radius
:
28rpx
;
font-size
:
24rpx
;
color
:
#666666
;
border
:
none
;
}
.
code-btn
:
:
after
{
border
:
none
;
}
.placeholderClass
,
.placeholder
{
color
:
#BCBCBC
;
}
.other
{
margin-top
:
64rpx
;
font-size
:
28rpx
;
letter-spacing
:
0
;
color
:
#A8ABBC
;
text
{
color
:
#5570D4
;
}
}
}
pages/authentication/login/login.wxml
View file @
fdb1bb4
<!--pages/login.wxml-->
<view class="container" style="padding-bottom: {{padHeight}}px;">
<view class="salutation-wrap">
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="门店助手">
<text>门店助手</text>
</navigation-bar>
<image class="login-bg" src="{{IMGURL}}login.png"></image>
<view class="container" style="padding-top: {{headerHeight}}px;">
<view class="salutation-wrap" wx:if="{{loginMethod==0}}">
<view class="salutation">您好</view>
<view class="welcome">欢迎登录门店助手</view>
<view class="logo">
<image class="logo-img" src="{{IMGURL}}login-logo.png"></image>
</view>
</view>
<view class="footer"
style="background-image: url('{{IMGURL}}register.png');"
>
<view class="footer">
<view class="login-wrap" wx:if="{{loginMethod==0}}">
<!-- <view class="wx-btn login-btn">微信授权登录</view> -->
<button class="wx-btn login-btn" hover-class="btn-hover" open-type="getPhoneNumber" bindgetphonenumber="wxLogin">微信授权登录</button>
<view class="phone-btn login-btn" bindtap="switchLoginMethod">手机号码登录</view>
<button class="wx-btn login-btn" hover-class="btn-hover" open-type="getPhoneNumber" bindgetphonenumber="wxLogin"
loading="{{showLoading}}"
>微信授权登录</button>
<view class="phone-btn login-btn" bindtap="switchLoginMethod"
data-type="1"
>手机号码登录</view>
</view>
<view class="login-wrap login-input-wrap" wx:else>
<view class="login-btn phone">
<input maxlength="11" adjust-position="{{false}}" bindfocus="inputBindFocus" bindblur="inputBindBlur" placeholder-class="placeholderClass" placeholder="请输入手机号码" bindinput="input" value="{{formData.phone}}" data-name="phone"/>
</view>
<view class="login-btn code">
<input maxlength="4" adjust-position="{{false}}" bindfocus="inputBindFocus" bindblur="inputBindBlur" placeholder-class="placeholder" placeholder="请输入验证码"
bindinput="input" value="{{formData.code}}" data-name="code"/>
<view class="code-btn" bindtap="getSmsCode">{{count? count + 's':'获取验证码'}}</view>
<block wx:else>
<view class="login-wrap login-input-wrap">
<view class="login-title">手机号码登录</view>
<view class="login-btn phone">
<input maxlength="11" adjust-position="{{false}}" placeholder-class="placeholderClass" placeholder="请输入手机号码" bindinput="input" value="{{formData.phone}}" data-name="phone"/>
</view>
<view class="login-btn code">
<input maxlength="4" adjust-position="{{false}}" placeholder-class="placeholder" placeholder="请输入验证码"
bindinput="input" value="{{formData.code}}" data-name="code"/>
<button disabled="{{phoneReady}}" class="code-btn" bindtap="getSmsCode">{{count? count + 's':'获取验证码'}}</button>
</view>
<view class="login-btn wx-btn" bindtap="handleLogin">登录</view>
<view class="other">或 <text bindtap="switchLoginMethod" data-type="0">微信登录</text></view>
</view>
<view class="login-btn wx-btn" bindtap="handleLogin">登录</view>
</view>
</block>
</view>
<popup bindconfirm="goServicePage" show="{{authorized}}" confirmText="联系客服" title="提示" height="560rpx">
<view class="popup-content">当前登录手机号未认证,请联系客服处理</view>
...
...
pages/authentication/register/register.js
View file @
fdb1bb4
import
USERAPI
from
'~/api/usersApi/index'
const
navStyle
=
"background-color: transparent;"
;
Page
({
/**
* 页面的初始数据
*/
data
:
{
navStyle
,
headerHeight
:
0
},
navbarReady
(
e
)
{
let
{
height
}
=
e
.
detail
;
this
.
setData
({
headerHeight
:
height
,
});
},
async
init
()
{
try
{
...
...
@@ -46,7 +56,6 @@ Page({
toRegister
({
detail
})
{
console
.
log
(
detail
,
'detaildetail'
)
if
(
!
detail
.
code
)
return
USERAPI
.
authUserPhone
(
detail
,
this
.
loginToken
).
then
(({
code
,
...
...
@@ -55,7 +64,7 @@ Page({
errId
})
=>
{
if
(
code
==
'0'
){
wx
.
$router
.
reLaunch
(
'/pages/tab/index/index'
)
this
.
checkLoginUserInfo
(
data
)
}
else
{
if
(
errId
==
'30990103'
){
let
params
=
{
...
...
@@ -74,6 +83,22 @@ Page({
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
})
},
checkLoginUserInfo
({
loginUserInfoList
,
sessionId
})
{
/**多个账号 */
console
.
log
(
loginUserInfoList
,
'loginUserInfoList'
)
if
(
loginUserInfoList
.
length
>
1
)
wx
.
$router
.
go
(
'/pages/authentication/accountItems/accountItems'
,
{
sessionId
,
...
this
.
options
})
/**只有一个账号 */
else
selectAccountLogin
({
id
:
loginUserInfoList
[
0
].
uuid
,
sessionId
})
},
/**
* 生命周期函数--监听页面加载
*/
...
...
pages/authentication/register/register.json
View file @
fdb1bb4
{
"usingComponents"
:
{},
"navigation
BarTitleText"
:
"注册
"
"navigation
Style"
:
"custom
"
}
\ No newline at end of file
pages/authentication/register/register.wxml
View file @
fdb1bb4
<!--pages/login/register/register.wxml-->
<view class="container">
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="门店助手">
<text>门店助手</text>
</navigation-bar>
<image class="login-bg" src="{{IMGURL}}login.png"></image>
<view class="container" style="padding-top: {{headerHeight}}px;">
<view class="salutation-wrap">
<view class="salutation">您好</view>
<view class="welcome">欢迎注册门店助手</view>
<view class="logo">
<image class="logo-img" src="{{IMGURL}}login-logo.png"></image>
</view>
</view>
<view class="footer" style="background-image: url('{{IMGURL}}register.png');">
<view class="login-wrap">
...
...
pages/authentication/registerInfo/registerInfo.js
View file @
fdb1bb4
...
...
@@ -104,9 +104,13 @@ Page({
}
console
.
log
(
params
,
'ddd'
)
USERAPI
.
register
(
params
).
then
((
res
)
=>
{
console
.
log
(
res
,
'paramsparams'
)
if
(
code
==
'0'
){
wx
.
$router
.
go
(
'/pages/authentication/registerSuccess/registerSuccess'
,{
type
:
0
})
}
else
{
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
}
})
//
wx.$router.go('/pages/authentication/registerSuccess/registerSuccess',{type:0})
//
},
inputStaffNamme
(
e
){
const
{
value
}
=
e
.
detail
...
...
pages/authentication/registerSuccess/registerSuccess.js
View file @
fdb1bb4
...
...
@@ -9,10 +9,6 @@ Page({
interval
:
null
},
onRoute
(
options
){
console
.
log
(
options
,
111
)
this
.
setData
({
type
:
options
.
type
})
},
/**
* 生命周期函数--监听页面加载
...
...
pages/tab/discovery/discovery.js
View file @
fdb1bb4
...
...
@@ -6,7 +6,7 @@ Page({
* 页面的初始数据
*/
data
:
{
btn
Height
:
0
,
header
Height
:
0
,
navStyle
,
},
navbarReady
(
e
)
{
...
...
@@ -14,7 +14,7 @@ Page({
height
}
=
e
.
detail
;
this
.
setData
({
btn
Height
:
height
,
header
Height
:
height
,
});
},
/**
...
...
pages/tab/discovery/discovery.wxml
View file @
fdb1bb4
<view style="background:#fff;" class="container">
<image style="height: {{
btn
Height+45}}px;" src="{{IMGURL}}discovery_center_bg.png" class="bg-img"></image>
<image style="height: {{
header
Height+45}}px;" src="{{IMGURL}}discovery_center_bg.png" class="bg-img"></image>
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="发现">
<text>发现</text>
</navigation-bar>
<view style="padding-top: {{
btn
Height}}px;">
<view style="padding-top: {{
header
Height}}px;">
<product></product>
</view>
</view>
\ No newline at end of file
utils/request/environment.js
View file @
fdb1bb4
...
...
@@ -6,7 +6,7 @@ const target = ['ip', 'dev', 'uat', 'prod']
2测试
3生产
*/
const
index
=
0
const
index
=
1
const
secretKey
=
{
ip
:
{},
dev
:
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment