hookehuyr

feat(router): 添加帮助中心页面及详情页路由

新增帮助中心页面和帮助详情页面的路由配置,并在相关页面中集成动态标题功能
......@@ -122,6 +122,18 @@ const routes = [
meta: { title: '消息中心' },
},
{
path: '/profile/help',
name: 'Help',
component: () => import('../views/profile/HelpPage.vue'),
meta: { title: '帮助中心' },
},
{
path: '/profile/help/:id',
name: 'HelpDetail',
component: () => import('../views/profile/HelpDetailPage.vue'),
meta: { title: '帮助详情' },
},
{
path: '/profile/messages/:id',
name: 'MessageDetail',
component: () => import('../views/profile/MessageDetailPage.vue'),
......
<!--
* @Date: 2025-03-24 13:04:31
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-24 13:04:32
* @FilePath: /mlaj/src/views/profile/HelpDetailPage.vue
* @Description: 文件描述
-->
<template>
<AppLayout title="帮助详情">
<div class="bg-gradient-to-br from-green-50 via-green-100/30 to-blue-50/30 min-h-screen">
<div class="px-4 py-6">
<FrostedGlass class="rounded-xl overflow-hidden p-4">
<h2 class="text-xl font-semibold text-gray-900 mb-4">{{ helpItem?.title }}</h2>
<div class="prose prose-sm max-w-none">
<pre class="whitespace-pre-wrap text-gray-600 font-normal text-base">{{ helpItem?.content }}</pre>
</div>
</FrostedGlass>
</div>
</div>
</AppLayout>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import AppLayout from '@/components/layout/AppLayout.vue';
import FrostedGlass from '@/components/ui/FrostedGlass.vue';
import { useTitle } from '@vueuse/core';
const $route = useRoute();
const $router = useRouter();
useTitle($route.meta.title);
const route = useRoute();
const helpItem = ref(null);
onMounted(() => {
// 从本地存储中获取帮助项数据
const id = route.params.id;
const storedItem = localStorage.getItem(`help_item_${id}`);
if (storedItem) {
helpItem.value = JSON.parse(storedItem);
}
});
</script>
<!--
* @Date: 2025-03-24 13:04:21
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-24 13:04:23
* @FilePath: /mlaj/src/views/profile/HelpPage.vue
* @Description: 文件描述
-->
<template>
<AppLayout title="帮助中心">
<div class="bg-gradient-to-br from-green-50 via-green-100/30 to-blue-50/30 min-h-screen">
<div class="px-4 py-6">
<FrostedGlass class="rounded-xl overflow-hidden">
<div class="divide-y divide-gray-100">
<div
v-for="item in helpItems"
:key="item.id"
class="p-4 flex items-center cursor-pointer hover:bg-gray-50/50"
@click="handleItemClick(item)"
>
<div class="flex-1">
<h3 class="text-base font-medium text-gray-900 mb-1">{{ item.title }}</h3>
<p class="text-sm text-gray-500">{{ item.description }}</p>
</div>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-5 w-5 text-gray-400"
viewBox="0 0 20 20"
fill="currentColor"
>
<path
fill-rule="evenodd"
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"
clip-rule="evenodd"
/>
</svg>
</div>
</div>
</FrostedGlass>
</div>
</div>
</AppLayout>
</template>
<script setup>
import { ref } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import AppLayout from '@/components/layout/AppLayout.vue';
import FrostedGlass from '@/components/ui/FrostedGlass.vue';
import { useTitle } from '@vueuse/core';
const $route = useRoute();
const $router = useRouter();
useTitle($route.meta.title);
const router = useRouter();
const helpItems = ref([
{
id: 1,
title: '如何开始学习课程?',
description: '了解如何选择和开始学习课程的详细指南',
content: '1. 浏览课程列表\n2. 选择感兴趣的课程\n3. 点击课程进入详情页\n4. 点击开始学习按钮\n5. 按照课程章节顺序学习'
},
{
id: 2,
title: '如何参与打卡活动?',
description: '学习打卡功能使用说明和注意事项',
content: '1. 在首页或个人中心点击打卡按钮\n2. 选择打卡类型(阅读、运动、学习、写作)\n3. 填写打卡内容\n4. 上传相关图片(可选)\n5. 提交打卡'
},
{
id: 3,
title: '如何参加线下活动?',
description: '线下活动报名流程和参与方式说明',
content: '1. 进入活动页面\n2. 查看活动详情和时间地点\n3. 点击报名按钮\n4. 填写报名信息\n5. 确认提交\n6. 等待审核通过\n7. 按时参加活动'
},
{
id: 4,
title: '订单和支付说明',
description: '了解订单流程和支付方式的详细说明',
content: '1. 选择要购买的课程或服务\n2. 点击购买按钮\n3. 确认订单信息\n4. 选择支付方式(微信支付/支付宝)\n5. 完成支付\n6. 查看订单状态'
},
{
id: 5,
title: '常见问题解答',
description: '解答用户最常遇到的问题和疑难',
content: '1. 账号相关问题\n - 如何修改密码\n - 如何绑定手机号\n - 如何更新个人信息\n\n2. 课程相关问题\n - 课程有效期说明\n - 如何获取课程证书\n - 课程退款规则\n\n3. 技术支持\n - 视频无法播放解决方案\n - 系统使用要求\n - 如何清除缓存'
}
]);
const handleItemClick = (item) => {
// 将帮助项数据存储到本地存储
localStorage.setItem(`help_item_${item.id}`, JSON.stringify(item));
router.push({
path: `/profile/help/${item.id}`
});
};
</script>
<!--
* @Date: 2025-03-24 12:56:24
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-24 12:56:26
* @LastEditTime: 2025-03-24 13:07:51
* @FilePath: /mlaj/src/views/profile/MessageDetailPage.vue
* @Description: 文件描述
-->
......@@ -28,6 +28,10 @@ import { ref, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import AppLayout from '@/components/layout/AppLayout.vue';
import FrostedGlass from '@/components/ui/FrostedGlass.vue';
import { useTitle } from '@vueuse/core';
const $route = useRoute();
useTitle($route.meta.title);
const route = useRoute();
const message = ref({
......
<!--
* @Date: 2025-03-24 12:56:07
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-24 12:56:09
* @LastEditTime: 2025-03-24 13:07:40
* @FilePath: /mlaj/src/views/profile/MessagesPage.vue
* @Description: 消息中心页面
-->
......@@ -42,9 +42,14 @@
<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { useRouter, useRoute } from 'vue-router';
import AppLayout from '@/components/layout/AppLayout.vue';
import FrostedGlass from '@/components/ui/FrostedGlass.vue';
import { useTitle } from '@vueuse/core';
const $route = useRoute();
const $router = useRouter();
useTitle($route.meta.title);
const router = useRouter();
const loading = ref(false);
......