diff --git a/pages_tool/cases/index.vue b/pages_tool/cases/index.vue index d1b8671..6eb35d8 100644 --- a/pages_tool/cases/index.vue +++ b/pages_tool/cases/index.vue @@ -98,8 +98,7 @@ export default { markers: [], Form: { realname: "", - mobile: "", - remark: "" + mobile: "" }, ismessage: 0, video_url: "" @@ -264,7 +263,6 @@ export default { success: (res) => { this.$refs.informationPopup.close(); this.$util.showToast({ title: res.message }); - this.resetForm(); }, fail: (err) => { console.log(err); @@ -282,15 +280,7 @@ export default { closeinformationPopup() { this.ismessage = 0; this.$refs.informationPopup.close(); - this.resetForm(); }, - resetForm() { - this.Form = { - realname: "", - mobile: "", - remark: "" - }; - }, Tel(phone) { uni.makePhoneCall({ phoneNumber: phone + "", diff --git a/pages_tool/contact/contact.vue b/pages_tool/contact/contact.vue index 085721a..6e9808b 100644 --- a/pages_tool/contact/contact.vue +++ b/pages_tool/contact/contact.vue @@ -113,20 +113,20 @@ {{ $lang('name') }} - + {{ $lang('contactInfo') }} - + {{ $lang('messageContent') }} - + @@ -158,6 +158,7 @@ export default { remark: '' }, + formKey: Date.now(), markers: [ { id: 1, @@ -222,18 +223,30 @@ export default { // window.open('https://xcx10.5g-quickapp.com/test.php') }, save() { - this.$api.sendRequest({ - url: '/api/member/message', - data: this.Form, - success: res => { - this.$refs.informationPopup.close(); - this.$util.showToast({ - title: res.message - }); - }, - fail: res => { - } - }); + if (!this.Form.realname.trim()) { + uni.showToast({ title: '请填写姓名', icon: 'none' }); + return; + } + if (!this.Form.mobile || !/^1[3-9]\d{9}$/.test(this.Form.mobile)) { + uni.showToast({ title: '手机号格式不正确', icon: 'none' }); + return; + } + if (!this.Form.remark.trim()) { + uni.showToast({ title: '请填写留言内容', icon: 'none' }); + return; + } + + this.$api.sendRequest({ + url: '/api/member/message', + data: this.Form, + success: res => { + this.$refs.informationPopup.close(); + uni.showToast({ title: res.message || '提交成功', icon: 'success' }); + + this.Form = { realname: '', mobile: '', remark: '' }; + this.formKey = Date.now(); + } + }); }, change(e) { console.log(e) @@ -241,8 +254,17 @@ export default { }, //留言打开 tapMessage() { - this.ismessage = 1 - this.$refs.informationPopup.open(); + // 清空表单数据 + this.Form = { + realname: '', + mobile: '', + remark: '' + }; + // 关键:更新 key,强制重建输入框 + this.formKey = Date.now(); + + this.ismessage = 1; + this.$refs.informationPopup.open(); }, //留言关闭 closeinformationPopup() { diff --git a/pages_tool/member/collection.vue b/pages_tool/member/collection.vue index b8e84d2..b1fcdbd 100644 --- a/pages_tool/member/collection.vue +++ b/pages_tool/member/collection.vue @@ -1,5 +1,4 @@ - -