style:调整商品详情代码

This commit is contained in:
wangsongsole 2022-10-18 15:02:16 +08:00
parent 5610894847
commit c2aae41c65
1 changed files with 86 additions and 18 deletions

View File

@ -249,17 +249,57 @@
handler (newVal) { handler (newVal) {
this.maxlen = 50; this.maxlen = 50;
this.acctype = "text"; this.acctype = "text";
const placeholderArray = [ switch (Number(newVal)) {
"请输入昵称", "请输入手机号", "请输入邮箱", "请输入手机号或邮箱", "请输入QQ号", case 0:
"请输入手机号或QQ号", "请输入邮箱或QQ号", "请输入手机号/邮箱/QQ号", "请输入微信号", return this.placeholder = "请输入昵称";
"请输入手机号或微信", "请输入邮箱或微信号", "请输入手机号/邮箱/微信号", "请输入QQ号或微信号", case 1:
"请输入手机号/QQ号/微信号", "请输入邮箱/QQ号/微信号", "请输入手机号/邮箱/QQ号/微信号" this.acctype = "tel";
] this.placeholder = "请输入手机号";
this.placeholder = placeholderArray[newVal] this.maxlen = 11;
if ([1, 4, 5].includes(newVal)) this.acctype = "tel" return
if ([8, 9, 12, 13].includes(newVal)) this.maxlen = 20 case 2:
if (newVal === 4) this.maxlen = 10 return this.placeholder = "请输入邮箱";
if (newVal === 5) this.maxlen = 11 case 3:
return this.placeholder = "请输入手机号或邮箱";
case 4:
this.placeholder = "请输入QQ号";
this.acctype = "tel";
this.maxlen = 10;
return
case 5:
this.placeholder = "请输入手机号或QQ号";
this.maxlen = 11;
this.acctype = "tel";
return
case 6:
return this.placeholder = "请输入邮箱或QQ号";
case 7:
return this.placeholder = "请输入手机号/邮箱/QQ号";
case 8:
this.placeholder = "请输入微信号";
this.maxlen = 20;
return
case 9:
this.placeholder = "请输入手机号或微信";
this.maxlen = 20;
return
case 10:
return this.placeholder = "请输入邮箱或微信号";
case 11:
return this.placeholder = "请输入手机号/邮箱/微信号";
case 12:
this.placeholder = "请输入QQ号或微信号";
this.maxlen = 20;
return
case 13:
this.placeholder = "请输入手机号/QQ号/微信号";
this.maxlen = 20;
return
case 14:
return this.placeholder = "请输入邮箱/QQ号/微信号";
default:
return this.placeholder = "请输入手机号/邮箱/QQ号/微信号";
}
} }
} }
}, },
@ -378,13 +418,41 @@
let emailsReg = /^[A-Za-z0-9\u4e00-\u9fa5\.]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(this.account); let emailsReg = /^[A-Za-z0-9\u4e00-\u9fa5\.]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(this.account);
let weiXinReg = /^[a-zA-Z][a-zA-Z\d_-]{5,19}$/.test(this.account); let weiXinReg = /^[a-zA-Z][a-zA-Z\d_-]{5,19}$/.test(this.account);
let regFlag = true; let regFlag = true;
switch (Number(this.productType)) {
const array = [nameReg, phoneReg, emailsReg, phoneReg || emailsReg, qqReg, case 0:
phoneReg || qqReg, emailsReg || qqReg, phoneReg || emailsReg || qqReg, weiXinReg, this.placeholder = "请输入昵称";
phoneReg || weiXinReg, emailsReg || weiXinReg, phoneReg || emailsReg || weiXinReg, return regFlag = nameReg
qqReg || weiXinReg, phoneReg || qqReg || weiXinReg, emailsReg || qqReg || weiXinReg, case 1:
phoneReg || emailsReg || qqReg || weiXinReg] return regFlag = phoneReg
regFlag = array[this.productType] case 2:
return regFlag = emailsReg
case 3:
return regFlag = phoneReg || emailsReg
case 4:
return regFlag = qqReg
case 5:
return regFlag = phoneReg || qqReg
case 6:
return regFlag = emailsReg || qqReg
case 7:
return regFlag = phoneReg || emailsReg || qqReg
case 8:
return regFlag = weiXinReg
case 9:
return regFlag = phoneReg || weiXinReg
case 10:
return regFlag = emailsReg || weiXinReg
case 11:
return regFlag = phoneReg || emailsReg || weiXinReg
case 12:
return regFlag = qqReg || weiXinReg
case 13:
return regFlag = phoneReg || qqReg || weiXinReg
case 14:
return regFlag = emailsReg || qqReg || weiXinReg
default:
return regFlag = phoneReg || emailsReg || qqReg || weiXinReg
}
if (!regFlag) { if (!regFlag) {
this.openDialog("充值账号格式不正确!"); this.openDialog("充值账号格式不正确!");