From b77e8e776af4d81e748e9e21d51b64a11085a195 Mon Sep 17 00:00:00 2001 From: zhongshujie <2862698242@qq.com> Date: 星期四, 19 十二月 2024 10:49:11 +0800 Subject: [PATCH] 未提交退出提示 --- pages/personalCenter/feedBackSubmit/index.js | 30 ++++++++++++++++-------------- 1 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pages/personalCenter/feedBackSubmit/index.js b/pages/personalCenter/feedBackSubmit/index.js index a6f3185..33c79f8 100644 --- a/pages/personalCenter/feedBackSubmit/index.js +++ b/pages/personalCenter/feedBackSubmit/index.js @@ -68,11 +68,18 @@ const { phoneError } = this.data; - const isPhoneNumber = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e.detail.value); - if (phoneError === isPhoneNumber) { + if (e.detail.value) { + const isPhoneNumber = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e.detail.value); + if (phoneError === isPhoneNumber) { + this.setData({ + phoneError: !isPhoneNumber, + mannder: e.detail.value, + }); + } + } else { this.setData({ - phoneError: !isPhoneNumber, - mannder: e.detail.value, + phoneError: false, + mannder: '' }); } }, @@ -97,16 +104,7 @@ if (this.data.mannder.replace(/^\s*|\s*$/g, "") == '') { this.data.lock = true; wx.showToast({ - title: "鍙嶉鍐呭涓嶈兘涓虹┖", - icon: 'none', - duration: 1000 - }) - return - } - if (this.data.phoneError) { - this.data.lock = true; - wx.showToast({ - title: "鑱旂郴鏂瑰紡鏍煎紡涓嶆纭�", + title: "鑱旂郴鏂瑰紡涓嶈兘涓虹┖", icon: 'none', duration: 1000 }) @@ -121,6 +119,10 @@ }) return } + if (this.data.phoneError) { + this.data.lock = true; + return + } let submitData = { content: this.data.content.replace(/^\s*|\s*$/g, ""), -- Gitblit v1.9.1