From ce98f9c5d931630e70e4bb545f2ec86ad0aa9c08 Mon Sep 17 00:00:00 2001 From: Qi <3194726156@qq.com> Date: Fri, 28 Mar 2025 14:52:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E4=B8=80=E6=AD=A5=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9C=8B=E5=8F=8B=E5=9C=88=E3=80=81=E6=B7=BB=E5=8A=A0=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=B8=BB=E9=A1=B5=E3=80=81=E4=BC=98=E5=8C=96=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=A0=8F=E3=80=81=E5=88=9D=E6=AD=A5=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E7=9F=A5=E8=AF=86=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 5 + src/views/customer/AnonymousShareCircle.vue | 75 +- src/views/customer/CustomerDashboard.vue | 144 +++- src/views/customer/UserProfile.vue | 237 +++++- src/views/customer/knowledgeBase.vue | 753 ++++++++++++++++++++ 5 files changed, 1166 insertions(+), 48 deletions(-) create mode 100644 src/views/customer/knowledgeBase.vue diff --git a/src/router/index.js b/src/router/index.js index 6d63237..ecafc64 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -88,6 +88,11 @@ const routes = [ path: '/customer/questionnaire', name: 'Questionnaire', component: () => import('@/views/customer/Questionnaire.vue') + }, + { + path: '/customer/knowledge-base', + name: 'knowledgeBase', + component: () => import('@/views/customer/knowledgeBase.vue') } ] } diff --git a/src/views/customer/AnonymousShareCircle.vue b/src/views/customer/AnonymousShareCircle.vue index b081699..1e5b5d4 100644 --- a/src/views/customer/AnonymousShareCircle.vue +++ b/src/views/customer/AnonymousShareCircle.vue @@ -420,12 +420,18 @@ export default { this.refreshState = 'ready' this.refreshHeight = threshold - // 更新内容区域位置 + // 更新内容区域和用户资料区域位置 const content = document.querySelector('.moments-content') + const userProfile = document.querySelector('.user-profile') + if (content) { content.style.transform = `translateY(${this.refreshHeight}px)` } + if (userProfile) { + userProfile.style.transform = `translateY(${this.refreshHeight}px)` + } + // 标记当前已触发刷新,防止重复触发 this.isRefreshing = true @@ -494,10 +500,17 @@ export default { // 更新界面显示 const content = document.querySelector('.moments-content') + const userProfile = document.querySelector('.user-profile') + if (content) { content.style.transform = `translateY(${this.refreshHeight}px)` } + // 同时移动用户头像和用户名 + if (userProfile) { + userProfile.style.transform = `translateY(${this.refreshHeight}px)` + } + // 根据拉动距离决定刷新状态 if (this.refreshHeight >= threshold) { this.refreshState = 'ready' @@ -516,6 +529,8 @@ export default { // 强制刷新DOM const content = document.querySelector('.moments-content') + const userProfile = document.querySelector('.user-profile') + if (content) { // 确保内容区域回到原位 content.style.transform = 'translateY(0)' @@ -524,6 +539,11 @@ export default { content.offsetHeight } + // 同时重置用户头像和用户名位置 + if (userProfile) { + userProfile.style.transform = 'translateY(0)' + } + // 确保指示器被完全移除 // Vue的v-if会处理DOM的移除,所以这里不需要额外的DOM操作 }, @@ -533,6 +553,12 @@ export default { this.refreshState = 'loading' this.isRefreshing = true // 确保刷新标记被设置 + // 确保在刷新状态下用户头像和用户名保持在正确位置 + const userProfile = document.querySelector('.user-profile') + if (userProfile && this.refreshHeight > 0) { + userProfile.style.transform = `translateY(${this.refreshHeight}px)` + } + // 模拟数据库查询延迟 setTimeout(() => { try { @@ -675,12 +701,13 @@ export default { .user-profile { position: absolute; right: 5%; - bottom: 200px; + bottom: 290px; display: flex; align-items: center; color: #fff; z-index: 2; gap: 20px; + transition: transform 0.3s ease; } .user-name { @@ -697,28 +724,47 @@ export default { } .moments-content { - padding: 30px 0; + padding: 0; width: 100%; margin: 0 auto; - margin-top: -300px; + margin-top: -350px; position: relative; z-index: 1; - background-color: transparent; + background-color: #fff; transition: transform 0.3s ease; + border-top-left-radius: 20px; + border-top-right-radius: 20px; + box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1); +} + +.moments-content::before { + content: ''; + display: block; + width: 10%; + height: 5px; + background-color: #e0e0e0; + border-radius: 3px; + margin: 15px auto; +} + +.moment-item:first-child { + margin-top: 30px; } .moment-item { - background-color: #fff; + background-color: transparent; padding: 25px 15% 25px 15%; margin-bottom: 20px; display: flex; flex-direction: column; border-radius: 12px; - box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); + box-shadow: none; width: 100%; box-sizing: border-box; position: relative; overflow: visible; + border: none; + border-bottom: 1px solid #f0f0f0; } .post-user-info { @@ -794,7 +840,7 @@ export default { color: #999; font-size: 14px; padding-top: 10px; - border-top: 1px solid #f0f0f0; + border-top: 1px solid rgba(240, 240, 240, 0.6); position: relative; } @@ -879,7 +925,7 @@ export default { .interaction-area { margin-top: 12px; - background-color: #f7f7f7; + background-color: rgba(247, 247, 247, 0.7); border-radius: 4px; padding: 12px; text-align: left; @@ -978,8 +1024,13 @@ export default { @media screen and (max-width: 768px) { .moments-content { - padding: 20px 0; - margin-top: -150px; + padding: 0; + margin-top: -260px; + border-top-left-radius: 15px; + border-top-right-radius: 15px; + } + .moment-item:first-child { + margin-top: 20px; } .moment-item { padding: 15px 5%; @@ -989,7 +1040,7 @@ export default { } .user-profile { right: 3%; - bottom: 150px; + bottom: 220px; } .single-image { max-width: 100%; diff --git a/src/views/customer/CustomerDashboard.vue b/src/views/customer/CustomerDashboard.vue index 592e9f2..34c0a7d 100644 --- a/src/views/customer/CustomerDashboard.vue +++ b/src/views/customer/CustomerDashboard.vue @@ -2,29 +2,33 @@

中医药与心理健康

- - 首页 - - 教育与预防 - - - - 心理健康评估 + +
+ + - 匿名分享圈 - - 退出登录 +
@@ -33,15 +37,27 @@ diff --git a/src/views/customer/knowledgeBase.vue b/src/views/customer/knowledgeBase.vue new file mode 100644 index 0000000..bd6934c --- /dev/null +++ b/src/views/customer/knowledgeBase.vue @@ -0,0 +1,753 @@ + + + + +