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) {
this.maxlen = 50;
this.acctype = "text";
const placeholderArray = [
"请输入昵称", "请输入手机号", "请输入邮箱", "请输入手机号或邮箱", "请输入QQ号",
"请输入手机号或QQ号", "请输入邮箱或QQ号", "请输入手机号/邮箱/QQ号", "请输入微信号",
"请输入手机号或微信", "请输入邮箱或微信号", "请输入手机号/邮箱/微信号", "请输入QQ号或微信号",
"请输入手机号/QQ号/微信号", "请输入邮箱/QQ号/微信号", "请输入手机号/邮箱/QQ号/微信号"
]
this.placeholder = placeholderArray[newVal]
if ([1, 4, 5].includes(newVal)) this.acctype = "tel"
if ([8, 9, 12, 13].includes(newVal)) this.maxlen = 20
if (newVal === 4) this.maxlen = 10
if (newVal === 5) this.maxlen = 11
switch (Number(newVal)) {
case 0:
return this.placeholder = "请输入昵称";
case 1:
this.acctype = "tel";
this.placeholder = "请输入手机号";
this.maxlen = 11;
return
case 2:
return this.placeholder = "请输入邮箱";
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 weiXinReg = /^[a-zA-Z][a-zA-Z\d_-]{5,19}$/.test(this.account);
let regFlag = true;
const array = [nameReg, phoneReg, emailsReg, phoneReg || emailsReg, qqReg,
phoneReg || qqReg, emailsReg || qqReg, phoneReg || emailsReg || qqReg, weiXinReg,
phoneReg || weiXinReg, emailsReg || weiXinReg, phoneReg || emailsReg || weiXinReg,
qqReg || weiXinReg, phoneReg || qqReg || weiXinReg, emailsReg || qqReg || weiXinReg,
phoneReg || emailsReg || qqReg || weiXinReg]
regFlag = array[this.productType]
switch (Number(this.productType)) {
case 0:
this.placeholder = "请输入昵称";
return regFlag = nameReg
case 1:
return regFlag = phoneReg
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) {
this.openDialog("充值账号格式不正确!");