fulinqingjie/public/output/server/chunks/build/_id_-DRsxvGrY.mjs

105 lines
5.3 KiB
JavaScript

import { _ as __nuxt_component_0 } from './HeaderImage-92nFA80c.mjs';
import { _ as __nuxt_component_1 } from './CustomTitle-2eWUrzRV.mjs';
import { defineComponent, computed, withAsyncContext, mergeProps, unref, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrRenderComponent, ssrRenderAttr, ssrInterpolate } from 'vue/server-renderer';
import { _ as _imports_0 } from './virtual_public-Ch4_18y6.mjs';
import { u as useRequest } from './useRequest-pSRZvR3u.mjs';
import { u as useRoute } from './server.mjs';
import { u as useAsyncData } from './asyncData-D5wEK86T.mjs';
import { u as useSeoMeta } from './composables-2BFBRDmB.mjs';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import '../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';
import 'unhead/server';
import 'devalue';
import 'unhead/plugins';
import 'unhead/utils';
import 'vue-router';
import 'axios';
import 'perfect-debounce';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "[id]",
__ssrInlineRender: true,
async setup(__props) {
let __temp, __restore;
const route = useRoute();
const request = useRequest();
const id = computed(() => String(route.params.id || ""));
const type = computed(() => {
const t = String(route.query.type || "");
if (t === "case_study") return "case_study";
return "case_study";
});
const DETAIL_API = {
case_study: (caseStudyId) => `/api/case_studies/${caseStudyId}`
};
const DETAIL_PAGE_CONFIG = {
case_study: {
headerTitle: "服务案例",
headerImg: "/images/服务案例/服务案例.png",
listLabel: "服务案例",
listPath: "/service"
}
};
const pageConfig = computed(() => DETAIL_PAGE_CONFIG[type.value]);
const { data: detailRes } = ([__temp, __restore] = withAsyncContext(async () => useAsyncData(
() => `detail-${type.value}-${id.value}`,
async () => {
if (!id.value) return null;
const url = DETAIL_API[type.value](id.value);
return await request.get(url);
},
{ watch: [id, type] }
)), __temp = await __temp, __restore(), __temp);
const detail = computed(() => {
const res = detailRes.value;
return res?.code === 200 ? res.data : null;
});
useSeoMeta({
title: () => detail.value?.title || "详情",
description: () => detail.value?.description || "",
ogTitle: () => detail.value?.title || "",
ogDescription: () => detail.value?.description || "",
ogImage: () => detail.value?.cover || void 0
});
return (_ctx, _push, _parent, _attrs) => {
const _component_HeaderImage = __nuxt_component_0;
const _component_CustomTitle = __nuxt_component_1;
_push(`<div${ssrRenderAttrs(mergeProps({ class: "w-full" }, _attrs))}>`);
_push(ssrRenderComponent(_component_HeaderImage, {
title: unref(pageConfig).headerTitle,
img: unref(pageConfig).headerImg
}, null, _parent));
_push(`<div class="hidden sm:flex sticky top-[56px] sm:top-[64px] md:top-[80px] lg:top-[100px] xl:top-[135px] z-[999] w-full h-[56px] flex-row items-center justify-center bg-[#F2F2F2]"><div class="flex flex-row justify-end items-center w-full h-full layout"><div class="h-full text-[12px] pl-[12px] text-[#999999] border-l-[1px] flex flex-row items-center gap-[8px]"><img class="w-[14px] h-[14px]"${ssrRenderAttr("src", _imports_0)} alt=""><a href="/home" class="hover:text-[#0A357D] transition-colors">首页</a><span class="inline-block border-solid border-transparent border-l-[2px] border-y-[2px] border-l-current text-[#999999]"></span><a${ssrRenderAttr("href", unref(pageConfig).listPath)} class="hover:text-[#0A357D] transition-colors">${ssrInterpolate(unref(pageConfig).listLabel)}</a><span class="inline-block border-solid border-transparent border-l-[2px] border-y-[2px] border-l-current text-[#999999]"></span><span>${ssrInterpolate(unref(detail)?.title || "")}</span></div></div></div><div class="w-full bg-white"><div class="layout pt-[28px] sm:pt-[34px] md:pt-[44px] lg:pt-[54px] xl:pt-[64px] pb-[40px] sm:pb-[48px] md:pb-[56px] lg:pb-[64px] xl:pb-[72px]"><div class="flex flex-col items-center w-full">`);
_push(ssrRenderComponent(_component_CustomTitle, {
title: unref(detail)?.title || ""
}, null, _parent));
_push(`</div><div class="mt-[24px] sm:mt-[28px] md:mt-[32px] lg:mt-[36px] xl:mt-[40px] flex flex-col items-center gap-[24px] sm:gap-[28px] md:gap-[32px] lg:gap-[36px] xl:gap-[40px]">`);
if (unref(detail)?.content) {
_push(`<div class="w-full text-left text-[12px] sm:text-[14px] md:text-[16px] lg:text-[18px] xl:text-[18px] text-[#333333] leading-relaxed [&amp;_img]:max-w-full [&amp;_img]:h-auto [&amp;_img]:block [&amp;_img]:my-[12px] [&amp;_p]:mb-[12px]">${unref(detail).content ?? ""}</div>`);
} else {
_push(`<!---->`);
}
_push(`</div></div></div></div>`);
};
}
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/service/[id].vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as default };
//# sourceMappingURL=_id_-DRsxvGrY.mjs.map