From 2ccff4106676144ec5ee61a346e23645d987b87e Mon Sep 17 00:00:00 2001 From: zoujing Date: Wed, 23 Sep 2026 12:29:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=80=E4=B9=88=E6=98=AF=E7=A5=A8?= =?UTF-8?q?=E6=A0=B9=E7=BB=8F=E6=B5=8E=3F=E4=BB=8B=E7=BB=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/content.js | 18 ++++++++++++++- src/constant/index.js | 4 ++++ src/pages-sub/intro/index.vue | 42 +++++++++++++++++++++++++++++++++++ src/pages.json | 8 +++++++ src/utils/nav.js | 3 +++ src/views/home/index.vue | 27 ++++++++++++++++++---- 6 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 src/pages-sub/intro/index.vue diff --git a/src/api/content.js b/src/api/content.js index 886b753..97f2558 100644 --- a/src/api/content.js +++ b/src/api/content.js @@ -8,7 +8,7 @@ * 2)公共内容(协议 / 隐私 / 关于 / 客服) * GET /v1/content(列表,登录同意版本号取这里) + GET /v1/content/:key(单条详情) */ -import { AGREEMENT_DATE, CUSTOMER_SERVICE_PHONE, CUSTOMER_SERVICE_TIME } from "@/constant"; +import { AGREEMENT_DATE, CUSTOMER_SERVICE_PHONE, CUSTOMER_SERVICE_TIME, TICKET_ECONOMY_KEY } from "@/constant"; import { clone, cnDate, unique } from "@/utils"; import { toPublicCard } from "@/api/benefit"; import * as contentApi from "@/request/api/content"; @@ -166,6 +166,21 @@ export const getCustomerService = async () => { return { phone: (info && info.phone) || CUSTOMER_SERVICE_PHONE }; }; +/* --------------------------------------------------------------------------- + * 票根经济介绍页(GET /v1/content/ticket_economy) + * 口径与公共内容一致:title 作标题、body 作正文(纯文本按行拆段,`一、` 行作小标题)。 + * 内容全部取自接口,接口无内容时正文为空(无本地兜底)。 + * ------------------------------------------------------------------------- */ + +/** 票根经济介绍页:标题 + 正文段落 */ +export const getTicketEconomy = async () => { + const info = await getContent(TICKET_ECONOMY_KEY); + return { + title: (info && info.title) || "票根经济", + blocks: toContentBlocks(info && info.body), + }; +}; + export default { getHomepage, getCategories, @@ -178,4 +193,5 @@ export default { getAgreement, getAbout, getCustomerService, + getTicketEconomy, }; diff --git a/src/constant/index.js b/src/constant/index.js index aa04235..011ebf1 100644 --- a/src/constant/index.js +++ b/src/constant/index.js @@ -188,5 +188,9 @@ export const ROUTES = { DETAIL: "/pages-sub/detail/index", AGREEMENT: "/pages-sub/agreement/index", ABOUT: "/pages-sub/about/index", + INTRO: "/pages-sub/intro/index", ACCOUNT_CANCEL: "/pages-sub/account/cancel", }; + +/** 票根经济介绍页的内容 key(GET /v1/content/ticket_economy) */ +export const TICKET_ECONOMY_KEY = "ticket_economy"; diff --git a/src/pages-sub/intro/index.vue b/src/pages-sub/intro/index.vue new file mode 100644 index 0000000..caddea7 --- /dev/null +++ b/src/pages-sub/intro/index.vue @@ -0,0 +1,42 @@ + + + diff --git a/src/pages.json b/src/pages.json index f527701..9e4b339 100644 --- a/src/pages.json +++ b/src/pages.json @@ -68,6 +68,14 @@ "enablePullDownRefresh": false } }, + { + "path": "intro/index", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "票根经济", + "enablePullDownRefresh": false + } + }, { "path": "account/cancel", "style": { diff --git a/src/utils/nav.js b/src/utils/nav.js index 1645260..b915c4f 100644 --- a/src/utils/nav.js +++ b/src/utils/nav.js @@ -220,6 +220,9 @@ export const goAgreement = (type) => { }; export const goAbout = () => uni.navigateTo({ url: ROUTES.ABOUT }); + +/** 跳票根经济介绍页 */ +export const goIntro = () => uni.navigateTo({ url: ROUTES.INTRO }); export const goAccountCancel = () => uni.navigateTo({ url: ROUTES.ACCOUNT_CANCEL }); /** 拨打电话 */ diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 6230f09..944d79b 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -14,10 +14,12 @@ */ import { computed, ref } from "vue"; import contentApi from "@/api/content"; -import { goCatalog, previewImages } from "@/utils/nav"; +import { goCatalog, goIntro, previewImages } from "@/utils/nav"; const home = ref({}); const featured = ref([]); +/** 票根经济入口文案:取接口 /v1/content/ticket_economy 的 title(与首页首屏并行前置请求) */ +const introTitle = ref("什么是票根经济?"); /** 首屏数据是否已回来(骨架屏开关;请求失败也置真,避免骨架常驻) */ const loaded = ref(false); @@ -44,9 +46,15 @@ const load = async () => { if (loading) return; loading = true; try { - const data = await contentApi.getHomepage(); + // 票根经济介绍内容与首屏一起前置请求:入口文案首屏即为接口值, + // 且二级页进入时命中内容缓存(不再等请求)。 + const [data, intro] = await Promise.all([ + contentApi.getHomepage(), + contentApi.getTicketEconomy(), + ]); home.value = data || {}; featured.value = data?.featured?.items || []; + if (intro?.title) introTitle.value = intro.title; } catch (e) { home.value = {}; featured.value = []; @@ -140,8 +148,19 @@ const onMapTap = () => { {{ brand.sub_name }} - - {{ brandHead }}{{ brandTail }} + + + {{ brandHead }}{{ brandTail }} + + + + {{ introTitle }} + + {{ brand.slogan }}