diff --git a/pages/home/rePassword.vue b/pages/home/rePassword.vue index b90b930..edf6c5c 100644 --- a/pages/home/rePassword.vue +++ b/pages/home/rePassword.vue @@ -53,7 +53,7 @@ import request from '@/common/request' }else if(!this.formData.password){ uni.showToast({title:"请输入密码!",icon:"none"}) return false - }else if(!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/.test(this.formData.password)){ + }else if(!/^(?=.*\d)(?=.*[a-zA-Z])(?=.*[^\da-zA-Z\s]).+$/.test(this.formData.password)){ uni.showToast({title:"密码格式为6-20位字母和数字的组合!",icon:"none"}) return false }else if(this.formData.confirmpassword!=this.formData.password){ diff --git a/pages/home/register.vue b/pages/home/register.vue index aafec0a..7035ece 100644 --- a/pages/home/register.vue +++ b/pages/home/register.vue @@ -41,12 +41,12 @@ export default { data(){ return{ fields:{ - name:{placeholder:"请输入企业名称(中文)"}, - creditCode:{placeholder:"请输入统一社会信用代码"}, - type:{placeholder:"请选择企业类型",type:"select",columns:[[]],value:[]}, - connectUser:{placeholder:"请输入企业联系人"}, - connectPhone:{placeholder:"请输入手机号码"}, - password:{placeholder:"请输入密码(6-20位字母和数字的组合)",type:"password"}, + // name:{placeholder:"请输入企业名称(中文)"}, + // creditCode:{placeholder:"请输入统一社会信用代码"}, + // type:{placeholder:"请选择企业类型",type:"select",columns:[[]],value:[]}, + // connectUser:{placeholder:"请输入企业联系人"}, + // connectPhone:{placeholder:"请输入手机号码"}, + password:{placeholder:"请输入密码(大小写字母、数字、特殊字符)",type:"password"}, }, formData:{ name: "", @@ -72,7 +72,7 @@ export default { }, trigger:"blur"}, password:{required:true, validator(rule,val,call){ if(!val)call(new Error('密码必填!')); - else if(!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/.test(val))call(new Error('密码格式为(6-20位字母和数字的组合)!')); + else if(!/^(?=.*\d)(?=.*[a-zA-Z])(?=.*[^\da-zA-Z\s]).+$/.test(val))call(new Error('密码格式为(大小写字母、数字、特殊字符)!')); else call(); }, trigger:"blur"}, }, @@ -101,6 +101,7 @@ export default { } }, async submit(){ + console.log(this.formData.password) this.$refs.form.validate().then(async valid=>{ if(valid){ var res=await request("/base/api/plantCompany/register",{