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 @@ />