Browse Source

修改密码格式

master
邓宏 2 years ago
parent
commit
30c66d8c1b
  1. 2
      pages/home/rePassword.vue
  2. 15
      pages/home/register.vue

2
pages/home/rePassword.vue

@ -53,7 +53,7 @@ import request from '@/common/request'
}else if(!this.formData.password){ }else if(!this.formData.password){
uni.showToast({title:"请输入密码!",icon:"none"}) uni.showToast({title:"请输入密码!",icon:"none"})
return false 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"}) uni.showToast({title:"密码格式为6-20位字母和数字的组合!",icon:"none"})
return false return false
}else if(this.formData.confirmpassword!=this.formData.password){ }else if(this.formData.confirmpassword!=this.formData.password){

15
pages/home/register.vue

@ -41,12 +41,12 @@ export default {
data(){ data(){
return{ return{
fields:{ fields:{
name:{placeholder:"请输入企业名称(中文)"}, // name:{placeholder:"()"},
creditCode:{placeholder:"请输入统一社会信用代码"}, // creditCode:{placeholder:""},
type:{placeholder:"请选择企业类型",type:"select",columns:[[]],value:[]}, // type:{placeholder:"",type:"select",columns:[[]],value:[]},
connectUser:{placeholder:"请输入企业联系人"}, // connectUser:{placeholder:""},
connectPhone:{placeholder:"请输入手机号码"}, // connectPhone:{placeholder:""},
password:{placeholder:"请输入密码(6-20位字母和数字的组合)",type:"password"}, password:{placeholder:"请输入密码(大小写字母、数字、特殊字符)",type:"password"},
}, },
formData:{ formData:{
name: "", name: "",
@ -72,7 +72,7 @@ export default {
}, trigger:"blur"}, }, trigger:"blur"},
password:{required:true, validator(rule,val,call){ password:{required:true, validator(rule,val,call){
if(!val)call(new Error('密码必填!')); 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(); else call();
}, trigger:"blur"}, }, trigger:"blur"},
}, },
@ -101,6 +101,7 @@ export default {
} }
}, },
async submit(){ async submit(){
console.log(this.formData.password)
this.$refs.form.validate().then(async valid=>{ this.$refs.form.validate().then(async valid=>{
if(valid){ if(valid){
var res=await request("/base/api/plantCompany/register",{ var res=await request("/base/api/plantCompany/register",{

Loading…
Cancel
Save