【bug】企业管理员登录
This commit is contained in:
@@ -28,6 +28,23 @@ export function phoneLogin(parameter) {
|
||||
})
|
||||
}
|
||||
|
||||
// 管理员账号密码登录
|
||||
export function conpanyAdminLogin(parameter) {
|
||||
return axios({
|
||||
url: '/company/smsLogin',
|
||||
method: 'post',
|
||||
data: parameter
|
||||
})
|
||||
}
|
||||
// 管理员手机号登录
|
||||
export function conpanyAdminPhoneLogin(parameter) {
|
||||
return axios({
|
||||
url: '/company/smsLogin',
|
||||
method: 'post',
|
||||
data: parameter
|
||||
})
|
||||
}
|
||||
|
||||
export function getSmsCaptcha(parameter) {
|
||||
return axios({
|
||||
url: api.SendSms,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import { login, logout, phoneLogin, thirdLogin } from '@/api/login'
|
||||
import { login, logout, phoneLogin, thirdLogin,conpanyAdminLogin,conpanyAdminPhoneLogin } from '@/api/login'
|
||||
import {
|
||||
ACCESS_TOKEN,
|
||||
USER_NAME,
|
||||
@@ -126,6 +126,14 @@ const user = {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
// 管理员账号密码登录
|
||||
CompanyAdminLogin(){
|
||||
|
||||
},
|
||||
// 管理员手机验证码登录
|
||||
CompanyAdminPhoneLogin() {
|
||||
|
||||
},
|
||||
/**
|
||||
* 初次手机号登录,修改密码后再存用户信息
|
||||
|
||||
+74
-37
@@ -126,8 +126,9 @@
|
||||
<a-row style="margin-bottom: 2%;">
|
||||
<a-col :span="6"></a-col>
|
||||
<!-- 切换登录方式-->
|
||||
<!-- 企业管理员 去掉注册 去掉忘记密码 -->
|
||||
<a-col :span="4">
|
||||
<a-form-item>
|
||||
<a-form-item v-if="loginType === 0">
|
||||
<div @click="handleRegister" class="forget-password" style="margin-left: 5px;">注册</div>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -139,33 +140,45 @@
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="4" style="text-align: right;">
|
||||
<a-form-item>
|
||||
<a-form-item v-if="loginType === 0">
|
||||
<span @click='forgetPassword' class="forget-password" style="float: right;">
|
||||
忘记密码 <img style='height: 14px' src='../../assets/wenhao.png' alt=''>
|
||||
</span>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="6"></a-col>
|
||||
<a-col :span="10">
|
||||
<div>
|
||||
<span @click="toggleLoginType" class="company-admin-login">{{ loginTip }}</span>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</a-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapActions } from 'vuex'
|
||||
import { timeFix } from '@/utils/util'
|
||||
import {mapActions} from 'vuex'
|
||||
import {timeFix} from '@/utils/util'
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import { getAction } from '@/api/manage'
|
||||
import { getRSAPublicKey } from '@/api/login.js'
|
||||
import { JSEncrypt } from 'jsencrypt'
|
||||
import { phoneReg } from '@/utils/validate'
|
||||
import {ACCESS_TOKEN} from '@/store/mutation-types'
|
||||
import {getAction} from '@/api/manage'
|
||||
import {getRSAPublicKey} from '@/api/login.js'
|
||||
import {JSEncrypt} from 'jsencrypt'
|
||||
import {phoneReg} from '@/utils/validate'
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
loginBtn: false,
|
||||
loginType: 0,
|
||||
loginType: 0, // 登录方式 0 普通用户登录 1企业管理员登录
|
||||
loginTipObj: {
|
||||
1: '普通用户登录',
|
||||
0: '企业管理员登录'
|
||||
},
|
||||
stepCaptchaVisible: false,
|
||||
form: this.$form.createForm(this),
|
||||
state: {
|
||||
@@ -173,12 +186,12 @@ export default {
|
||||
smsSendBtn: false
|
||||
},
|
||||
validatorRules: {
|
||||
username: { rules: [{ required: true, message: '请输入手机号!' }, { validator: this.checkPhone }] },
|
||||
password: { rules: [{ required: true, message: '请输入密码!' }] },
|
||||
mobile: { rules: [{ validator: this.validateMobile }] },
|
||||
captcha: { rules: [{ required: true, message: '请输入验证码!' }] },
|
||||
inputCode: { rules: [{ required: true, message: '请输入验证码!' }] },
|
||||
phone: { rules: [{ required: true, message: '请输入手机号!' }, { validator: this.checkPhone }] }
|
||||
username: {rules: [{required: true, message: '请输入手机号!'}, {validator: this.checkPhone}]},
|
||||
password: {rules: [{required: true, message: '请输入密码!'}]},
|
||||
mobile: {rules: [{validator: this.validateMobile}]},
|
||||
captcha: {rules: [{required: true, message: '请输入验证码!'}]},
|
||||
inputCode: {rules: [{required: true, message: '请输入验证码!'}]},
|
||||
phone: {rules: [{required: true, message: '请输入手机号!'}, {validator: this.checkPhone}]}
|
||||
},
|
||||
velorifiedCode: '',
|
||||
inputCodeContent: '',
|
||||
@@ -192,6 +205,13 @@ export default {
|
||||
needSetPassword: false // 是否需要设置密码
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 底部提示的登录方式文字
|
||||
loginTip() {
|
||||
return this.loginTipObj[this.loginType]
|
||||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
document.title = '汽车标准化工作平台'
|
||||
this.currdatetime = new Date().getTime()
|
||||
@@ -201,16 +221,20 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['Login', 'Logout', 'PhoneLogin']),
|
||||
handleUsernameOrEmail(rule, value, callback) {
|
||||
const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/
|
||||
if (regex.test(value)) {
|
||||
this.loginType = 0
|
||||
} else {
|
||||
this.loginType = 1
|
||||
}
|
||||
callback()
|
||||
},
|
||||
/**
|
||||
* 切换登录方式
|
||||
* */
|
||||
toggleLoginType() {
|
||||
|
||||
if (this.loginType === 0) {
|
||||
this.loginType = 1
|
||||
} else if (this.loginType === 1) {
|
||||
this.loginType = 0
|
||||
}
|
||||
// 清空表单
|
||||
this.form.resetFields()
|
||||
|
||||
},
|
||||
/**
|
||||
* 验证手机号
|
||||
* @param rule
|
||||
@@ -232,7 +256,7 @@ export default {
|
||||
let that = this
|
||||
let loginParams = {}
|
||||
that.loginBtn = true
|
||||
that.form.validateFields(['username', 'password', 'inputCode', 'captcha', 'rememberMe'], { force: true }, (err, values) => {
|
||||
that.form.validateFields(['username', 'password', 'inputCode', 'captcha', 'rememberMe'], {force: true}, (err, values) => {
|
||||
if (!err) {
|
||||
loginParams.remember_me = values.rememberMe
|
||||
// 手机登录验证码
|
||||
@@ -289,7 +313,7 @@ export default {
|
||||
getCaptcha(e) {
|
||||
e.preventDefault()
|
||||
let that = this
|
||||
this.form.validateFields(['username'], { force: true }, (err, values) => {
|
||||
this.form.validateFields(['username'], {force: true}, (err, values) => {
|
||||
if (!values.username) {
|
||||
that.cmsFailed('请输入手机号')
|
||||
} else if (!err) {
|
||||
@@ -317,12 +341,12 @@ export default {
|
||||
}
|
||||
setTimeout(hide, 500)
|
||||
}).catch(err => {
|
||||
setTimeout(hide, 1)
|
||||
clearInterval(interval)
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
this.requestFailed(err)
|
||||
})
|
||||
setTimeout(hide, 1)
|
||||
clearInterval(interval)
|
||||
that.state.time = 60
|
||||
that.state.smsSendBtn = false
|
||||
this.requestFailed(err)
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -335,11 +359,11 @@ export default {
|
||||
},
|
||||
// 忘记密码
|
||||
forgetPassword() {
|
||||
this.$router.push({ name: 'alteration' })
|
||||
this.$router.push({name: 'alteration'})
|
||||
},
|
||||
handleChangeCheckCode() {
|
||||
this.currdatetime = new Date().getTime()
|
||||
getAction(`/sys/randomImage/${ this.currdatetime }`).then(res => {
|
||||
getAction(`/sys/randomImage/${this.currdatetime}`).then(res => {
|
||||
if (res.success) {
|
||||
this.randCodeImage = res.result
|
||||
this.requestCodeSuccess = true
|
||||
@@ -362,11 +386,11 @@ export default {
|
||||
loginSuccess() {
|
||||
// this.$router.push({ path: "/dashboard/analysis" }).catch((res)=>{})
|
||||
// 进入首页
|
||||
this.$router.push({ path: '/' }).catch(() => {
|
||||
this.$router.push({path: '/'}).catch(() => {
|
||||
})
|
||||
this.$notification.success({
|
||||
message: '欢迎',
|
||||
description: `${ timeFix() },欢迎回来`
|
||||
description: `${timeFix()},欢迎回来`
|
||||
})
|
||||
},
|
||||
cmsFailed(err) {
|
||||
@@ -527,4 +551,17 @@ export default {
|
||||
height: 60px;
|
||||
border: 1px solid #E6E3E3;
|
||||
}
|
||||
|
||||
// 企业管理员登录
|
||||
.center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.company-admin-login {
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
color: #BFBFBF;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user