优化登录和注册页面
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
size="large"
|
size="large"
|
||||||
v-decorator="['loginName',{initialValue:'', rules: validatorRules.loginName.rules}]"
|
v-decorator="['loginName',{initialValue:'', rules: validatorRules.loginName.rules}]"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请输入帐户名">
|
placeholder="请输入用户名">
|
||||||
<a-icon slot="prefix" type="user" :style="{ color: 'rgba(0,0,0,.25)' }"/>
|
<a-icon slot="prefix" type="user" :style="{ color: 'rgba(0,0,0,.25)' }"/>
|
||||||
</a-input>
|
</a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<a-checkbox v-decorator="['rememberMe', {initialValue: true, valuePropName: 'checked'}]" >自动登陆</a-checkbox>
|
<a-checkbox v-decorator="['rememberMe', {initialValue: true, valuePropName: 'checked'}]" >自动登陆</a-checkbox>
|
||||||
<router-link :to="{ name: 'register'}" class="forge-password" style="float: right;margin-right: 10px" >
|
<router-link :to="{ name: 'register'}" class="forge-password" style="float: right;margin-right: 10px;" >
|
||||||
注册账户
|
注册租户
|
||||||
</router-link>
|
</router-link>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@
|
|||||||
//loginParams.remember_me = values.rememberMe
|
//loginParams.remember_me = values.rememberMe
|
||||||
console.log("登录参数",loginParams)
|
console.log("登录参数",loginParams)
|
||||||
that.Login(loginParams).then((res) => {
|
that.Login(loginParams).then((res) => {
|
||||||
this.departConfirm(res)
|
this.departConfirm(res, loginParams.loginName)
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
that.requestFailed(err);
|
that.requestFailed(err);
|
||||||
});
|
});
|
||||||
@@ -157,9 +157,6 @@
|
|||||||
if(res.data.user.loginName === 'admin'){
|
if(res.data.user.loginName === 'admin'){
|
||||||
let desc = 'admin只是平台运维用户,真正的管理员是租户(测试账号为jsh),admin不能编辑任何业务数据,只能配置平台菜单和创建租户'
|
let desc = 'admin只是平台运维用户,真正的管理员是租户(测试账号为jsh),admin不能编辑任何业务数据,只能配置平台菜单和创建租户'
|
||||||
this.$message.info(desc,30)
|
this.$message.info(desc,30)
|
||||||
} else if(res.data.user.loginName === 'jsh'){
|
|
||||||
let desc = '当前为测试用户,数据会被重置,正式体验请注册!'
|
|
||||||
this.$message.info(desc,10)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.initMPropertyShort();
|
this.initMPropertyShort();
|
||||||
@@ -182,7 +179,7 @@
|
|||||||
generateCode(value){
|
generateCode(value){
|
||||||
this.verifiedCode = value.toLowerCase()
|
this.verifiedCode = value.toLowerCase()
|
||||||
},
|
},
|
||||||
departConfirm(res){
|
departConfirm(res, loginName){
|
||||||
if(res.code==200){
|
if(res.code==200){
|
||||||
let err = {};
|
let err = {};
|
||||||
if(res.data.msgTip == 'user can login'){
|
if(res.data.msgTip == 'user can login'){
|
||||||
@@ -202,7 +199,11 @@
|
|||||||
this.requestFailed(err)
|
this.requestFailed(err)
|
||||||
this.Logout();
|
this.Logout();
|
||||||
} else if(res.data.msgTip == 'tenant is black'){
|
} else if(res.data.msgTip == 'tenant is black'){
|
||||||
|
if(loginName === 'jsh') {
|
||||||
|
err.message = 'jsh用户已停用,请注册租户进行体验!';
|
||||||
|
} else {
|
||||||
err.message = '用户所属的租户被禁用';
|
err.message = '用户所属的租户被禁用';
|
||||||
|
}
|
||||||
this.requestFailed(err)
|
this.requestFailed(err)
|
||||||
this.Logout();
|
this.Logout();
|
||||||
} else if(res.data.msgTip == 'tenant is expire'){
|
} else if(res.data.msgTip == 'tenant is expire'){
|
||||||
@@ -272,6 +273,7 @@
|
|||||||
|
|
||||||
.forge-password {
|
.forge-password {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
font-weight: bolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.login-button {
|
button.login-button {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<a-form ref="formRegister" :autoFormCreate="(form)=>{this.form = form}" id="formRegister">
|
<a-form ref="formRegister" :autoFormCreate="(form)=>{this.form = form}" id="formRegister">
|
||||||
<a-form-item
|
<a-form-item
|
||||||
fieldDecoratorId="username"
|
fieldDecoratorId="username"
|
||||||
:fieldDecoratorOptions="{rules: [{ required: true, message: '用户名不能为空'}], validateTrigger: ['change', 'blur'], validateFirst: true}">
|
:fieldDecoratorOptions="{rules: [{ required: true, message: '用户名不能为空'}, { validator: this.handleUserName}], validateTrigger: ['change', 'blur'], validateFirst: true}">
|
||||||
<a-input size="large" type="text" autocomplete="false" placeholder="请输入用户名"></a-input>
|
<a-input size="large" type="text" autocomplete="false" placeholder="请输入用户名"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
@@ -40,7 +40,6 @@
|
|||||||
size="large"
|
size="large"
|
||||||
type="text"
|
type="text"
|
||||||
default-value=""
|
default-value=""
|
||||||
@change="inputCodeChange"
|
|
||||||
placeholder="请输入验证码">
|
placeholder="请输入验证码">
|
||||||
<a-icon slot="prefix" type="smile" :style="{ color: 'rgba(0,0,0,.25)' }"/>
|
<a-icon slot="prefix" type="smile" :style="{ color: 'rgba(0,0,0,.25)' }"/>
|
||||||
</a-input>
|
</a-input>
|
||||||
@@ -60,9 +59,9 @@
|
|||||||
class="register-button"
|
class="register-button"
|
||||||
:loading="registerBtn"
|
:loading="registerBtn"
|
||||||
@click.stop.prevent="handleSubmit"
|
@click.stop.prevent="handleSubmit"
|
||||||
:disabled="registerBtn">注册
|
:disabled="registerBtn">注册租户
|
||||||
</a-button>
|
</a-button>
|
||||||
<router-link class="login" :to="{ name: 'login' }">使用已有账户登录</router-link>
|
<router-link class="login" :to="{ name: 'login' }">使用已有租户登录</router-link>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
<div class="login-copyright">
|
<div class="login-copyright">
|
||||||
@@ -153,6 +152,13 @@
|
|||||||
this.requestCodeSuccess=false
|
this.requestCodeSuccess=false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
handleUserName(rule, value, callback) {
|
||||||
|
let reg = /^(?=.*[a-z]).{4,}$/;
|
||||||
|
if (!reg.test(value)) {
|
||||||
|
callback(new Error('用户名需要由4位小写字母组成!'))
|
||||||
|
}
|
||||||
|
callback()
|
||||||
|
},
|
||||||
handlePasswordLevel(rule, value, callback) {
|
handlePasswordLevel(rule, value, callback) {
|
||||||
|
|
||||||
let level = 0
|
let level = 0
|
||||||
@@ -232,8 +238,8 @@
|
|||||||
if(res.code === 200){
|
if(res.code === 200){
|
||||||
this.$notification.success({
|
this.$notification.success({
|
||||||
message: '提示',
|
message: '提示',
|
||||||
description: "注册成功,请进行登录!",
|
description: "注册成功,请使用该租户登录!",
|
||||||
duration: 2
|
duration: 5
|
||||||
});
|
});
|
||||||
let that = this;
|
let that = this;
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
@@ -326,6 +332,7 @@
|
|||||||
.login {
|
.login {
|
||||||
float: right;
|
float: right;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
|
font-weight: bolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.login-copyright {
|
.login-copyright {
|
||||||
|
|||||||
Reference in New Issue
Block a user