HelpPage.vue 2.14 KB
<!--
 * @Date: 2025-03-24 13:04:21
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2025-06-11 17:34:52
 * @FilePath: /mlaj/src/views/profile/HelpPage.vue
 * @Description: 文件描述
-->
<template>
  <AppLayout>
    <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.post_title }}</h3>
                <p class="text-sm text-gray-500">{{ item.post_excerpt }}</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';
// 导入接口
import { getArticleListAPI } from "@/api/help";

const $route = useRoute();
const $router = useRouter();
useTitle($route.meta.title);

const router = useRouter();

const helpItems = ref([]);

onMounted(async() => {
  const res = await getArticleListAPI();
  if (res.code) {
    helpItems.value = res.list;
  }
})

const handleItemClick = (item) => {
  router.push({
    path: `/profile/help/${item.id}`
  });
};
</script>