Files
jczxw-pc/app/pages/membership/index.vue
T
2026-09-11 12:25:38 +08:00

340 lines
6.5 KiB
Vue

<template>
<div class="membership-page">
<PortalHeader active-path="/membership" />
<main class="container membership-main">
<div class="page-head">
<div>
<h1>会员服务</h1>
<p>为企业会员和个人会员提供专业高效的咨询服务</p>
</div>
<div class="page-summary">
<span>{{ total }} 项服务内容</span>
</div>
</div>
<div class="filter-bar">
<button
v-for="item in tabs"
:key="item.key"
type="button"
class="filter-btn"
:class="{ active: activeTab === item.key }"
@click="handleTabChange(item.key)"
>
{{ item.label }}
</button>
</div>
<div v-if="loading" class="state-wrap">
<a-skeleton v-for="i in 6" :key="i" active :paragraph="{ rows: 3 }" />
</div>
<div v-else-if="!services.length" class="state-wrap">
<a-empty description="暂无会员服务" />
</div>
<div v-else class="service-grid">
<article
v-for="item in services"
:key="item.serviceId || item.id"
class="service-card"
@click="goDetail(item)"
>
<div class="service-card-icon">{{ item.icon || "•" }}</div>
<div class="service-card-top">
<h3>{{ item.title }}</h3>
<span>{{ item.categoryName }}</span>
</div>
<p>{{ item.summary || "暂无简介" }}</p>
<div v-if="item.tags?.length" class="service-card-tags">
<span v-for="tag in item.tags" :key="tag">{{ tag }}</span>
</div>
</article>
</div>
</main>
<footer class="site-footer">
<PortalFooter />
</footer>
</div>
</template>
<script setup lang="ts">
import { message } from "ant-design-vue"
import { pageSiteMembershipServices, type SiteMembershipService } from "@/api/site"
import { usePageSeo } from "@/composables/usePageSeo"
definePageMeta({
layout: "blank"
})
usePageSeo({
title: "会员服务",
description: "广西决策咨询网会员服务"
})
const route = useRoute()
const router = useRouter()
const tabs = [
{ key: "all", label: "全部" },
{ key: "consult", label: "企业咨询" },
{ key: "service", label: "专项服务" },
]
const total = ref(0)
const loading = ref(false)
const services = ref<SiteMembershipService[]>([])
const activeTab = ref(((route.query.type as string) || "all"))
async function loadServices() {
loading.value = true
try {
const data = await pageSiteMembershipServices({
page: 1,
limit: 60,
categoryKey: activeTab.value === "all" ? undefined : activeTab.value,
})
total.value = data.count || 0
services.value = data.list || []
} catch (error) {
services.value = []
total.value = 0
message.error(error instanceof Error ? error.message : "加载会员服务失败")
} finally {
loading.value = false
}
}
function updateRoute(type: string) {
router.replace({
query: {
...(type !== "all" ? { type } : {}),
}
})
}
function handleTabChange(type: string) {
if (activeTab.value === type) {
return
}
activeTab.value = type
updateRoute(type)
loadServices()
}
function goDetail(item: SiteMembershipService) {
router.push(`/membership/${item.serviceId || item.id}`)
}
watch(() => route.query.type, (value) => {
activeTab.value = (value as string) || "all"
loadServices()
})
onMounted(() => {
loadServices()
})
</script>
<style scoped>
.membership-page {
min-height: 100vh;
background: #f5f7fa;
}
.container {
width: min(1200px, calc(100% - 32px));
margin: 0 auto;
}
.membership-main {
padding: 32px 0 48px;
}
.page-head {
display: flex;
align-items: end;
justify-content: space-between;
gap: 24px;
margin-bottom: 22px;
}
.page-head h1 {
margin: 0 0 10px;
color: #1f2d3d;
font-size: 34px;
line-height: 1.2;
}
.page-head p {
margin: 0;
color: #697586;
font-size: 15px;
}
.page-summary {
color: #7d8a98;
font-size: 14px;
}
.filter-bar {
display: inline-flex;
margin-bottom: 36px;
border: 1px solid #d8dee7;
border-radius: 14px;
overflow: hidden;
}
.filter-btn {
min-width: 132px;
padding: 12px 20px;
border: none;
background: #fff;
color: #233245;
font-size: 16px;
font-weight: 600;
cursor: pointer;
transition: background 0.2s ease, color 0.2s ease;
}
.filter-btn + .filter-btn {
border-left: 1px solid #d8dee7;
}
.filter-btn.active {
background: #2d7af0;
color: #fff;
}
.service-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 22px;
}
.service-card {
min-height: 240px;
padding: 34px 38px;
border: 1px solid #eef2f7;
border-radius: 22px;
background: #fff;
cursor: pointer;
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
box-shadow: 0 18px 40px rgba(17, 34, 68, 0.06);
}
.service-card:hover {
border-color: #cfe0ff;
box-shadow: 0 20px 42px rgba(36, 82, 156, 0.12);
transform: translateY(-2px);
}
.service-card-icon {
margin-bottom: 18px;
color: #4b6ea8;
font-size: 56px;
line-height: 1;
}
.service-card-top {
display: flex;
align-items: start;
justify-content: space-between;
gap: 16px;
margin-bottom: 14px;
}
.service-card-top h3 {
margin: 0;
color: #1f2d3d;
font-size: 24px;
line-height: 1.4;
}
.service-card-top span {
flex-shrink: 0;
color: #7c8eab;
font-size: 14px;
}
.service-card p {
margin: 0 0 18px;
color: #66768a;
font-size: 16px;
line-height: 1.85;
}
.service-card-tags {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.service-card-tags span {
padding: 6px 14px;
border: 1px solid #99c1ff;
border-radius: 12px;
color: #2d7af0;
font-size: 14px;
line-height: 1.2;
}
.state-wrap {
display: grid;
gap: 20px;
}
.site-footer {
margin-top: 24px;
}
.footer-nav {
background: #1f4fa3;
}
.footer-nav-inner {
display: flex;
align-items: center;
justify-content: center;
gap: 32px;
min-height: 58px;
}
.footer-nav-inner a {
color: rgba(255, 255, 255, 0.9);
font-size: 14px;
}
@media (max-width: 1024px) {
.service-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 768px) {
.membership-main {
padding-top: 24px;
}
.page-head {
flex-direction: column;
align-items: stretch;
}
.filter-bar {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.service-grid {
grid-template-columns: 1fr;
}
.service-card {
min-height: auto;
padding: 28px 22px;
}
}
</style>