427 lines
11 KiB
JavaScript
427 lines
11 KiB
JavaScript
/** 官网 CMS 内容状态与安全展示辅助;默认文案是页面占位,不是实时资源/业绩数据。 */
|
|
import { useState } from "#app";
|
|
import { useApi } from "~/lib/auth.js";
|
|
// 默认评价隐藏,未填写的联系方式/备案不虚构;实际内容由 CMS 接口覆盖。
|
|
var n = {
|
|
meta: {
|
|
title: `破碎工坊网络 - 云计算与基础设施服务`,
|
|
description: `为开发者与企业提供云服务器、物理服务器、机柜托管与网络资源。`,
|
|
},
|
|
theme: {
|
|
primary: `#0052d9`,
|
|
accent: `#eff6ff`,
|
|
},
|
|
brand: {
|
|
name: `破碎工坊网络`,
|
|
tagline: `云计算与基础设施服务`,
|
|
logoUrl: ``,
|
|
},
|
|
header: {
|
|
navigation: [
|
|
{
|
|
label: `产品服务`,
|
|
href: `#products`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `订购产品`,
|
|
href: `/cart`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `基础设施`,
|
|
href: `#infrastructure`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `客户评价`,
|
|
href: `#reviews`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `联系我们`,
|
|
href: `#contact`,
|
|
is_show: !0,
|
|
},
|
|
],
|
|
buttonLabel: `进入客户中心`,
|
|
buttonHref: `/login`,
|
|
},
|
|
hero: {
|
|
tag: `面向开发者与企业用户`,
|
|
title: `让每一份算力,
|
|
都稳定生长。`,
|
|
subtitle: `灵活的云基础设施服务`,
|
|
description: `从云服务器到专属物理资源,按业务阶段灵活选择,让部署、扩展与日常管理更简单。`,
|
|
features: [
|
|
{
|
|
text: `按需配置`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
text: `弹性扩展`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
text: `统一管理`,
|
|
is_show: !0,
|
|
},
|
|
],
|
|
buttonLabel: `浏览产品服务`,
|
|
buttonHref: `/login?redirect=%2Fproducts`,
|
|
secondaryLabel: `了解基础设施`,
|
|
secondaryHref: `#infrastructure`,
|
|
metric: {
|
|
value: `云 · 物 · 柜`,
|
|
unit: ``,
|
|
title: `多类型资源`,
|
|
label: `从轻量部署到专属算力`,
|
|
description: `云服务器、物理服务器与机柜托管,可按需选择。`,
|
|
},
|
|
floatingText: `灵活部署 · 简单管理`,
|
|
artCaption: `为业务构建可靠的运行基础`,
|
|
},
|
|
sectionOrder: [`products`, `infrastructure`, `reviews`, `contact`],
|
|
products: {
|
|
is_show: !0,
|
|
eyebrow: `产品与服务`,
|
|
title: `为不同阶段准备合适的资源`,
|
|
description: `从快速上线到专属部署,选择适合当前业务的产品方案。`,
|
|
badges: [
|
|
{
|
|
label: `配置清晰`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `按需选择`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `统一管理`,
|
|
is_show: !0,
|
|
},
|
|
],
|
|
items: [
|
|
{
|
|
title: `云服务器`,
|
|
subtitle: `CLOUD SERVER`,
|
|
icon: `lucide:cloud`,
|
|
price: `按需选配`,
|
|
period: `查看方案`,
|
|
description: `灵活部署,随业务变化扩展计算资源。`,
|
|
features: [
|
|
{
|
|
label: `多种配置可选`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `支持弹性升级`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `控制台统一管理`,
|
|
is_show: !0,
|
|
},
|
|
],
|
|
buttonLabel: `查看云服务器`,
|
|
href: `/login?redirect=%2Fcloud-servers`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
title: `物理服务器`,
|
|
subtitle: `DEDICATED SERVER`,
|
|
icon: `lucide:server`,
|
|
price: `专属算力`,
|
|
period: `查看方案`,
|
|
description: `独享硬件资源,适合稳定运行的核心业务。`,
|
|
features: [
|
|
{
|
|
label: `独享物理资源`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `可选多种规格`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `实例状态可视`,
|
|
is_show: !0,
|
|
},
|
|
],
|
|
buttonLabel: `查看物理服务器`,
|
|
href: `/login?redirect=%2Fdedicated-servers`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
title: `机柜托管`,
|
|
subtitle: `CABINET COLOCATION`,
|
|
icon: `lucide:network`,
|
|
price: `按需咨询`,
|
|
period: `了解服务`,
|
|
description: `为自有设备提供机房空间与网络接入方案。`,
|
|
features: [
|
|
{
|
|
label: `机房资源托管`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `网络接入可选`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `服务信息可查询`,
|
|
is_show: !0,
|
|
},
|
|
],
|
|
buttonLabel: `了解机柜托管`,
|
|
href: `/login?redirect=%2Fcolocations`,
|
|
is_show: !0,
|
|
},
|
|
],
|
|
},
|
|
infrastructure: {
|
|
is_show: !0,
|
|
eyebrow: `基础设施`,
|
|
title: `让资源状态一目了然`,
|
|
description: `通过统一的客户中心管理实例、订单与服务信息,减少日常运维中的重复操作。`,
|
|
visualLabel: `RESOURCE OVERVIEW`,
|
|
visualCaption: `基础设施服务概览`,
|
|
stats: [
|
|
{
|
|
value: `多类型`,
|
|
unit: ``,
|
|
label: `资源形态`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
value: `按需`,
|
|
unit: ``,
|
|
label: `配置选择`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
value: `统一`,
|
|
unit: ``,
|
|
label: `控制入口`,
|
|
is_show: !0,
|
|
},
|
|
],
|
|
nodeTitle: `服务资源`,
|
|
nodeSubtitle: `按业务需要灵活组合`,
|
|
nodes: [
|
|
{
|
|
label: `云服务器`,
|
|
value: `弹性计算`,
|
|
progress: 78,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `物理服务器`,
|
|
value: `专属资源`,
|
|
progress: 64,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `机柜托管`,
|
|
value: `设备接入`,
|
|
progress: 52,
|
|
is_show: !0,
|
|
},
|
|
],
|
|
},
|
|
reviews: {
|
|
is_show: !1,
|
|
eyebrow: `客户声音`,
|
|
title: `真实体验,值得持续打磨`,
|
|
description: `在这里展示经授权发布的客户评价。`,
|
|
items: [
|
|
{
|
|
quote: `请填写获得客户授权的真实评价。`,
|
|
author: `客户姓名`,
|
|
company: `公司或项目名称`,
|
|
avatar: ``,
|
|
rating: 5,
|
|
is_show: !1,
|
|
},
|
|
],
|
|
},
|
|
contact: {
|
|
is_show: !0,
|
|
eyebrow: `开始使用`,
|
|
title: `为你的下一个项目选好基础设施`,
|
|
description: `浏览可用产品方案,或进入客户中心配置服务、管理实例与订单。`,
|
|
buttonLabel: `前往产品目录`,
|
|
buttonHref: `/login?redirect=%2Fproducts`,
|
|
secondaryLabel: `登录客户中心`,
|
|
secondaryHref: `/login`,
|
|
},
|
|
footer: {
|
|
linkGroups: [
|
|
{
|
|
title: `产品服务`,
|
|
is_show: !0,
|
|
links: [
|
|
{
|
|
label: `云服务器`,
|
|
href: `/login?redirect=%2Fcloud-servers`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `物理服务器`,
|
|
href: `/login?redirect=%2Fdedicated-servers`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `机柜托管`,
|
|
href: `/login?redirect=%2Fcolocations`,
|
|
is_show: !0,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: `服务支持`,
|
|
is_show: !0,
|
|
links: [
|
|
{
|
|
label: `帮助中心`,
|
|
href: `/login?redirect=%2Fhelp`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `服务公告`,
|
|
href: `/login?redirect=%2Fnotices`,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `新闻资讯`,
|
|
href: `/login?redirect=%2Fnews`,
|
|
is_show: !0,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
contactTitle: `联系我们`,
|
|
phone: ``,
|
|
email: ``,
|
|
address: ``,
|
|
qrImage: ``,
|
|
qrCaption: `扫码关注`,
|
|
copyright: `© 破碎工坊网络`,
|
|
registrations: [
|
|
{
|
|
label: `ICP备案`,
|
|
number: ``,
|
|
href: ``,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `网安备案`,
|
|
number: ``,
|
|
href: ``,
|
|
is_show: !0,
|
|
},
|
|
{
|
|
label: `增值电信业务经营许可证`,
|
|
number: ``,
|
|
href: ``,
|
|
is_show: !0,
|
|
},
|
|
],
|
|
legalLinks: [
|
|
{
|
|
label: `服务条款`,
|
|
href: ``,
|
|
is_show: !1,
|
|
},
|
|
{
|
|
label: `隐私政策`,
|
|
href: ``,
|
|
is_show: !1,
|
|
},
|
|
],
|
|
},
|
|
};
|
|
function r(e) {
|
|
return typeof e == `object` && !!e && !Array.isArray(e);
|
|
}
|
|
// 对象递归合并缺省值,数组整体替换,避免 CMS 删除条目后又被默认数组补回。
|
|
function i(e, t) {
|
|
if (Array.isArray(e)) return Array.isArray(t) ? t : e;
|
|
if (!r(e)) return t === void 0 ? e : t;
|
|
let n = r(t) ? t : {},
|
|
a = {
|
|
...e,
|
|
};
|
|
for (let [t, r] of Object.entries(n)) a[t] = t in e ? i(e[t], r) : r;
|
|
return a;
|
|
}
|
|
// useState 初始化时使用深拷贝,页面编辑不会修改模块内的默认文案。
|
|
function a() {
|
|
return JSON.parse(JSON.stringify(n));
|
|
}
|
|
function o(e) {
|
|
return i(n, e);
|
|
}
|
|
// 链接允许站内路径、锚点、HTTP(S)/mailto/tel;未知协议和反斜杠回落为不可跳转的 #。
|
|
function s(e) {
|
|
if (typeof e != `string`) return `#`;
|
|
let t = e.trim();
|
|
return !t || /[\u0000-\u001f\\]/.test(t)
|
|
? `#`
|
|
: /^(https?:\/\/|mailto:|tel:|#|\/(?!\/))/i.test(t)
|
|
? t
|
|
: `#`;
|
|
}
|
|
// 图片来源比链接更严格,不允许 mailto/tel、data 或协议相对 URL。
|
|
function c(e) {
|
|
if (typeof e != `string`) return ``;
|
|
let t = e.trim();
|
|
return !t || /[\u0000-\u001f\\]/.test(t)
|
|
? ``
|
|
: /^(https?:\/\/|\/(?!\/))/i.test(t)
|
|
? t
|
|
: ``;
|
|
}
|
|
// 主题颜色只接受六位十六进制值,非法 CMS 值使用调用方给出的默认色。
|
|
function l(e, t) {
|
|
return typeof e == `string` && /^#[0-9a-fA-F]{6}$/.test(e) ? e : t;
|
|
}
|
|
// 一般加载共享在途 Promise;显式强制刷新可重新请求,失败保留默认/既有内容。
|
|
var u = null;
|
|
function d() {
|
|
let n = useState(`official-site-content`, a),
|
|
r = useState(`official-site-content-loaded`, () => !1),
|
|
i = useState(`official-site-content-error`, () => ``);
|
|
// loaded 表示本轮尝试已结束(含失败);错误单独暴露,避免布局挂载后无限重试。
|
|
async function s(e = !1) {
|
|
return r.value && !e
|
|
? n.value
|
|
: ((!u || e) &&
|
|
((i.value = ``),
|
|
(u = useApi()
|
|
.get(`/official_site_cms/content`, void 0, !1, {
|
|
timeoutMs: 8e3,
|
|
})
|
|
.then((e) => {
|
|
(e?.content && (n.value = o(e.content)), (r.value = !0));
|
|
})
|
|
.catch((e) => {
|
|
((r.value = !0),
|
|
(i.value =
|
|
e instanceof Error ? e.message : `官网内容暂时无法同步`));
|
|
})
|
|
.finally(() => {
|
|
u = null;
|
|
}))),
|
|
await u,
|
|
n.value);
|
|
}
|
|
return {
|
|
content: n,
|
|
loaded: r,
|
|
error: i,
|
|
load: s,
|
|
};
|
|
}
|
|
export { c as i, l as n, s as r, d as t };
|