From da56d6adf193c95d9972202029eb2283e1d1bc6c Mon Sep 17 00:00:00 2001 From: chenzhihao <1798906853@qq.com> Date: Tue, 30 Dec 2025 15:23:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E5=86=8C=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E5=8F=B7=E4=B8=BA=E5=B7=A5=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CommunicationRecords/pages/chat/chat.wxml | 3 +- CommunicationRecords/pages/logs/logs.js | 39 ++++++++++++++++++++++- CommunicationRecords/pages/logs/logs.wxml | 2 +- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/CommunicationRecords/pages/chat/chat.wxml b/CommunicationRecords/pages/chat/chat.wxml index 8c692bf..41225f7 100644 --- a/CommunicationRecords/pages/chat/chat.wxml +++ b/CommunicationRecords/pages/chat/chat.wxml @@ -9,7 +9,8 @@ {{weChatName}} - + + diff --git a/CommunicationRecords/pages/logs/logs.js b/CommunicationRecords/pages/logs/logs.js index a86fd86..087ae95 100644 --- a/CommunicationRecords/pages/logs/logs.js +++ b/CommunicationRecords/pages/logs/logs.js @@ -39,7 +39,42 @@ if (typeof isAgree !== 'undefined'){ inputName(e) {this.setData({'form.name': e.detail.value})}, inputPhone(e) {this.setData({'form.phone': e.detail.value})}, async submitReg() { - + // 校验注册信息 + const { form, nickName } = this.data; + + if (!form.name.trim()) { + wx.showToast({ + title: '姓名不能为空', + icon: 'none' + }); + return; + } + + if (!form.phone.trim()) { + wx.showToast({ + title: '工号不能为空', + icon: 'none' + }); + return; + } + + // 校验电话号码格式(11位数字,以1开头) + const phoneReg = /^1\d{10}$/; + if (!phoneReg.test(form.phone.trim())) { + wx.showToast({ + title: '请输入有效的工号', + icon: 'none' + }); + return; + } + + if (!nickName.trim()) { + wx.showToast({ + title: '微信昵称不能为空', + icon: 'none' + }); + return; + } try { wx.showLoading({ title: '登录中...', mask: true }); @@ -58,6 +93,8 @@ if (typeof isAgree !== 'undefined'){ let form =this.data.form let openid =this.data.openid let avatarUrl =this.data.avatarUrl + + // 发送到后端 const apiRes = await new Promise((resolve, reject) => { wx.request({ diff --git a/CommunicationRecords/pages/logs/logs.wxml b/CommunicationRecords/pages/logs/logs.wxml index a852371..1c791b6 100644 --- a/CommunicationRecords/pages/logs/logs.wxml +++ b/CommunicationRecords/pages/logs/logs.wxml @@ -40,7 +40,7 @@ />