From b977324bb70c2c023fc23d3ece464756c4915ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=85=81=E6=9E=9E?= <3422692813@qq.com> Date: Fri, 14 Mar 2025 09:51:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=BF=9B=E5=85=A5=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=97=A0=E6=B3=95=E5=88=B0=E5=BA=95=E9=83=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dc-App/pages/Chat/newChat.vue | 28 ++++++++++------- dc-App/pages/my/Contact.vue | 59 ++++++++++++++++++++++------------- 2 files changed, 54 insertions(+), 33 deletions(-) diff --git a/dc-App/pages/Chat/newChat.vue b/dc-App/pages/Chat/newChat.vue index d19460f..033381c 100644 --- a/dc-App/pages/Chat/newChat.vue +++ b/dc-App/pages/Chat/newChat.vue @@ -28,7 +28,8 @@ - + @@ -494,7 +495,11 @@ export default { } else { this.messagesList = tempList } - this.goBottom() + //延时五秒 + setTimeout(() => { + this.goBottom() + }, 500); + // this.goBottom() }, // 获取历史消息 getMessage() { @@ -528,7 +533,9 @@ export default { that.$set(that.messagesList, that.messagesList.length - 1, that.messagesList[that.messagesList .length - 1]) // 数据挂载后执行,不懂的请自行阅读 Vue.js 文档对 Vue.nextTick 函数说明。 - that.goBottom() + setTimeout(() => { + that.goBottom() + }, 500); } get(); @@ -698,7 +705,6 @@ export default { }, // 滚动到底部 goBottom() { - this.$nextTick(() => { this.scrollToView = this.scrollId; this.$nextTick(() => { @@ -709,22 +715,22 @@ export default { }) }, // 滚动至聊天底部 - scrollToBottom(e){ - setTimeout(()=>{ + scrollToBottom(e) { + setTimeout(() => { let query = uni.createSelectorQuery().in(this); query.select('#scrollview').boundingClientRect(); query.select('#msglistview').boundingClientRect(); - query.exec((res) =>{ - if(res[1].height > res[0].height){ + query.exec((res) => { + if (res[1].height > res[0].height) { this.scrollTop = this.rpxTopx(res[1].height - res[0].height) } }) - },15) + }, 15) }, // px转换成rpx - rpxTopx(px){ + rpxTopx(px) { let deviceWidth = uni.getSystemInfoSync().windowWidth - let rpx = ( 750 / deviceWidth ) * Number(px) + let rpx = (750 / deviceWidth) * Number(px) return Math.floor(rpx) }, } diff --git a/dc-App/pages/my/Contact.vue b/dc-App/pages/my/Contact.vue index fb4773e..5b49f30 100644 --- a/dc-App/pages/my/Contact.vue +++ b/dc-App/pages/my/Contact.vue @@ -2,28 +2,28 @@ - + 123 Main Street, New York, NY 10001 - + +1 (123) 456-7890 - + contact@company.com - - - + + + - + - + @@ -45,7 +45,26 @@ export default { name: [ { required: true, - message: '请输入姓名', + message: 'Please enter your name', + trigger: ['blur', 'change'] + } + ], + email: [ + { + required: true, + message: 'Please enter your email address', + trigger: ['blur', 'change'] + }, + { + pattern: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, + message: 'Please enter a valid email address', + trigger: ['blur', 'change'] + } + ], + message: [ + { + required: true, + message: 'Please enter your feedback', trigger: ['blur', 'change'] } ] @@ -55,21 +74,11 @@ export default { methods: { submitForm() { this.$refs.formRef.validate().then(res => { - uni.$u.toast('校验通过') + uni.showToast({title: 'Successfully', icon: 'success'}); + this.form = {name: '', email: '', message: ''}; }).catch(errors => { - uni.$u.toast('校验失败') + uni.$u.toast('Validation failed') }) - if (!this.form.name || !this.form.email || !this.form.message) { - uni.showToast({ title: 'Please fill in all fields', icon: 'none' }); - return; - } - //验证邮箱 - if (!this.form.email.match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/)) { - uni.showToast({ title: 'Invalid email address', icon: 'none' }); - return; - } - uni.showToast({ title: 'Successfully', icon: 'success' }); - this.form = { name: '', email: '', message: '' }; } } }; @@ -86,6 +95,7 @@ export default { font-size: 20rpx; background-color: #FFFFFF; } + .card { width: 90%; padding: 30rpx; @@ -94,6 +104,7 @@ export default { color: #FFFFFF; border-radius: 20rpx; } + .info { display: flex; align-items: center; @@ -101,11 +112,13 @@ export default { margin-bottom: 20rpx; color: #FFFFFF; } + .info-text { margin-left: 15rpx; font-size: 22rpx; color: #FFFFFF; } + .form-container { width: 90%; //display: flex; @@ -113,12 +126,14 @@ export default { align-items: center; font-size: 22rpx; } + .button-container { display: flex; justify-content: center; width: 100%; margin-top: 20rpx; } + .submit-button { font-size: 22rpx; padding: 15rpx 30rpx;