diff --git a/src/pages/login.vue b/src/pages/login.vue index 90af0b8c18cf73252f237997e2c39c5b96380cc5..42427e0c39df7758b7f253aa5d401c0d1014e599 100644 --- a/src/pages/login.vue +++ b/src/pages/login.vue @@ -61,13 +61,17 @@

账号

- +

登录密码

@@ -82,7 +86,7 @@

确认密码

16) { + } else if (value.length > 16 || value.length < 3) { this.ruleFormIcon.userid1 = false; - callback(new Error("长度请不要超过16位")); + callback(new Error("长度请大于三位且不超过16位")); } else if (!reg.test(value)) { this.ruleFormIcon.userid1 = false; callback(new Error("只支持字母、数字、-、_、.")); @@ -232,14 +236,14 @@ export default { }; var validatePassword = (rule, value, callback) => { let reg = new RegExp( - /^.*(?=.{6,50})(?=.*\d)(?=.*[A-Z]{1,})(?=.*[a-z]{1,}).*$/ + /^.*(?=.{6,20})(?=.*\d)(?=.*[A-Z]{1,})(?=.*[a-z]{1,}).*$/ ); if (value == "") { this.ruleFormIcon.password1 = false; callback(new Error("请输入密码")); } else if (!reg.test(value)) { this.ruleFormIcon.password1 = false; - callback(new Error("密码包含大小写字母、数字,长度不小于6位")); + callback(new Error("密码包含大小写字母、数字,长度在6位~20位")); } else { this.ruleFormIcon.password1 = true; callback(); @@ -249,6 +253,9 @@ export default { if (value == "") { this.ruleFormIcon.cname = false; callback(new Error("请输入昵称")); + } else if (value.length > 8) { + this.ruleFormIcon.cname = false; + callback(new Error("昵称长度请不超过8位")); } else { this.ruleFormIcon.cname = true; callback(); @@ -258,15 +265,27 @@ export default { if (value == "") { this.ruleFormIcon.businessSystemName = false; callback(new Error("请输入业务系统名")); + } else if (value.length > 16) { + this.ruleFormIcon.businessSystemName = false; + callback(new Error("业务系统名长度请不超过16位")); } else { this.ruleFormIcon.businessSystemName = true; 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 == "") { this.ruleFormIcon.domainName = false; 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 { this.ruleFormIcon.domainName = true; callback(); @@ -339,32 +358,16 @@ export default { organization: true, }, rules_0: { - userid1: [ - { validator: validateUser, trigger: "blur" }, - { max: 8, message: "长度请小于8个字符", 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" }, - ], + userid1: [{ validator: validateUser, trigger: "blur" }], + password1: [{ validator: validatePassword, trigger: "blur" }], + truePassword: [{ validator: validatePass, trigger: "blur" }], + cname: [{ validator: validateCname, trigger: "blur" }], }, rules_1: { businessSystemName: [ { 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" }], }, imgSrc: "", @@ -464,13 +467,6 @@ export default { register() { this.active = "register"; 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.refreshCode(); }, @@ -503,10 +499,7 @@ export default { if (valid) { self.$refs["yzms"].validate((volid_yzm, obj_yzm) => { if (volid_yzm) { - let setI = setInterval(function () { - clearInterval(setI); - self.submitAll(); - }); + self.submitAll(); } else { self.$message({ message: "请完善验证码", @@ -557,9 +550,11 @@ export default { }); }, delIp(index) { - this.ruleForm_1.ip_white.split(index, 1); + this.ruleForm_1.ip_white.splice(index, 1); }, login() { + this.$refs.ruleForm_1.resetFields(); + this.$refs.ruleForm_0.resetFields(); this.active = "login"; this.ruleForm_0.userid1 = ""; this.ruleForm_0.password1 = ""; @@ -569,6 +564,7 @@ export default { this.ruleForm_1.domainName = ""; this.ruleForm_1.ip_white = []; this.ruleForm_1.organization = ""; + this.yzms.yzm = ""; this.ruleFormIcon.userid1 = true; this.ruleFormIcon.password1 = true; this.ruleFormIcon.truePassword = true;