|
|
|
@ -1,16 +1,13 @@ |
|
|
|
<!-- 账号密码登录页 --> |
|
|
|
<template> |
|
|
|
<view class="" style="position: relative;"> |
|
|
|
<view class="logins"> |
|
|
|
<view class="nav_area"></view> |
|
|
|
<view class="logo_area"> |
|
|
|
<image src="../../static/home/logo.png" mode=""></image> |
|
|
|
<!-- <view class="close" @click="backPrev()"></view> --> |
|
|
|
<view class="selece_box" v-if="0"> |
|
|
|
<uni-data-select :clear="false" |
|
|
|
v-model="value" |
|
|
|
:localdata="range" |
|
|
|
@change="changeType" |
|
|
|
></uni-data-select> |
|
|
|
<uni-data-select :clear="false" v-model="value" :localdata="range" |
|
|
|
@change="changeType"></uni-data-select> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<text class="title-box">欢迎登陆顶呱刮</text> |
|
|
|
@ -18,11 +15,11 @@ |
|
|
|
<uni-forms> |
|
|
|
<uni-forms-item name="username"> |
|
|
|
<uni-easyinput :focus="focusUsername" @blur="focusUsername = false" class="input-box" |
|
|
|
:inputBorder="false" v-model="username" placeholder="请输入手机号/账号" /> |
|
|
|
:inputBorder="false" v-model="username" placeholder="请输入手机号/账号"/> |
|
|
|
</uni-forms-item> |
|
|
|
<uni-forms-item name="password"> |
|
|
|
<uni-easyinput :focus="focusPassword" @blur="focusPassword = false" class="input-box" clearable |
|
|
|
type="password" :inputBorder="false" v-model="password" placeholder="请输入密码" /> |
|
|
|
type="password" :inputBorder="false" v-model="password" placeholder="请输入密码"/> |
|
|
|
</uni-forms-item> |
|
|
|
</uni-forms> |
|
|
|
<uni-captcha v-if="needCaptcha" focus ref="captcha" scene="login-by-pwd" v-model="captcha" /> |
|
|
|
@ -45,11 +42,12 @@ |
|
|
|
温馨提示:<br/> |
|
|
|
忘记密码,请联系平台 |
|
|
|
</view> --> |
|
|
|
<view v-if="this.userType=='user'" |
|
|
|
style="width: 100vw;text-align: center;color: #dcdcdc;font-size: 14px; line-height: 28px;position: absolute;bottom: -34vh;"> |
|
|
|
温馨提示:<br/> |
|
|
|
忘记密码,请联系平台 |
|
|
|
</view> |
|
|
|
|
|
|
|
<view v-if="this.userType=='user'" |
|
|
|
class="bottom_t"> |
|
|
|
温馨提示:<br /> |
|
|
|
忘记密码,请联系平台 |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
@ -68,36 +66,44 @@ |
|
|
|
"focusUsername": false, |
|
|
|
"focusPassword": false, |
|
|
|
"logo": "/static/logo.png", |
|
|
|
userType: 'user',//user|agent|background |
|
|
|
userType: 'user', //user|agent|background |
|
|
|
value: 0, |
|
|
|
range: [ |
|
|
|
{ value: 0, text: "用户登录" }, |
|
|
|
{ value: 1, text: "代理登录" }, |
|
|
|
{ value: 2, text: "后台登录" }, |
|
|
|
], |
|
|
|
range: [{ |
|
|
|
value: 0, |
|
|
|
text: "用户登录" |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 1, |
|
|
|
text: "代理登录" |
|
|
|
}, |
|
|
|
{ |
|
|
|
value: 2, |
|
|
|
text: "后台登录" |
|
|
|
}, |
|
|
|
] |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(e) { |
|
|
|
if(e.phone){ |
|
|
|
if (e.phone) { |
|
|
|
this.username = e.phone; |
|
|
|
} |
|
|
|
// 打开应用时查一下是否登录过,登录过就跳转, |
|
|
|
// 跳转到相应的页面请求时,会查询token是否过期,过期会清除并且跳转登录页 |
|
|
|
if(uni.getStorageSync('user_token')){ |
|
|
|
if (uni.getStorageSync('user_token')) { |
|
|
|
let newUrl = ''; |
|
|
|
switch (uni.getStorageSync('userType')){ |
|
|
|
switch (uni.getStorageSync('userType')) { |
|
|
|
case 'user': |
|
|
|
newUrl = '/pages/home/home'; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'agent': |
|
|
|
newUrl = '/pages/list/team'; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'background': |
|
|
|
newUrl = '/pages/home/home'; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
uni.switchTab({ |
|
|
|
url:newUrl |
|
|
|
url: newUrl |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
@ -132,45 +138,50 @@ |
|
|
|
duration: 3000 |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
let url = '/passport/mixedLogin', newUrl = ''; |
|
|
|
let data = {account_number: this.username, password: this.password, captcha: ''}; |
|
|
|
|
|
|
|
API.request(url, data, res=>{ |
|
|
|
|
|
|
|
let url = '/passport/mixedLogin', |
|
|
|
newUrl = ''; |
|
|
|
let data = { |
|
|
|
account_number: this.username, |
|
|
|
password: this.password, |
|
|
|
captcha: '' |
|
|
|
}; |
|
|
|
|
|
|
|
API.request(url, data, res => { |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
let accounts = uni.getStorageSync('accounts') || []; |
|
|
|
accounts.push(this.username); |
|
|
|
accounts = Array.from(new Set(accounts)); |
|
|
|
uni.setStorageSync('accounts', accounts); |
|
|
|
|
|
|
|
|
|
|
|
uni.setStorageSync('user_token', res.data.token); |
|
|
|
switch (res.data.type){ |
|
|
|
switch (res.data.type) { |
|
|
|
case 3: |
|
|
|
newUrl = '/pages/home/home'; |
|
|
|
this.userType = 'user'; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
newUrl = '/pages/home/home'; |
|
|
|
// newUrl = '/pages/list/team'; |
|
|
|
this.userType = 'agent'; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
newUrl = '/pages/home/home'; |
|
|
|
this.userType = 'background'; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
uni.setStorageSync('userType', this.userType); |
|
|
|
|
|
|
|
setTimeout(()=>{ |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
uni.switchTab({ |
|
|
|
url:newUrl |
|
|
|
url: newUrl |
|
|
|
}) |
|
|
|
}, 1500) |
|
|
|
}, fail=>{}, false) |
|
|
|
|
|
|
|
}, fail => {}, false) |
|
|
|
|
|
|
|
}, |
|
|
|
/* 前往注册 */ |
|
|
|
toRegister() { |
|
|
|
@ -181,13 +192,27 @@ |
|
|
|
console.error(e); |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
.nav_area{ |
|
|
|
uni-page-body{ |
|
|
|
display: block; |
|
|
|
box-sizing: border-box; |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
.logins{ |
|
|
|
height: 100%; |
|
|
|
// position: relative; |
|
|
|
} |
|
|
|
.bottom_t{ |
|
|
|
width: 100vw;text-align: center;color: #dcdcdc;font-size: 14px; |
|
|
|
line-height: 28px;height: 56px;position: relative;bottom: -25%; |
|
|
|
} |
|
|
|
.nav_area { |
|
|
|
background-color: #fff; |
|
|
|
width: 750rpx; |
|
|
|
/* #ifdef H5 */ |
|
|
|
@ -198,18 +223,20 @@ |
|
|
|
/* #endif */ |
|
|
|
padding-top: var(--status-bar-height); |
|
|
|
} |
|
|
|
.logo_area{ |
|
|
|
|
|
|
|
.logo_area { |
|
|
|
width: 270px; |
|
|
|
height: 50px; |
|
|
|
margin: 4px auto; |
|
|
|
position: relative; |
|
|
|
|
|
|
|
image{ |
|
|
|
// position: relative; |
|
|
|
|
|
|
|
image { |
|
|
|
width: 50px; |
|
|
|
height: 47px; |
|
|
|
} |
|
|
|
} |
|
|
|
.title-box{ |
|
|
|
|
|
|
|
.title-box { |
|
|
|
font-size: 26px; |
|
|
|
color: #444; |
|
|
|
margin: 0px auto 20px; |
|
|
|
@ -220,34 +247,40 @@ |
|
|
|
flex-direction: column; |
|
|
|
} |
|
|
|
|
|
|
|
.content-A{ |
|
|
|
.content-A { |
|
|
|
width: 270px; |
|
|
|
margin: 0px auto; |
|
|
|
} |
|
|
|
/deep/ .uni-easyinput__content{ |
|
|
|
|
|
|
|
/deep/ .uni-easyinput__content { |
|
|
|
background-color: #fff !important; |
|
|
|
border-bottom: 1px solid #ebebeb; |
|
|
|
font-size: 16px !important; |
|
|
|
} |
|
|
|
.uni-easyinput__placeholder-class{ |
|
|
|
|
|
|
|
.uni-easyinput__placeholder-class { |
|
|
|
font-size: 16px; |
|
|
|
color: #cecece; |
|
|
|
} |
|
|
|
/deep/ .uni-easyinput__content-input{ |
|
|
|
|
|
|
|
/deep/ .uni-easyinput__content-input { |
|
|
|
padding-left: 0px !important; |
|
|
|
// flex: 0.45; |
|
|
|
} |
|
|
|
/deep/ .content-clear-icon{ |
|
|
|
|
|
|
|
/deep/ .content-clear-icon { |
|
|
|
// flex: 1; |
|
|
|
} |
|
|
|
.login-btn{ |
|
|
|
|
|
|
|
.login-btn { |
|
|
|
border-radius: 10px; |
|
|
|
} |
|
|
|
|
|
|
|
.forget { |
|
|
|
font-size: 14px; |
|
|
|
color: #999; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.link-box { |
|
|
|
/* #ifndef APP-NVUE */ |
|
|
|
display: flex; |
|
|
|
@ -256,9 +289,9 @@ |
|
|
|
justify-content: space-between; |
|
|
|
margin-top: 20px; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.link { |
|
|
|
font-size: 14px; |
|
|
|
color: #444; |
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |