Commit 9908bd16 by 张立顺

Merge branch 'develop' of 192.168.3.233:saas_plus/business-assistant into develop

2 parents 85eabb11 4a82636a
// import api from '../api/request'
import api from '~/utils/request/request'
const { appId } = wx.getAccountInfoSync().miniProgram
class UsersApi {
......
// login/index/components/LoginBox.js
import USERAPI from '~/api/usersApi/index'
let thisPage
const countDown = 60
Component({
options: {
styleIsolation: 'shared'
},
/**
* 组件的属性列表
*/
properties: {
loginType: Number
loginType: Number,
disabled: Boolean
},
/**
* 组件的初始数据
*/
data: {
formData: {
phone: '',
code: '',
account: '',
password: ''
},
phoneReady: false,
countDown: null
},
/**
* 组件的方法列表
*/
methods: {
input(e) {
const {
value
} = e.detail, {
name
} = e.currentTarget.dataset
this.setData({
[`formData.${name}`]: value
})
if (name == 'phone') this.setData({
phoneReady: thisPage.validate.methods.tel(value)
})
this.checkFormData()
},
clear(e) {
const {
name
} = e.currentTarget.dataset
this.setData({
[`formData.${name}`]: ''
})
this.checkFormData()
},
getSms() {
const {
phoneReady,
count
} = this.data
if (!phoneReady || count) return
this.setData({
count: countDown
})
this.countDown()
},
countDown() {
setTimeout(() => {
let {
count
} = this.data
this.setData({
count: --count
})
if (count > 0) this.countDown()
else this.setData({
count: null
})
}, 1e3)
},
checkFormData() {
const {
loginType,
formData
} = this.data
if (loginType != 0) {
if (loginType == 1) {
this.setData({
phoneReady: formData.phone && thisPage.validate.methods.tel(formData.phone)
}, () => {
thisPage.checkLoginBtn()
})
} else thisPage.checkLoginBtn()
}
},
pwdSwitch() {
this.setData({
showPwd: !this.data.showPwd
})
},
login() {
this.setBtnLoading()
setTimeout(() => {
this.setBtnLoading(false)
}, 5e3)
},
wxLogin({detail}) {
if(!detail.code) return
this.setBtnLoading()
setTimeout(() => {
this.setBtnLoading(false)
}, 5e3)
},
setBtnLoading(loading = true) {
thisPage.setData({
loading
})
this.setData({
loading
})
}
},
lifetimes: {
attached: function () {
// 在组件实例进入页面节点树时执行
USERAPI.login().then(res => {
console.log(res)
})
thisPage = wx.$router.getPageInstance()
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
},
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
"usingComponents": {
"input-icon":"../InputIcon/InputIcon"
}
}
\ No newline at end of file
......@@ -2,6 +2,10 @@
.box {
height: 800rpx;
.opacity-view {
animation: opacity-view .5s forwards;
}
.img {
width: 472rpx;
height: 458rpx;
......@@ -9,4 +13,77 @@
left: 151rpx;
top: 264rpx;
}
.input-box {
width: 540rpx;
padding-top: 352rpx;
margin: 0 auto;
.title {
font-weight: 500;
font-size: 44rpx;
color: #323436;
}
.input {
display: flex;
align-items: center;
margin-top: 33rpx;
border-bottom: 1rpx solid #E3E3E6;
padding: 24rpx 0;
position: relative;
input {
flex: 1;
color: #323436;
font-size: 28rpx;
}
.placeholder {
color: #CCCED1;
font-size: 28rpx;
}
.sms {
width: 130rpx;
flex-shrink: 0;
color: #5092FF;
font-size: 24rpx;
}
.sms-disabled {
color: #CCCED1;
}
.error {
position: absolute;
font-size: 24rpx;
color: #F35251;
left: 0;
bottom: -13rpx;
transform: translateY(100%);
}
}
}
}
.button {
width: 100% !important;
height: 88rpx;
background: #3666FE;
border-radius: 8rpx;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
line-height: 88rpx;
padding: 0;
&[disabled]:not([type]){
background: #CCCED1 !important;
color: #fff !important;
}
}
.btn-hover {
opacity: .75;
}
\ No newline at end of file
<view class="box">
<block wx:if="{{loginType == 0}}">
<image webp class="img" src="https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/login.png" />
<image webp class="img opacity-view" src="https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/login/login.png" />
</block>
<block wx:else>
<view class="input-box opacity-view">
<view class="title">{{loginType == 1?'手机号':'账号'}}登录</view>
<block wx:if="{{loginType == 1}}">
<view class="input">
<input type="number" placeholder="填写手机号" placeholder-class="placeholder" bindinput="input" data-name="phone" value="{{formData.phone}}" maxlength="11" />
<input-icon show="{{formData.phone}}" bindtap="clear" data-name="phone" />
</view>
<view class="input">
<input type="number" placeholder="填写验证码" placeholder-class="placeholder" bindinput="input" data-name="code" value="{{formData.code}}" maxlength="6" />
<input-icon show="{{formData.code}}" bindtap="clear" data-name="code" />
<view class="sms text-center {{count?'sms-disabled':''}} {{phoneReady?'':'sms-disabled'}} " bindtap="getSms">{{
count? count + 's':'获取验证码'
}}</view>
<block wx:if="{{smsError}}">
<view class="error">验证码错误</view>
</block>
</view>
</block>
<block wx:else>
<view class="input">
<input type="text" placeholder="填写账号名" placeholder-class="placeholder" bindinput="input" data-name="account" value="{{formData.account}}" maxlength="20" />
<input-icon show="{{formData.account}}" bindtap="clear" data-name="account" />
</view>
<view class="input">
<input type="text" placeholder="填写密码" placeholder-class="placeholder" bindinput="input" data-name="password" value="{{formData.password}}" maxlength="20" password='{{!showPwd}}' />
<input-icon show bindtap="pwdSwitch" type="{{showPwd?'showPwd':'hidePwd'}}" />
<input-icon show="{{formData.password}}" bindtap="clear" data-name="password" />
</view>
</block>
</view>
</block>
</view>
\ No newline at end of file
</view>
<block wx:if="{{loginType == 0}}">
<button class="button" disabled="{{disabled}}" hover-class="btn-hover" open-type="getPhoneNumber" bindgetphonenumber="wxLogin" loading="{{loading}}">微信登录</button>
</block>
<block wx:else>
<button class="button" disabled="{{disabled}}" hover-class="btn-hover" bindtap="login" loading="{{loading}}">登录</button>
</block>
\ No newline at end of file
// login/index/components/InputIcon/InputIcon.js
Component({
/**
* 组件的属性列表
*/
properties: {
show: Boolean,
type: {
type: String,
value: 'clear'
},
src: String
},
/**
* 组件的初始数据
*/
data: {
ICON_TYPE: {
showPwd: './images/seePwd.png',
hidePwd: './images/hidePwd.png',
clear: './images/clear.png'
}
},
/**
* 组件的方法列表
*/
methods: {
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* login/index/components/Clear/Clear.wxss */
.icon-box {
width: 44rpx;
height: 40rpx;
padding: 0 10rpx;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
.icon {
width: 32rpx;
height: 32rpx;
}
}
\ No newline at end of file
<view class="icon-box" hidden="{{!show}}">
<image src="{{src || ICON_TYPE[type]}}" class="icon"></image>
</view>
\ No newline at end of file
// login/index/components/Mask/Mask.js
Component({
/**
* 组件的属性列表
*/
properties: {
maskStyle: String,
show: Boolean
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
/* login/index/components/Mask/Mask.wxss */
.mask{
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 99999999999;
}
\ No newline at end of file
<block wx:if="{{show}}">
<view class="mask" style="{{maskStyle}}"></view>
</block>
\ No newline at end of file
......@@ -26,6 +26,7 @@ Component({
thisPage.setData({
agree: !agree
})
wx.vibrateShort()
thisPage.checkLoginBtn()
},
}
......
......@@ -24,6 +24,7 @@ Component({
thisPage.setData({
loginType
})
wx.vibrateShort()
thisPage.checkLoginBtn()
},
}
......
......@@ -16,7 +16,7 @@
align-items: center;
flex-direction: column;
width: 100rpx;
animation: opacity-view .25s forwards;
animation: btn-move .25s forwards;
.icon {
width: 68rpx;
......@@ -25,5 +25,13 @@
}
}
@keyframes btn-move {
0% {
transform: scale(0.1);
}
100% {
transform: scale(1);
}
}
}
\ No newline at end of file
// pages/login/index/index.js
import WxValidate from '~/utils/WxValidate'
Page({
/**
* 页面的初始数据
*/
data: {
navStyle: 'background-color: rgba(0,0,0,0);',
loginType: 0,
agree: true
},
......@@ -12,7 +12,9 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
onLoad(options) {
this.validate = new WxValidate()
},
/**
* 生命周期函数--监听页面初次渲染完成
......@@ -29,6 +31,7 @@ Page({
wx.hideLoading()
}
})
this.checkLoginBtn()
},
/**
......@@ -54,16 +57,26 @@ Page({
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
// onShareAppMessage() {
},
checkLoginBtn() {
// },
checkLoginBtn(flag = false) {
const {
agree,
loginType
} = this.data
if (loginType == 0) flag = true
else {
const {
formData,
phoneReady
} = this.selectComponent('#box').data
flag = loginType == 1 ?
phoneReady && formData.code :
formData.account && formData.password
}
this.setData({
disabled: !agree
disabled: !agree || !flag
})
}
})
},
})
\ No newline at end of file
{
"usingComponents": {
"navigation-bar": "/components/NavigationBar/NavigationBar",
"mask": "./components/Mask/Mask",
"box": "./components/Box/Box",
"type-list": "./components/TypeList/TypeList",
"protocol": "./components/Protocol/Protocol"
......
@keyframes opacity-view {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.layout {
position: relative;
padding: 0 32rpx;
......@@ -25,22 +15,15 @@
top: 0;
z-index: -1;
}
.button {
width: 100%;
height: 88rpx;
background: #3666FE;
border-radius: 8rpx;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
line-height: 88rpx;
padding: 0;
}
.disabled{
background: #CCCED1;
}
@keyframes opacity-view {
0% {
opacity: 0;
transform: scale(0.1);
}
.btn-hover {
opacity: .75;
100% {
opacity: 1;
transform: scale(1);
}
}
\ No newline at end of file
<navigation-bar navStyle="{{navStyle}}">生意助手</navigation-bar>
<view class="layout">
<box loginType="{{loginType}}" />
<button class="button {{disabled?'disabled':''}}" hover-class="btn-hover">{{loginType == 0?'微信登陆':'登陆'}}</button>
<mask show="{{loading}}"></mask>
<navigation-bar navStyle="background-color: rgba(0,0,0,0)">生意助手</navigation-bar>
<box loginType="{{loginType}}" disabled="{{disabled}}" id="box" />
<type-list loginType="{{loginType}}" />
<protocol agree="{{agree}}" />
</view>
\ No newline at end of file
{
"setting": {
"compileHotReLoad": true,
"compileHotReLoad": false,
"urlCheck": false,
"lazyloadPlaceholderEnable": true
},
......
......@@ -70,7 +70,6 @@ class Router {
parent = _parent
}
/**只传页面名 默认跳转当前包下的页面,相同名称默认第一个 */
console.log(_parent, _name, last_name)
if (!_name && !last_name) name = _parent
const routerMapItem = this[_routerList].find(item => {
if (last_name) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!