generated from liutk/owl-admin-base
98 lines
5.2 KiB
JavaScript
98 lines
5.2 KiB
JavaScript
import { _ as __nuxt_component_0 } from './HeaderImage-92nFA80c.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 { data: detailRes, pending } = ([__temp, __restore] = withAsyncContext(async () => useAsyncData(
|
|
() => `news-detail-${id.value}`,
|
|
async () => {
|
|
if (!id.value) return null;
|
|
return await request.get(`/api/news/${id.value}`);
|
|
},
|
|
{ watch: [id] }
|
|
)), __temp = await __temp, __restore(), __temp);
|
|
const detail = computed(() => {
|
|
const res = detailRes.value;
|
|
return res?.code === 200 ? res.data : null;
|
|
});
|
|
function formatDate(str) {
|
|
if (!str) return "";
|
|
return str.split(" ")[0] ?? str;
|
|
}
|
|
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;
|
|
_push(`<div${ssrRenderAttrs(mergeProps({ class: "w-full" }, _attrs))}>`);
|
|
_push(ssrRenderComponent(_component_HeaderImage, {
|
|
title: "企业资讯",
|
|
img: "/images/企业资讯/企业资讯.png"
|
|
}, 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 href="/news" 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><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]">`);
|
|
if (unref(detail)) {
|
|
_push(`<!--[--><h1 class="text-[20px] sm:text-[22px] md:text-[24px] lg:text-[26px] xl:text-[28px] text-[#333333] font-bold">${ssrInterpolate(unref(detail).title)}</h1><div class="mt-[12px] sm:mt-[14px] md:mt-[16px] text-[12px] sm:text-[13px] md:text-[14px] text-[#999999]"> 发布时间:${ssrInterpolate(formatDate(unref(detail).published_at))}</div>`);
|
|
if (unref(detail).cover) {
|
|
_push(`<img${ssrRenderAttr("src", unref(detail).cover)}${ssrRenderAttr("alt", unref(detail).title)} class="w-full mt-[20px] sm:mt-[24px] md:mt-[28px] h-[220px] sm:h-[260px] md:h-[300px] lg:h-[340px] xl:h-[380px] object-cover rounded-[4px]">`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
if (unref(detail).content) {
|
|
_push(`<div class="mt-[24px] sm:mt-[28px] md:mt-[32px] w-full text-left text-[12px] sm:text-[14px] md:text-[16px] lg:text-[18px] text-[#333333] leading-relaxed [&_img]:max-w-full [&_img]:h-auto [&_img]:block [&_img]:my-[12px] [&_p]:mb-[12px]">${unref(detail).content ?? ""}</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`<!--]-->`);
|
|
} else if (!unref(pending)) {
|
|
_push(`<p class="text-[#666666]">暂无内容</p>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</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/news/[id].vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
|
|
export { _sfc_main as default };
|
|
//# sourceMappingURL=_id_-0mLHz3QR.mjs.map
|