Commit fdb1bb4f by zhangquan

登录ui改版

1 parent 865db9cf
...@@ -45,11 +45,13 @@ class UsersApi { ...@@ -45,11 +45,13 @@ class UsersApi {
} }
/**授权手机号登录 */ /**授权手机号登录 */
async authUserPhone(detail, loginToken) { async authUserPhone(detail, loginToken) {
console.log(221)
if (!loginToken) { if (!loginToken) {
wx.$api.showToast('缺少loginToken') wx.$api.showToast('缺少loginToken')
Promise.reject() Promise.reject()
return return
} }
console.log(111)
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject() if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg delete detail.errMsg
if (detail.iv && detail.encryptedData) { if (detail.iv && detail.encryptedData) {
......
.login-bg{
position: absolute;
bottom: 0;
left: 0;
top: 0;
}
.container{ .container{
height: 100vh;
background-color: #fff;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative;
.salutation-wrap{ .salutation-wrap{
padding: 112rpx 96rpx 0; padding: 96rpx 96rpx 0;
flex: 1; flex: 1;
.salutation{ .salutation{
height: 88rpx; height: 88rpx;
...@@ -24,18 +29,28 @@ ...@@ -24,18 +29,28 @@
color: #333333; color: #333333;
line-height: 64rpx; 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{ .footer{
width: 100%; width: 100%;
height: 850rpx; margin-top: 120rpx;
background-size: 100% 100%;
.login-wrap{ .login-wrap{
width: 100%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
flex-wrap: nowrap; flex-wrap: nowrap;
margin-top: 500rpx;
.login-btn{ .login-btn{
width: 590rpx; width: 590rpx;
height: 88rpx; height: 88rpx;
...@@ -52,8 +67,9 @@ ...@@ -52,8 +67,9 @@
} }
.phone-btn{ .phone-btn{
margin-top: 40rpx; margin-top: 40rpx;
background: #F9F9F9; background: #fff;
color: #1B233D; color: #1B233D;
border: 2rpx solid #DCDFE6;
} }
} }
} }
......
// pages/login.js const navStyle = "background-color: transparent;";
import USERAPI from '~/api/usersApi/index' import USERAPI from '~/api/usersApi/index'
import { import {
selectAccountLogin, selectAccountLogin,
...@@ -10,29 +10,34 @@ Page({ ...@@ -10,29 +10,34 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
navStyle,
padHeight:0, padHeight:0,
headerHeight: 0,
loginMethod: 0, loginMethod: 0,
formData:{ formData:{
phone:'13097951885', phone:'',
code:'8888' code:''
}, },
authorized: false authorized: false
}, },
navbarReady(e) {
let {
height
} = e.detail;
this.setData({
headerHeight: height,
});
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() { onReady() {
this.init() this.init()
}, },
/**页面初始化 */
async init() { async init() {
try { try {
const { const {
...@@ -67,26 +72,26 @@ Page({ ...@@ -67,26 +72,26 @@ Page({
}) })
}, },
inputBindFocus(e){ // inputBindFocus(e){
if(this.data.padHeight) return; // if(this.data.padHeight) return;
this.setData({ // this.setData({
padHeight: e.detail.height // padHeight: e.detail.height
}) // })
this.pageScrollToBottom() // this.pageScrollToBottom()
}, // },
inputBindBlur(){ // inputBindBlur(){
this.setData({ // this.setData({
padHeight: 0 // padHeight: 0
}) // })
}, // },
pageScrollToBottom() { // pageScrollToBottom() {
wx.createSelectorQuery().select('.container').boundingClientRect(function(rect) { // wx.createSelectorQuery().select('.container').boundingClientRect(function(rect) {
// 使页面滚动到底部 // // 使页面滚动到底部
wx.pageScrollTo({ // wx.pageScrollTo({
scrollTop: rect.height // scrollTop: rect.height
}) // })
}).exec() // }).exec()
}, // },
handleLogin(){ handleLogin(){
const { const {
formData formData
...@@ -95,12 +100,15 @@ Page({ ...@@ -95,12 +100,15 @@ Page({
mobile: formData.phone, mobile: formData.phone,
code: formData.code code: formData.code
} }
if(this.data.showLoading) return;
this.setShowLoading(true)
USERAPI.phoneSmsLogin(obj).then(({ USERAPI.phoneSmsLogin(obj).then(({
code, code,
data, data,
message, message,
errId errId
}) => { }) => {
this.setShowLoading(false)
if (code == '0') { if (code == '0') {
this.checkLoginUserInfo(data) this.checkLoginUserInfo(data)
} else if(errId=='30990103') { } else if(errId=='30990103') {
...@@ -111,6 +119,7 @@ Page({ ...@@ -111,6 +119,7 @@ Page({
wx.$api.showToast(message || '系统异常') wx.$api.showToast(message || '系统异常')
} }
}).catch(err => { }).catch(err => {
this.setShowLoading(false)
wx.$api.showToast('系统异常') wx.$api.showToast('系统异常')
}) })
}, },
...@@ -131,15 +140,22 @@ Page({ ...@@ -131,15 +140,22 @@ Page({
sessionId sessionId
}) })
}, },
switchLoginMethod(){ switchLoginMethod(e){
const {type} = e.target.dataset
this.setData({ this.setData({
loginMethod: 1 loginMethod: type
}) })
}, },
input(e){ input(e){
const {value} = e.detail const {value} = e.detail
const {name} = e.target.dataset const {name} = e.target.dataset
console.log(e,this.data.formData,'88') console.log(e,this.data.formData,'88')
this.setData({
[`formData.${name}`] : value
})
let a = this.validate.methods.tel(formData.phone)
console.log(a)
}, },
/**获取验证码 */ /**获取验证码 */
getSmsCode() { getSmsCode() {
...@@ -187,16 +203,23 @@ Page({ ...@@ -187,16 +203,23 @@ Page({
}) })
}, 1e3) }, 1e3)
}, },
setShowLoading(val){
this.setData({
showLoading: val
})
},
wxLogin({ wxLogin({
detail detail
}) { }) {
if (!detail.code) return if (!detail.code || this.data.showLoading) return
this.setShowLoading(true)
USERAPI.authUserPhone(detail, this.loginToken).then(({ USERAPI.authUserPhone(detail, this.loginToken).then(({
code, code,
data, data,
message, message,
errId errId
}) => { }) => {
this.setShowLoading(false)
if (code == '0'){ if (code == '0'){
this.checkLoginUserInfo(data) this.checkLoginUserInfo(data)
}else if(errId=='30990103'){ }else if(errId=='30990103'){
...@@ -209,6 +232,7 @@ Page({ ...@@ -209,6 +232,7 @@ Page({
}).catch(({ }).catch(({
errMsg errMsg
}) => { }) => {
this.setShowLoading(false)
wx.$api.showToast('系统异常') wx.$api.showToast('系统异常')
}) })
}, },
......
{ {
"usingComponents": {}, "usingComponents": {},
"navigationBarTitleText": "登录" "navigationStyle": "custom"
} }
\ No newline at end of file \ No newline at end of file
...@@ -9,7 +9,15 @@ ...@@ -9,7 +9,15 @@
color: #333333; color: #333333;
} }
.login-input-wrap{ .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{ .phone, .code{
background-color: #fff; background-color: #fff;
display: flex; display: flex;
...@@ -19,10 +27,10 @@ ...@@ -19,10 +27,10 @@
text-align: left!important; text-align: left!important;
} }
.phone{ .phone{
margin-bottom: 24rpx; margin-bottom: 48rpx;
} }
.code{ .code{
margin-bottom: 50rpx; margin-bottom: 128rpx;
} }
.code-btn{ .code-btn{
width: 180rpx; width: 180rpx;
...@@ -33,8 +41,21 @@ ...@@ -33,8 +41,21 @@
border-radius: 28rpx; border-radius: 28rpx;
font-size: 24rpx; font-size: 24rpx;
color: #666666; color: #666666;
border: none;
}
.code-btn::after{
border: none;
} }
.placeholderClass,.placeholder{ .placeholderClass,.placeholder{
color: #BCBCBC; color: #BCBCBC;
} }
.other{
margin-top: 64rpx;
font-size: 28rpx;
letter-spacing: 0;
color: #A8ABBC;
text{
color: #5570D4;
}
}
} }
<!--pages/login.wxml--> <!--pages/login.wxml-->
<view class="container" style="padding-bottom: {{padHeight}}px;"> <navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="门店助手">
<view class="salutation-wrap"> <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="salutation">您好</view>
<view class="welcome">欢迎登录门店助手</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>
<view class="footer">
<view class="login-wrap" wx:if="{{loginMethod==0}}"> <view class="login-wrap" wx:if="{{loginMethod==0}}">
<!-- <view class="wx-btn login-btn">微信授权登录</view> --> <!-- <view class="wx-btn login-btn">微信授权登录</view> -->
<button class="wx-btn login-btn" hover-class="btn-hover" open-type="getPhoneNumber" bindgetphonenumber="wxLogin">微信授权登录</button> <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">手机号码登录</view> <view class="phone-btn login-btn" bindtap="switchLoginMethod" data-type="1">手机号码登录</view>
</view> </view>
<view class="login-wrap login-input-wrap" wx:else> <block wx:else>
<view class="login-wrap login-input-wrap">
<view class="login-title">手机号码登录</view>
<view class="login-btn phone"> <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"/> <input maxlength="11" adjust-position="{{false}}" placeholder-class="placeholderClass" placeholder="请输入手机号码" bindinput="input" value="{{formData.phone}}" data-name="phone"/>
</view> </view>
<view class="login-btn code"> <view class="login-btn code">
<input maxlength="4" adjust-position="{{false}}" bindfocus="inputBindFocus" bindblur="inputBindBlur" placeholder-class="placeholder" placeholder="请输入验证码" <input maxlength="4" adjust-position="{{false}}" placeholder-class="placeholder" placeholder="请输入验证码"
bindinput="input" value="{{formData.code}}" data-name="code"/> bindinput="input" value="{{formData.code}}" data-name="code"/>
<view class="code-btn" bindtap="getSmsCode">{{count? count + 's':'获取验证码'}}</view> <button disabled="{{phoneReady}}" class="code-btn" bindtap="getSmsCode">{{count? count + 's':'获取验证码'}}</button>
</view> </view>
<view class="login-btn wx-btn" bindtap="handleLogin">登录</view> <view class="login-btn wx-btn" bindtap="handleLogin">登录</view>
<view class="other">或 <text bindtap="switchLoginMethod" data-type="0">微信登录</text></view>
</view> </view>
</block>
</view> </view>
<popup bindconfirm="goServicePage" show="{{authorized}}" confirmText="联系客服" title="提示" height="560rpx"> <popup bindconfirm="goServicePage" show="{{authorized}}" confirmText="联系客服" title="提示" height="560rpx">
<view class="popup-content">当前登录手机号未认证,请联系客服处理</view> <view class="popup-content">当前登录手机号未认证,请联系客服处理</view>
......
import USERAPI from '~/api/usersApi/index' import USERAPI from '~/api/usersApi/index'
const navStyle = "background-color: transparent;";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
navStyle,
headerHeight:0
},
navbarReady(e) {
let {
height
} = e.detail;
this.setData({
headerHeight: height,
});
}, },
async init() { async init() {
try { try {
...@@ -46,7 +56,6 @@ Page({ ...@@ -46,7 +56,6 @@ Page({
toRegister({ toRegister({
detail detail
}) { }) {
console.log(detail,'detaildetail')
if (!detail.code) return if (!detail.code) return
USERAPI.authUserPhone(detail, this.loginToken).then(({ USERAPI.authUserPhone(detail, this.loginToken).then(({
code, code,
...@@ -55,7 +64,7 @@ Page({ ...@@ -55,7 +64,7 @@ Page({
errId errId
}) => { }) => {
if (code == '0'){ if (code == '0'){
wx.$router.reLaunch('/pages/tab/index/index') this.checkLoginUserInfo(data)
}else{ }else{
if(errId=='30990103'){ if(errId=='30990103'){
let params = { let params = {
...@@ -74,6 +83,22 @@ Page({ ...@@ -74,6 +83,22 @@ Page({
wx.$api.showToast(message || '系统异常') 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
})
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
......
{ {
"usingComponents": {}, "usingComponents": {},
"navigationBarTitleText": "注册" "navigationStyle": "custom"
} }
\ No newline at end of file \ No newline at end of file
<!--pages/login/register/register.wxml--> <!--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-wrap">
<view class="salutation">您好</view> <view class="salutation">您好</view>
<view class="welcome">欢迎注册门店助手</view> <view class="welcome">欢迎注册门店助手</view>
<view class="logo">
<image class="logo-img" src="{{IMGURL}}login-logo.png"></image>
</view>
</view> </view>
<view class="footer" style="background-image: url('{{IMGURL}}register.png');"> <view class="footer" style="background-image: url('{{IMGURL}}register.png');">
<view class="login-wrap"> <view class="login-wrap">
......
...@@ -104,9 +104,13 @@ Page({ ...@@ -104,9 +104,13 @@ Page({
} }
console.log(params,'ddd') console.log(params,'ddd')
USERAPI.register(params).then((res) => { 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){ inputStaffNamme(e){
const {value} = e.detail const {value} = e.detail
......
...@@ -9,10 +9,6 @@ Page({ ...@@ -9,10 +9,6 @@ Page({
interval:null interval:null
}, },
onRoute(options){ onRoute(options){
console.log(options,111)
this.setData({
type: options.type
})
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
......
...@@ -6,7 +6,7 @@ Page({ ...@@ -6,7 +6,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
btnHeight: 0, headerHeight: 0,
navStyle, navStyle,
}, },
navbarReady(e) { navbarReady(e) {
...@@ -14,7 +14,7 @@ Page({ ...@@ -14,7 +14,7 @@ Page({
height height
} = e.detail; } = e.detail;
this.setData({ this.setData({
btnHeight: height, headerHeight: height,
}); });
}, },
/** /**
......
<view style="background:#fff;" class="container"> <view style="background:#fff;" class="container">
<image style="height: {{btnHeight+45}}px;" src="{{IMGURL}}discovery_center_bg.png" class="bg-img"></image> <image style="height: {{headerHeight+45}}px;" src="{{IMGURL}}discovery_center_bg.png" class="bg-img"></image>
<navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="发现"> <navigation-bar bindnavbarReady="navbarReady" navStyle="{{navStyle}}" page-title="发现">
<text>发现</text> <text>发现</text>
</navigation-bar> </navigation-bar>
<view style="padding-top: {{btnHeight}}px;"> <view style="padding-top: {{headerHeight}}px;">
<product></product> <product></product>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -6,7 +6,7 @@ const target = ['ip', 'dev', 'uat', 'prod'] ...@@ -6,7 +6,7 @@ const target = ['ip', 'dev', 'uat', 'prod']
2测试 2测试
3生产 3生产
*/ */
const index = 0 const index = 1
const secretKey = { const secretKey = {
ip: {}, ip: {},
dev: { dev: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!