docs: annotate all shared frontend modules in Chinese
This commit is contained in:
1 parent
2be21c1c62
commit
408f8e5c98
55 files changed
+349
No files matched your search
@@ -1,3 +1,4 @@
|
||||
/** 前端公开路由清单,供路由守卫和跨标签退出共用;后端接口仍须独立鉴权。 */
|
||||
const authPages = new Set([
|
||||
"/login",
|
||||
"/register",
|
||||
@@ -16,6 +17,7 @@ const shopPages = new Set([
|
||||
"/products/dedicated-server/customize",
|
||||
]);
|
||||
|
||||
// 商品可匿名浏览,但 edit_position 表示编辑用户购物车,不能按公开商品页放行。
|
||||
export function isPublicShop(route) {
|
||||
if (Object.hasOwn(route.query || {}, "edit_position")) return false;
|
||||
const path = route.path.replace(/\/+$/, "") || "/";
|
||||
@@ -24,6 +26,7 @@ export function isPublicShop(route) {
|
||||
export function isAuthPage(path) {
|
||||
return authPages.has(path.replace(/\/+$/, "") || "/");
|
||||
}
|
||||
// /home.htm 是待核验的过渡入口,公开仅表示能打开核验页,不表示已获登录权限。
|
||||
export function isPublicRoute(route) {
|
||||
return (
|
||||
route.path === "/home.htm" || isAuthPage(route.path) || isPublicShop(route)
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
// 品牌图片统一使用 public 中的站内资源,页面和布局不要各自拼接部署路径。
|
||||
export const logoUrl = "/images/brand/logo.png";
|
||||
@@ -1,3 +1,4 @@
|
||||
/** 提供现有调用方使用的 SHA-256 函数;这是摘要算法,不是加密或密码存储方案。 */
|
||||
import CryptoJS from "crypto-js";
|
||||
export function getCrypto() {
|
||||
return CryptoJS.SHA256;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// 恢复模块的加载入口,原样调用工厂并返回其结果/Promise;异常由调用方处理,不做静默回退。
|
||||
export function loadModule(load) {
|
||||
return load();
|
||||
}
|
||||
Reference in new issue
Block a user