docs: annotate remaining routes layouts and view boundaries
This commit is contained in:
1 parent
408f8e5c98
commit
ab22d406c0
56 files changed
+403
No files matched your search
@@ -1,4 +1,7 @@
|
||||
<script>
|
||||
/**
|
||||
* 商品目录:两级分类、搜索、分页和配置摘要;摘要缓存按账户令牌与 API origin 分区,切换会话后清理,不能跨账号复用。
|
||||
*/
|
||||
import "~/assets/styles/ProductGroupLabel.B1kWpFA-.css";
|
||||
import "~/assets/styles/ProductDescription.Ctb7jDuO.css";
|
||||
import "~/assets/styles/ProductConfigurationSummary.BqZns1LB.css";
|
||||
@@ -53,6 +56,7 @@ var j = rolldown_runtime_i(getCrypto(), 1),
|
||||
N = 100,
|
||||
P = 512e3,
|
||||
F = 3;
|
||||
// 校验本地摘要缓存键的结构、字段长度和规范序列化,拒绝不符合当前格式的存储条目。
|
||||
function I(e) {
|
||||
if (typeof e != `string` || e.length > 4096) return !1;
|
||||
try {
|
||||
@@ -73,6 +77,7 @@ function I(e) {
|
||||
return !1;
|
||||
}
|
||||
}
|
||||
// 摘要仅接受有界、非空的字符串数组,不从本地存储信任任意结构。
|
||||
function L(e) {
|
||||
return (
|
||||
Array.isArray(e) &&
|
||||
@@ -83,6 +88,7 @@ function L(e) {
|
||||
)
|
||||
);
|
||||
}
|
||||
// 管理摘要缓存、过期清理和同键在途请求复用;持久化容量有界,清空操作会使旧异步任务失效。
|
||||
function R(e, t = Date.now, n) {
|
||||
let r = new Map(),
|
||||
i = new Map(),
|
||||
@@ -226,6 +232,7 @@ function R(e, t = Date.now, n) {
|
||||
};
|
||||
}
|
||||
var z = new WeakMap();
|
||||
// 为当前 Pinia 会话建立缓存管理;每次读取确认 localStorage 令牌一致,并按后端 origin 隔离数据。
|
||||
function pe() {
|
||||
let e = useAuth(),
|
||||
n = useRuntimeConfig(),
|
||||
@@ -291,6 +298,7 @@ function pe() {
|
||||
clear: () => B(a),
|
||||
};
|
||||
}
|
||||
// 提升缓存版本并清除各分区及持久化内容,使旧账号的在途摘要结果不能写回。
|
||||
function B(e) {
|
||||
e.version++;
|
||||
for (let t of e.caches.values()) t.clear();
|
||||
@@ -405,6 +413,7 @@ var me = {
|
||||
onScopeDispose(() => {
|
||||
(W++, G++);
|
||||
});
|
||||
// 部分物理模块列表无可靠起价,需要后续从套餐配置补充,不直接把无效零价当报价。
|
||||
function q(e) {
|
||||
let t = Number(e.price);
|
||||
return (
|
||||
@@ -413,6 +422,7 @@ var me = {
|
||||
(!Number.isFinite(t) || t <= 0)
|
||||
);
|
||||
}
|
||||
// 列出有效父分类与子分类配对,供未指定分类时逐一寻找可展示商品。
|
||||
function Re() {
|
||||
return I.value.flatMap((e) =>
|
||||
L.value
|
||||
@@ -423,11 +433,13 @@ var me = {
|
||||
})),
|
||||
);
|
||||
}
|
||||
// 分类查询参数只接受正的安全整数,避免错误编号进入目录状态。
|
||||
function J(e) {
|
||||
if (typeof e != `string` || !/^[1-9]\d*$/.test(e)) return null;
|
||||
let t = Number(e);
|
||||
return Number.isSafeInteger(t) ? t : null;
|
||||
}
|
||||
// 依据实际分类树恢复查询选择,子分类必须属于有效父分类;无效组合不直接套用。
|
||||
function ze() {
|
||||
let e = J(o.query.g) ?? J(o.query.first_group_id),
|
||||
t = J(o.query.sg) ?? J(o.query.second_group_id),
|
||||
@@ -456,6 +468,7 @@ var me = {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// 把分类选择规范为 g/sg 查询参数,去掉旧参数别名并保留其他查询。
|
||||
function Y(e, t) {
|
||||
let n = {
|
||||
...o.query,
|
||||
@@ -473,6 +486,7 @@ var me = {
|
||||
query: n,
|
||||
}));
|
||||
}
|
||||
// 未指定有效分类时依次查找非空分类;全部为空则回到首个分类展示真实空态。
|
||||
async function Be(e) {
|
||||
let t = Re(),
|
||||
n = t[0];
|
||||
@@ -502,6 +516,7 @@ var me = {
|
||||
(j.value = ``),
|
||||
(D.value = !1));
|
||||
}
|
||||
// 重新加载两级分类后恢复有效选择与页码;分类已变更时重新选择,不沿用过期商品列表。
|
||||
async function X() {
|
||||
let e = ++G;
|
||||
(W++, (B.value = !0), (D.value = !0), (V.value = ``), (j.value = ``));
|
||||
@@ -547,6 +562,7 @@ var me = {
|
||||
e === G && (B.value = !1);
|
||||
}
|
||||
}
|
||||
// 切换一级分类时选择其首个子分类,重置分页并同步 URL。
|
||||
function Ve(e) {
|
||||
if (
|
||||
!B.value &&
|
||||
@@ -561,6 +577,7 @@ var me = {
|
||||
Z()
|
||||
);
|
||||
}
|
||||
// 只允许切换当前一级分类下存在的二级分类。
|
||||
function He(e) {
|
||||
if (
|
||||
!B.value &&
|
||||
@@ -569,6 +586,7 @@ var me = {
|
||||
)
|
||||
return ((z.value = e), (M.value = 1), Y(R.value, z.value), Z());
|
||||
}
|
||||
// 按当前分类/页码/搜索请求列表;仅同一查询复用现有摘要与起价,异步补全仍需匹配列表代次。
|
||||
async function Z(e = !1) {
|
||||
if (B.value || V.value) return;
|
||||
let n = ++W;
|
||||
@@ -644,16 +662,20 @@ var me = {
|
||||
n === W && (D.value = !1);
|
||||
}
|
||||
}
|
||||
// 搜索确认后应用关键词并回到第一页。
|
||||
function Ue() {
|
||||
return ((F.value = P.value.trim()), (M.value = 1), Z());
|
||||
}
|
||||
// 清空草稿关键词,再复用统一搜索提交逻辑。
|
||||
function We() {
|
||||
return ((P.value = ``), Ue());
|
||||
}
|
||||
// 加载中或当前查询有错误时不接受分页,防止叠加新的列表状态。
|
||||
function Ge(e) {
|
||||
if (!(D.value || B.value || j.value || V.value))
|
||||
return ((M.value = e.page + 1), (N.value = e.rows), Z());
|
||||
}
|
||||
// 把已知计费周期转换为中文单位,未知英文枚举不直接作为用户文案。
|
||||
function Ke(e) {
|
||||
return e
|
||||
? {
|
||||
@@ -667,11 +689,13 @@ var me = {
|
||||
}[e] || (/[\u4e00-\u9fff]/.test(e) ? e : ``)
|
||||
: ``;
|
||||
}
|
||||
// 仅在库存控制已开启且数量明确不大于零时判定售罄。
|
||||
function Q(e) {
|
||||
return (
|
||||
Number(e.stock_control) === 1 && e.qty != null && Number(e.qty) <= 0
|
||||
);
|
||||
}
|
||||
// 不允许订购标记或未知模块会阻止进入配置流程,不能单靠列表有价格就开放下单。
|
||||
function $(e) {
|
||||
let t = e.module?.trim();
|
||||
return (
|
||||
@@ -692,6 +716,7 @@ var me = {
|
||||
].includes(t))
|
||||
);
|
||||
}
|
||||
// 区别免费、有效起价、补价中、缺货及配置后报价,不把未知金额显示成零元。
|
||||
function qe(e) {
|
||||
if (e.pay_type === `free`) return `免费`;
|
||||
let t = Number(e.price);
|
||||
@@ -705,6 +730,7 @@ var me = {
|
||||
? `暂无价格`
|
||||
: `配置后报价`;
|
||||
}
|
||||
// 详情链接保留当前有效分类选择,返回目录时可恢复上下文。
|
||||
function Je(e) {
|
||||
return {
|
||||
path: `/products/${e}`,
|
||||
@@ -724,6 +750,7 @@ var me = {
|
||||
}
|
||||
return (
|
||||
onMounted(X),
|
||||
// 分类、商品列表、起价/摘要及库存状态分别呈现;配置摘要是辅助信息,最终报价仍在配置器中确认。
|
||||
(e, t) => {
|
||||
let i = NuxtLink,
|
||||
o = skeleton,
|
||||
|
||||
Reference in new issue
Block a user