Commit 644d5ab8 authored by 刘殿昕's avatar 刘殿昕

bg-login移植

parent 6a13f357
...@@ -61,13 +61,17 @@ ...@@ -61,13 +61,17 @@
<el-form :model="ruleForm_0" :rules="rules_0" ref="ruleForm_0" class="demo-ruleForm"> <el-form :model="ruleForm_0" :rules="rules_0" ref="ruleForm_0" class="demo-ruleForm">
<el-form-item prop="userid1" :class="ruleFormIcon.userid1?'':'icon_show'"> <el-form-item prop="userid1" :class="ruleFormIcon.userid1?'':'icon_show'">
<p class="item_p">账号</p> <p class="item_p">账号</p>
<el-input v-model.trim="ruleForm_0.userid1" placeholder="为字母、数字、下划线或其组合"></el-input> <el-input
v-model.trim="ruleForm_0.userid1"
autocomplete="new-password"
placeholder="为字母、数字、下划线或其组合"
></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password1" :class="ruleFormIcon.password1?'':'icon_show'"> <el-form-item prop="password1" :class="ruleFormIcon.password1?'':'icon_show'">
<p class="item_p">登录密码</p> <p class="item_p">登录密码</p>
<el-input <el-input
autocomplete="off"
v-model.trim="ruleForm_0.password1" v-model.trim="ruleForm_0.password1"
autocomplete="new-password"
:type="pwdCheck?'text':'password'" :type="pwdCheck?'text':'password'"
placeholder="密码为大小写字母及数字组合,不少于6位" placeholder="密码为大小写字母及数字组合,不少于6位"
> >
...@@ -82,7 +86,7 @@ ...@@ -82,7 +86,7 @@
<el-form-item prop="truePassword" :class="ruleFormIcon.truePassword?'':'icon_show'"> <el-form-item prop="truePassword" :class="ruleFormIcon.truePassword?'':'icon_show'">
<p class="item_p">确认密码</p> <p class="item_p">确认密码</p>
<el-input <el-input
autocomplete="off" autocomplete="new-password"
v-model.trim="ruleForm_0.truePassword" v-model.trim="ruleForm_0.truePassword"
:type="truePwdCheck?'text':'password'" :type="truePwdCheck?'text':'password'"
placeholder="请确认密码" placeholder="请确认密码"
...@@ -203,9 +207,9 @@ export default { ...@@ -203,9 +207,9 @@ export default {
if (value == "") { if (value == "") {
this.ruleFormIcon.userid1 = false; this.ruleFormIcon.userid1 = false;
callback(new Error("请输入账号")); callback(new Error("请输入账号"));
} else if (value.length > 16) { } else if (value.length > 16 || value.length < 3) {
this.ruleFormIcon.userid1 = false; this.ruleFormIcon.userid1 = false;
callback(new Error("长度请不要超过16位")); callback(new Error("长度请大于三位且不超过16位"));
} else if (!reg.test(value)) { } else if (!reg.test(value)) {
this.ruleFormIcon.userid1 = false; this.ruleFormIcon.userid1 = false;
callback(new Error("只支持字母、数字、-、_、.")); callback(new Error("只支持字母、数字、-、_、."));
...@@ -232,14 +236,14 @@ export default { ...@@ -232,14 +236,14 @@ export default {
}; };
var validatePassword = (rule, value, callback) => { var validatePassword = (rule, value, callback) => {
let reg = new RegExp( let reg = new RegExp(
/^.*(?=.{6,50})(?=.*\d)(?=.*[A-Z]{1,})(?=.*[a-z]{1,}).*$/ /^.*(?=.{6,20})(?=.*\d)(?=.*[A-Z]{1,})(?=.*[a-z]{1,}).*$/
); );
if (value == "") { if (value == "") {
this.ruleFormIcon.password1 = false; this.ruleFormIcon.password1 = false;
callback(new Error("请输入密码")); callback(new Error("请输入密码"));
} else if (!reg.test(value)) { } else if (!reg.test(value)) {
this.ruleFormIcon.password1 = false; this.ruleFormIcon.password1 = false;
callback(new Error("密码包含大小写字母、数字,长度不小于6")); callback(new Error("密码包含大小写字母、数字,长度在6位~20"));
} else { } else {
this.ruleFormIcon.password1 = true; this.ruleFormIcon.password1 = true;
callback(); callback();
...@@ -249,6 +253,9 @@ export default { ...@@ -249,6 +253,9 @@ export default {
if (value == "") { if (value == "") {
this.ruleFormIcon.cname = false; this.ruleFormIcon.cname = false;
callback(new Error("请输入昵称")); callback(new Error("请输入昵称"));
} else if (value.length > 8) {
this.ruleFormIcon.cname = false;
callback(new Error("昵称长度请不超过8位"));
} else { } else {
this.ruleFormIcon.cname = true; this.ruleFormIcon.cname = true;
callback(); callback();
...@@ -258,15 +265,27 @@ export default { ...@@ -258,15 +265,27 @@ export default {
if (value == "") { if (value == "") {
this.ruleFormIcon.businessSystemName = false; this.ruleFormIcon.businessSystemName = false;
callback(new Error("请输入业务系统名")); callback(new Error("请输入业务系统名"));
} else if (value.length > 16) {
this.ruleFormIcon.businessSystemName = false;
callback(new Error("业务系统名长度请不超过16位"));
} else { } else {
this.ruleFormIcon.businessSystemName = true; this.ruleFormIcon.businessSystemName = true;
callback(); callback();
} }
}; };
var validateDomainName = (rule, value, callback) => { var validateDomainName = (rule, value, callback) => {
let reg = new RegExp(
/^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$/
);
if (value == "") { if (value == "") {
this.ruleFormIcon.domainName = false; this.ruleFormIcon.domainName = false;
callback(new Error("请输入域名")); callback(new Error("请输入域名"));
} else if (value.length > 255) {
this.ruleFormIcon.domainName = false;
callback(new Error("域名长度请不超过255位"));
} else if (!reg.test(value)) {
this.ruleFormIcon.domainName = false;
callback(new Error("域名格式不正确"));
} else { } else {
this.ruleFormIcon.domainName = true; this.ruleFormIcon.domainName = true;
callback(); callback();
...@@ -339,32 +358,16 @@ export default { ...@@ -339,32 +358,16 @@ export default {
organization: true, organization: true,
}, },
rules_0: { rules_0: {
userid1: [ userid1: [{ validator: validateUser, trigger: "blur" }],
{ validator: validateUser, trigger: "blur" }, password1: [{ validator: validatePassword, trigger: "blur" }],
{ max: 8, message: "长度请小于8个字符", trigger: "blur" }, truePassword: [{ validator: validatePass, trigger: "blur" }],
], cname: [{ validator: validateCname, trigger: "blur" }],
password1: [
{ validator: validatePassword, trigger: "blur" },
{ max: 20, message: "长度请小于20个字符", trigger: "blur" },
],
truePassword: [
{ validator: validatePass, trigger: "blur" },
{ max: 20, message: "长度请小于20个字符", trigger: "blur" },
],
cname: [
{ validator: validateCname, trigger: "blur" },
{ max: 8, message: "长度请小于8个字符", trigger: "blur" },
],
}, },
rules_1: { rules_1: {
businessSystemName: [ businessSystemName: [
{ validator: validateBusinessSystemName, trigger: "blur" }, { validator: validateBusinessSystemName, trigger: "blur" },
{ max: 16, message: "长度请小于16个字符", trigger: "blur" },
],
domainName: [
{ validator: validateDomainName, trigger: "blur" },
{ max: 50, message: "长度请小于50个字符", trigger: "blur" },
], ],
domainName: [{ validator: validateDomainName, trigger: "blur" }],
organization: [{ validator: validateOrganization, trigger: "change" }], organization: [{ validator: validateOrganization, trigger: "change" }],
}, },
imgSrc: "", imgSrc: "",
...@@ -464,13 +467,6 @@ export default { ...@@ -464,13 +467,6 @@ export default {
register() { register() {
this.active = "register"; this.active = "register";
this.registerActive = 0; this.registerActive = 0;
setTimeout(() => {
this.ruleForm_0.userid1 = "";
this.ruleForm_0.password1 = "";
this.ruleFormIcon.userid1 = true;
this.ruleFormIcon.password1 = true;
this.$refs.ruleForm_0.clearValidate();
}, 100);
this.getOrganizations(); this.getOrganizations();
this.refreshCode(); this.refreshCode();
}, },
...@@ -503,10 +499,7 @@ export default { ...@@ -503,10 +499,7 @@ export default {
if (valid) { if (valid) {
self.$refs["yzms"].validate((volid_yzm, obj_yzm) => { self.$refs["yzms"].validate((volid_yzm, obj_yzm) => {
if (volid_yzm) { if (volid_yzm) {
let setI = setInterval(function () { self.submitAll();
clearInterval(setI);
self.submitAll();
});
} else { } else {
self.$message({ self.$message({
message: "请完善验证码", message: "请完善验证码",
...@@ -557,9 +550,11 @@ export default { ...@@ -557,9 +550,11 @@ export default {
}); });
}, },
delIp(index) { delIp(index) {
this.ruleForm_1.ip_white.split(index, 1); this.ruleForm_1.ip_white.splice(index, 1);
}, },
login() { login() {
this.$refs.ruleForm_1.resetFields();
this.$refs.ruleForm_0.resetFields();
this.active = "login"; this.active = "login";
this.ruleForm_0.userid1 = ""; this.ruleForm_0.userid1 = "";
this.ruleForm_0.password1 = ""; this.ruleForm_0.password1 = "";
...@@ -569,6 +564,7 @@ export default { ...@@ -569,6 +564,7 @@ export default {
this.ruleForm_1.domainName = ""; this.ruleForm_1.domainName = "";
this.ruleForm_1.ip_white = []; this.ruleForm_1.ip_white = [];
this.ruleForm_1.organization = ""; this.ruleForm_1.organization = "";
this.yzms.yzm = "";
this.ruleFormIcon.userid1 = true; this.ruleFormIcon.userid1 = true;
this.ruleFormIcon.password1 = true; this.ruleFormIcon.password1 = true;
this.ruleFormIcon.truePassword = true; this.ruleFormIcon.truePassword = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment