@ -0,0 +1,4 @@ |
|||
VITE_API_URL=https://wwwskillhub.popi.art |
|||
VITE_SKILLHUB_URL=https://wwwtestskillhub.popi.art |
|||
|
|||
|
|||
@ -0,0 +1,4 @@ |
|||
VITE_API_URL=https://popi.yuanzoo.cn/ |
|||
VITE_SKILLHUB_URL=https://skillhub.popi.art |
|||
|
|||
|
|||
@ -0,0 +1,4 @@ |
|||
VITE_API_URL=https://wwwtest.popi.art/ |
|||
VITE_SKILLHUB_URL=https://wwwtestskillhub.popi.art |
|||
|
|||
|
|||
@ -0,0 +1 @@ |
|||
node_modules |
|||
@ -0,0 +1,22 @@ |
|||
{ |
|||
"editor.formatOnSave": true, |
|||
"editor.defaultFormatter": "esbenp.prettier-vscode", |
|||
"editor.codeActionsOnSave": { |
|||
"source.fixAll.eslint": "explicit" |
|||
}, |
|||
"eslint.validate": [ |
|||
"javascript", |
|||
"typescript", |
|||
"javascriptreact", |
|||
"typescriptreact" |
|||
], |
|||
"[scss]": { |
|||
"editor.defaultFormatter": "vscode.css-language-features" |
|||
}, |
|||
"[typescriptreact]": { |
|||
"editor.defaultFormatter": "vscode.typescript-language-features" |
|||
}, |
|||
"[typescript]": { |
|||
"editor.defaultFormatter": "vscode.typescript-language-features" |
|||
} |
|||
} |
|||
@ -0,0 +1,84 @@ |
|||
# Popiart SkillHub 前端项目 |
|||
|
|||
PC 端企业级网站前端,面向桌面端浏览器(1280px 及以上分辨率),便于长期维护与团队协作。 |
|||
|
|||
## 技术栈 |
|||
|
|||
| 类别 | 选型 | |
|||
|------|------| |
|||
| 框架 | React 18(函数组件) | |
|||
| 构建 | Vite 5 | |
|||
| 语言 | TypeScript 5(strict,禁止 any,优先 interface) | |
|||
| UI | Arco Design | |
|||
| 样式 | Tailwind CSS v4(@tailwindcss/vite) | |
|||
| 路由 | React Router 6 | |
|||
| 状态 | Zustand | |
|||
| HTTP | Axios | |
|||
|
|||
## 目录说明 |
|||
|
|||
``` |
|||
src/ |
|||
├── api/ # API 层:request 实例、通用类型、按业务拆分的 modules |
|||
├── assets/ # 静态资源:fonts、images、styles |
|||
├── components/ # 公共组件,按组件名建子目录 |
|||
├── constants/ # 常量(路由路径、状态码等) |
|||
├── hooks/ # 自定义 Hooks |
|||
├── layouts/ # 布局组件 |
|||
├── pages/ # 页面,按路由组织 |
|||
├── router/ # 路由配置与守卫 |
|||
├── store/ # Zustand store |
|||
├── types/ # 全局类型(业务实体、API 模型等) |
|||
├── utils/ # 工具函数 |
|||
├── App.tsx |
|||
├── main.tsx |
|||
└── index.css # 全局样式入口(Tailwind + 自定义) |
|||
``` |
|||
|
|||
## 安装与启动 |
|||
|
|||
```bash |
|||
# 安装依赖(推荐 pnpm,也可 npm / yarn) |
|||
pnpm install |
|||
|
|||
# 开发环境,端口 5180 |
|||
pnpm dev |
|||
|
|||
# 构建 |
|||
pnpm build # 默认 |
|||
pnpm build:stage # 预发 |
|||
pnpm build:prod # 生产 |
|||
|
|||
# 预览构建产物 |
|||
pnpm preview |
|||
``` |
|||
|
|||
## 环境变量 |
|||
|
|||
根目录下复制 `.env.example` 为 `.env` 并填写实际值。所有以 `VITE_` 开头的变量会在构建时注入前端。 |
|||
|
|||
| 变量 | 说明 | |
|||
|------|------| |
|||
| VITE_APP_BASE_URL | 应用基础地址 | |
|||
| VITE_API_BASE_URL | 后端 API 基础路径,默认 `/api_client` | |
|||
| VITE_APP_TITLE | 应用标题 | |
|||
|
|||
详见 `.env.example`。 |
|||
|
|||
## 代码规范 |
|||
|
|||
- ESLint 9(flat config)+ TypeScript ESLint + React Hooks |
|||
- Prettier 与 ESLint 集成,保存时自动格式化 |
|||
- 提交前由 Husky + lint-staged 执行 lint、format;commit 信息需符合 Conventional Commits(feat、fix、docs、style、refactor、chore 等) |
|||
|
|||
详见 [CONTRIBUTING.md](./CONTRIBUTING.md)。 |
|||
|
|||
## 代理说明 |
|||
|
|||
开发环境下 `/api_client` 会代理到后端(默认 `http://localhost:3000`),可在 `vite.config.ts` 的 `server.proxy` 中修改。 |
|||
|
|||
## 构建与脚本 |
|||
|
|||
- 路径别名:`@` 指向 `src` |
|||
- 开发端口:5180 |
|||
- 生产构建启用 gzip 压缩(vite-plugin-compression) |
|||
@ -0,0 +1,13 @@ |
|||
export default { |
|||
extends: ["@commitlint/config-conventional"], |
|||
rules: { |
|||
"type-enum": [ |
|||
2, |
|||
"always", |
|||
["feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore", "revert"], |
|||
], |
|||
"header-max-length": [2, "always", 100], |
|||
"subject-empty": [2, "never"], |
|||
"type-empty": [2, "never"], |
|||
}, |
|||
}; |
|||
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 18 KiB |
@ -0,0 +1,2 @@ |
|||
function n(e){return String(e).padStart(2,"0")}function u(e,c="YYYY年MM月DD日 HH:mm:ss"){const t=new Date(e);if(Number.isNaN(t.getTime()))return"";const r=t.getFullYear(),s=t.getMonth()+1,o=t.getDate(),Y=t.getHours(),g=t.getMinutes(),i=t.getSeconds(),m={YYYY:String(r),YY:String(r).slice(-2),MM:n(s),M:String(s),DD:n(o),D:String(o),HH:n(Y),H:String(Y),mm:n(g),m:String(g),ss:n(i),s:String(i)};return c.replace(/YYYY|YY|MM|M|DD|D|HH|H|mm|m|ss|s/g,a=>m[a]??a)}export{u as f}; |
|||
//# sourceMappingURL=date-DPes005z.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"date-DPes005z.js","sources":["../../src/utils/date.ts"],"sourcesContent":["function pad2(v: number): string {\n return String(v).padStart(2, \"0\");\n}\n\n/**\n * 按本地时区格式化日期(仅日期部分)。\n * 支持 token:YYYY、YY、MM、M、DD、D\n */\nexport function formatLocalDate(ms: number, format: string = \"YYYY年MM月DD日 HH:mm:ss\"): string {\n const d = new Date(ms);\n if (Number.isNaN(d.getTime())) return \"\";\n\n const year = d.getFullYear();\n const month = d.getMonth() + 1;\n const day = d.getDate();\n const hour = d.getHours();\n const minute = d.getMinutes();\n const second = d.getSeconds();\n const tokenMap: Record<string, string> = {\n YYYY: String(year),\n YY: String(year).slice(-2),\n MM: pad2(month),\n M: String(month),\n DD: pad2(day),\n D: String(day),\n HH: pad2(hour),\n H: String(hour),\n mm: pad2(minute),\n m: String(minute),\n ss: pad2(second),\n s: String(second),\n };\n\n return format.replace(/YYYY|YY|MM|M|DD|D|HH|H|mm|m|ss|s/g, (token) => tokenMap[token] ?? token);\n}\n"],"names":["pad2","v","formatLocalDate","ms","format","d","year","month","day","hour","minute","second","tokenMap","token"],"mappings":"AAAA,SAASA,EAAKC,EAAmB,CAC/B,OAAO,OAAOA,CAAC,EAAE,SAAS,EAAG,GAAG,CAClC,CAMO,SAASC,EAAgBC,EAAYC,EAAiB,uBAAgC,CAC3F,MAAMC,EAAI,IAAI,KAAKF,CAAE,EACrB,GAAI,OAAO,MAAME,EAAE,QAAA,CAAS,EAAG,MAAO,GAEtC,MAAMC,EAAOD,EAAE,YAAA,EACTE,EAAQF,EAAE,SAAA,EAAa,EACvBG,EAAMH,EAAE,QAAA,EACRI,EAAOJ,EAAE,SAAA,EACTK,EAASL,EAAE,WAAA,EACXM,EAASN,EAAE,WAAA,EACXO,EAAmC,CACvC,KAAM,OAAON,CAAI,EACjB,GAAI,OAAOA,CAAI,EAAE,MAAM,EAAE,EACzB,GAAIN,EAAKO,CAAK,EACd,EAAG,OAAOA,CAAK,EACf,GAAIP,EAAKQ,CAAG,EACZ,EAAG,OAAOA,CAAG,EACb,GAAIR,EAAKS,CAAI,EACb,EAAG,OAAOA,CAAI,EACd,GAAIT,EAAKU,CAAM,EACf,EAAG,OAAOA,CAAM,EAChB,GAAIV,EAAKW,CAAM,EACf,EAAG,OAAOA,CAAM,CAAA,EAGlB,OAAOP,EAAO,QAAQ,oCAAsCS,GAAUD,EAASC,CAAK,GAAKA,CAAK,CAChG"} |
|||
|
After Width: | Height: | Size: 142 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 20 KiB |
@ -0,0 +1 @@ |
|||
.user_edit_dialog{width:520px;max-width:calc(100vw - 32px);position:relative;border-radius:26px;background:#fff;box-sizing:border-box}.user_edit_dialog *{box-sizing:border-box}.user_edit_dialog__title{position:relative;padding:20px 24px;font-size:20px;line-height:28px;color:#141414;text-align:center}.user_edit_dialog__close{cursor:pointer;position:absolute;top:12px;right:12px;width:32px;height:32px;border:none;border-radius:50%;font-size:24px;line-height:32px;color:#666;background:transparent}.user_edit_dialog__content{padding:0 24px 24px}.user_edit_dialog__avatarWrapper{width:72px;height:72px;margin:24px auto 0;border:1px solid #d0c4f8;border-radius:50%}.user_edit_dialog__avatar{display:block;width:64px;height:64px;margin:4px;border-radius:50%;object-fit:cover}.user_edit_dialog__hiddenInput{display:none}.user_edit_dialog__avatarButton{cursor:pointer;display:block;height:36px;margin:16px auto 0;padding:0 16px;border:none;border-radius:4px;color:#6f3cff;background:#f0ecfd}.user_edit_dialog__label{display:block;margin-top:16px;font-size:14px;line-height:22px;color:#666}.user_edit_dialog__label_required:after{content:"*";color:red}.user_edit_dialog__description{margin-top:8px;font-size:12px;line-height:20px;color:#999}.user_edit_dialog__inputBody{position:relative;width:100%;margin-top:8px;background:#f5f5f5;border-radius:9px}.user_edit_dialog__inputBody input{display:block;width:100%;height:48px;padding:12px 80px 12px 12px;border:none;border-radius:4px;font-size:15px;line-height:24px;color:#333;background:#f8f8f8;outline:none}.user_edit_dialog__inputBody input::placeholder{color:#b3b3b3}.user_edit_dialog__inputBody textarea{resize:none;display:block;width:100%;height:96px;padding:12px 56px 12px 12px;border:none;border-radius:4px;font-size:15px;line-height:24px;color:#333;background:#f8f8f8;outline:none}.user_edit_dialog__inputBody textarea::placeholder{color:#b3b3b3}.user_edit_dialog__inputBody .user_edit_dialog__input,.user_edit_dialog__inputBody .user_edit_dialog__textarea{display:block;width:100%;background:transparent}.user_edit_dialog__inputBody .user_edit_dialog__input .arco-input{height:48px;padding:12px 80px 12px 12px;border:none;border-radius:4px;font-size:15px;line-height:24px;color:#333;background:#f8f8f8}.user_edit_dialog__inputBody .user_edit_dialog__textarea .arco-textarea{height:96px;padding:12px 56px 12px 12px;border:none;border-radius:4px;font-size:15px;line-height:24px;color:#333;background:#f8f8f8}.user_edit_dialog__suffix{position:absolute;right:0;top:0;height:48px;padding:0 12px;font-size:15px;line-height:48px;color:#ccc;pointer-events:none}.user_edit_dialog__suffix span{color:#666}.user_edit_dialog__inputBody textarea+.user_edit_dialog__suffix{top:auto;bottom:0}.user_edit_dialog__buttons{margin-top:32px}.user_edit_dialog__buttons button{cursor:pointer;display:block;min-width:120px;margin:0 auto;padding:0 16px;border:none;border-radius:4px;color:#fff;background:#6f3cff;text-align:center}.user_edit_dialog__buttons button:disabled{cursor:not-allowed;opacity:.6}.user_edit_arco_modal .arco-modal-content{padding:0} |
|||
@ -0,0 +1,2 @@ |
|||
import{j as e}from"./markdown-vendor-DnN-_XEd.js";import{u as s}from"./data-vendor-DOiUz3Tw.js";function r(){const{t}=s();return e.jsxs("div",{className:"flex min-h-[60vh] flex-col items-center justify-center px-6 text-gray-600",children:[e.jsx("h1",{className:"text-2xl font-semibold text-gray-800",children:t("pages.aiVideo.title")}),e.jsx("p",{className:"mt-3 max-w-md text-center text-sm leading-relaxed",children:t("pages.aiVideo.desc")})]})}export{r as default}; |
|||
//# sourceMappingURL=index-B27lr7Yu.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"index-B27lr7Yu.js","sources":["../../src/pages/AiVideo/index.tsx"],"sourcesContent":["import { useTranslation } from \"react-i18next\";\r\n\r\nexport default function AiVideo() {\r\n const { t } = useTranslation();\r\n return (\r\n <div className=\"flex min-h-[60vh] flex-col items-center justify-center px-6 text-gray-600\">\r\n <h1 className=\"text-2xl font-semibold text-gray-800\">{t(\"pages.aiVideo.title\")}</h1>\r\n <p className=\"mt-3 max-w-md text-center text-sm leading-relaxed\">{t(\"pages.aiVideo.desc\")}</p>\r\n </div>\r\n );\r\n}\r\n"],"names":["AiVideo","useTranslation","jsxs","jsx"],"mappings":"gGAEA,SAAwBA,GAAU,CAChC,KAAM,CAAE,CAAA,EAAMC,EAAA,EACd,OACEC,EAAAA,KAAC,MAAA,CAAI,UAAU,4EACb,SAAA,CAAAC,MAAC,KAAA,CAAG,UAAU,uCAAwC,SAAA,EAAE,qBAAqB,EAAE,QAC9E,IAAA,CAAE,UAAU,oDAAqD,SAAA,EAAE,oBAAoB,CAAA,CAAE,CAAA,EAC5F,CAEJ"} |
|||
@ -0,0 +1 @@ |
|||
@charset "UTF-8";.charactersPage{box-sizing:border-box;width:100%;min-height:100%;padding:22px 24px 40px;background:#fff}@media (max-width: 520px){.charactersPage{padding:16px 14px 28px}}.character_library_sections{box-sizing:border-box;width:100%}.character_library_sections__section{width:100%}.character_library_sections__section+.character_library_sections__section{margin-top:30px}.character_library_sections__section_head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 16px;min-height:42px}.character_library_sections__title_wrap{flex:0 1 auto;min-height:42px;display:flex;align-items:center}.character_library_sections__section_title{position:relative;margin:0;padding:0 0 3px;display:inline-block;font-family:Source Han Sans CN,Noto Sans SC,system-ui,sans-serif;font-size:16px;font-weight:500;line-height:26px;color:#333}.character_library_sections__section_title:after{content:"";position:absolute;left:calc(50% - .5px);bottom:-5px;transform:translate(-50%);width:39px;height:3px;background:#5c3bc7}.character_library_sections__search{flex:0 0 auto;position:relative;width:228px;max-width:100%;height:27px;box-sizing:border-box;background:#fff;border:1px solid #e5e6eb;border-radius:9px}.character_library_sections__search_icon{position:absolute;left:9px;top:50%;transform:translateY(-50%);width:20px;height:20px;display:block;object-fit:contain;pointer-events:none}.character_library_sections__search_input{width:100%;height:100%;box-sizing:border-box;border:none;background:transparent;padding:0 12px 0 36px;font-family:Source Han Sans CN,Noto Sans SC,system-ui,sans-serif;font-size:14px;font-weight:500;line-height:26px;color:#333;border-radius:9px;outline:none}.character_library_sections__search_input::placeholder{color:#999}.character_library_sections__category{flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:6px;width:105px;height:27px;box-sizing:border-box;padding:0 15px;background:#fff;border:1px solid #e5e6eb;border-radius:9px;cursor:pointer;font-family:Source Han Sans CN,Noto Sans SC,system-ui,sans-serif;font-size:14px;font-weight:500;line-height:26px;color:#333}.character_library_sections__category_icon{width:15px;height:15px;flex-shrink:0;display:block;object-fit:contain;transform:rotate(90deg)}.character_library_sections__category_dropdown{min-width:120px;max-height:280px;overflow-y:auto;padding:4px;box-sizing:border-box;background:#fff;border:1px solid #e5e6eb;border-radius:9px;box-shadow:0 8px 24px #00000014}.character_library_sections__category_menu_item{width:100%;height:32px;padding:0 10px;border:none;border-radius:6px;background:transparent;cursor:pointer;font-family:Source Han Sans CN,Noto Sans SC,system-ui,sans-serif;font-size:14px;font-weight:500;line-height:26px;color:#333;text-align:left;box-sizing:border-box}.character_library_sections__category_menu_item:hover{background:#f5f5f5}.character_library_sections__category_menu_item_active{color:#5c3bc7}.character_library_sections__grid{margin-top:10px;display:grid;grid-template-columns:repeat(auto-fill,168px);gap:15px;justify-content:start;width:100%}.character_library_sections__card{position:relative;width:168px;max-width:100%;height:168px;box-sizing:border-box;border:2px solid #f0f0f0;border-radius:9px;overflow:hidden;background:#fff;padding:0;cursor:pointer;text-align:left}.character_library_sections__card_image{width:100%;height:100%;display:block;object-fit:cover;border-radius:7px}.character_library_sections__card_tag{position:absolute;right:0;bottom:0;min-width:77px;height:26px;padding:0 10px;box-sizing:border-box;border-top-left-radius:24px;border-bottom-right-radius:9px;background:linear-gradient(90deg,#333,#5c3bc7);display:flex;align-items:center;justify-content:center;font-family:Source Han Sans CN,Noto Sans SC,system-ui,sans-serif;font-size:14px;font-weight:500;line-height:24px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.character_library_sections__diy_card{cursor:pointer;border:none;background:linear-gradient(135.5603531394deg,#f0f0f0 36.134%,#d6ceef 99.52%);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:11px}.character_library_sections__diy_icon{width:32px;height:32px;display:block;object-fit:contain;flex-shrink:0}.character_library_sections__diy_label{margin:0;font-family:Source Han Sans CN,Noto Sans SC,system-ui,sans-serif;font-size:14px;font-weight:500;line-height:24px;color:#666;text-align:center}@media (max-width: 520px){.character_library_sections__search{width:100%}.character_library_sections__grid{grid-template-columns:repeat(2,minmax(0,1fr))}.character_library_sections__card{width:100%;height:auto;aspect-ratio:1/1}} |
|||
@ -0,0 +1,2 @@ |
|||
import{j as t}from"./markdown-vendor-DnN-_XEd.js";import{t as d}from"./index-BKk2Zt4l.js";import{r as a}from"./data-vendor-DOiUz3Tw.js";import{f as m,g}from"./react-vendor-B8OyfHW2.js";import"./arco-vendor-Cm-ntj-q.js";function _(){const[i,s]=a.useState(void 0),[o,r]=a.useState(void 0),{id:n}=m(),[c]=g(),e=n??c.get("id")??void 0;return a.useEffect(()=>{e&&(s(void 0),d({id:e}).then(l=>{s(l.data?.content),r(l.data?.title)}))},[e]),t.jsx("div",{className:"legal-page",children:t.jsxs("section",{className:"legal-page__section",id:e,"aria-labelledby":"legal-doc-title",children:[t.jsx("h1",{className:"legal-page__title",id:"legal-doc-title",children:o}),t.jsx("div",{className:"legal-page__content",children:t.jsx("div",{dangerouslySetInnerHTML:{__html:i??""}})})]})})}export{_ as default}; |
|||
//# sourceMappingURL=index-BQVtw4fd.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"index-BQVtw4fd.js","sources":["../../src/pages/content/page/index.tsx"],"sourcesContent":["import { getContent } from \"@/api/api\";\r\nimport { useEffect, useState } from \"react\";\r\nimport { useParams, useSearchParams } from \"react-router-dom\";\r\nimport \"./index.scss\";\r\n\r\nexport default function Content() {\r\n\r\n const [html, setHtml] = useState<string | undefined>(undefined);\r\n const [title, setTitle] = useState<string | undefined>(undefined);\r\n const { id: idFromPath } = useParams();\r\n const [searchParams] = useSearchParams();\r\n const id = idFromPath ?? searchParams.get(\"id\") ?? undefined;\r\n\r\n useEffect(() => {\r\n if (!id) return;\r\n setHtml(undefined);\r\n getContent({ id }).then((res) => {\r\n setHtml(res.data?.content);\r\n setTitle(res.data?.title);\r\n });\r\n }, [id]);\r\n\r\n return (\r\n <div className=\"legal-page\">\r\n <section\r\n className=\"legal-page__section\"\r\n id={id}\r\n aria-labelledby=\"legal-doc-title\"\r\n >\r\n <h1 className=\"legal-page__title\" id=\"legal-doc-title\">\r\n {title}\r\n </h1>\r\n <div className=\"legal-page__content\">\r\n <div dangerouslySetInnerHTML={{ __html: html ?? \"\" }} />\r\n </div>\r\n </section>\r\n </div>\r\n );\r\n}\r\n"],"names":["Content","html","setHtml","useState","title","setTitle","idFromPath","useParams","searchParams","useSearchParams","id","useEffect","getContent","res","jsx","jsxs"],"mappings":"2NAKA,SAAwBA,GAAU,CAE9B,KAAM,CAACC,EAAMC,CAAO,EAAIC,EAAAA,SAA6B,MAAS,EACxD,CAACC,EAAOC,CAAQ,EAAIF,EAAAA,SAA6B,MAAS,EAC1D,CAAE,GAAIG,CAAA,EAAeC,EAAA,EACrB,CAACC,CAAY,EAAIC,EAAA,EACjBC,EAAKJ,GAAcE,EAAa,IAAI,IAAI,GAAK,OAEnDG,OAAAA,EAAAA,UAAU,IAAM,CACPD,IACLR,EAAQ,MAAS,EACjBU,EAAW,CAAE,GAAAF,CAAA,CAAI,EAAE,KAAMG,GAAQ,CAC7BX,EAAQW,EAAI,MAAM,OAAO,EACzBR,EAASQ,EAAI,MAAM,KAAK,CAC5B,CAAC,EACL,EAAG,CAACH,CAAE,CAAC,EAGHI,EAAAA,IAAC,MAAA,CAAI,UAAU,aACX,SAAAC,EAAAA,KAAC,UAAA,CACG,UAAU,sBACV,GAAAL,EACA,kBAAgB,kBAEhB,SAAA,CAAAI,MAAC,KAAA,CAAG,UAAU,oBAAoB,GAAG,kBAChC,SAAAV,EACL,EACAU,EAAAA,IAAC,MAAA,CAAI,UAAU,sBACX,SAAAA,EAAAA,IAAC,MAAA,CAAI,wBAAyB,CAAE,OAAQb,GAAQ,EAAA,CAAG,CAAG,CAAA,CAC1D,CAAA,CAAA,CAAA,EAER,CAER"} |
|||
@ -0,0 +1 @@ |
|||
.legal-page{width:100vw;min-height:100vh;display:flex;flex-direction:column;align-items:center;padding:20px;box-sizing:border-box}.legal-page .legal-page__section{width:100%;max-width:100%;display:flex;flex-direction:column;align-items:center;scroll-margin-top:20px}.legal-page .legal-page__title{text-align:center;font-size:24px;font-weight:600;color:#333;margin-bottom:20px}.legal-page .legal-page__content{width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:20px;box-sizing:border-box;background:#fff;border-radius:10px;margin:0 20px 20px;box-shadow:0 0 10px #0000001a} |
|||
@ -0,0 +1,2 @@ |
|||
import{j as a}from"./markdown-vendor-DnN-_XEd.js";import{u as o,r as i}from"./data-vendor-DOiUz3Tw.js";import{e as n,O as c}from"./react-vendor-B8OyfHW2.js";const l=["myCreations","inspiration","favorite"],m={myCreations:"my-creations",inspiration:"inspiration",favorite:"favorite"};function _(...e){return e.filter(Boolean).join(" ")}function u(){const{t:e}=o(),t=i.useId();return a.jsxs("div",{className:"createPage",children:[a.jsx("header",{className:"createPage__toolbar createPage__toolbar_primary_only",children:a.jsx("div",{className:"createPage__primaryTabs",role:"tablist","aria-label":e("pages.create.toolbarAria"),children:l.map(r=>a.jsx(n,{id:`${t}-tab-${r}`,to:m[r],end:!0,role:"tab",className:({isActive:s})=>_("createPage__primaryTab",s&&"createPage__primaryTab_active"),children:e(`pages.create.tabs.${r}`)},r))})}),a.jsx(c,{context:t})]})}export{u as default}; |
|||
//# sourceMappingURL=index-Bq1lmU3i.js.map
|
|||
@ -0,0 +1 @@ |
|||
{"version":3,"file":"index-Bq1lmU3i.js","sources":["../../src/pages/Create/index.tsx"],"sourcesContent":["import { useId } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { NavLink, Outlet } from \"react-router-dom\";\nimport \"./index.scss\";\n\ntype PrimaryTabId = \"myCreations\" | \"inspiration\" | \"favorite\";\n\nconst PRIMARY_TAB_ORDER: PrimaryTabId[] = [\n \"myCreations\",\n \"inspiration\",\n \"favorite\",\n];\n\n/** 与 router 子 path 一致(相对 ROUTES.CREATE) */\nconst PRIMARY_TAB_PATH: Record<PrimaryTabId, string> = {\n myCreations: \"my-creations\",\n inspiration: \"inspiration\",\n favorite: \"favorite\",\n};\n\nfunction cn(...parts: Array<string | false | undefined>) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport default function Create() {\n const { t } = useTranslation();\n const tabIdPrefix = useId();\n\n return (\n <div className=\"createPage\">\n <header className=\"createPage__toolbar createPage__toolbar_primary_only\">\n <div className=\"createPage__primaryTabs\" role=\"tablist\" aria-label={t(\"pages.create.toolbarAria\")}>\n {PRIMARY_TAB_ORDER.map((id) => (\n <NavLink\n key={id}\n id={`${tabIdPrefix}-tab-${id}`}\n to={PRIMARY_TAB_PATH[id]}\n end\n role=\"tab\"\n className={({ isActive }) => cn(\"createPage__primaryTab\", isActive && \"createPage__primaryTab_active\")}\n >\n {t(`pages.create.tabs.${id}`)}\n </NavLink>\n ))}\n </div>\n </header>\n\n <Outlet context={tabIdPrefix} />\n </div>\n );\n}\n"],"names":["PRIMARY_TAB_ORDER","PRIMARY_TAB_PATH","cn","parts","Create","t","useTranslation","tabIdPrefix","useId","jsxs","jsx","id","NavLink","isActive","Outlet"],"mappings":"6JAOA,MAAMA,EAAoC,CACxC,cACA,cACA,UACF,EAGMC,EAAiD,CACrD,YAAa,eACb,YAAa,cACb,SAAU,UACZ,EAEA,SAASC,KAAMC,EAA0C,CACvD,OAAOA,EAAM,OAAO,OAAO,EAAE,KAAK,GAAG,CACvC,CAEA,SAAwBC,GAAS,CAC/B,KAAM,CAAE,EAAAC,CAAA,EAAMC,EAAA,EACRC,EAAcC,EAAAA,MAAA,EAEpB,OACEC,EAAAA,KAAC,MAAA,CAAI,UAAU,aACb,SAAA,CAAAC,MAAC,UAAO,UAAU,uDAChB,SAAAA,MAAC,MAAA,CAAI,UAAU,0BAA0B,KAAK,UAAU,aAAYL,EAAE,0BAA0B,EAC7F,SAAAL,EAAkB,IAAKW,GACtBD,EAAAA,IAACE,EAAA,CAEC,GAAI,GAAGL,CAAW,QAAQI,CAAE,GAC5B,GAAIV,EAAiBU,CAAE,EACvB,IAAG,GACH,KAAK,MACL,UAAW,CAAC,CAAE,SAAAE,CAAA,IAAeX,EAAG,yBAA0BW,GAAY,+BAA+B,EAEpG,SAAAR,EAAE,qBAAqBM,CAAE,EAAE,CAAA,EAPvBA,CAAA,CASR,EACH,CAAA,CACF,EAEAD,EAAAA,IAACI,EAAA,CAAO,QAASP,CAAA,CAAa,CAAA,EAChC,CAEJ"} |
|||
@ -0,0 +1,2 @@ |
|||
import{j as n}from"./markdown-vendor-DnN-_XEd.js";import{u as G,r as s}from"./data-vendor-DOiUz3Tw.js";import{g as q}from"./react-vendor-B8OyfHW2.js";import{F as R,G as z,o as V}from"./index-BKk2Zt4l.js";import"./arco-vendor-Cm-ntj-q.js";const N=20,T=[{title:"image",type:1},{title:"video",type:2},{title:"template",type:4},{title:"character",type:5}];function B(...l){return l.filter(Boolean).join(" ")}function L(l){const i=l;return i?.data?.list??i?.list??[]}function H(l,i){const g=()=>{const r=l?.images??l?.imageList;if(Array.isArray(r)&&typeof r[0]=="string"&&r[0])return r[0];for(const c of["cover","avatar","headImage","headImg","image","thumbnail"]){const o=l?.[c];if(typeof o=="string"&&o.trim())return o.trim()}return null};if(i===2){const r=l?.video;if(typeof r=="string"&&r){const c=l?.cover,o=typeof c=="string"&&c.trim()?c.trim():g()??void 0;return{kind:"video",src:r,poster:o}}}const p=g();return p?{kind:"image",src:p}:null}function A(l){const i=l?.id??l?.assetId;return i==null||i===""?null:String(i)}function Q({tabIdPrefix:l}){const{t:i}=G(),[g,p]=q(),[r,c]=s.useState(1),[o,v]=s.useState([]),[S,j]=s.useState(1),[_,d]=s.useState(!0),[m,F]=s.useState(!1),[y,I]=s.useState(!1),[P,k]=s.useState(null),w=s.useRef(null),x=s.useRef(!1),u=s.useRef(0),E=s.useRef(async()=>{});s.useEffect(()=>{const e=g.get("type");if(e==null)return;const t=Number(e);Number.isFinite(t)&&T.some(a=>a.type===t)&&c(t)},[g]);const h=s.useCallback(e=>({type:r,page:e,pageSize:N}),[r]);s.useEffect(()=>{let e=!1;u.current+=1;const t=u.current;return j(1),d(!0),v([]),F(!0),k(null),R(h(1)).then(a=>{if(e||u.current!==t)return;const f=L(a);v(f),d(f.length>=N)}).catch(a=>{e||u.current!==t||(k(a instanceof Error?a:new Error(String(a))),v([]),d(!1))}).finally(()=>{!e&&u.current===t&&F(!1)}),()=>{e=!0}},[r,h]);const C=s.useCallback(async()=>{if(!_||x.current||m||y)return;x.current=!0,I(!0);const e=u.current,t=S+1;try{const a=await R(h(t));if(u.current!==e)return;const f=L(a);f.length===0?d(!1):(v($=>[...$,...f]),j(t),d(f.length>=N))}catch{u.current===e&&d(!1)}finally{x.current=!1,I(!1)}},[_,m,y,h,S]);E.current=C,s.useEffect(()=>{const e=w.current;if(!e||!_||m)return;const t=new IntersectionObserver(a=>{a[0]?.isIntersecting&&E.current()},{root:null,rootMargin:"200px",threshold:0});return t.observe(e),()=>t.disconnect()},[_,m,o.length]);const M=s.useCallback(e=>{c(e),p(t=>{const a=new URLSearchParams(t);return a.set("type",String(e)),a},{replace:!0})},[p]),b=s.useCallback(async e=>{const t=A(e);if(t==null)return;if(Number(e?.type??r)===4)try{await z(t)}catch{}await V({assetId:t})},[r]),D=s.useCallback(e=>{e.currentTarget.querySelector("video")?.play()},[]),O=s.useCallback(e=>{e.currentTarget.querySelector("video")?.pause()},[]);return n.jsxs("div",{className:"myFavoritePanel",children:[n.jsx("div",{className:"createPage__subRow myFavoritePanel__subRow",children:n.jsx("div",{className:"createPage__filters",role:"group","aria-label":i("pages.create.filtersAria"),"data-active-tab":r,children:T.map(({title:e,type:t})=>n.jsx("button",{type:"button","data-type":t,"data-selected":r===t,"aria-pressed":r===t,className:B("createPage__filterPill",r===t&&"createPage__filterPill_active"),onClick:()=>M(t),children:i(`pages.create.filters.${e}`)},t))})}),n.jsxs("section",{className:"createPage__panel createPage__panel_below_filters",id:`${l}-panel-favorite`,role:"tabpanel","aria-labelledby":`${l}-tab-favorite`,children:[m&&o.length===0?n.jsx("p",{className:"createPage__panelStatus",children:i("common.loading")}):null,P?n.jsx("p",{className:"createPage__panelStatus createPage__panelStatus_error",children:P.message}):null,!m&&!P&&o.length===0?n.jsx("p",{className:"createPage__panelPlaceholder",children:i("pages.create.panels.favorite.placeholder")}):null,o.length>0?n.jsxs(n.Fragment,{children:[n.jsx("ul",{className:"myFavoritePanel__list",role:"list",children:o.map(e=>{const t=A(e)??`row-${r}`,a=H(e,r);return a?.kind==="video"?n.jsx("li",{className:"myFavoritePanel__item",onClick:()=>void b(e),onMouseEnter:D,onMouseLeave:O,children:n.jsx("video",{className:"myFavoritePanel__media",src:a.src,muted:!0,playsInline:!0,loop:!0,preload:"metadata",poster:a.poster,"aria-hidden":!0})},t):a?.kind==="image"?n.jsx("li",{className:"myFavoritePanel__item",onClick:()=>void b(e),children:n.jsx("img",{className:"myFavoritePanel__media",src:a.src,alt:"",loading:"lazy"})},t):n.jsx("li",{className:"myFavoritePanel__item myFavoritePanel__item_empty",onClick:()=>void b(e),children:n.jsx("span",{className:"myFavoritePanel__emptyLabel",children:i("pages.create.panels.favorite.noPreview")})},t)})}),_?n.jsx("div",{ref:w,className:"myFavoritePanel__sentinel","aria-hidden":!0}):null,y?n.jsx("p",{className:"createPage__panelStatus myFavoritePanel__loadMore",children:i("common.loading")}):null]}):null]})]})}export{Q as default}; |
|||
//# sourceMappingURL=index-BuB1TwF9.js.map
|
|||