feat(router): 添加帮助中心页面及详情页路由
新增帮助中心页面和帮助详情页面的路由配置,并在相关页面中集成动态标题功能
Showing
5 changed files
with
166 additions
and
3 deletions
| ... | @@ -122,6 +122,18 @@ const routes = [ | ... | @@ -122,6 +122,18 @@ const routes = [ |
| 122 | meta: { title: '消息中心' }, | 122 | meta: { title: '消息中心' }, |
| 123 | }, | 123 | }, |
| 124 | { | 124 | { |
| 125 | + path: '/profile/help', | ||
| 126 | + name: 'Help', | ||
| 127 | + component: () => import('../views/profile/HelpPage.vue'), | ||
| 128 | + meta: { title: '帮助中心' }, | ||
| 129 | + }, | ||
| 130 | + { | ||
| 131 | + path: '/profile/help/:id', | ||
| 132 | + name: 'HelpDetail', | ||
| 133 | + component: () => import('../views/profile/HelpDetailPage.vue'), | ||
| 134 | + meta: { title: '帮助详情' }, | ||
| 135 | + }, | ||
| 136 | + { | ||
| 125 | path: '/profile/messages/:id', | 137 | path: '/profile/messages/:id', |
| 126 | name: 'MessageDetail', | 138 | name: 'MessageDetail', |
| 127 | component: () => import('../views/profile/MessageDetailPage.vue'), | 139 | component: () => import('../views/profile/MessageDetailPage.vue'), | ... | ... |
src/views/profile/HelpDetailPage.vue
0 → 100644
| 1 | +<!-- | ||
| 2 | + * @Date: 2025-03-24 13:04:31 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2025-03-24 13:04:32 | ||
| 5 | + * @FilePath: /mlaj/src/views/profile/HelpDetailPage.vue | ||
| 6 | + * @Description: 文件描述 | ||
| 7 | +--> | ||
| 8 | +<template> | ||
| 9 | + <AppLayout title="帮助详情"> | ||
| 10 | + <div class="bg-gradient-to-br from-green-50 via-green-100/30 to-blue-50/30 min-h-screen"> | ||
| 11 | + <div class="px-4 py-6"> | ||
| 12 | + <FrostedGlass class="rounded-xl overflow-hidden p-4"> | ||
| 13 | + <h2 class="text-xl font-semibold text-gray-900 mb-4">{{ helpItem?.title }}</h2> | ||
| 14 | + <div class="prose prose-sm max-w-none"> | ||
| 15 | + <pre class="whitespace-pre-wrap text-gray-600 font-normal text-base">{{ helpItem?.content }}</pre> | ||
| 16 | + </div> | ||
| 17 | + </FrostedGlass> | ||
| 18 | + </div> | ||
| 19 | + </div> | ||
| 20 | + </AppLayout> | ||
| 21 | +</template> | ||
| 22 | + | ||
| 23 | +<script setup> | ||
| 24 | +import { ref, onMounted } from 'vue'; | ||
| 25 | +import { useRoute, useRouter } from 'vue-router'; | ||
| 26 | +import AppLayout from '@/components/layout/AppLayout.vue'; | ||
| 27 | +import FrostedGlass from '@/components/ui/FrostedGlass.vue'; | ||
| 28 | +import { useTitle } from '@vueuse/core'; | ||
| 29 | + | ||
| 30 | +const $route = useRoute(); | ||
| 31 | +const $router = useRouter(); | ||
| 32 | +useTitle($route.meta.title); | ||
| 33 | + | ||
| 34 | +const route = useRoute(); | ||
| 35 | +const helpItem = ref(null); | ||
| 36 | + | ||
| 37 | +onMounted(() => { | ||
| 38 | + // 从本地存储中获取帮助项数据 | ||
| 39 | + const id = route.params.id; | ||
| 40 | + const storedItem = localStorage.getItem(`help_item_${id}`); | ||
| 41 | + if (storedItem) { | ||
| 42 | + helpItem.value = JSON.parse(storedItem); | ||
| 43 | + } | ||
| 44 | +}); | ||
| 45 | +</script> |
src/views/profile/HelpPage.vue
0 → 100644
| 1 | +<!-- | ||
| 2 | + * @Date: 2025-03-24 13:04:21 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2025-03-24 13:04:23 | ||
| 5 | + * @FilePath: /mlaj/src/views/profile/HelpPage.vue | ||
| 6 | + * @Description: 文件描述 | ||
| 7 | +--> | ||
| 8 | +<template> | ||
| 9 | + <AppLayout title="帮助中心"> | ||
| 10 | + <div class="bg-gradient-to-br from-green-50 via-green-100/30 to-blue-50/30 min-h-screen"> | ||
| 11 | + <div class="px-4 py-6"> | ||
| 12 | + <FrostedGlass class="rounded-xl overflow-hidden"> | ||
| 13 | + <div class="divide-y divide-gray-100"> | ||
| 14 | + <div | ||
| 15 | + v-for="item in helpItems" | ||
| 16 | + :key="item.id" | ||
| 17 | + class="p-4 flex items-center cursor-pointer hover:bg-gray-50/50" | ||
| 18 | + @click="handleItemClick(item)" | ||
| 19 | + > | ||
| 20 | + <div class="flex-1"> | ||
| 21 | + <h3 class="text-base font-medium text-gray-900 mb-1">{{ item.title }}</h3> | ||
| 22 | + <p class="text-sm text-gray-500">{{ item.description }}</p> | ||
| 23 | + </div> | ||
| 24 | + <svg | ||
| 25 | + xmlns="http://www.w3.org/2000/svg" | ||
| 26 | + class="h-5 w-5 text-gray-400" | ||
| 27 | + viewBox="0 0 20 20" | ||
| 28 | + fill="currentColor" | ||
| 29 | + > | ||
| 30 | + <path | ||
| 31 | + fill-rule="evenodd" | ||
| 32 | + d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" | ||
| 33 | + clip-rule="evenodd" | ||
| 34 | + /> | ||
| 35 | + </svg> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + </FrostedGlass> | ||
| 39 | + </div> | ||
| 40 | + </div> | ||
| 41 | + </AppLayout> | ||
| 42 | +</template> | ||
| 43 | + | ||
| 44 | +<script setup> | ||
| 45 | +import { ref } from 'vue'; | ||
| 46 | +import { useRouter, useRoute } from 'vue-router'; | ||
| 47 | +import AppLayout from '@/components/layout/AppLayout.vue'; | ||
| 48 | +import FrostedGlass from '@/components/ui/FrostedGlass.vue'; | ||
| 49 | +import { useTitle } from '@vueuse/core'; | ||
| 50 | + | ||
| 51 | +const $route = useRoute(); | ||
| 52 | +const $router = useRouter(); | ||
| 53 | +useTitle($route.meta.title); | ||
| 54 | + | ||
| 55 | +const router = useRouter(); | ||
| 56 | + | ||
| 57 | +const helpItems = ref([ | ||
| 58 | + { | ||
| 59 | + id: 1, | ||
| 60 | + title: '如何开始学习课程?', | ||
| 61 | + description: '了解如何选择和开始学习课程的详细指南', | ||
| 62 | + content: '1. 浏览课程列表\n2. 选择感兴趣的课程\n3. 点击课程进入详情页\n4. 点击开始学习按钮\n5. 按照课程章节顺序学习' | ||
| 63 | + }, | ||
| 64 | + { | ||
| 65 | + id: 2, | ||
| 66 | + title: '如何参与打卡活动?', | ||
| 67 | + description: '学习打卡功能使用说明和注意事项', | ||
| 68 | + content: '1. 在首页或个人中心点击打卡按钮\n2. 选择打卡类型(阅读、运动、学习、写作)\n3. 填写打卡内容\n4. 上传相关图片(可选)\n5. 提交打卡' | ||
| 69 | + }, | ||
| 70 | + { | ||
| 71 | + id: 3, | ||
| 72 | + title: '如何参加线下活动?', | ||
| 73 | + description: '线下活动报名流程和参与方式说明', | ||
| 74 | + content: '1. 进入活动页面\n2. 查看活动详情和时间地点\n3. 点击报名按钮\n4. 填写报名信息\n5. 确认提交\n6. 等待审核通过\n7. 按时参加活动' | ||
| 75 | + }, | ||
| 76 | + { | ||
| 77 | + id: 4, | ||
| 78 | + title: '订单和支付说明', | ||
| 79 | + description: '了解订单流程和支付方式的详细说明', | ||
| 80 | + content: '1. 选择要购买的课程或服务\n2. 点击购买按钮\n3. 确认订单信息\n4. 选择支付方式(微信支付/支付宝)\n5. 完成支付\n6. 查看订单状态' | ||
| 81 | + }, | ||
| 82 | + { | ||
| 83 | + id: 5, | ||
| 84 | + title: '常见问题解答', | ||
| 85 | + description: '解答用户最常遇到的问题和疑难', | ||
| 86 | + content: '1. 账号相关问题\n - 如何修改密码\n - 如何绑定手机号\n - 如何更新个人信息\n\n2. 课程相关问题\n - 课程有效期说明\n - 如何获取课程证书\n - 课程退款规则\n\n3. 技术支持\n - 视频无法播放解决方案\n - 系统使用要求\n - 如何清除缓存' | ||
| 87 | + } | ||
| 88 | +]); | ||
| 89 | + | ||
| 90 | +const handleItemClick = (item) => { | ||
| 91 | + // 将帮助项数据存储到本地存储 | ||
| 92 | + localStorage.setItem(`help_item_${item.id}`, JSON.stringify(item)); | ||
| 93 | + router.push({ | ||
| 94 | + path: `/profile/help/${item.id}` | ||
| 95 | + }); | ||
| 96 | +}; | ||
| 97 | +</script> |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-03-24 12:56:24 | 2 | * @Date: 2025-03-24 12:56:24 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-03-24 12:56:26 | 4 | + * @LastEditTime: 2025-03-24 13:07:51 |
| 5 | * @FilePath: /mlaj/src/views/profile/MessageDetailPage.vue | 5 | * @FilePath: /mlaj/src/views/profile/MessageDetailPage.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -28,6 +28,10 @@ import { ref, onMounted } from 'vue'; | ... | @@ -28,6 +28,10 @@ import { ref, onMounted } from 'vue'; |
| 28 | import { useRoute } from 'vue-router'; | 28 | import { useRoute } from 'vue-router'; |
| 29 | import AppLayout from '@/components/layout/AppLayout.vue'; | 29 | import AppLayout from '@/components/layout/AppLayout.vue'; |
| 30 | import FrostedGlass from '@/components/ui/FrostedGlass.vue'; | 30 | import FrostedGlass from '@/components/ui/FrostedGlass.vue'; |
| 31 | +import { useTitle } from '@vueuse/core'; | ||
| 32 | + | ||
| 33 | +const $route = useRoute(); | ||
| 34 | +useTitle($route.meta.title); | ||
| 31 | 35 | ||
| 32 | const route = useRoute(); | 36 | const route = useRoute(); |
| 33 | const message = ref({ | 37 | const message = ref({ | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-03-24 12:56:07 | 2 | * @Date: 2025-03-24 12:56:07 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-03-24 12:56:09 | 4 | + * @LastEditTime: 2025-03-24 13:07:40 |
| 5 | * @FilePath: /mlaj/src/views/profile/MessagesPage.vue | 5 | * @FilePath: /mlaj/src/views/profile/MessagesPage.vue |
| 6 | * @Description: 消息中心页面 | 6 | * @Description: 消息中心页面 |
| 7 | --> | 7 | --> |
| ... | @@ -42,9 +42,14 @@ | ... | @@ -42,9 +42,14 @@ |
| 42 | 42 | ||
| 43 | <script setup> | 43 | <script setup> |
| 44 | import { ref } from 'vue'; | 44 | import { ref } from 'vue'; |
| 45 | -import { useRouter } from 'vue-router'; | 45 | +import { useRouter, useRoute } from 'vue-router'; |
| 46 | import AppLayout from '@/components/layout/AppLayout.vue'; | 46 | import AppLayout from '@/components/layout/AppLayout.vue'; |
| 47 | import FrostedGlass from '@/components/ui/FrostedGlass.vue'; | 47 | import FrostedGlass from '@/components/ui/FrostedGlass.vue'; |
| 48 | +import { useTitle } from '@vueuse/core'; | ||
| 49 | + | ||
| 50 | +const $route = useRoute(); | ||
| 51 | +const $router = useRouter(); | ||
| 52 | +useTitle($route.meta.title); | ||
| 48 | 53 | ||
| 49 | const router = useRouter(); | 54 | const router = useRouter(); |
| 50 | const loading = ref(false); | 55 | const loading = ref(false); | ... | ... |
-
Please register or login to post a comment