Compare commits

...
196 Commits
Author SHA1 Message Date
kate522 9e7ccc1ba4 fix(forum): correct sidebar nesting and duplicate widget card
- keep .sidebar a sibling of .content-wrap inside main.container so the
  theme's float math puts it in the right column
- move fluid widget zones inside main on plate / post routes
- drop the leftover .forum-home .jio-widget-box override that stacked a
  second card background on the user card
- balance the compose page shell for guests and editors
2026-11-11 18:25:12 +08:00
kate522 ec5dfcd82f fix(forum): align forum pages with the reference layout
- cards: restore the shared card shell, add author follow/message actions,
  score group, last-reply meta and reference plate header actions
- home: desktop left tab rail, widget-only sidebar, reference load-more markup
- plate: 1-based tabs, reference defaults (全部/推荐/最新回复/热门/精华)
- post: fixed action rail, score footer, author card, h1 article title
- quick publish: plate selector moved into the submit row like the reference
2026-11-11 18:06:33 +08:00
kate522andClaude Fable 5 7a59c65252 feat(forum): add quick publish, captcha and hidden content
Port the reference inline quick-publish composer to the forum home:
title/body inputs, image upload, plate/topic/access/hidden-content
dropdowns and save/publish actions. Wire the site captcha into forum
publishing through a new `forum_post` scene (admin + REST gate), and
turn the hidden-content box into the theme's own visibility shortcodes
(login/comment/vip/payshow) so the existing gate renderer unlocks them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-11 16:37:31 +08:00
kate522andClaude Fable 5 5d3358d844 feat(forum): rebuild plate, post and compose pages
Match the reference layouts for the remaining forum routes: plate pages
get the blurred header card, moderator row and the affix tab bar with
per-tab filtering, topping posts and moderator-only pending/trash tabs;
post pages get the article shell with breadcrumbs, cover, meta row,
vote box, tag row and footer actions; compose pages get the reference
editor plus settings sidebar (submit/draft, status, access, plate,
topic, tag, type, vote) with a cover picker. Saving now honours draft
state and the featured image through the REST contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-11 16:17:55 +08:00
kate522andClaude Fable 5 eceddb5f7d feat(forum): add the reference forum widgets
Port the six forum widgets from the reference theme: posts list,
multi-tab posts, plate list (default and card), plate info, moderator
list and topic list. They join the schema widget catalog under a forum
group that stays hidden while the forum module is off, reuse the shared
forum cards, paginate through the widget REST client contract, and pull
the forum stylesheet/runtime onto any sidebar that hosts them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-11 15:47:13 +08:00
kate522andClaude Fable 5 376827ea97 test(account): stub do_action in the account settings harness
The email-change flow fires jio_user_email_changed after a successful
write, but the harness only shimmed add_action, so the run died on an
undefined do_action() before reaching the assertions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-11 14:53:09 +08:00
kate522andClaude Fable 5 024ecddfed feat(forum): rebuild forum home page
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-11 14:41:02 +08:00
kate522andClaude Fable 5 51d5b8a2a1 fix(admin): make forum settings pages auditable
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-11 14:41:02 +08:00
kate522andClaude Fable 5 374de05059 fix(submit): enable optional topic selection by default
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-11 14:41:02 +08:00
kate522 ee65fc7fd2 feat(forum): add complete forum workflows 2026-11-11 00:09:43 +08:00
kate522 a254cbd3e9 feat(topics): restore topic taxonomy workflow 2026-11-10 22:31:11 +08:00
kate522 f3dd1ec3b1 fix(admin): unify settings save controls 2026-11-10 21:34:00 +08:00
kate522 7fe26d3fff fix(users): restore WeChat template notification flow 2026-11-10 20:54:24 +08:00
kate522 30ceab4615 fix(creator-studio): unify block and inline marker deletion 2026-11-10 20:10:48 +08:00
kate522 d391b0fd00 fix(creator-studio): delete selected hidden blocks reliably 2026-11-10 20:01:16 +08:00
kate522 304c59c8f3 fix(submit): keep page width stable when dialogs open 2026-11-10 19:55:49 +08:00
kate522 b497eb4a59 fix(creator-studio): respect line breaks when deleting blocks 2026-11-10 19:48:40 +08:00
kate522 561378312f fix(creator-studio): repair structural block deletion 2026-11-10 19:36:43 +08:00
kate522 a061ec86ce refactor(submit): drop the hover block-delete overlay
Hovering a quote, hidden block, code block or table showed a ✕ button in the
block's top-right corner. It read as a stray close button and is not wanted.

Removed
- installBlockActions() and the two-step select/delete flow it drove
- the block-actions markup, positioning, selected-state CSS in the iframe
  content style
- BLOCK_SELECTOR, which only the overlay used

Deleting blocks still works: removeAdjacentBlock() keeps Backspace / Delete
next to a structural block (table, pre, hr, quote, hidden block) working, and
that is covered by both code and tests.
2026-11-10 18:56:30 +08:00
kate522 49f1212e33 fix(submit): keep the editor iframe tall enough for restored drafts and media
The iframe height is synced explicitly, and two paths were missing it, so long
content ended up clipped inside the editor's own scroll area.

- restoring a local draft calls setContent with a whole article at once; the
  iframe stayed at 520px while the body grew to 1410px, so only the first few
  paragraphs appeared to survive the restore
- media inserts called insertContent directly without resyncing, and images
  load asynchronously: the height was measured while the image was still 0px
  tall, leaving the paragraphs below it cut off (measured: iframe 946 vs body
  1006 with a single image after long text)

Fixes
- resync the height right after the restore's setContent, and add SetContent to
  the events that already sync height and content
- resync after both media callbacks (picker and embed)
- add installHeightWatchers(): capture-phase load listener inside the iframe for
  img / iframe / video / audio, plus a ResizeObserver on the body, so the height
  follows assets that finish loading later

Tests cover the restore path and both media paths, including async loading.
2026-11-10 18:45:14 +08:00
kate522 a5386f72c6 fix(submit): make the draft chain survive continuous writing, reloads and flaky networks
Autosave only ran after 4s of idle, and every keystroke reset that timer, so a
writer who never stopped had zero saves (measured: 15s of typing = 0 requests).
Saving also never rebound the URL, so a new draft could not be found again after
a reload, the local backup was cleared on every autosave, and a failed save had
no retry and stayed failed once the network came back.

Client
- autosave: keep the idle debounce but add a 30s max-wait window that is not
  reset by further keystrokes, and retry failures at 5s / 15s / 60s
- bind `?edit=<id>` into the URL once the server returns a post id, so reloads,
  new tabs and history all reopen the same draft
- only clear the local backup when the save settled and nothing changed since
- key the local backup by draft id instead of the constant `jio-studio-0`
- restore snapshots through hydrateBlocks so code blocks come back editable
- never disable publish while an autosave is in flight, and mark autosave
  states separately (自动保存中… / 已自动保存 / 自动保存失败,将重试)
- on 409, adopt the server rev and tell the author instead of failing silently
- status bar reports the real save state instead of a bogus Markdown hint

Server
- draft saves no longer rewrite the lifecycle: pending / future / publish /
  private posts keep their status, so an autosave cannot pull a submitted post
  out of the review queue
- drafts and autosaves stop consuming the publish flood quota, which is meant to
  cap actual publishing (measured: 4 drafts used to burn 4 slots)
- autosave skips wp_save_post_revision for both plain drafts and submission
  versions; manual saves and submits still create a revision to roll back to
- media-only drafts (image / table / code / hr) count as content
- the response now carries the resulting status so the client can tell
  "just submitted" from "still under review"

Tests cover the max-wait window, retry schedule, URL binding, backup clearing,
status labelling and every server-side draft rule.
2026-11-10 17:58:22 +08:00
kate522 ec582ac9f9 fix(submit): repair placeholder, code block, hidden block and settings toggles
- placeholder: hide the body ::before hint once the editor body has focus, so
  clicking an empty document no longer leaves the hint sitting under the caret
- code block: edit as a bare <pre> and convert to pre > code on save. TinyMCE
  treats pre > code as an inline boundary, so typing there leaked into the
  following paragraph; Enlighter also splits lines on newlines, so the <br>
  the editor produced rendered the whole block as one overflowing line
- code block: align the iframe rendering with Enlighter (Menlo 13px/1.4,
  #f8f9fa, 8px radius, 12px 17px padding, nowrap) in both content CSS files
- code block: move the caret into the block after insertion
- hidden block: hang the block-delete overlay on documentElement instead of
  body. data-mce-bogus only skips serialization, so the extra body child made
  mceInsertContent wipe the document and drop the first hidden block
- settings: give the toggle a real 44x24 hit area, align it to the top of the
  row, add aria-labels and show the disabled state
- styles: drop the duplicated @use/@import of publish-drawer and block-tools
- media insert/embed now serialize through serializeBlocks so code blocks are
  never stored in editor form
2026-11-10 16:04:49 +08:00
kate522andClaude Opus 5 4f9347b6aa fix(submit): let the editor iframe grow with the body instead of scrolling internally
正文超过 iframe 高度时会在编辑器内部出现第二根滚动条,正文应该随页面一起变长。
登录态实测确认了滚动来源与两个副作用:

1. 经典投稿表单完全没做高度同步(iframe 固定 504px,正文 1824px → 内滚动)。
   在共用基础插件里补上 syncHeight():测量正文高度并同步 iframe,
   下限取编辑器声明高度;图片加载后重新同步。工作台自带 syncEditorHeight()
   负责块浮层定位,用 __jioStudioOwnsEditorHeight 让插件跳过,避免双写。

2. 直接量 scrollHeight 会把 body 的 min-height 撑满算进内容高度,形成
   「撑高 → 再撑高」的反馈循环(实测涨到 22616px)。测量时临时把
   min-height 归零、同帧恢复。

3. body 的 min-height 基准从 100% 改成 100vh:iframe 随正文变高,
   百分比会跟着循环;同时把 WordPress content CSS 的 body 外边距改内边距,
   外边距不计入高度,会让 html 比 iframe 高一截、长正文时又冒出内滚动。

登录态实测(studio 与经典两条路径):
- iframe 2152px / 1874px,与正文一致,innerHasScrollbar=false;
- 空正文占位符正常、点击空白落光标正常;
- 只有页面级滚动。

测试:新增 iframe 随正文增长、测量忽略 min-height 两个回归用例;903 全通过。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-09 21:37:14 +08:00
kate522andClaude Opus 5 305896796c fix(submit): detect empty body without editor chrome and let body fill the frame
登录态实测(Edge + 真实 TinyMCE)复现了上一版没修好的两点:

1. 占位符仍不显示:editor-runtime 会把块级删除浮层插进 body,它带
   data-mce-bogus 但含「✕ 选中此块」文字,body.textContent 因此永远非空,
   data-jio-empty 一直没被打上。判断正文是否为空时先剔除 data-mce-bogus 节点。

2. 点空白落不到正文:body 高度只有 29px。`min-height:100%` 的父级 html
   没有确定高度,百分比退化成 auto。改为 html{height:100%} +
   body{min-height:100%},body 现在铺满 520px 的 iframe。

实测结果(登录态 https://localhost/submit/):
- 首次加载 data-jio-empty=1、::before 渲染「请输入正文」;
- 点击正文中部空白,光标落进 P 并可继续输入;
- 引用块内编辑后点空白,光标落到引用之后的段落;
- 清空内容后占位符恢复。

测试:新增「编辑器辅助节点不算正文」回归用例;900 → 901 全通过。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-09 21:16:45 +08:00
kate522andClaude Opus 5 5afa7ab9df fix(submit): show body placeholder on first load and restore caret on blank clicks
两个前台投稿编辑器的缺陷,根因都在占位符的实现方式:

1. 首次加载不显示占位符,输入一个再删掉才出现。
   旧实现往正文插了一个 data-mce-bogus 占位段落,而 TinyMCE 在
   setContent(studio 初始化时必调)与清理 bogus 元素时会把它移除。

2. 光标在块级结构里时,点击正文空白处无法落回正文。
   占位段落占着首行、且 pointer-events:none,点击落不到可编辑元素上;
   正文以表格 / 代码块这类结构块结尾时也没有可承载光标的段落。

改为 front-submit-editor-basics.js(替换 front-submit-placeholder.js):
- 占位符改成 body 属性 + content CSS 的 ::before,正文 DOM 不含占位节点;
- 点击空白处(事件目标是 body)且光标不在普通文本里时,补一个可编辑尾段
  并把光标放进去;
- 两份 content CSS 让 html/body 撑满编辑区,studio 的 syncEditorHeight
  以编辑器声明高度为下限,空正文时 iframe 不会缩成一行。

新增 tests/widget-system/submit-placeholder-behavior.test.cjs(jsdom 跑真实插件)。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-09 20:38:02 +08:00
kate522andClaude Opus 5 c2733017fd feat(header): add 叠加组件 with after_html per background item
「顶部多功能组件 → 背景内容」的每个背景项目新增「叠加组件」手风琴,
其中提供「组件下方额外内容」(after_html) 输入框,支持 HTML。

- 后台 schema:slider_item_fields 增加 overlay accordion(sanitize_type html),
  默认值与 PageConfigMetaBox / DisplayPageGroups 的默认项目同步带上空 overlay
- 保存:页面独立配置(page_config 元数据)按项目写入 overlay.after_html,
  沿用 wp_kses_post() 过滤
- 前端:after_html 作为 .slide-overlay-after 覆盖层输出在所属幻灯片内
  (幻灯片是 overflow:hidden 的定位层,放到幻灯片外会被裁掉),
  默认贴底居中、仅其中的链接与表单接收点击
- main.min.css 由 tools/build-public-assets.mjs 重新生成

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-09 19:44:54 +08:00
kate522andClaude Opus 5 44a03fd5f4 fix(submit): render the configured body placeholder in TinyMCE
WordPress 打包的 TinyMCE 4.9 不含官方 placeholder 插件,tinymce.init 里的
placeholder 配置被静默忽略,投稿页「投稿内容占位符」从未显示过。

新增主题插件 assets/js/front-submit-placeholder.js:正文为空时插入一个
data-mce-bogus 的占位段落,有内容即移除;序列化 / 解析都剔除该段落,
字数统计也跳过它,提示文字不会写进文章。

- 经典投稿表单与创作者工作台都通过 external_plugins 加载
  (WordPress 会丢弃名字已在 plugins 列表里的外部插件)
- 占位样式写进 iframe 的 content CSS:submit-editor.css 与
  editor-content-style.ts

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-09 19:01:28 +08:00
kate522andClaude Opus 5 beb898b1ab fix(creator-studio): caret overlap in toolbar and hidden sub-categories
工具条下拉触发器的下三角原本绝对定位在按钮右下角,按钮宽度不够时会压到
居中的文字上。改为文字 + 三角同行排版(.jio-creator__tool-meta),宽度不足
时只压缩文字。

分类只查询 parent=0,导致二级 / 三级分类在投稿页完全不可选。新增
SubmitCategories 统一解析:
- 取全部分类并按父子关系深度优先展平,带上 depth / path;
- 白名单按"选了上级即包含其全部子级"展开,未配置白名单时不做额外过滤;
- 创作者工作台、经典投稿表单、保存校验与审核应用共用同一份结果。

选择器按 depth 缩进,搜索同时匹配完整路径。

同时把 assets/creator-studio/build 与 assets/admin/build 统一为整目录忽略
(不再跟踪 .gitkeep),避免构建产物反复被误提交。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-09 18:10:19 +08:00
kate522andClaude Opus 5 330df53195 feat(creator-studio): multi-select category picker and creatable tag input
分类从平铺复选标签改为带搜索的多选下拉(触发器内是已选令牌),
标签改为令牌输入框:回车 / 逗号 / 顿号 / 分号 / 换行切分,输入时列出
站点已有标签作为建议,面板内可一键新建。

- 抽出 useAnchoredPanel,工具条下拉与新的选择器共用同一套 portal 定位
- bootstrap 的 tags 增加 suggestions(按使用量取前 200 个已有标签)
- 清理 .jio-creator-inline 与 chip 内的死样式

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-09 17:35:52 +08:00
kate522 8bb4b98fc9 chore(creator-studio): stop tracking the build output
assets/creator-studio/build is generated by `npm run build`, so committing it
put a rebuilt bundle in every diff. It now follows the same deploy-only rule
as assets/admin/build.

- Root .gitignore ignores build/* and node_modules/, keeping a .gitkeep so
  the directory still exists in a clean checkout.
- Drops the three tracked artifacts from the index.
- The contract test no longer requires the artifacts to exist; it checks the
  set is all-or-nothing, so a clean checkout and a locally built tree both
  pass. This mirrors admin-build-graph-contract.
- README documents that build/ is produced on the target machine.

887 widget-system tests pass.
2026-11-09 16:44:41 +08:00
kate522 4cd296c066 refactor(creator-studio): pick the cover from the toolbar image dialog
The cover row carried its own hidden file input and upload call, so authors
had two different image flows in one page.

- 添加封面 now opens window.JioSubmitMedia with type=image, the same dialog
  the toolbar's 图片 button uses (mine / upload / external link).
- The picked image is stored as the full-size URL plus its attachment id,
  matching FrontSubmitFeatured's image branch, which re-checks ownership
  and sets the post thumbnail.
- Removes the now-unused uploadCover path, apiUpload/nonce imports, and the
  .jio-creator__cover-input rule.

Contract added; 887 widget-system tests pass.
2026-11-09 15:57:30 +08:00
kate522 f97fd72bd0 refactor(creator-studio): move taxonomy to the settings card, slim the drawer to pay
Classification belongs next to everything else the author decides before
publishing, and the drawer should only configure paid resources.

- PublishSettings now renders categories, tags and custom taxonomy
  dimensions first, then cover, paid content and scheduling. Chips use a
  stacked row layout so long category lists wrap naturally.
- PublishDrawer keeps only PayPanel: taxonomy, save/publish buttons and the
  now-unused props are gone, leaving a single 完成 button.
- New PublishDialog takes over the publish action from the bottom bar, and
  with it the captcha mount point, so the gate still renders somewhere the
  author can see it.
- Promotes .jio-creator-primary / .jio-creator-ghost out of the dialog-only
  rules (drawer and pay panel buttons had no styling), and drops the dead
  .jio-creator-field / .jio-creator-cover blocks.

Contracts updated; 886 widget-system tests pass.
2026-11-09 15:47:02 +08:00
kate522 ac84e991d1 feat(creator-studio): pay toggle and entry in the publish settings card
The card below the writing surface only offered cover and scheduling, so
paid content could only be reached through the bottom bar's 发布 button.

- The card gains a 付费内容 row (rendered only with canPay): a toggle bound
  to draft.pay.enabled, a status line that reflects whether resources were
  added, and a 配置价格与付费资源 link.
- Turning the toggle on opens the publish drawer and scrolls it to the pay
  section, so pricing is the next thing the author sees. Entering from the
  bottom bar keeps the drawer at the top.
2026-11-09 15:31:08 +08:00
kate522 0e4e4670dd feat(creator-studio): full pay settings and paid resources in the publish drawer
The drawer only had a pay toggle and one bare price field, so several
options from the front-submit pay card could not be set at all.

- New PayPanel mirrors the front-submit card: cash / points segment
  (points only when the site has credits enabled), price or points with
  the currency suffix, and VIP prices. VIP fields render only when the
  site asks for manual VIP pricing and the level is enabled, and now
  submit vip1_points / vip2_points as well.
- New ResourceDialog restores "添加资源": download URL with an attachment
  picker, resource note (extraction code), copy name / value, custom
  button label and button style swatches. Pasting a net-disk share link
  splits the URL and the extraction code.
- pay.ts sends every download display field and tags net-disk links.
- CreatorRest exposes vipManual / vip*Enabled / vip names / pointsEnabled
  / downloadClasses / currencySymbol, and the readback carries
  extractCode / copyKey / copyVal / class / attachmentId.
- Fixes an existing data loss: snapshot_from_payload dropped copy_key,
  copy_val, class and attachment_id, so approving a revision erased them.

Files split to stay within budget: publish-drawer 332 lines, pay-panel
343, resource-dialog 254. 886 widget-system tests pass.
2026-11-09 15:24:30 +08:00
kate522 c5bdbc0457 feat(creator-studio): portal dropdowns, hidden content, two-step block delete
Toolbar
- New ToolMenu renders menus through a portal on body, so they are no longer
  clipped by the horizontally scrolling toolbar and no longer fall back to a
  native <select>. Triggers reuse .jio-creator__tool-btn geometry, fixing the
  heading button's mismatched height/size/position.
- Heading / list / align / quote / hidden-content are all dropdowns.
- Lists: unordered + ordered via InsertOrderedList/InsertUnorderedList.
  The TOC button is removed (it also used the wrong icon).
- Adds left / center / right alignment.
- Adds hidden content: comment / login / VIP / paid, wired to the existing
  [reply], [jio_hide mode="login"], [vip] and [payshow] shortcodes.

Editor content
- Quote blocks now match the live article: full .quote_q structure, four
  colour variables, and an SVG-mask quote mark that does not depend on the
  Font Awesome font being present inside the iframe.
- Block math is centred on a transparent background instead of a full-width
  grey bar.
- Code blocks are plain <pre><code>, identical to the article page; language
  and theme selection is gone and EnlighterJS handles highlighting globally.
  The classic submit editor's code modal follows the same shape.
- Hidden content reuses the .tinymce-hide structure and shows a readable label
  while keeping the shortcode text in the DOM for saving.

Block deletion
- Two-step delete, WPS style: the first click only selects and highlights the
  block, the second click removes it. Clicking elsewhere or Esc cancels.

Contracts updated and extended; 884 widget-system tests pass.
2026-11-09 15:03:50 +08:00
kate522andClaude Opus 5 3e48fdf61e fix(creator-studio): hide block-delete overlay inside the editor iframe
块级删除浮层插在 TinyMCE 的 iframe 里,但隐藏规则只写在父页面样式表,
iframe 是独立文档、拿不到这些样式,于是 opacity:0 / position:absolute 全部
失效,✕ 退化成正文顶部的常显元素。

- 把 #jio-block-actions 的定位与隐藏规则移入 content_style,并给 body 加
  position:relative 作为定位基准;隐藏时 pointer-events:none 避免挡住正文
- 浮层加 data-mce-bogus="all",让 TinyMCE 在序列化、字数和选区计算时跳过它,
  否则 ✕ 会被写进保存内容
- 删除 _block-tools.scss 中作用于同一选择器的页面级死样式
- 契约测试锁定「样式必须在 content_style」与 bogus 属性

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-08 22:36:57 +08:00
kate522andClaude Opus 5 1970db0b56 feat(creator-studio): two-row masthead with site logo and user avatar
顶栏改为知乎式两行结构:第一行左侧站点 LOGO、右侧当前用户头像,
第二行只保留正文工具条并居中,同时移除「Jio / 写文章」字样。

- bootstrap payload 新增 site/viewer 身份字段(复用 jio_get_site_logo_url
  与 jio_get_avatar_url,前端不拼 URL、不做权限判断)
- 拆分 draft 类型、TinyMCE 块运行时、顶栏组件,index.tsx 1065 → 735 行
- 清理死代码:未调用的 keepCaretInsideCode、永远无法打开的代码语言弹窗
  (setCodeLanguage 只会收到 null,codeTargetRef 从未赋值)及其样式,
  以及顶栏移除后失效的 bar-left/brand/mode/save-draft/ghost/primary 规则
- 契约测试、本地预览与截图脚本同步到新 DOM

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-08 22:20:10 +08:00
kate522andClaude Opus 5 5f31c58df2 fix(front-submit): let drafts save with partial content
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-07 00:58:13 +08:00
kate522andClaude Opus 5 4a119358ca feat(creator-studio): bottom status bar, editor-rendered math/footnote, code language picker, block delete
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-07 00:38:39 +08:00
kate522andClaude Opus 5 6928127bfa fix(creator-studio): render math/footnote shortcodes, inline code blocks, block deletion
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 23:52:39 +08:00
kate522andClaude Opus 5 7885f42cff feat(creator-studio): dialog-driven table/math/footnote, theme quote, code language picker
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 23:23:59 +08:00
kate522andClaude Opus 5 7c33482be7 feat(creator-studio): icon toolbar with block tools, drop author strip
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 22:30:08 +08:00
kate522andClaude Opus 5 7bdf7cf018 feat(creator-studio): centered paper layout and scheduled publishing
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 21:33:40 +08:00
kate522andClaude Opus 5 384d2b7aa0 feat(creator-studio): switch writing editor to TinyMCE
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 20:51:18 +08:00
kate522andClaude Opus 5 4868de2cda fix(creator-studio): 加载正文编辑格式工具栏
选中文字时的 RichText 加粗、斜体、链接等工具由 WordPress format-library 注册。
BlockTools 虽然提供 inline toolbar slot,但此前前台没有加载 wp-format-library,
因此正文选区没有格式工具。为 Creator Studio 前台显式加载该 script/style handle,
并将行内格式工具栏统一为深色圆角悬浮样式。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 17:59:17 +08:00
kate522andClaude Opus 5 9e8913ea0a fix(creator-studio): 固定公众号式创作工具栏
- 顶部改为 fixed 创作工具栏:左侧返回/品牌/模式,中间文章标题与保存状态,
  右侧撤销/重做、保存草稿、预览、发布
- 新增工作台级撤销/重做快照栈,连续编辑合并记录;支持 Ctrl/Cmd+Z / Shift+Z,
  不覆盖 RichText 输入框自身的编辑历史
- 移动端收敛工具栏布局,保留撤销/重做、预览、发布
- 先保存草稿再请求审核/直接发布;请求使用服务端更新后的文章与版本 ID
- 固定工具栏以独立 chrome 层布局,正文避开顶部工具栏高度
- 补充固定工具栏、历史操作与键盘快捷键契约

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 17:36:15 +08:00
kate522andClaude Opus 5 f5e9420266 feat(creator-studio): 图片宽度四档与作者行
- 通过 editor.BlockEdit 过滤器给 core/image 增加「半屏 / 中等 / 通栏 / 全宽」
  四档宽度,选中图片时出现在区块工具条;宽度写入 className 并序列化到
  post_content,前台样式即可生效,无需自定义区块或额外元数据
- 前台样式:半屏靠左 50%,中等 72%,通栏跟随正文行宽,全宽突破行宽但受容器
  内边距约束;移动端半屏与全宽回退为整行,避免横向滚动
- 新增作者行(头像 + 昵称 + 身份说明),数据由 CreatorRest::author_payload()
  从服务端给出,前端不自行拼装;无昵称时整行不渲染,头像缺失时回退首字占位
- 作者行放在摘要之后、正文之前

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 16:05:19 +08:00
kate522andClaude Opus 5 79909f449e feat(creator-studio): 公众号式插入面板与封面条
- 新增常驻「添加内容」按钮与插入面板:分组网格列出正文/标题/列表/引用、
  图片/视频/嵌入、代码/分隔线/表格/付费内容;条目不满足能力时不出现在面板里
- 面板支持方向键在网格内移动焦点、Esc 关闭;桌面居中浮层,移动端贴底抽屉并
  留出安全区
- 空文档插入区块时替换初始空白段落,不留空行
- 新增封面条:无封面时给低调入口,有封面时显示 2.35:1 缩略图,悬停出现
  「更换封面」,右上角可移除
- 补充契约测试:头部/页脚/挂件区开关、插入面板真实区块名与能力过滤、
  中文字数口径

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 15:57:44 +08:00
kate522andClaude Opus 5 d07cffe99e fix(creator-studio): 沉浸式布局与公众号式写作体验
首轮实机体验暴露的问题:

- 投稿页仍在渲染主题头部的 all_top_fluid 挂件区、页脚与浮动入口,
  与工作台顶栏重复。header.php / footer.php 新增 jio_render_header、
  jio_render_footer、jio_render_fluid_widgets 过滤器,工作台模式下全部关闭
- 区块 Inspector 被写在 BlockList 之后,作为正文流的一部分渲染出
  一个巨大的「未选择区块」白框;移除内联 Inspector(区块设置改由
  行内工具栏的区块菜单提供)
- 中文正文被 wordcount 的 'words' 口径算成「字数:1」;改用
  characters_excluding_spaces,与前台 TinyMCE 字数一致
- 行宽 820px、标题 34px 偏松散;收窄到 720px / 27px,正文 16px/1.85,
  段落间距与选区描边收敛,行内工具栏改为深色圆角悬浮条

新增本地视觉验收脚本(不参与运行时):
- scripts/preview.cjs:用模拟 bootstrap 生成离线预览页
- scripts/shoot.cjs:桌面/移动端截图与控制台错误采集

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 15:49:57 +08:00
kate522andClaude Opus 5 2c7262770b fix(creator-studio): 修复白屏与前台 REST 鉴权
白屏根因:CreatorRest / SubmissionVersion 位于 Jio\Core 命名空间,
但调用 Jio\Content\PrivateAssets 时缺少 use 导入,PHP 就近解析为不存在的
Jio\Core\PrivateAssets,在 wp_head 中抛致命错误导致页面输出截断。

- 为 CreatorRest、SubmissionVersion 补上 use Jio\Content\PrivateAssets
- 新增前台 api-fetch nonce 中间件:WordPress 只在后台注入 wpApiSettings,
  前台工作台里 Gutenberg core-data 请求(/wp/v2/users/me)因此全部 403
- 提交前先落一次草稿,避免自动保存未触发时发布到旧内容
- 新增 tools/check-class-refs.php:静态检测命名空间内未导入的裸类引用
- 新增 assets/creator-studio/scripts/smoke.cjs:浏览器冒烟脚本,
  抓控制台错误、失败请求与未捕获的 Promise 拒绝

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 15:39:10 +08:00
kate522andClaude Opus 5 fac4a714e0 feat(creator-studio): 前台 Gutenberg 创作工作台与受保护付费附件
前台投稿页改为沉浸式创作工作台:Gutenberg 负责区块解析与序列化,
React + TypeScript 负责工作台外壳与发布抽屉,Jio 服务端继续作为权限、
审核与付费的唯一权威。

- 新增 assets/creator-studio 独立构建(wp-scripts,锁定 WP 6.4 时代包),
  仅在投稿模板加载,构建缺失或游客访问时回退原有 TinyMCE 表单
- 自动保存(4s 防抖 + rev 冲突 409)、本地快照恢复、发布配置抽屉、
  移动端全屏单列与安全区适配
- 图片插入走现有 front-submit 上传管线,保留能力校验与待认领生命周期
- 已发布文章的改稿写入私有版本,审核通过前线上内容/链接/付费条款不变;
  原生后台「改稿审核」一次性应用或退回,并校验源文章并发指纹
- 私有附件新表 jio_private_asset + jio_dl_token.asset_id,schema 升到 3.4.0;
  文件存放 ABSPATH 之外,未配置私有存储时 fail closed
- 下载令牌绑定文章/附件/用户/IP/UA/次数,每次交付复核 Visibility 的
  订单、VIP 与配额判定;中断传输归还次数
- 付费字段改为写入前校验,非法价格不再留下半保存文章
- 新增 creator-studio 契约测试;更新受影响的 schema/下载/投稿契约

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 14:53:23 +08:00
kate522andClaude Opus 5 7a8279f8e7 fix(layout): pass term object to archive settings
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-06 00:00:17 +08:00
kate522andClaude Opus 5 fbb53c6890 feat(categories): align archive and directory pages
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 23:51:33 +08:00
kate522andClaude Opus 5 7faa2d53d8 fix(admin): improve native link manager filters
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 22:19:50 +08:00
kate522andClaude Opus 5 b124795d84 fix(links): use plus icon for logo upload placeholder
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 21:41:09 +08:00
kate522andClaude Opus 5 f53cdd4dc8 feat(links): align the friends page layout and submit UI
- assemble the friends template with page header, search cover, content position, widget zones and comments
- render the three page title styles and the tabbed search cover
- restore card, category nav and submit modal markup for the friends page
- add page content style support to the page editor
- port the linked card, category nav and submit modal styles to the mobile and desktop breakpoints

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 21:09:40 +08:00
kate522andClaude Opus 5 4c562428b4 feat(links): move friend links to native WordPress links with review flow
- enable the native Links manager and drop the custom friend-link option/REST path
- add per-page link settings for the friends template
- render link categories from get_bookmarks() with search and page-content options
- add a validated public link submission endpoint with logo upload, captcha, rate limiting and duplicate checks
- create pending links for review and notify administrators by email and in-app message
- add native Links admin pending count, columns and edit notes
- cover the new submission and cleanup contracts

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 19:54:33 +08:00
kate522andClaude Opus 5 ef7b5939ba chore(assets): refresh the site logo
Same 2172x724 artwork, re-exported at 29,609 bytes (down from 41,469).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 18:30:11 +08:00
kate522andClaude Opus 5 6bcfbfb252 feat(branding): default both site logos to assets/img/logo.png
- Point 站点 Logo / 暗色模式 Logo schema defaults (PHP + VUE) and the
  Settings::logo_url() fallback at assets/img/logo.png.
- Point the footer night image default at the same file.
- Remove logo_dark.png and the now-unreferenced assets/icons/default-logo.svg
  along with the private default_asset_url() helper that was its only reader.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 18:02:51 +08:00
kate522andClaude Opus 5 1dfcc38a83 chore(assets): ship the new site logo
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 17:59:19 +08:00
kate522andClaude Opus 5 8e74b60570 fix(navigation): let CSS size the nav logo and drop the inline width cap
The navbar logo carried an inline `height:36px;width:auto;max-width:{logo_width}px`
while `.navbar-logo > img` already owns `height:36px;padding:0 30px`. Under
`box-sizing:border-box` that max-width capped the border box, so the 60px of
horizontal padding stayed inside it and wide logos were squeezed against a
fixed height, breaking the intrinsic aspect ratio.

- Render the nav logo with no inline sizing; CSS alone sizes it.
- Add a `$lazy` argument to jio_get_adaptive_theme_img() so the navbar can emit
  the real src up front instead of a square lazyload placeholder; defaults to
  'auto' so every other caller keeps the lazy_other behaviour.
- Remove the superseded logo_width plumbing: the setting (PHP + VUE schemas),
  Settings::logo_width(), jio_get_site_logo_width(), the --jio-logo-width token
  and the unused has_logo context key.
- Cover the contract in the header reference test.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 17:50:56 +08:00
kate522andClaude Opus 5 3ce5bfc20c feat(branding): default the site icons to assets/img/favicon.png
- Point the 浏览器图标 / 移动端图标 schema defaults (PHP + VUE) at
  assets/img/favicon.png instead of an empty media field.
- Fall back to the same PNG in Settings::favicon_url() when no custom
  favicon and no native site_icon are configured.
- Add Settings::mobile_icon_url() and emit apple-touch-icon from SEOHead;
  the 移动端图标 field previously had no consumer and never reached the page.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 17:00:50 +08:00
kate522andClaude Opus 5 b56b9bbe37 fix(navigation): restore the reference 8px radius and unclip the mega menu
Traced against the running site (docker theme at AKSRT-theme) with real
computed styles:

- theme_main_radius defaulted to 12, so --main-radius was 12px and every
  dropdown panel, card and button was rounder than the reference, which
  sets 8px. Default is now 8 in the runtime reader and both schemas.
- The public bundle loads after main.min.css. Its bare img rule replaced
  the inline image baseline the menu relies on, and html{overflow-x} made
  the root a clipping context that crops the fixed senior mega menu.
  Reset is now scoped to content; the horizontal-overflow guard is on body.
- The senior mega menu renders a .container inside the dropdown where the
  reference keeps Bootstrap's 15px gutter; the padding-free site-shell
  .container rule stripped it, running the card/link grid to the edges.

Rebuilt public.css / public.min.css and the admin SPA.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 12:33:10 +08:00
kate522andClaude Opus 5 ed38dec314 fix(navigation): stop the public reset from overriding the reference menu styles
The public bundle loads after main.min.css, and its bare-element rules
won on equal specificity:

- img { display: block; height: auto } replaced the inline image baseline
  the menu relies on (Bootstrap img{vertical-align:middle} + main.css
  img{max-height:100%}). Menu glyphs and graphic-card thumbnails were
  pulled out of the inline flow, breaking row height and baseline.
  Scoped the reset to content and restored the inline baseline inside
  .header / .mobile-header.
- html { overflow-x: clip/hidden } made the root a clipping context,
  which crops the position:fixed senior mega menu and its drop panels.
  The horizontal-overflow guard now lives on body only.

Rebuilt public.css / public.min.css.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 12:04:31 +08:00
kate522andClaude Opus 5 3595935475 refactor(moderation): remove the Akismet backend and its admin fields
The comment moderation pipeline no longer calls Akismet. Removed:
- check_akismet() and the Akismet step in Moderation::process().
- akismet_* config keys from Moderation defaults and ExtensionRuntime.
- akismet decision state, the jio_moderation_akismet / akismet_result
  comment meta writes, and the legacy-meta fallbacks in the comments column.
- The Akismet fieldset in both the PHP and Vue permissions schemas.

Rate limit, GeoIP, blocked keywords and AI moderation are unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 11:27:24 +08:00
kate522andClaude Opus 5 e6d9ff49a2 fix(navigation): align mega-menu rendering and menu-item backend with the reference
Renderer:
- Graphic-card images carry fit-cover so they crop into the fixed card box
  instead of stretching it and pushing the title out of alignment.
- Mega-menu link icons use fa-fw (fixed glyph column) instead of the
  undefined menu-item-icon class, so link titles line up.

Backend:
- Restore show_policy (login / vip / vip_2 / auth) on menu items; the field
  was missing entirely, so items could not be gated by identity.
- Default submenu_type to graphic_card, badge_class to jb-red, arrangement
  to swiper, size to md.
- Clamp img_scale to 20-300 to match the reference's spinner bounds.
- Drop the now-meaningless "none" submenu_type option: the senior-submenu
  switch is itself the on/off control.
- Admin JS gains the align control (left/center/space-around).

Cleanup:
- Remove the unused header_actions nav menu location.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-05 10:51:36 +08:00
kate522 55423403a6 fix qcode default 2026-11-04 21:27:05 +08:00
kate522 8c4aabb9a4 fix(withdrawal): wire the channel hint to the actual withdrawal modal
The previous commit put the channel-switching code in the wrong init block.
credits.js initializes two modals side by side — the points recharge dialog and
the withdrawal dialog — and the snippet landed in the recharge one, which has
no [data-jio-withdraw-method] element at all. Both symptoms followed from that:
methodField resolved to null so no change listener was ever bound, and the
initial sync never ran, leaving the note paragraph permanently hidden.

The block now lives inside initWithdraw(), and the stray copy is gone. The
behaviour itself was already correct — switching channels swaps the account
placeholder and shows or hides the channel note — it just never executed.

Verified in a headless browser against the real markup and stylesheet: the
placeholder starts as the first channel's hint and the note is hidden; switching
to the second channel swaps the placeholder and reveals the note as
display:block; switching back hides it again as display:none.

The contract test previously only checked that the code existed, which is why
it missed a placement bug that made the whole block dead. It now asserts
syncChannelHint appears exactly once, sits after initWithdraw(), and does not
run past the next function definition. 873 tests pass.
2026-11-04 19:37:56 +08:00
kate522 dcd306b428 feat(withdrawal): make payout channels a configurable sortable list
The payout channel was a two-item checkbox (alipay / wechat). Sites that pay
out through a bank transfer, USDT or any other route had no way to express it,
and every surface behind it — the withdrawal modal, the server-side check, the
admin review list — hard-coded those two names.

affiliate_payout_channels is now a repeater on both the PHP and Vue schemas,
using the same draggable component as the post filters and gateway config. Each
row carries a stable key, a display label, an account placeholder, an optional
note and an enabled flag. Disabled channels disappear from the front end but
stay resolvable, so historical withdrawal records still render their original
name.

PaymentRuntime::payout_channels() normalises the stored structure: it drops rows
with an empty key or label, de-duplicates keys, and falls back to the built-in
two channels when nothing is configured. enabled_payout_channels() feeds the
front end and payout_channel() resolves a single key for record display.
CommissionLedger's validation now compares against the configured, enabled keys
instead of a literal allowlist.

The withdrawal modal renders the configured list and swaps the account
placeholder and note when the channel changes; credits.js drives that. The
admin review page reads the same settings for its method labels and filter, and
the review dialog gained a "渠道说明" row so the operator sees the payout
instruction, hidden when empty.

Default channels live in SchemaPayment as plain data — the runtime imports them
rather than the reverse, because the schema layer must not depend on a runtime
settings class (doing it the other way made the schema harness fatal).

Verification: drove payout_channels() through default / custom / dirty / duplicate
inputs and confirmed enabled filtering, note lookup and disabled-channel
resolution. Added payment-withdrawal-channels-contract.test.cjs covering the
schema shape, runtime helpers, front-end wiring and admin read path. 873 tests
pass, PSR-4 audit clean, admin SPA builds.
2026-11-04 19:16:39 +08:00
kate522 bcba0f598a fix(admin): stop the browser autofilling credentials into the settings search box
A settings screen renders twenty-odd AppSecret and private-key fields as
type="password". Chrome reads any page carrying a password input as a login
form and fills the saved username and password into the first text box it
finds — the settings search field at the top of the panel.

Suppressing autocomplete on that one input could not fix it, because the
trigger is the password inputs elsewhere on the page. Secret fields now render
as text with CSS masking (-webkit-text-security: disc), so they still look
like ciphertext but no longer register as password inputs; the mask lifts on
focus so a freshly typed value can be checked. That covers the 21 schema-driven
fields through JioField plus the four captcha provider forms and the WeChat
template page.

The search box keeps a second layer of defence: a descriptive name and
autocomplete/autocorrect/spellcheck disabled, with the LastPass and 1Password
ignore markers set.

Verification: vite build succeeds and the emitted bundles no longer contain a
single type="password"; 980 admin/widget tests pass.

Note: assets/admin/build/ is gitignored, so the production build must be run on
deploy. -webkit-text-security is WebKit/Blink only — Firefox falls back to
plain text.
2026-11-04 18:53:44 +08:00
kate522 b1c3d86e44 refactor(oauth): drop the hand-written providers and keep only what the SDK ships
The previous commit added five direct clients (Douyin, Microsoft, Facebook,
Twitter, Apple) written against each platform's own endpoints. Maintaining
five bespoke OAuth implementations — including Apple's ES256 client secret and
Twitter's PKCE — is maintenance the bundled yurunsoft SDK does not ask for,
and none of them could be verified without production credentials.

Only providers yurunsoft/yurun-oauth-login actually implements stay on the
direct surface: GitHub, Gitee, QQ, Google, Weibo, Weixin, Baidu and Alipay.
Baidu and Alipay move into OAuthProviderBroker's existing client() switch and
normalize() map rather than living in a separate class, so there is no new
layer to reason about.

OAuthProviderClient, its harness and its contract test are deleted outright
(-809 lines). The Apple form_post handling added to handle_callback() is
reverted too — without Apple there is no POST callback to read.

The aggregate-login channel keeps its 16 platforms, matching the reference;
that list describes what the aggregation provider offers, not a local
implementation. Brand icons for those names stay for the same reason.

Verification: 869 widget/navigation tests pass, the PSR-4 audit reports 0
errors, and the catalog constant, PHP schema and Vue schema now list the same
16 aggregate platforms.
2026-11-04 18:33:37 +08:00
kate522 6db34646ed feat(oauth): add the seven missing providers and open the full aggregate list
The theme shipped six direct providers while the reference carries fourteen,
and its aggregate-login channel offered three of sixteen platforms.

OAuthProviderClient now owns the providers the bundled SDK does not cover.
Douyin, Microsoft, Facebook, Twitter and Apple talk to their documented OAuth2
endpoints directly; Baidu and Alipay reuse yurunsoft, which already ships both
(Alipay needs its application private key, so provider_config learned an
extra_keys map to surface it). The broker dispatches through handles(), so the
existing start/callback routes stay provider-agnostic.

Three provider quirks needed handling rather than a plain copy:

Apple returns the callback as response_mode=form_post, and handle_callback
only read $_GET, so it now reads $_POST when the request is a POST — otherwise
every Apple login would fail with code_missing. Its client secret is built as
an ES256 JWT from Team ID / Key ID / .p8 rather than a static string.

Twitter requires PKCE. The verifier is derived from the state token, so it
travels with the existing transaction row and needs no extra storage.

Facebook hands back protocol-less avatar URLs, which are upgraded to https the
same way the OAuth avatar resolver does.

Settings gained matching toggles and credential groups on both sides — the PHP
schema and the Vue schema — and the aggregate platform list went from three to
sixteen, with CLoginClient's hard-coded allowlist replaced by the catalog
constant. Brand icons were extended so each new provider resolves to its
sprite; facebook and twitter moved to their colour sprites, and the
`twitter -> x` alias was dropped since it bypassed the new mapping.

The oauth-security contract previously asserted that Baidu and Alipay must not
appear on the OAuth surface. That was the old intent, so the assertion is
replaced with a positive one, keeping the separate check that the Alipay
payment gateway still exists.

Verification: a new harness stubs the HTTP layer and drives all five custom
clients — authorization URLs carry redirect/state (Twitter also a PKCE
challenge), identities normalize to the shared shape, Facebook's avatar is
upgraded to https, Apple's private-relay email survives, and an error payload
throws instead of yielding an empty identity. 871 widget/navigation tests pass
and the PSR-4 audit reports 0 errors.

Not covered: no live handshake happened — every provider needs real AppID and
secret pairs, and Apple/Douyin require developer-account review before the
full round trip can be exercised.
2026-11-04 18:00:29 +08:00
kate522 6f29e3d865 fix(oauth): actually use the third-party avatar and seed it only once
The OAuth flow wrote the provider avatar to `jio_oauth_avatar`, but nothing
ever read it — every user who signed up through GitHub/QQ saw a Gravatar hash
or the default avatar instead of their own picture. The reference seeds its
`custom_avatar` from the OAuth profile and its resolver reads it back, so both
halves were missing here.

jio_get_custom_avatar_url() now falls back to the stored OAuth avatar when no
uploaded one exists, which puts the chain at uploaded → third-party → external
service → default. The theme already swaps WordPress's get_avatar_data, so one
change covers every avatar surface.

Writes go through a single seed_avatar() guard: it no-ops when an uploaded
avatar or an existing OAuth avatar is present, matching the reference's
`if ($args['avatar'] && !$custom_avatar)`. Previously both the bind path and
the login refresh overwrote the meta unconditionally, which would have wiped a
user's own picture on their next social login.

Because the OAuth avatar now shows through once the upload is gone, both
"restore default" flows (the REST endpoint and the admin profile box) delete
it too; the admin checkbox also appears when only an OAuth avatar is set,
since $avatar_url is now non-empty in that case.

Baidu serves avatars from tb.himg.baidu.com, which 403s — rewritten to
himg.bdimg.com the way the reference does. On top of that the URL is upgraded
to https when the site runs over SSL, because the reference's scheme-relative
form still yields a plain http:// when copied verbatim, and browsers block it
as mixed content.

WeChatShare was reading `custom_avatar` — a reference-theme key this codebase
never writes — so its author branch always fell through to get_avatar_url();
it now uses the shared resolver like every other surface.

Verification: drove the resolver through five states with a stub (none /
OAuth only / both / upload only / Baidu legacy host) and confirmed the
expected URL each time. Added oauth-avatar-contract.test.cjs to pin the
resolution order, the seed guard, and the reset cleanup. 868 widget and
navigation tests pass; the PSR-4 path audit reports 0 errors.
2026-11-04 17:41:48 +08:00
kate522 7d78a33a9d fix(user-center): match the reference meta pills on the profile header card
The username and e-mail entries under the profile header rendered as plain
grey text on a solid icon. The reference makes each one a bordered pill that
copies its own value on click, drawn with the outline glyphs.

Both entries now carry `.but` plus `data-clipboard-tag` / `data-clipboard-text`
so the existing frontend clipboard runtime (assets/js/runtime/libs/clipboard.js)
picks them up and toasts "用户名已复制". Icons move from `fas` to `far`, which
is the FA5 equivalent of the reference's `fa-user-o` / `fa-envelope-o`.

Geometry follows `.author-header .user-identity > .but/.badg` exactly:
padding 2px 6px, margin 5px 6px 0 0, 12px type, 1.4 line height, and the meta
row gets the reference's 520px max width. medal.css already carried its own
approximation of this pill (2px 8px 2px 0, .3em .6em, 1.44) for the medal
entry; it now uses the same numbers so the two entries line up. The base rule
lives in layout.css rather than medal.css because the medal module is only
enqueued when badges are enabled, and the header must keep its shape either
way.

Verification: rendered the real header through a PHP stub and measured the
computed styles in the browser — padding 2px 6px, margin 5px 6px 0 0, 12px /
16.8px, 23px tall, both entries carrying the right clipboard payload. Added
user-center-header-meta-contract.test.cjs to pin the markup and geometry;
864 widget/navigation tests pass.
2026-11-04 17:27:51 +08:00
kate522 6d01e7489a fix(user-center): use the reference trend sprite for experience task rows
Each experience task row closed with a solid `fa-bolt` glyph. The reference
marks the same slot with the colour `trend-color` sprite followed by "+ N",
and uses that sprite for the 成长体系 heading as well, so the level page also
carried a stray `fa-chart-line` there.

The sprite already ships in the theme (`jiosvg-trend-color`); its path data is
byte-identical to the reference sheet. Both slots now render it, sized to
match the reference (`icon mr6 em09` for the rows, `icon mr6 em12` for the
heading). The "动态" rows keep their wording without a "+", which is how they
read before.

The check-in experience badges in src/Credits/Signin.php stay on
`fa-line-chart` — the reference uses the same monochrome glyph there.

Verification: rendered the real level page through a PHP stub — all ten task
rows emit `#icon-trend-color`, the only Font Awesome glyph left is the
"每日详情" arrow, matching the reference. Screenshotted against the real
stylesheet. A contract test pins both sprite usages and rejects a regression
to `fa-bolt` / `fa-chart-line`; 862 widget/navigation tests pass.
2026-11-04 17:17:49 +08:00
kate522 09b1e535e4 fix(user-center): use the reference colour sprites on the balance and points cards
Both asset cards opened with the same solid `fa-money-bill` glyph, so the
wallet and the points card showed an identical icon and neither matched the
reference, which pairs a blue wallet mark with the balance card and an orange
coin mark with the points card.

The theme already ships both sprites — the header wallet popover and the user
center sidebar resolve to `jiosvg-money-color-2` and `jiosvg-points-color`
through the same helper. Only these two cards were still on Font Awesome.
Swapping them keeps one icon family across the user center; the existing
`em12 mr6` sizing carries over unchanged because `svg` is 1em tall.

The wallet/points icon contract test now pins both keys and fails if either
card falls back to `fa-money-bill` or `fa-coins`.

Verification: rendered both cards through a PHP stub and screenshotted them
against the real theme stylesheet — the blue wallet and orange coin render at
the same optical size as the labels. 861 widget/navigation tests pass.
2026-11-04 17:08:09 +08:00
kate522 00ae62f62b fix(auth): close the modal regressions and keep the header component off /sign/
Three defects slipped into the sign-card rebuild:

The hidden-glyph rule was dropped. `.fa` sets display:inline-block, which
outranks the UA [hidden] rule, so every hidden glyph stayed visible — most
visibly a spinner rendered beside the login button at rest. `.sign [hidden]`
restores the override.

Closing account login produced an empty shell. The whole sign-in pane was
gated on `!$close_signin`, and the social block carried the same gate, so a
site with account login off but registration on still opened on an empty
panel with no social entry. The pane is now rendered in three shapes: open
registration falls through to the signup tab, a QR entry falls through to
the QR tab, social-only renders a notice plus the social bar, and when
nothing is available it states that login is closed.

The modal close button sat in normal flow and pushed the card content down;
`#u_sign .sign > .close` pins it back to the top-right corner.

The /sign/ route is `index.php?jio_sign=1`, so WordPress reports it as home.
The header multifunction component resolves page type by query flags and the
home branch won, so the component appeared on the auth page whenever "首页"
was in its scope — even though the sign page template itself was already
excluded. `jio_header_slide_current_page_type()` now bails out on `jio_sign`
before any of the is_* checks.

The breakpoint overrides that were fighting the shared sheet between 641px
and 991px are narrowed to the one offset that actually needed adjusting.

Verification: the modal was rendered through a PHP stub, served with the real
theme stylesheets, and driven by the real auth.js in a headless browser —
tab switching, signin-mode switching, password reveal, close button and
geometry at 1440/1100/900/760/500/390px. The header harness gained a
`jio_sign` case asserting no markup, and 860 widget/navigation tests pass.
2026-11-04 16:51:41 +08:00
kate522 41366e7fc4 feat(auth): rebuild the sign-in surfaces on the shared sign-card contract
The login/register page and the auth modal had drifted into a parallel
system: floating-input fields, a sign-page-card shell and a bespoke
jio-auth-modal wrapper that none of the theme's own sign CSS targeted.
The reference card rules (.sign, .sign-img, .sign-content, .line-form-input,
.scale-placeholder, .social_loginbar, .title-h-left, #u_sign .modal-dialog,
.qrcode-signin-container) have been in main.css all along, so the fix is to
render the reference DOM instead of re-styling a second one.

auth-content.php now emits one .sign.jio-panel.blur-bg.relative card with a
.tab-content of #tab-sign-in / #tab-sign-up / #tab-resetpassword /
#tab-qrcode-signin / #tab-bind panes. Each pane opens with a
.title-h-left.fa-2x heading plus a .muted-color.px12 link, fields are
.relative.line-form.mb10 > .line-form-input + .scale-placeholder +
.line-form-line, the verification trigger is the .yztx.abs-right captchsubmit
button, and submits are .but.radius.jb-blue|jb-green.padding-lg.btn-block.
Social entries come from the shared render_social_buttons() separator +
.social_loginbar, and the OAuth bind pane uses the oauth-data-box avatar card.

The modal shell is #u_sign.modal > .modal-dialog > .sign-content >
.sign-img.absolute.hide-sm + .sign, and the page shell is the reference
.container.sign-page > .row.sign-row.gutters-5 > .col-md-6(.col-md-offset-6/
.col-md-offset-3).sign-col with a .fixed.lazyload background and a blurred
fixed footer. auth.js drives .in instead of .is-open, toggles the new
password/signin-mode/invite-gate controls and no longer touches the retired
markup. The page also drops two footer-hook removals that targeted functions
which no longer exist, and opts out of the fixed-nav offset.

The sign page's custom theme setting now actually applies: Router answers
jio_forced_theme_mode, jioData.themeForced wins over the stored cookie in
theme.js, theme-toggle positions are suppressed, and the page marks html/body
dark or white accordingly.

sign.css shrinks from ~114 lines of bespoke component styling to a thin
positioning layer, and the retired classes are gone rather than kept.

Verification: php -l on every changed PHP file, node --check on both JS files,
node --test across widget-system, navigation and front-submit (873 passing),
and tools/audit-psr4-paths.php / audit-admin-contracts.php both at 0 errors.
assets/js/runtime/main.min.js was rebuilt because theme.js gained the forced
theme branch.
2026-11-04 16:04:24 +08:00
kate522andClaude Fable 5 d40906b4a3 feat(single): align author bar follow and reward actions with the site flows
- guests get the sign-in trigger instead of a redirect to the login page,
  for both follow and wallet reward controls
- follow requests swap the label for an inline loader and block a second
  submit; the followed state uses the .actived hook
- follower counts sync through data-follow-count on the user homepage
  (the previous selector matched nothing) and only for the viewed profile
- reward button uses the secondary action colour; the reward template is
  only rendered for signed-in visitors
- drop the unused author-hero aria-disabled rule and stale wording in the
  touched comments

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-04 13:34:34 +08:00
kate522 8ad5ef9aff fix(single): align article code blocks with the reference theme
The article body ran two highlighting pipelines at once: the runtime
EnlighterJS pass (same one the comment area uses) plus a bespoke
precode.js enhancer, and a hand-rolled .code-block skin. The two
disagreed, so rendered blocks carried a dark #282c34 card with 15px
padding, 14px text, a border and a second copy button stacked on top of
the EnlighterJS toolbar.

Drop the parallel path and let one pipeline own code blocks:
- delete precode.js, single-post/code-blocks.css and the unused
  assets/js/enlighter copy that only precode.js referenced
- drop the now-dead has_code requirement (PHP scan + feature enqueue)
- render pre exactly as the reference does: bootstrap's pre box
  (9.5px padding / 13px / radius 4) plus main.css's muted background,
  with the EnlighterJS theme supplying the skin

Also scope the inline-code skin to :not(pre code) so it stops painting
the block background pink, and remap the toolbar copy glyph: \f0ea is
the clipboard in FA4 but "paste" in FA5; the clipboard is \f328.

Verified against the reference at 1440px both themes: pre 13px/18.57,
9.5px padding, radius 4, muted background; EnlighterJS block heights
151.31 / 60.38 match exactly.
2026-11-03 23:31:28 +08:00
kate522andClaude Opus 5 ba32e0ef9c fix(nav): match the theme toggle icon size and baseline to its neighbours
Measured in the live header: the toggle's glyph was 15.25px tall centred at
y=31.5, while the account and search icons are 14px tall centred at y=34.09.
Two causes stack up:

- `.toggle-radius` is a fixed 29x29 circle with no font-size, so the sun/moon
  pseudo-elements inherit `.navbar-top`'s 15px. The sibling `.jio-nav-icon`
  buttons pin 14px, so the toggle glyph renders a size larger.
- The toggle sits alone in a 29px `.navbar-form`, while the account cluster is
  34px (6px padding + 20px line box + 6px). Both clusters are top-aligned, so
  their centres differ by 2.5px.

Pin the toggle's glyph to 14px and give its cluster the same 34px flex line as
its neighbours. Scoped to `.navbar-top`, so the mobile drawer and the floating
rail (which also carry .toggle-theme) keep their own geometry.

Verified via headless Edge + CDP on https://localhost: glyph now 14px, centre
delta 0.09px (was 2.5px); pixel measurement shows the sun at 14.0px against
14.0px for the search icon.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-03 21:36:56 +08:00
kate522andClaude Opus 5 02246c7ec8 fix(nav): render the theme toggle with the outline sun/moon face
The top-bar theme switch looked heavier and larger than the icons beside it.
An earlier commit dropped the `far` modifier from fa-toggle-theme, which moved
the glyphs to the Solid face. The reference's glyphs are the outline variants
(FA4's sun-o / moon-o), and in FA5 those live in the Regular face — so the
Solid replacement reads bolder and visually bigger at the same 1em size, while
the neighbouring account icons stay on the lighter Regular-style SVG set.

Restore `fa far fa-toggle-theme` on all three placements: desktop navbar,
mobile header, and the floating rail. The .fa-toggle-theme::before/::after
composite rules only handle positioning and the slide transition, so they are
unaffected by the face swap.

legacy-navigation-contract already asserts `fa far fa-toggle-theme` and passes
again; full suite 999/1000 with the pre-existing frontend-lifecycle failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-03 19:58:54 +08:00
kate522andClaude Opus 5 6c3c0f7c6d refactor(admin): fold code highlight and system notice into 常用功能
The 代码高亮 and 系统公告 schemas existed but appeared in no menu, so their
routes were never generated (routes come from the sidebar constants). The
reference keeps both inside the 常用功能 panel rather than as their own
entries, so follow that structure instead of adding sidebar items.

- global/common now carries three groups after the lazy-load ones:
  代码高亮 (switch / line numbers / buttons / max height / light+dark theme)
  and 弹窗通知 (policy, content, 4 buttons, size, radius, icon, expiry)
- group keys are uniquified (code-highlight, code-theme, notice-*) so they do
  not collide with the existing performance group
- delete the orphan code-highlight.js / system-notice.js schemas and their
  section entries on both the Vue and PHP sides
- delete post-list/pay.js and its PHP counterpart: every post_pay_* and
  post_download_* key there had zero runtime consumers, and the reference has
  no such page (paid-content config lives under 支付&付费)

tools/health and tools/import-export turned out to already be reachable as
custom pages, and remain untouched.

Tests: admin contract audit 0 errors (warnings 56 → 51); SPA builds clean;
suite 967/968 with the pre-existing frontend-lifecycle failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-03 17:50:32 +08:00
kate522andClaude Opus 5 451b04160b fix(comments): restore syntax highlighting for comment code blocks
Comment [code] blocks rendered as bare <pre><code> with only Bootstrap's
grey box — no syntax colours, unlike the reference.

The runtime gates EnlighterJS on `_win.highlight_kg`, which was hardcoded to
false. With that false the selector degrades to `pre code.gl, pre code.special`,
and comment code carries neither class, so it never highlighted. The admin
already exposes 「全局功能 → 代码高亮」 (default on), and jioData.codeHighlight
reads it — only the runtime payload disagreed.

- _win.highlight_kg / highlight_hh / highlight_zt (plus white/dark theme
  names) now come from Settings::get_code_highlight_config(); the initial
  theme follows cookie → mode → time-auto via initial_theme_mode()
- define those values before the _win localize (it sits above jioData in the
  same method)
- inject the reference's two head rules the runtime path was missing:
  max-height from `highlight_maxheight`, and
  `.enlighter-toolbar{display:none}` when `highlight_btn` is off

Tests: comment-image-upload contract gains cases pinning the settings-backed
booleans (and their definition order) and the two inline CSS rules; suite
837/838 with the pre-existing frontend-lifecycle failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-03 17:31:42 +08:00
kate522andClaude Opus 5 0007e78bfe fix(comments): render image upload progress like the reference
While uploading, the confirm button turned into a thin 3px bar below the
label instead of the reference's striped overlay that fills the button.

Two causes:
- the markup used <span class="progress">; Bootstrap sizes the bar with a
  block-level .progress, so the swap produced a flattened line
- shell.css carried a bespoke override pinning .progress to
  `position: static; height: 3px`, discarding the absolute full-size
  overlay that main.css already provides

Changes:
- emit the reference skeleton: <div class="progress progress-striped active">
  > <div class="progress-bar progress-bar-success">, so the striped bar
  spans the button and the gradient shows through the translucent layer
- give the upload button `position: relative` so the overlay is contained by
  the button rather than the dropdown panel; delete the static-line override
- restore the reference's "正在处理请稍等..." toast and switch the label to
  "处理中 ..." at 100%, both keyed to the shared `miniupload_ajax` toast id
  so the completion message replaces the loading one
- notify() now forwards the toast id instead of dropping it

Tests: comment-image-upload contract gains two cases pinning the div-based
striped overlay and the deletion of the 3px override; suite 835/836 with the
pre-existing frontend-lifecycle failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-03 17:12:52 +08:00
kate522andClaude Opus 5 f6fde18857 fix(single): align author-bar publish time with the reference
The publish time under the author name diverged from the reference in four
ways: it rendered a leading bullet from `.icon-circle`, its tooltip opened
above instead of below, its wording was "2 天发布" (WordPress'
human_time_diff has no 前 and keeps spaces), and it ignored the
「时间显示数据源」 setting entirely.

- markup: drop `.icon-circle` from the time span and the description fallback;
  add `data-placement="bottom"` so the tooltip opens below like the reference
- wording: use jio_time_ago() (which already ends in 前) and append only
  发布 / 更新, yielding "2天前发布"
- branches: mirror zib_get_post_time_tooltip exactly (date source → publish
  time; unpublished → modified time; published-with-update → modified time
  labelled 更新 while the tooltip keeps the publish time; otherwise publish)
- the setting is read from post_time_source via get_post_list_style_settings()

Tests: new author-bar-time suite drives the real template through a stub
harness across all four branches (4/4); widget suite 833/834 with the
pre-existing frontend-lifecycle failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-03 16:58:05 +08:00
kate522andClaude Opus 5 f14e6bd88d fix(single): align cover breadcrumb with the article title
With a featured image the breadcrumb sits under the title inside the cover
overlay, but its first icon started 6px left of the title's left edge.

The overlay rule carried an extra `padding: 0` that this theme added on top of
the reference. The same node also matches `ul.breadcrumb { padding: 0 }`
(0,1,1 specificity), which outranks the base `.breadcrumb { padding: 0 8px }`
(0,1,0) — so the reference's `margin-left: -6px` nudge was applied with no
inset to compensate, pulling the whole row 6px to the left.

Writing the inset back as `padding: 0 8px` on the overlay rule restores the
reference geometry: -6px + 8px nets +2px from the panel edge. The global
`ul.breadcrumb` reset and the video footer variant are untouched, so archive
and video breadcrumbs keep their current padding.

Tests: new case in the single-cover contract suite pins the 8px inset (and the
global reset); cover suite 12/12, widget suite 829/830 with the pre-existing
frontend-lifecycle failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-03 16:48:38 +08:00
kate522andClaude Opus 5 93e83e1835 fix(single): align article like/favorite interaction UX with reference
The like and favorite buttons gave no in-flight feedback: the label just sat
there until the request returned, the lovestar animation never replayed on a
repeat like, duplicate clicks reported "success", and guest favorites silently
wrote a cookie instead of asking the user to sign in.

- pending state: replace the count with the reference inline spinner
  (`<i class="loading zts">`) and disable the button until the response lands
- animation: strip `action-animation` before re-adding it (forced reflow), so
  every successful like replays the reference lovestar keyframes
- duplicate: when the server reports the same state and count, skip the
  animation and surface the reference warning copy (已赞过此文章了!)
- failures: restore the original count and toast `danger`; guest-only actions
  now open the site login modal instead of dead-ending on an error
- favorite requires login server-side, matching the reference; the guest
  favourite cookie branch and its reader are removed as dead code
- unify like/favorite through one bindToggle path and keep every mirror
  button (article row + footer tabbar) in sync

Tests: new article-actions-ux suite (8 cases) drives assets/js/core/article.js
against a DOM/fetch shim — pending spinner, replay, duplicate no-op,
concurrency, rollback, guest login, mirror sync. Widget suite 828/829; the one
failure (frontend-lifecycle theme-init stub) predates this change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-03 16:36:45 +08:00
kate522andClaude Opus 5 3c07ef7a8d fix(widgets): restore the 20px bottom gap under the quote and search widgets
The reference wraps these two widgets in a middle .theme-box layer
(widget-container > .theme-box > title + card), which is what supplies the
20px bottom margin. Our outer .jio-widget-box-wrap is only a transparent
layout container, so dropping .theme-box left the quote card flush against
the following module.

- search/quote: emit the reference .theme-box middle layer; the card itself
  stays margin-free like the reference, so the gap is exactly 20px
- keep the generic .widget-content branch for user_card/author_card and the
  other reference widgets untouched (the string is contract-tested)
- contract test now pins the .theme-box layer and asserts the quote card
  carries no margin class of its own

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-03 16:09:46 +08:00
kate522andClaude Opus 5 f80ca1e27d fix(widgets): restore single-card reference UI for search and quote widgets
The 搜索框 and 一言 sidebar widgets fell into the generic renderer branch, so
they rendered a .jio-panel card wrapping a second bespoke card
(.jio-widget-search / .jio-widget-quote). In-article 一言 also used
divergent modifier classes and an extra hover rule.

- search: render through the shared jio_get_search_box() (legacy keyword,
  history and category pickers) inside one reference card, mirroring the
  reference widget's markup and title default 「搜索」
- quote: render the reference .yiyan-box card itself as the click root; the
  shell now emits only the reference widget-container/title wrapper
- article 一言: adopt the reference class lists for header, footer and the
  standalone after-article box; drop the invented yiyan--* modifiers and
  the duplicate hover/opacity rules
- client: fill .cn/.en in the reference order (first line .cn, second .en)
  and drop the stale window.JioYiyan bridge plus the dead qv-yiyan.php AJAX
  path in runtime main.js
- schema: replace the ad-hoc search_style radio with the reference switches
  (keywords, history, input category, more_cats) and default title
- assets: enqueue assets/js/yiyan.js through the quote widget's asset list

Tests: widget-system suite 820/821 (the one failure is the pre-existing
frontend-lifecycle theme-init stub); new search/quote card contracts pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-03 15:56:52 +08:00
kate522andClaude Fable 5 1549d5b25d fix(payment): honor schema defaults for balance recharge and fix withdrawal warning
Fixes two issues:

1. **Balance recharge disabled on fresh install**: The `pay_balance_s`
   setting has `default: true` in SchemaPayment but was treated as
   disabled when the key was absent from the database. This meant users
   had to toggle it off and back on to activate the feature.

   Fixed by using `!isset() || !empty()` pattern to honor the schema
   default when the key is missing.

2. **PHP Warning in withdrawal settings**: `get_withdrawal_settings()`
   passed `$s['affiliate_withdrawal_reset_time']` directly to
   `preg_match()` without extracting it first, causing "Undefined
   array key" warnings when the option was unset.

   Fixed by extracting to `$reset_time_raw` before the regex check.

Changed:
- `PaymentRuntime::get_payment_recharge_settings()`: enabled defaults to true
- `PaymentRuntime::get_payment_gateway_settings()`: balance_enabled defaults to true
- `PaymentRuntime::is_gateway_enabled('balance')`: defaults to true
- `PaymentRuntime::get_withdrawal_settings()`: no longer warns on missing key

Added test script `tools/test-payment-runtime-defaults.php` to verify
the fix works with empty settings (fresh install).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-02 22:33:18 +08:00
kate522andClaude Opus 5 030baa511e fix(nav): restore reference theme toggle geometry and single binding
The top-bar theme switch was bound twice — core/theme.js attached a click
handler to #theme-toggle-desktop while runtime/main.js delegated click on
.toggle-theme, and both ship in main.min.js, so one press toggled twice and
the button looked dead.

Also realign the control with the reference:

- Drop the far modifier from fa-toggle-theme so the sun/moon glyphs resolve
  against the Solid face at the reference weight instead of Regular.
- Restore .toggle-radius .fa/.icon to the reference form (left/right 0 +
  auto margin only). The extra position/top/transform/size/flex block and
  the > i selector were overriding the shared abs-* centering rule.
- Replace the per-ID bindings with one delegated listener so the floating
  rail, which carries no id, keeps working.
- Remove dead theme.js queries for selectors no markup or stylesheet ships
  (#theme-toggle, #dropdown-theme-toggle, .theme-icon-moon/.theme-icon-sun,
  [data-action='toggle-theme'], .is-dark).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-02 22:24:20 +08:00
kate522andClaude Opus 5 e30de6562c fix(routing): bootstrap permalink structure so fresh installs resolve single posts
A fresh install leaves `permalink_structure` empty, so WordPress snapshots
$wp_rewrite with no post/page permalink rules and every single post resolves
to 404 until someone re-saves Settings -> Permalinks.

The existing mitigation fired too late to help: routing.php wrote the option
and flushed from `init`, but WP_Rewrite was already constructed with the empty
structure, and core defers pre-`wp_loaded` flushes to a `wp_loaded` callback
that regenerates from that stale snapshot. The rewrite_rules option ended up
non-empty but broken, so the 404 persisted on every request.

New \Jio\Core\RewriteBootstrap owns this: on `after_setup_theme` (still inside
wp-settings.php, before wp-blog-header.php parses the query) it calls
$wp_rewrite->set_permalink_structure() — the same API wp-admin/options-permalink.php
uses — which persists the option *and* refreshes the in-memory snapshot, so both
the current request and the rules written for the next one are correct. A
structure an administrator chose is never overridden.

Also consolidates the two duplicated flush sites that lived inline in
functions.php (`after_switch_theme` closure and the `jio_flushed_version`
block, whose `delete_option('rewrite_rules')` forced a needless regenerate),
and drops the now-redundant permalink write from routing.php. The version
stamp moves to `wp_loaded` priority 20 so it sees the complete rule set
instead of the pre-`add_rewrite_rule()` snapshot.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-02 19:50:24 +08:00
kate522andClaude Opus 5 39aed0d430 fix(admin): show the real default URL for level and VIP icons
用户等级配置的「等级图标 URL」和 VIP 的「会员图标」在后台显示为空白输入框,
但前台实际渲染的是主题自带图标——后台既看不到当前效果,也无法判断该字段
是否已被配置。根因是 schema default 写成空串,而运行时(Level::
get_level_icon_url() / PaymentRuntime::get_vip_icon_url())在值为空时回退
到 assets/img 下的内置图标。

把 schema default 改为直接写入主题自带图标 URL,与运行时回退链保持同一路径、
同一 is_file 守卫:后台展示的就是前台真正使用的图标,清空则回到文本/FA 回退。

- SchemaUsers::default_level_options():icon_img_N 写入 user-level-N.png
- SchemaPayment::vip_icon_default():vip_N_img_icon 写入 user/vip/vip-N.svg
- level.js / vip.js 同步默认值,help 与 placeholder 文案改为描述默认图标
- 两个测试 harness 补齐 get_theme_file_uri/path stub(schema 现在需要它们)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-02 14:06:52 +08:00
kate522andClaude Opus 5 427968a721 chore(branding): remove leftover upstream theme identifiers
The theme was renamed Zibll/子比 → AKSRT → Jio, but upstream branding
survived the sweeps in CSS classes, the SVG sprite prefix, a persisted
widget field ID, JS events, admin Vue class names, test infrastructure
and docblocks.

Renames:
- zib-widget / zib-widget-wrap / zib-slider → jio-widget-box /
  jio-widget-box-wrap / jio-slider-box (jio-widget is taken by the modern
  widget shell, jio-box-* by the card primitives)
- zib-partners-scroll + zps-* → jio-partners-scroll + jps-*
- zib-combo-info-card + zci-* → jio-combo-info-card + jci-*
- zibsvg- → jiosvg-, including the exported picker helpers and the
  fa-zibsvg- family-prefix guard
- zibpay_type → pay_type; the dual-read fallback in PostQuery collapses
  to a single key
- [zibajax="submit"] dropped (no PHP emitter); zib_ajax.success →
  jio_ajax.success
- aks-* admin Vue classes → jio-*
- zib_palette() → palette()

User-facing vendor traces are gone: the floating "more" button default no
longer ships a zibll.com link or 子比主题 marketing copy, the notice
widget ships no preset promo entries, and the four 官网教程 links are
removed from the post-list admin schema.

Test infrastructure renamed to neutral names (docker-compose.reference.yml,
Caddyfile, article-baseline.json, modern-widgets-contract.test.cjs) with
their DB/volume/env/slug identifiers following.

Kept intentionally, documented in tests/fixtures/README.md: the golden
fixture reference fingerprint (a SHA-256 record of an external directory,
read by validate-widget-golden / generate-widget-golden-fixture /
audit-widget-system), the doesNotMatch guards that prove the old tokens are
gone, and the reference theme's own meta key in the visual fixtures.

No backward-compat or data migration: saved widget configs holding old
icon keys or the old field ID silently lose them, per the project's
rewrite-over-compatibility rule.

Verified: 132/132 node contract tests, php tests/widget-system/run.php
(146 assertions), audit-admin-contracts, audit-psr4-paths and
validate-widget-golden all green; tracked bundles regenerated and in sync.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-02 00:06:54 +08:00
kate522andClaude Opus 5 42cc64106d docs: point the theme folder references at Jio, not Jio-theme
The mechanical rename turned AKSRT-theme into Jio-theme, but the
directory itself is Jio. Fix the three places that name the folder
(README install steps and tree, wp-cli-visual-fixtures usage comment,
DocsPage docs deep-link) and rebuild the SPA bundle.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-01 20:12:25 +08:00
kate522andClaude Opus 5 35bb96e82f refactor: rename the theme brand and every identifier from AKSRT to Jio
Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.

Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
  cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
  window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)

Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
  so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
  (dropped 3 stale entries, added the 17 missing ones)

Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
  get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
  when it is empty

Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.

Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-01 20:05:04 +08:00
kate522andClaude Opus 5 5b16bc6e15 fix(frontend): route the VIP points-exchange entry through the custom currency name
/user/vip/ 档位购买卡下方的入口横条仍硬编码「积分兑换会员」,而后台
「积分配置 → 自定义货币名称」改名后不跟随。上一轮改名只覆盖了兑换弹窗
标题与会员弹窗内入口,页面自身的入口横条是另一处服务端渲染,漏改了。

入口横条(inc/helpers/aksrt-vip.php)
- aksrt_get_vip_points_exchange_entry_html 改取已加载的
  catalog.currency_name,回退 Settings::get_currency_name() 再回退「积分」

同一页面上其余漏改的兑换文案一并收口,命名与入口/弹窗保持一致:
- VipServiceModal:积分不足提示 → {货币名}不足,暂时无法兑换
- VipServicePurchase.exchange_with_points:兑换未启用 / 兑换无效 /
  不足三处 WP_Error、流水说明、订单备注(%1$s兑换会员 %2$d %1$s。)
  currency_name 在此单独解析,get_catalog 内的局部变量不在该作用域
- LedgerPresentation:vip_points_exchange 流水原因标签

契约测试新增源断言,并用两个 PHP harness 做运行时断言:入口横条
(改名后 / 已是会员不输出 / 缺 key 回退)与弹窗(余额充足 / 不足两分支)。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-01 16:19:49 +08:00
XingandClaude Opus 5 4e62b325d2 fix(badges): keep the medal catalog from being cast to a string on save
user_medal_args was declared as type=json without sanitize_type, so
sanitize_field_value() fell through to sanitize_text_field((string) $value)
and stored the literal string "Array". validate() has no json shape check,
so the save reported success.

Consequence: parse_medal_catalog() json_decoded "Array" into an empty
catalog, the dictionary came back empty, and user_context() dropped every
owned badge — the front end showed "获取徽章" and the grant modal listed
nothing, hiding both the newly added and the pre-existing badges.

Add the missing sanitize_type to match its sibling level/integral fields,
and guard sanitize_field_value() so structured container types can never
reach the scalar fallback again. Mirrors the declaration in the Vue schema.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-01 15:47:09 +08:00
kate522andClaude Opus 5 5c6b422866 fix(frontend): route every user-center points label through the custom currency name
后台「积分配置 → 自定义货币名称」改名后,用户中心仍有大量硬编码
「积分」:做任务赚积分 / 购买积分 / 签到领积分、积分记录 / 积分任务、
每日可免费获取 XX 积分、我的积分、积分+1、创作中心积分收益等。

get_currency_name() 早已存在且可用,问题只是这些文案没有走它。
本PR 全部替换,无双路、无迁移:

服务端渲染(用户中心 renderers)
- credits-balance.php:购买/做任务赚/签到领 + 整个购买弹窗
- profile-credits.php:积分记录 / 积分任务 页签
- credits-points-tasks.php:每日上限三态与空态
- sidebar-creator.php / profile-creator.php:积分收益
- transfer-modal.php:积分转账提示
- Signin.php:签到详情弹窗(我的积分 / 奖励 tooltip / 积分+N)
- VipServiceModal.php:我的积分 / 积分兑换会员
- download-permission-card.php:购买价格

客户端渲染(JS 无法调用 PHP,注入 currencyName 到 aksrtData)
- signin.js:签到状态行「已签到 N 天 +1」
- credits.js:转账标题/金额标签 + 购买提示 toast
- cms-download.js:积分不足视图、我的积分 入口、余额不足文案
- pay-vip.js:积分兑换会员入口(优先 catalog.currency_name)
- order-center.js:订单行单位回退

契约测试同步改为断言模板构造而非死字符串,并新增两例:
改名后跟随、未注入时回退「积分」。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-01 15:09:49 +08:00
kate522andClaude Opus 5 1c95f94bca refactor(admin): drop the SPA credits asset record browser
「用户近期资产记录」卡片在 SPA 积分配置页里按用户 ID + 资产类型 +
日期查 user meta 历史,再伪装成统一账本行(entries / operation_key /
ref_key)。SPA 只承载配置,运营记录归原生 用户 → 积分/余额 屏幕
(CreditsAdmin / BalanceAdmin),这条平行路径删除,不留双读或迁移。

- CmsCredits.vue: 移除卡片、表格、分页及 ledger* 状态与
  formatAssetValue/loadLedger/searchLedger/resetLedger
- users.js: 删除仅服务该卡片的 getCreditLog()
- UserController: 删除 /assets/transactions 路由、rest_get_credits_log()
  及其唯一调用方 asset_value_to_minor()
- 契约测试改为断言该能力不得回归

points_record / balance_record 本身保留,前端账本与原生后台仍在消费。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-01 14:20:07 +08:00
kate522 324bcfdadc fix(admin): verify the whole SPA build graph, not just the entry
find_missing_admin_chunks() only parsed index.js, but a lazily
imported page chunk pulls in its own deps (shared-api, PageHeader,
sortable-options…). A deploy that drops one of those still leaves the
entry internally consistent, so the existing notice never fires and the
failure only shows up when an admin opens that menu — every schemaPage
keeps working, which makes the breakage look arbitrary.

The same scan never looked at CSS at all: 18 stylesheets are reachable
from the graph and none of them were checked, so a missing page
stylesheet ships an unstyled screen with no warning.

Walk the module graph transitively from index.js, queueing each
discovered dependency, and match .js and .css specifiers. Deleting
PageHeader now also reports every page that depends on it.

This is a diagnostic hardening only — it makes an incomplete deploy loud
instead of guessing at the cause of a broken page.
2026-11-01 13:41:58 +08:00
kate522 df12f51199 fix(admin): stop cropping the layout preview images in image_select
AksImageSelectField pinned every preview to a 60x60 box with
object-fit:cover, but these are wide layout strips: header layouts are
597x57 (10.47:1), the footer template is 800x190 (4.21:1) and the slide
align set is 200x101. A 10:1 strip inside a square crop keeps ~6% of its
width, so the layout it is supposed to illustrate is unrecognisable.

Constrain the width instead and let the height follow, which is what the
reference theme's CSF image_select does (max-width:100%; height:auto).
Each field now declares the width that suits its images, and an option
may still override it: header 200, footer 240, slide align 160, mobile
header 120.

Only presentation changed. No image files and no stored values moved,
so existing settings are unaffected.
2026-11-01 12:18:14 +08:00
kate522 4740078135 fix(icons): repair the FA5 generator and drop the 404 font references
generate-fa5-icons.php read fa-{brands,regular,solid}.svg from
webfonts/, but only woff/woff2 ship with the theme, so the generator
died on file_get_contents() and the committed fa5-icons.php could not
be regenerated from what the theme actually distributes.

Decode the style split from each shipped woff's cmap table instead.
The split has to come from the font: FA5 assigns different drawings to
the same codepoint per style, so fas/far/fab membership is unanswerable
from the CSS alone. Output is byte-identical to the committed catalog
(1001/151/456), so the picker is unaffected.

all.min.css also declared eot / eot?#iefix / ttf / svg fallbacks for all
three families while webfonts/ holds only woff2 + woff, so a browser
that stops at woff requested six files that do not exist. Add
tools/strip-fa5-legacy-fonts.mjs to keep the src: list to what ships;
it is idempotent and touches nothing but the @font-face blocks.
2026-11-01 11:52:14 +08:00
kate522 9c70d7929a chore(assets): drop the duplicated header-layout previews
assets/admin/public/images/header-layout duplicated
assets/images/header-layout byte for byte (all five PNGs, matching
md5). The directory only existed because assets/admin/public is Vite's
default publicDir, so every build copied it into build/images.

Nothing referenced it: SchemaPageDisplay builds its preview URLs from
assets/images/header-layout via self::asset(), and a repo-wide search
finds no reference to public/images anywhere. Remove the source and let
build/images stop being regenerated.
2026-11-01 11:52:11 +08:00
kate522andClaude Fable 5 869d437485 test(admin): match invite bulk row by class token, not exact attribute
The bulk row gained the shared aksrt-native-bulk class in 1273a013, so the
exact class="aksrt-inv-bulk" string match no longer held.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-01 00:22:44 +08:00
kate522andClaude Fable 5 9805a371d8 feat(admin): rebuild the payment center overview with ECharts analytics
- Overview page: realtime today vs. same time yesterday, 6 KPI cards with
  period-over-period deltas, trend (paid / net / refund curves + order count
  line), category curves, payment method donut, top 10 paid content,
  conversion / close / refund rates, todos and shortcuts
- Date presets, custom range and category filter via
  GET aksrt/v1/admin/pay-overview (manage_options + wp_rest nonce)
- Metrics: paid amount by paid date including later-refunded orders, refunds
  by refund date, net = paid - refund; CNY only, points and recharge excluded,
  foreign-currency orders listed separately; integer cents internally
- Daily records cached per month in transients (today/yesterday live),
  invalidated on order status change and on purge
- ECharts 6.1.0 subset bundled to assets/js/runtime/libs/echarts-pay.min.js
  (npm run build:pay-charts), loaded only on the overview page
- Split payment-attempt methods out of OrderRepositoryCore into
  OrderRepositoryAttempts; remove dead get_stats(), cash_decimal(),
  Order::get_stats() and the old .aksrt-native-links styles

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-11-01 00:22:44 +08:00
kate522andClaude Fable 5 d98f8d7975 feat(admin): redesign withdrawal review page and drop dead withdrawal code
- Split PayWithdrawals into shell + PayWithdrawalsList flat sibling trait
- Add process/policy callout, open/paid/fee stats, status views with counts
- Filter by source and payout method; reset keeps the status view
- Show net payout with gross/fee breakdown, copyable payee, note column
- Replace inline select form with per-row actions and a confirm dialog;
  reject requires a reason; double-submit guard; retry reuses the
  idempotency key; redirect back preserving filters and paging
- Withdrawal: add get_status_counts() and method filter; get_stats() now
  returns open_gross / paid_net / paid_fee
- Remove unused REST routes (/payment/withdrawals, /transition),
  admin_withdrawals(), update_status(), has_open_withdrawal(),
  count_open(), resolve_gross_amount()

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 21:06:52 +08:00
kate522andClaude Fable 5 1d6bc8f7cc feat(admin): add bulk actions and pending-record deletion to creator income
- Always render the checkbox column and bulk bar; disable with a reason
  instead of hiding when settlement is off or the page has no pending rows
- Replace the batch-settle button with a bulk action select (settle / delete)
  plus apply, matching the charge cards and invite codes pages
- Add per-row delete for pending records and Revenue::delete_pending(),
  guarded by status = 'pending' so settled ledger-backed rows are never removed
- Report done / failed counts for bulk settle and delete

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 19:51:55 +08:00
kate522andClaude Fable 5 b25ebc5fff feat(admin): redesign creator income page with status views and safer settlement
- Split PayIncome into shell + PayIncomeList flat sibling trait
- Add policy callout, per-currency stats, status views, filter card
- Show source post/order/buyer, base amount x ratio, expected settle time
- Confirm single/batch settlement, selection count, double-submit guard
- Redirect back preserving filters; report settled/failed counts
- Revenue: add get_status_counts(), share admin_list_where(), drop dead settle()

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 19:37:38 +08:00
kate522andClaude Fable 5 1273a0138e fix(admin): match bulk action select and apply button sizes
- Add shared .aksrt-native-bulk row that locks select and button to the
  same height, font size and line height
- Apply it to the charge cards and invite codes bulk action rows

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 19:13:09 +08:00
kate522andClaude Fable 5 4f6e17ba5e feat(admin): create and batch-generate coupons in dialogs
- Move "新建优惠码" / "批量生成" into header-launched <dialog>s
- Extract forms into PayCouponsForms trait with shared rule fields,
  hints, validation and currency/percent unit switching
- Generated codes card gets a copy-all button; list codes copy on click
- Drop old inline forms, render_generated_dump and the unread
  aksrt_coupon_generated redirect arg

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 19:03:49 +08:00
kate522andClaude Fable 5 92a3c2b8c7 fix(admin): stop stretching checkboxes full-width in the pay products dialog
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 18:45:56 +08:00
kate522andClaude Fable 5 dc6dbc05d8 feat(admin): quick-edit paid post settings in a dialog on the pay products page
- Rebuild aksrt_pay_products as list + in-page quick settings dialog
  (pay type, limit, cash/points prices, sales float, coupon, order expiry, copy)
- Query by _aksrt_pay_type with real pagination; drop order-summary fallback
  and the duplicate "Meta 销量" column
- Centralize pay meta writes in DomainModel::persist_pay_meta(); stop writing
  unread _aksrt_pay_modo / _aksrt_pay_limit keys

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 17:28:45 +08:00
kate522andClaude Fable 5 4083613dbe fix(admin): scroll ticket notes inside their card instead of the whole sidebar
Keep ticket info at its natural height and let the internal notes card fill
the remaining sidebar height, so only the notes list scrolls.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 15:34:24 +08:00
kate522andClaude Fable 5 ed526709c8 fix(admin): align ticket sidebar and conversation pane heights
Share one --aksrt-ticket-pane-height between the conversation panel and
the sidebar cap so both columns line up, and drop the sidebar sticky
offset that no longer matches the pane height.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 15:20:45 +08:00
kate522andClaude Fable 5 b9000e1b93 feat(admin): dock ticket reply composer in conversation and move notes to a dialog
Put the reply composer at the bottom of the conversation card so the
timeline and composer form one viewport-height panel; the send button is
visible on load and Ctrl/Cmd+Enter submits. Internal notes now open in a
dialog instead of expanding inline, so the sidebar no longer grows.

Remove the shared ticket_composer helper and the inline note expansion CSS;
both dialogs share ticket_dialog_head.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 15:10:13 +08:00
kate522andClaude Fable 5 54cc5301c3 feat(admin): open ticket creation in a dialog on the list page
Move "代客提交工单" back into a native <dialog> on the ticket list while
the ticket workspace stays a full page. Closing asks before discarding
input, ignores backdrop clicks, resets the form and returns focus; an
uncertain create result keeps the form locked behind "重新加载".

Remove the ?view=new create page route and its styles.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 14:57:35 +08:00
kate522andClaude Fable 5 d86a85e6a6 feat(admin): replace ticket dialogs with in-page views
Ticket handling on users.php?page=aksrt_tickets no longer uses dialogs.
The list, the workspace (?id=N) and the assisted create form (?view=new)
are server-rendered page views that carry the list filters and page
for going back. Writes still go through the ticket REST routes; on
success the page reloads with a native notice, and unsent drafts in
other forms survive the reload via sessionStorage. Uncertain or
conflicting writes lock every form and only offer a reload.

Remove dead code: UsersMenusTicketsDialogs, the aksrt_ticket_view AJAX
read and its nonce, dialog CSS/JS (backdrop, scroll lock, focus return,
read races) and the dialog runtime test. Fix the create link carrying
an unclamped page number on out-of-range list pages.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 14:45:27 +08:00
kate522andClaude Fable 5 48e54dc115 fix(tests): restore green contract suite
Drop the legacy credits_added message label per the hard-cut rule, switch
three remaining Font Awesome 4 icons to FA5 solid, and align two widget
contracts with the badge rule grouping and renderer list from fc04bf65.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 14:18:01 +08:00
kate522andClaude Fable 5 b32b56f8bc feat(admin): redesign order list and detail workspace
Replace the type/method tab rows with status views backed by one GROUP BY
count, move filters into a single toolbar card, show gateway names, keep
list context across detail and actions, and split the detail page into a
summary/timeline column and an actions/buyer/note sidebar. Confirmations
move to admin-orders.js; PayOrders splits into flat List/Detail traits.

Remove dead code: unused Order AJAX endpoints and init(), get_orders_count(),
shipping flash codes, and the legacy raw-note fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 14:03:57 +08:00
kate522andClaude Fable 5 8c553c7221 fix(admin): auto-dismiss transient ticket dialog feedback
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 12:23:51 +08:00
kate522andClaude Fable 5 7b65b3c6d8 fix(admin): keep ticket internal notes compact
Show only the latest three notes and fold older ones into a details
toggle, collapse the note composer to one line until focused, and cap
the sidebar height to the dialog body so its controls stay reachable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 12:21:53 +08:00
kate522andClaude Fable 5 a9709377bb fix(admin): make ticket "view latest" jump reliably
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 12:13:57 +08:00
kate522andClaude Fable 5 d7616b193e feat(admin): redesign ticket handling dialog as conversation workspace
Render the original question and replies as one chat-style timeline,
merge editor and toolbar into a shared composer for replies and notes,
and refresh sidebar cards. Remove superseded renderers and selectors.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 12:02:49 +08:00
kate522andClaude Opus 5 09f3a94cea fix(admin): merge ticket controls into information panel
Edit status, department and assignee directly in ticket information, remove the redundant handling card and its layout rules, and cover editable and closed-ticket rendering.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-31 11:46:15 +08:00
kate522andClaude Opus 5 7f1a0dbeb4 fix(admin): remove duplicate ticket dialog subtitle
Keep the ticket number and status in the sidebar only, remove the unused header description payload and bindings, and update dialog regression coverage.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-31 11:34:21 +08:00
kate522andClaude Opus 5 264015b7e9 feat(admin): streamline ticket management with dialogs
Move on-behalf ticket creation into a header dialog and load ticket handling on demand. Reuse the admin REST write path, preserve drafts and filters, and cover dialog and server boundaries with regression tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-31 11:25:56 +08:00
kate522andClaude Fable 5 b45fd161f0 fix(reports): separate readable categories from report content
Store readable category snapshots separately from details and evidence, validate report categories, and preserve context in admin displays and moderation actions. Widen report categories to TEXT and bump the schema to 3.2.0 without legacy data conversion.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 00:57:13 +08:00
kate522andClaude Fable 5 b2811cc248 fix(frontend): simplify report dialog controls and feedback
Use highlight-only reason choices, show the associated target on one line, and replace inline submission progress with shared toast feedback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-31 00:14:36 +08:00
kate522andClaude Fable 5 80aecab586 feat(frontend): upgrade report dialog experience
Replace manual report links with automatic target association, improve validation and evidence uploads, and remove retired report UI code.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 23:56:59 +08:00
kate522andClaude Fable 5 59ddf677b6 feat(admin): review reports and ban appeals in dialogs
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 23:06:04 +08:00
kate522andClaude Fable 5 32ac2112b0 fix(uploads): reclaim abandoned front-submit attachments
Mark new regular and chunked uploads as pending and claim persisted article references, including partial saves and large reference sets. Protect associated media from cleanup and add upload lifecycle regression coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 21:57:46 +08:00
kate522andClaude Fable 5 f9b7997ec2 fix(user): match profile validation hook argument type
Accept the stdClass user data passed by WordPress and derive the user ID only from the hook object. Cover callback registration, nonce and permission guards, and mismatched posted IDs; refresh the identity review dialog contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 20:38:00 +08:00
kate522andClaude Fable 5 bc26d62602 feat(admin): redesign identity review with dialogs
Replace inline identity review forms with focused detail and review dialogs, improve list filters and caching, and align evidence permissions and deletion feedback. Add contract and runtime regression coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 20:05:21 +08:00
kate522andClaude Fable 5 5732be847e fix(admin): keep invite filters inside the list card
Unify status filters, search, bulk actions and pagination in one invite list card. Remove the standalone filter summary and preserve usable search widths on small screens, with structural regression coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 19:10:13 +08:00
kate522andClaude Fable 5 a6776ffe0a feat(admin): upgrade invite code management with dialogs
Replace standalone add and export views with accessible dialogs, refine list interactions, and remove obsolete paths and unused counts. Fix filtered totals and reject oversized imports without truncation, with regression coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 18:53:01 +08:00
kate522andClaude Fable 5 1cd19434d1 fix(admin): translate credits_added notification type
Display credits_added as 积分增加 with a success badge across message
filters, list rows and details. Extend rendering regression coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 18:04:47 +08:00
kate522andClaude Fable 5 f208424a26 fix(admin): center message actions with balanced cell padding
Center the operations heading and row buttons, with 20px padding on both
sides of the cell. Add a regression contract for alignment and spacing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 17:56:31 +08:00
kate522andClaude Fable 5 479b324f95 fix(admin): move message row actions into a rightmost column
Add a dedicated operations column for viewing, marking read and deleting
messages. Keep the message cell focused on its title, excerpt and ID;
adjust column widths and empty-state colspan with regression coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 17:45:52 +08:00
kate522andClaude Fable 5 1902ba1e87 fix(admin): translate asset notification type labels
Register Chinese labels and matching badge tones for balance and points
increase/decrease types across message filters, list badges and details.
Add regression coverage without changing notification delivery behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 17:36:42 +08:00
kate522andClaude Fable 5 fe3ef82718 feat(admin): upgrade message management and broadcast interactions
Add message details, per-row actions, selection-aware bulk controls and
confirmation dialogs. Merge filters into the list card and link overview
statistics to the matching views with site-timezone today filtering.

Improve the compose dialog with Unicode character counters, recipient mode
segments, role counts and explicit broadcast confirmation verified against
the resolved role and recipient count on submission. Split rendering into
focused sibling traits and cover rendering, handlers and UI interactions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 17:24:54 +08:00
kate522andClaude Fable 5 6195508481 feat(admin): move message compose into a header-button dialog
Replace the inline <details> compose card on users.php?page=aksrt_messages
with a primary header button that opens a native <dialog>. NativeUi::header()
gains dialog-type actions via NativeUi::button_dialog(). The dialog reopens
automatically after a failed send.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 16:42:56 +08:00
kate522andClaude Fable 5 8f1bbf2411 fix(admin): replace VIP expiry sort glyph with stacked CSS carets
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 16:29:46 +08:00
kate522andClaude Fable 5 117da19f16 fix(admin): hide VIP dialog radio marks and align button icons
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 16:20:06 +08:00
kate522andClaude Fable 5 1be52d75a0 feat(admin): redesign VIP membership page with modal editing
- Replace per-row inline <details> forms and the separate bulk form with a
  single <dialog> shared by single-user and bulk adjustments
- Add stats row, styled tabs, date range filter with reset, sortable expiry
- Show fallback tier, remaining time, and disable unavailable operations
- History tab: labelled operation/status badges, avatars, local time,
  batch marker and error message
- Move inline script/onclick to assets/js/admin-vip.js; add vip.css
- Surface the service error message when every user fails

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 16:12:12 +08:00
kate522andClaude Fable 5 18951b01d6 feat(admin): unify native admin pages on a shared modern UI
Add NativeUi helper + native-ui.css (tokens mirror the SPA Naive UI theme)
and move the pay center, orders, products, coupons, charge cards, income,
withdrawals, tickets, invite codes, VIP, verify, messages and report/ban
pages onto shared header, stat cards, cards, filters, badges and empty
states. Remove inline styles and dead helpers; split PayChargeCards into
sibling traits to stay under the file size limit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 15:05:38 +08:00
kate522andClaude Fable 5 aa692f3c9f fix(widgets): drop 520px control width so expanded widgets stay in the sidebar column
WP core widgets.js applies a negative margin-left to widgets whose
control width exceeds 250px, pushing the form over the available
widgets list. Use the default width like the reference theme.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 14:13:38 +08:00
kate522andClaude Fable 5 05c7ade3f5 fix(widgets): keep widget form accordions within the sidebar column
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 14:10:12 +08:00
kate522andClaude Fable 5 7650c3537a fix(widgets): disable block widget editor to restore classic widgets screen
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 14:06:49 +08:00
kate522andClaude Fable 5 a579a5b00a feat(widgets): rebuild admin widgets page to match reference theme
- Replace transfer modal/admin-post flow with reference-style AJAX
  export/import/template dialogs (admin-transfer.js, TransferController)
- Customizer "移出模块" action, reference lazy form loading with t-notice
- Common fields use reference labels, dependencies, compact/inline rows,
  top/bottom-only extra spacing; form header with description/reminder
- Remove placement hint, template preview and legacy transfer code
- Fix widget audit (current_datetime stub, honor catalog common flags)
  and regenerate stale golden fixtures for posts_toc, quote, posts

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-30 14:00:57 +08:00
kate522 ea80cd96cc fix(widgets): restore article table of contents behavior and styles 2026-10-30 13:18:40 +08:00
kate522 fc04bf65e6 fix(widgets): restore article list rendering and reference styles 2026-10-30 12:47:07 +08:00
kate522 4ea00f1322 fix(frontend): unify article timestamp clock icons 2026-10-29 23:13:14 +08:00
kate522 4cdde50695 fix(frontend): align post thumbnail display with reference 2026-10-29 23:07:08 +08:00
kate522 542daca457 fix(frontend): align search and header components with reference 2026-10-29 22:21:01 +08:00
kate522 4c13ef478c fix(widgets): replace old page before showing pagination skeleton 2026-10-29 21:29:17 +08:00
kate522 985f18c750 fix(widgets): align mini paid badges with reference 2026-10-29 21:15:11 +08:00
kate522 fd034ff055 fix(widgets): align tabbed post layouts with reference 2026-10-29 20:31:39 +08:00
kate522 17515cf9c5 fix(comments): center empty-state illustration 2026-10-29 19:31:16 +08:00
kate522 8aa116ec43 fix(theme): align reference layouts and restore passing contracts
Align homepage and category discovery, modern widgets, admin controls, quotes, and comments with the reference theme. Remove superseded paths and add rendering and behavior coverage. Update stale asset and finance contracts; all 760 Node tests and 139 widget assertions pass.
2026-10-29 19:16:03 +08:00
kate522 b520d29368 fix(frontend): match navigation icon divider spacing 2026-10-29 18:17:51 +08:00
kate522 f019760297 chore(frontend): normalize credits script line endings 2026-10-29 18:11:59 +08:00
kate522 9b27508a5b fix(frontend): align top navigation with reference theme 2026-10-29 18:10:00 +08:00
kate522 1c501ff713 fix(user): align badge modals with reference theme 2026-10-29 17:38:10 +08:00
kate522 8e9d3a7e49 fix(signin): align check-in feedback with reference theme 2026-10-29 17:06:25 +08:00
kate522andClaude Fable 5 1df2822f01 feat(pay): 统一收银台四种模式(站内二维码/当前页跳转/表单提交/JSAPI)
- PaymentOrchestrator 统一返回 mode + code_url/payment_url/form_html/jsapi_params
- 支付宝:当面付二维码 / 电脑网站支付 / H5;微信:Native / H5 / JSAPI(WechatOpenid 静默授权)
- 易支付:PC mapi 二维码,移动端自动提交表单
- 删除旧键 alipay_payment_type / wechat_payment_type / epay_device 与 redirect/qr_content 字段
- 新增 pay-cashier.js,移除 window.open,订单状态接口改为 /pay/order/{n}
- 拆分 credits.js(affiliate / withdraw-history)至 1000 行以内

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-29 14:01:28 +08:00
kate522andClaude Fable 5 b340b77d5a fix(pay): 订单缓存失效时订单列表无刷新重载
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-29 11:21:51 +08:00
kate522andClaude Fable 5 c3328e7279 fix(pay): 待支付浮窗无刷新同步
- modal-cache 失效时广播 aksrt:cache:invalidated
- 新增 GET /orders/wait-pay-float 返回浮窗片段
- wait-pay-float.js 监听 orders 标签失效并替换/移除浮窗、重启倒计时
- VIP/充值/下载待支付分支触发 orders 失效

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-29 11:11:13 +08:00
kate522andClaude Fable 5 d9d1122e9c feat(pay): add wait-pay float window aligned with reference theme
- Render pending orders (max 5, >=3 min left) in a top-right float button
  with hover list and countdown, gated by pay_wait_float_s
- Fix order countdown parsing expires_at as UTC
- Drop unused .paid-modal-lists-box thumb rule

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-29 10:45:23 +08:00
kate522andClaude Fable 5 7e86f2a821 用户中心侧栏工单中心图标改用 comment-color
- sidebar-nav: 工单中心 icon ticket-color -> comment-color
- 删除 assets/icons/sprite/ticket-color.svg 并重建 svg-icon.js
- 同步更新相关契约测试

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-29 10:10:49 +08:00
kate522andClaude Fable 5 b7a910b758 fix(scripts): bust tbquire module cache with newest runtime/*.js mtime
_win.ver only tracked main.min.js, so rebuilding svg-icon.js alone kept
serving the cached sprite and new icons (ticket-color) rendered blank.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-29 00:08:05 +08:00
kate522andClaude Fable 5 54ea83b262 feat(icons): split built-in sprite into per-icon SVG sources and add ticket icon
Move the 114 built-in sprite icons out of assets/js/runtime/svg-icon.js into
assets/icons/sprite/{key}.svg and generate svg-icon.js with
tools/build-svg-sprite.mjs. Add ticket-color and use it for the user center
ticket entry. Update sidebar contract tests for the creator card labels.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 23:59:06 +08:00
kate522andClaude Fable 5 794d981260 revert(user-center): restore promotion center ratio label
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 23:41:37 +08:00
kate522andClaude Fable 5 52749bf232 feat(user-center): rename promotion center ratio label to commission ratio
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 23:40:41 +08:00
kate522andClaude Fable 5 72e55d95fd feat(user-center): show cash and points income on sidebar creator card
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 23:39:01 +08:00
kate522andClaude Fable 5 293e1121c5 fix(user-center): align sidebar card spacing with reference mb20/mb10-sm flow
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 23:35:53 +08:00
kate522andClaude Fable 5 5d83a81b31 fix(user-center): match reference hover/focus interaction on sidebar statistics
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 23:21:53 +08:00
kate522andClaude Fable 5 cfe806728d fix(user-center): restore reference 6px padding on sidebar icon boxes
widgets/frontend.css loads after main.min.css and its global
.zib-widget{padding:15px} overrode .padding-6.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 23:14:48 +08:00
kate522andClaude Fable 5 c152e00501 fix(user-center): 1:1 port reference sidebar statistics row and icon box line-height
- Rewrite sidebar stats as a single zib-widget row (user-statistics-item, em14 / em09 opacity5 mt6), drop legacy .uc-stats styles
- Restore reference body line-height (1.42857143) on stats and service/settings boxes
- Move 我的订单 to the front of 我的服务 to match reference order

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 22:48:54 +08:00
kate522andClaude Fable 5 6ded62df92 fix(user-center): 1:1 port reference sidebar service/settings icon boxes
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 22:10:45 +08:00
kate522andClaude Fable 5 9fbfab54c2 feat(user-center): 1:1 port reference sidebar VIP bar and creator/promotion cards
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 22:01:37 +08:00
kate522andClaude Fable 5 5dd7d14334 fix(modal): compensate scrollbar width when locking page scroll
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 21:07:27 +08:00
kate522andClaude Fable 5 fcec5b996f refactor(color): use wpColorPicker for page config nav color
Replace the native input[type=color] in the page config meta box with a
wpColorPicker-enhanced text input, enqueued only on page edit screens, and
contract-lock that no native color inputs remain in theme PHP.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 21:01:54 +08:00
kate522andClaude Fable 5 ed1487d505 fix(tests): repair stale pagination/lazyload contracts and ban defaults script
- pay-pages-pagination asserts the $parent_file base URL added in b74381cf
- Drop native loading="lazy" from message avatars and medal presets per
  the lazyload contract
- verify-ban-settings-defaults requires SchemaUsersTicket and new deps

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 20:47:42 +08:00
kate522andClaude Fable 5 57ff405691 refactor(color): unify color sanitizing and picking behind shared components
- Add AKSRT\Core\Color::sanitize($value, $allow_alpha) as the single PHP
  color sanitizer; replace sanitize_hex_color calls and per-class regexes
  (FloatButtons, FieldSchema, ThemeSearch, icon cards, TicketStatusService)
- SchemaProvider / ControllerBase sanitize `color` fields as colors;
  alpha kept only when the schema sets showAlpha
- Split SchemaProvider OAuth validation and option matching into sibling
  traits to stay under the 1000-line limit
- Add AksColorPicker.vue + utils/color.js mirroring the PHP rules; AksField,
  FloatBtnCommonFields and TicketStatusPanel use it
- Widget background color input now uses wpColorPicker
- Remove dead AksCompositeField dimensions/spacing/background branches and
  the unused Gutenberg ColorPicker var
- Add color-unification contract test; update harness requires and tests

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 20:47:41 +08:00
kate522andClaude Fable 5 74021d26bb fix(layout): align color scheme, content width and fonts with reference theme
- Color scheme: zibll field order/labels, theme_skin_custom overrides palette,
  hex palette swatches, dark_theme_skin_custom, light/dark background images,
  close_backdrop via body.fps-accelerat, theme_main_radius drives --main-radius
- Emit --theme-color / --focus-shadow-color / --focus-color-opacity* vars
- Drop border_radius, primary_color readers and legacy value maps
- Content max width: free 1200-2200 number field; fix font family/custom stack

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 19:36:11 +08:00
kate522andClaude Fable 5 6da08d9d4f refactor(settings): remove filing info config and readers
Drop the 备案信息 group (icp_filing, police_filing, footer_text) from the
global.common PHP/Vue schemas, the FacadeBulk readers and the
get_global_settings() payload. No frontend consumer existed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 18:36:27 +08:00
kate522andClaude Fable 5 32172582ff fix(admin): shrink image previews to natural size like reference theme
Media and gallery previews now hug the image (inline box, capped height)
instead of stretching across fixed grid cells, removing empty letterbox space.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 18:30:34 +08:00
kate522andClaude Fable 5 7d61de70e3 fix(admin): keep image previews at natural aspect ratio
Media/gallery previews no longer stretch or crop: use object-fit contain,
natural sizing for single media, and the uncropped medium size instead of
the square thumbnail for gallery and native meta-box previews.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 15:58:01 +08:00
kate522andClaude Fable 5 fa89f43ac9 feat(admin): collapse provider/gateway groups by default, mask alipay private key, drop inline notice styles
- OAuth provider and payment gateway groups are collapsible and collapsed by default; remove dead expandWhen logic
- Textarea fields support secret masking; mark alipay_privatekey as secret in JS and PHP schemas
- Extract AksSecretClear shared by input and textarea secret fields
- Replace inline styles in payment/post-list notice HTML with aksrt-hint / aksrt-warn classes

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 15:50:37 +08:00
kate522andClaude Fable 5 3179754670 feat(admin): polish badge, OAuth and payment gateway settings UX
- Badge page: rewrite as collapsible sortable category/item cards with
  preset medal icon picker, dirty-tracked save bar and duplicate slug check;
  drop user_badge_* dual-read and legacy name/icon_url fallbacks
- OAuth: provider config groups collapsible, expanded when provider is on;
  clogin visibility moved to group-level dependsOn
- Gateway: expandWhen accepts dependsOn-style rules; select-gated groups no
  longer always expand ('null' was truthy); mark five gateway secrets as
  secret/password in JS and PHP; class-based notice list styling
- Remove unused UserRuntime::parse_badge_dictionary

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 15:33:49 +08:00
kate522andClaude Fable 5 116b6b2223 feat(admin): make all sortable/repeater cards collapsible, collapsed by default
- Add useCollapsibleItems: key-based open state, clickable/keyboard head, aria-expanded
- sortable items with sub-fields and every inline repeater/group row now collapse
- Repeater head summary falls back to the first filled field when no listPreview
- Drop per-schema collapsible/defaultCollapsed for repeater groups (JS + PHP)
- Align FloatBtnItemPanel head with the shared collapse attrs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 14:12:13 +08:00
kate522andClaude Fable 5 8843ae4261 refactor(admin): unify sortable/draggable/repeater list UI
- Add shared sortable-list.css, SORTABLE_LIST_ATTRS and AksSortHandle
- Migrate schema sortable, selected order, inline/modal repeater, sorter,
  floating buttons, footer tabbar and ticket prereply lists to the shared design
- Split AksField.vue (1885 -> 969 lines) into focused components/helpers
- Remove dead AksArrayTable/AksRepeaterField and move-up/down helpers
- Replace hardcoded colors and --n-* vars with --aksrt-color-* tokens

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-28 13:41:26 +08:00
kate522andClaude Fable 5 135fb4eaa4 feat(tickets): allow custom status key in status create/edit
- Validate status_key (^[a-z][a-z0-9_]{1,23}$, unique) on create/update
- Renaming a key moves aksrt_ticket.status in the same transaction
- Default statuses remain immutable

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-27 23:22:38 +08:00
kate522andClaude Fable 5 8d871c0828 fix(tickets): hide native radio dot in department picker
Global input[type=radio] rules in main.css out-specified the ticket
picker's hide rule, pulling the radio back into flow before the pill.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-10-27 23:22:38 +08:00
1323 changed files with 102844 additions and 42962 deletions

No files matched your search

+8 -4
View File
@@ -7,7 +7,7 @@
/.workbuddy/
# Project planning, internal docs, and local-only development files
/.aksrt-chrome-profile/
/.jio-chrome-profile/
/.specs/
/docs/
@@ -23,13 +23,17 @@ assets/css/routes/docs/*
!assets/css/routes/docs/toolbar-search-enhancements.css
# Frontend build output and installed dependencies.
# assets/admin/build is deploy-only: build it on the target with
# assets/admin/build and assets/creator-studio/build are deploy-only:
# build them on the target with
# cd assets/admin && npm ci && npm run build
# cd assets/creator-studio && npm ci && npm run build
/assets/admin/node_modules/
/assets/admin/build/*
!/assets/admin/build/.gitkeep
/assets/admin/build/
assets/admin/.vite-temp/
/assets/creator-studio/node_modules/
/assets/creator-studio/build/
# PHP installed dependencies
/vendor/*
!/vendor/.gitkeep
+15 -15
View File
@@ -2,15 +2,15 @@
/**
* 404 template.
*
* @package AKSRT
* @package Jio
*/
defined('ABSPATH') || exit;
get_header();
$search_placeholder = function_exists('aksrt_get_search_placeholder') ? aksrt_get_search_placeholder() : __('开启精彩搜索', 'aksrt');
$hot_keywords = function_exists('aksrt_get_search_hot_keywords') ? aksrt_get_search_hot_keywords() : [];
$search_placeholder = function_exists('jio_get_search_placeholder') ? jio_get_search_placeholder() : __('开启精彩搜索', 'jio');
$hot_keywords = function_exists('jio_get_search_hot_keywords') ? jio_get_search_hot_keywords() : [];
$hot_query = new WP_Query([
'post_type' => 'post',
@@ -39,33 +39,33 @@ $top_cats = get_terms([
<i class="fa fas fa-compass"></i>
</p>
<p class="error-hero__code" id="error-title">404</p>
<h1 class="error-hero__title"><?php esc_html_e('页面未找到', 'aksrt'); ?></h1>
<h1 class="error-hero__title"><?php esc_html_e('页面未找到', 'jio'); ?></h1>
<p class="error-hero__desc">
<?php esc_html_e('你访问的页面不存在或已被删除。试试搜索,或者从下方常用入口继续浏览。', 'aksrt'); ?>
<?php esc_html_e('你访问的页面不存在或已被删除。试试搜索,或者从下方常用入口继续浏览。', 'jio'); ?>
</p>
</div>
<?php if (function_exists('aksrt_render_admin_quick_link')) { aksrt_render_admin_quick_link('page-display/other', __('404 页设置', 'aksrt')); } ?>
<?php if (function_exists('jio_render_admin_quick_link')) { jio_render_admin_quick_link('page-display/other', __('404 页设置', 'jio')); } ?>
</div>
<form role="search" method="get" class="error-hero__search" action="<?php echo esc_url(home_url('/')); ?>">
<span class="error-hero__search-icon" aria-hidden="true">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
</span>
<label class="screen-reader-text" for="error-search-input"><?php esc_html_e('搜索', 'aksrt'); ?></label>
<label class="screen-reader-text" for="error-search-input"><?php esc_html_e('搜索', 'jio'); ?></label>
<input type="search" id="error-search-input" name="s" placeholder="<?php echo esc_attr($search_placeholder); ?>" autocomplete="off">
<button type="submit" class="btn-primary btn-sm"><?php esc_html_e('搜索', 'aksrt'); ?></button>
<button type="submit" class="btn-primary btn-sm"><?php esc_html_e('搜索', 'jio'); ?></button>
</form>
<?php aksrt_render_search_hot_keywords($hot_keywords, 'aksrt-search-hot-keywords'); ?>
<?php jio_render_search_hot_keywords($hot_keywords, 'jio-search-hot-keywords'); ?>
<div class="error-hero__actions">
<a href="<?php echo esc_url(home_url('/')); ?>" class="btn-primary"><?php esc_html_e('返回首页', 'aksrt'); ?></a>
<a href="javascript:history.back()" class="btn-outline"><?php esc_html_e('返回上一页', 'aksrt'); ?></a>
<a href="<?php echo esc_url(home_url('/')); ?>" class="btn-primary"><?php esc_html_e('返回首页', 'jio'); ?></a>
<a href="javascript:history.back()" class="btn-outline"><?php esc_html_e('返回上一页', 'jio'); ?></a>
</div>
</section>
<?php if (!empty($top_cats) && !is_wp_error($top_cats)) : ?>
<section class="error-section" aria-label="<?php esc_attr_e('热门分类', 'aksrt'); ?>">
<h2 class="error-section__title"><?php esc_html_e('热门分类', 'aksrt'); ?></h2>
<section class="error-section" aria-label="<?php esc_attr_e('热门分类', 'jio'); ?>">
<h2 class="error-section__title"><?php esc_html_e('热门分类', 'jio'); ?></h2>
<div class="error-section__chips">
<?php foreach ($top_cats as $cat) : ?>
<a class="error-section__chip" href="<?php echo esc_url(get_category_link($cat->term_id)); ?>">
@@ -78,8 +78,8 @@ $top_cats = get_terms([
<?php endif; ?>
<?php if ($hot_query->have_posts()) : ?>
<section class="error-section" aria-label="<?php esc_attr_e('热门内容', 'aksrt'); ?>">
<h2 class="error-section__title"><?php esc_html_e('热门内容', 'aksrt'); ?></h2>
<section class="error-section" aria-label="<?php esc_attr_e('热门内容', 'jio'); ?>">
<h2 class="error-section__title"><?php esc_html_e('热门内容', 'jio'); ?></h2>
<ul class="error-section__list">
<?php while ($hot_query->have_posts()) : $hot_query->the_post(); ?>
<li>
+29 -29
View File
@@ -1,4 +1,4 @@
# AKSRT WordPress Theme
# Jio WordPress Theme
> **版本**: 3.4.0-dev | **架构**: 原生 PHP + WordPress (非 headless)
> **要求**: WordPress >= 6.4 | PHP >= 8.1
@@ -7,7 +7,7 @@
## 项目概述
AKSRT 是一款现代化的 WordPress 主题,采用**原生 WordPress 主题架构**开发(PHP + HTML + CSS + JavaScript),不依赖 REST API 进行前端渲染。
Jio 是一款现代化的 WordPress 主题,采用**原生 WordPress 主题架构**开发(PHP + HTML + CSS + JavaScript),不依赖 REST API 进行前端渲染。
### 核心特性
@@ -22,14 +22,14 @@ AKSRT 是一款现代化的 WordPress 主题,采用**原生 WordPress 主题
## 文件结构
```
AKSRT-theme/
Jio/
├── functions.php # 入口:常量 + Composer autoload + bootstrap + 单例 init
├── style.css # WordPress 主题声明头
├── composer.json # 第三方依赖 + 主题 PSR-4(AKSRT\ → src/)
├── composer.json # 第三方依赖 + 主题 PSR-4(Jio\ → src/)
│
├── *.php # WP 核心模板保留根目录
│
├── src/ # Composer PSR-4 类型根(namespace AKSRT\)
├── src/ # Composer PSR-4 类型根(namespace Jio\)
│ ├── Admin/ # SPA 编排 + 域控制器 + Schema + Native ops
│ ├── Auth/ # 登录 / OAuth / 审核 / 邮箱
│ ├── Content/ # 下载 token / 付费内容 / VIP / 可见性
@@ -89,7 +89,7 @@ AKSRT-theme/
## 安装方式
主题类型(`AKSRT\…`)通过 Composer PSR-4 从 `src/` 自动加载;`vendor/` 不进 Git。**部署或更新主题后必须在主题根目录生成 autoload**,否则会出现 `Class "AKSRT\Core\DomainModel" not found` 等致命错误。
主题类型(`Jio\…`)通过 Composer PSR-4 从 `src/` 自动加载;`vendor/` 不进 Git。**部署或更新主题后必须在主题根目录生成 autoload**,否则会出现 `Class "Jio\Core\DomainModel" not found` 等致命错误。
### 前置:Composer(必做)
@@ -106,16 +106,16 @@ composer dump-autoload -o
确认:
```bash
php -r "require 'vendor/autoload.php'; echo class_exists('AKSRT\\\\Core\\\\DomainModel') ? \"ok\\n\" : \"missing\\n\";"
php -r "require 'vendor/autoload.php'; echo class_exists('Jio\\\\Core\\\\DomainModel') ? \"ok\\n\" : \"missing\\n\";"
```
应输出 `ok`。若 PHP 开启了 OPcache,重载 php-fpm / 重启 PHP 后再访问站点。
### 方式一:直接上传(推荐)
1. 将整个 `AKSRT-theme` 文件夹上传到 `wp-content/themes/`
1. 将整个 `Jio` 文件夹上传到 `wp-content/themes/`
2. 在服务器主题目录执行上一节的 `composer install`(若打包时已带上完整 `vendor/` 且已 `dump-autoload`,可跳过)
3. WordPress 后台 → **外观** → **主题** → 找到 **AKSRT** → **激活**
3. WordPress 后台 → **外观** → **主题** → 找到 **Jio** → **激活**
### 方式二:ZIP 打包上传
@@ -126,7 +126,7 @@ php -r "require 'vendor/autoload.php'; echo class_exists('AKSRT\\\\Core\\\\Domai
SSH 进入主题目录后:
```bash
cd /path/to/wp-content/themes/AKsrt-theme # 以实际路径为准
cd /path/to/wp-content/themes/Jio # 以实际路径为准
composer install --no-dev --optimize-autoloader
# 或仅刷新映射:composer dump-autoload -o
# 可选:reload php-fpm / 清 OPcache
@@ -150,9 +150,9 @@ composer install --no-dev --optimize-autoloader
### 2. 后台配置路径
WordPress 后台左侧 **Admin Bar** → ⚡ **AKSRT 主题设置**
WordPress 后台左侧 **Admin Bar** → ⚡ **Jio 主题设置**
或直接访问:`/wp-admin/admin.php?page=aksrt-settings`
或直接访问:`/wp-admin/admin.php?page=jio-settings`
### 3. 当前后台域
@@ -167,13 +167,13 @@ WordPress 后台左侧 **Admin Bar** → ⚡ **AKSRT 主题设置**
### 4. 推广、邀请与佣金(用户中心 → 收益)
- **推广链接**:用户中心「收益」页展示带 `?ref=` 的推广链接、二维码(可下载 PNG)与推广海报(按「推广返佣」设置中的海报文案生成)。归因模式(首触/末触)在「支付&付费 → 推广返佣 → 推广归因模式」配置。
- **一次性邀请码**:后台「用户 → 邀请码管理」三视图运营页——列表(状态筛选/搜索/批量删除/排序/分页/点击复制)、添加(系统自动生成:数量/标识/四类奖励[经验值、积分、余额、VIP]/高级选项自定义位数;或 Zibll 兼容文本导入:一行一码 `邀请码 奖励 标识`,奖励参数串 `points=20&balance=30&vip=1&vip_time=5&level_integral=100`,分隔符可自定义)、导出(状态筛选 + 文本文档[可回流导入]/Excel表格 双格式)。注册门控模式在「用户&互动 → 登录注册 → 邀请码注册」。消费为原子操作,并发注册不会超发;开启注册验证时奖励延迟到邮箱验证后发放。
- **一次性邀请码**:后台「用户 → 邀请码管理」三视图运营页——列表(状态筛选/搜索/批量删除/排序/分页/点击复制)、添加(系统自动生成:数量/标识/四类奖励[经验值、积分、余额、VIP]/高级选项自定义位数;或行格式文本导入:一行一码 `邀请码 奖励 标识`,奖励参数串 `points=20&balance=30&vip=1&vip_time=5&level_integral=100`,分隔符可自定义)、导出(状态筛选 + 文本文档[可回流导入]/Excel表格 双格式)。注册门控模式在「用户&互动 → 登录注册 → 邀请码注册」。消费为原子操作,并发注册不会超发;开启注册验证时奖励延迟到邮箱验证后发放。
- **佣金**:订单支付成功后按推广者等级分档比例记录到佣金账本,经「结算观察期」后自动结算入钱包,支持提现与退款联动回滚。「推广码禁用后停止返佣」开关默认关闭。
### 5. 部署注意事项
- **佣金结算时效**:结算依赖小时级 wp-cron,并有收益页访问触发的懒结算兜底。高流量站点建议禁用 `WP_CRON_LOCK` 场景下的默认 WP-Cron,改用系统 crontab 定时请求 `wp-cron.php`,保证结算与过期任务准时执行。
- **反代 / CDN 与 IP 风控**:主题默认按 Cloudflare → 通用代理头顺序识别真实 IP。若需收紧伪造风险,添加 `add_filter('aksrt_trusted_proxies', fn() => ['10.0.0.0/8', '173.245.48.0/20'])`(填入你的代理/CDN 网段);名单非空时仅当 `REMOTE_ADDR` 命中名单才采纳转发头,否则直接使用 `REMOTE_ADDR`(推广奖励的 IP 日上限、验证码等均依赖该函数)。
- **反代 / CDN 与 IP 风控**:主题默认按 Cloudflare → 通用代理头顺序识别真实 IP。若需收紧伪造风险,添加 `add_filter('jio_trusted_proxies', fn() => ['10.0.0.0/8', '173.245.48.0/20'])`(填入你的代理/CDN 网段);名单非空时仅当 `REMOTE_ADDR` 命中名单才采纳转发头,否则直接使用 `REMOTE_ADDR`(推广奖励的 IP 日上限、验证码等均依赖该函数)。
---
@@ -181,20 +181,20 @@ WordPress 后台左侧 **Admin Bar** → ⚡ **AKSRT 主题设置**
### Settings Facade 分层
- `AKSRT_Settings` 仍是主题设置的**唯一静态 facade**,外部调用方式保持 `AKSRT_Settings::*`
- `JIO_Settings` 仍是主题设置的**唯一静态 facade**,外部调用方式保持 `JIO_Settings::*`
- 具体运行时 getter 已按领域拆分到 `inc/classes/settings/`,例如:
- `class-aksrt-settings-theme-search.php`
- `class-aksrt-settings-post-display.php`
- `class-aksrt-settings-home-cms.php`
- `class-aksrt-settings-user-runtime.php`
- `class-aksrt-settings-integration.php`
- `class-aksrt-settings-display-runtime.php`
- `class-aksrt-settings-extension-runtime.php`
- `class-aksrt-settings-credits-runtime.php`
- `class-aksrt-settings-category-runtime.php`
- `class-aksrt-settings-capabilities.php`
- `inc/bootstrap.php` 会先加载 `settings/class-aksrt-settings.php`,再按领域加载这些 delegate 类
- 新增设置运行时逻辑时,优先放入对应 settings 子类;仅把聚合输出、统一入口和跨域装配保留在 `AKSRT_Settings`
- `class-jio-settings-theme-search.php`
- `class-jio-settings-post-display.php`
- `class-jio-settings-home-cms.php`
- `class-jio-settings-user-runtime.php`
- `class-jio-settings-integration.php`
- `class-jio-settings-display-runtime.php`
- `class-jio-settings-extension-runtime.php`
- `class-jio-settings-credits-runtime.php`
- `class-jio-settings-category-runtime.php`
- `class-jio-settings-capabilities.php`
- `inc/bootstrap.php` 会先加载 `settings/class-jio-settings.php`,再按领域加载这些 delegate 类
- 新增设置运行时逻辑时,优先放入对应 settings 子类;仅把聚合输出、统一入口和跨域装配保留在 `JIO_Settings`
### 添加新辅助函数
@@ -202,14 +202,14 @@ WordPress 后台左侧 **Admin Bar** → ⚡ **AKSRT 主题设置**
### 添加新页面模板
将 `page-{name}.php` 放入 `templates/pages/`,并在 `class-aksrt-templates.php` 中注册。
将 `page-{name}.php` 放入 `templates/pages/`,并在 `class-jio-templates.php` 中注册。
### CSS 组织规范
| 目录 | 用途 | 加载场景 |
|------|------|---------|
| `css/frontend/` | 前端公共样式 | 所有前台页面 |
| `css/admin/` | 后台管理样式 | 仅 AKSRT 设置页面 |
| `css/admin/` | 后台管理样式 | 仅 Jio 设置页面 |
| `css/shared/` | 共用组件样式 | 前后端按需加载(如验证码) |
---
+26 -26
View File
@@ -2,9 +2,9 @@
/**
* Resource Archive Template
*
* Virtual list at /resources/ — ordinary posts marked with _aksrt_is_resource.
* Virtual list at /resources/ — ordinary posts marked with _jio_is_resource.
*
* @package AKSRT
* @package Jio
*/
defined('ABSPATH') || exit;
@@ -25,18 +25,18 @@ if (!in_array($current_price, ['all', 'free', 'paid'], true)) {
$price_min = isset($_GET['price_min']) && $_GET['price_min'] !== '' ? (float) $_GET['price_min'] : '';
$price_max = isset($_GET['price_max']) && $_GET['price_max'] !== '' ? (float) $_GET['price_max'] : '';
$archive_url = function_exists('aksrt_resource_archive_url') ? aksrt_resource_archive_url() : home_url('/resources/');
$archive_url = function_exists('jio_resource_archive_url') ? jio_resource_archive_url() : home_url('/resources/');
$sort_options = [
'date' => __('最新', 'aksrt'),
'downloads' => __('热门下载', 'aksrt'),
'views' => __('阅读最多', 'aksrt'),
'date' => __('最新', 'jio'),
'downloads' => __('热门下载', 'jio'),
'views' => __('阅读最多', 'jio'),
];
$price_options = [
'all' => __('全部', 'aksrt'),
'free' => __('免费', 'aksrt'),
'paid' => __('付费', 'aksrt'),
'all' => __('全部', 'jio'),
'free' => __('免费', 'jio'),
'paid' => __('付费', 'jio'),
];
$preserve = [];
@@ -59,18 +59,18 @@ $has_filter = $current_orderby !== 'date' || $current_price !== 'all' || $price_
<main id="main-content" class="site-main container" tabindex="-1">
<header class="resource-archive-header page-cover">
<div class="container">
<?php if (function_exists('aksrt_breadcrumbs')) : ?>
<nav class="resource-archive-header__breadcrumbs" aria-label="<?php esc_attr_e('面包屑', 'aksrt'); ?>">
<?php aksrt_breadcrumbs(); ?>
<?php if (function_exists('jio_breadcrumbs')) : ?>
<nav class="resource-archive-header__breadcrumbs" aria-label="<?php esc_attr_e('面包屑', 'jio'); ?>">
<?php jio_breadcrumbs(); ?>
</nav>
<?php endif; ?>
<h1 class="resource-archive-header__title"><?php esc_html_e('资源', 'aksrt'); ?></h1>
<h1 class="resource-archive-header__title"><?php esc_html_e('资源', 'jio'); ?></h1>
<p class="resource-archive-header__sub">
<?php
global $wp_query;
/* translators: %s: resource count */
printf(esc_html__('共 %s 个资源', 'aksrt'), esc_html(number_format_i18n((int) $wp_query->found_posts)));
printf(esc_html__('共 %s 个资源', 'jio'), esc_html(number_format_i18n((int) $wp_query->found_posts)));
?>
</p>
</div>
@@ -79,9 +79,9 @@ $has_filter = $current_orderby !== 'date' || $current_price !== 'all' || $price_
<div class="content-wrap">
<div class="content-layout content-layout--no-sidebar">
<div class="content-layout__primary resource-archive">
<nav class="resource-archive__toolbar" aria-label="<?php esc_attr_e('筛选', 'aksrt'); ?>">
<nav class="resource-archive__toolbar" aria-label="<?php esc_attr_e('筛选', 'jio'); ?>">
<div class="resource-archive__filter-group">
<span class="resource-archive__filter-label"><?php esc_html_e('排序', 'aksrt'); ?></span>
<span class="resource-archive__filter-label"><?php esc_html_e('排序', 'jio'); ?></span>
<ul class="resource-archive__sort">
<?php foreach ($sort_options as $key => $label) :
$args = $preserve;
@@ -105,7 +105,7 @@ $has_filter = $current_orderby !== 'date' || $current_price !== 'all' || $price_
</div>
<div class="resource-archive__filter-group">
<span class="resource-archive__filter-label"><?php esc_html_e('价格', 'aksrt'); ?></span>
<span class="resource-archive__filter-label"><?php esc_html_e('价格', 'jio'); ?></span>
<ul class="resource-archive__sort">
<?php foreach ($price_options as $key => $label) :
$args = $preserve;
@@ -139,43 +139,43 @@ $has_filter = $current_orderby !== 'date' || $current_price !== 'all' || $price_
}
?>
<label class="resource-archive__price-input">
<span><?php esc_html_e('最低', 'aksrt'); ?></span>
<span><?php esc_html_e('最低', 'jio'); ?></span>
<input type="number" name="price_min" min="0" step="1" value="<?php echo esc_attr((string) $price_min); ?>">
</label>
<span class="resource-archive__price-sep">—</span>
<label class="resource-archive__price-input">
<span><?php esc_html_e('最高', 'aksrt'); ?></span>
<span><?php esc_html_e('最高', 'jio'); ?></span>
<input type="number" name="price_max" min="0" step="1" value="<?php echo esc_attr((string) $price_max); ?>">
</label>
<button type="submit" class="btn-primary btn-sm"><?php esc_html_e('应用', 'aksrt'); ?></button>
<button type="submit" class="btn-primary btn-sm"><?php esc_html_e('应用', 'jio'); ?></button>
</form>
<?php if ($has_filter) : ?>
<a class="resource-archive__reset" href="<?php echo esc_url($archive_url); ?>">
<i class="fa fas fa-times-circle" aria-hidden="true"></i>
<?php esc_html_e('清除筛选', 'aksrt'); ?>
<?php esc_html_e('清除筛选', 'jio'); ?>
</a>
<?php endif; ?>
</nav>
<?php if (have_posts()) : ?>
<?php
$render_config = aksrt_resolve_post_list_render_config([
$render_config = jio_resolve_post_list_render_config([
'context' => 'archive',
'overrides' => ['type' => 'card'],
]);
aksrt_render_post_list(array_merge($render_config, ['wrapper_class' => 'content-stream__list']));
aksrt_render_pagination(null, [
jio_render_post_list(array_merge($render_config, ['wrapper_class' => 'content-stream__list']));
jio_render_pagination(null, [
'query_context' => 'archive',
'render_config' => $render_config,
]);
?>
<?php else : ?>
<div class="no-results">
<p><?php esc_html_e('暂无资源。', 'aksrt'); ?></p>
<p><?php esc_html_e('暂无资源。', 'jio'); ?></p>
<?php if ($has_filter) : ?>
<p><a class="btn-outline btn-sm" href="<?php echo esc_url($archive_url); ?>"><?php esc_html_e('清除筛选条件', 'aksrt'); ?></a></p>
<p><a class="btn-outline btn-sm" href="<?php echo esc_url($archive_url); ?>"><?php esc_html_e('清除筛选条件', 'jio'); ?></a></p>
<?php endif; ?>
</div>
<?php endif; ?>
+19 -19
View File
@@ -2,7 +2,7 @@
/**
* Generic archive template.
*
* @package AKSRT
* @package Jio
*/
defined('ABSPATH') || exit;
@@ -11,31 +11,31 @@ get_header();
global $wp_query;
$render_config = function_exists('aksrt_archive_get_render_config')
? aksrt_archive_get_render_config(['context' => 'archive'])
$render_config = function_exists('jio_archive_get_render_config')
? jio_archive_get_render_config(['context' => 'archive'])
: ['context' => 'archive', 'mode' => 'list'];
$has_sidebar = function_exists('aksrt_archive_has_sidebar')
? aksrt_archive_has_sidebar()
: (function_exists('aksrt_is_show_sidebar') ? aksrt_is_show_sidebar() : false);
$has_sidebar = function_exists('jio_archive_has_sidebar')
? jio_archive_has_sidebar()
: (function_exists('jio_is_show_sidebar') ? jio_is_show_sidebar() : false);
$archive_description = trim(wp_strip_all_tags((string) get_the_archive_description()));
$archive_summary = '';
if (is_author()) {
$author = get_queried_object();
if ($author instanceof WP_User) {
$archive_summary = sprintf(__('作者:%s', 'aksrt'), $author->display_name);
$archive_summary = sprintf(__('作者:%s', 'jio'), $author->display_name);
}
} elseif ($archive_description !== '') {
$archive_summary = $archive_description;
} elseif (isset($wp_query->found_posts)) {
$archive_summary = sprintf(
esc_html(_n('共 %d 篇内容', '共 %d 篇内容', (int) $wp_query->found_posts, 'aksrt')),
esc_html(_n('共 %d 篇内容', '共 %d 篇内容', (int) $wp_query->found_posts, 'jio')),
(int) $wp_query->found_posts
);
}
if (function_exists('aksrt_archive_open_shell')) {
aksrt_archive_open_shell([
if (function_exists('jio_archive_open_shell')) {
jio_archive_open_shell([
'main_class' => 'site-main container',
'has_sidebar' => $has_sidebar,
'page_kind' => 'archive',
@@ -45,16 +45,16 @@ if (function_exists('aksrt_archive_open_shell')) {
}
?>
<div class="content-main content-main--archive">
<?php if (function_exists('aksrt_breadcrumbs')) { aksrt_breadcrumbs(); } ?>
<?php if (function_exists('jio_breadcrumbs')) { jio_breadcrumbs(); } ?>
<?php
ob_start();
if (function_exists('aksrt_render_admin_quick_link')) {
aksrt_render_admin_quick_link('post-list/list', __('列表样式设置', 'aksrt'));
if (function_exists('jio_render_admin_quick_link')) {
jio_render_admin_quick_link('post-list/list', __('列表样式设置', 'jio'));
}
$admin_link = trim((string) ob_get_clean());
get_template_part('templates/parts/page-header', null, [
'eyebrow' => __('内容归档', 'aksrt'),
'eyebrow' => __('内容归档', 'jio'),
'title' => get_the_archive_title(),
'desc' => $archive_summary,
'extra' => $admin_link,
@@ -62,19 +62,19 @@ if (function_exists('aksrt_archive_open_shell')) {
?>
<?php
if (function_exists('aksrt_archive_render_stream')) {
aksrt_archive_render_stream(null, $render_config, [
if (function_exists('jio_archive_render_stream')) {
jio_archive_render_stream(null, $render_config, [
'page_kind' => 'archive',
'query_context' => 'archive',
'stream_class' => 'content-stream--archive',
'empty_text' => __('暂无文章', 'aksrt'),
'empty_text' => __('暂无文章', 'jio'),
]);
}
?>
</div>
<?php
if (function_exists('aksrt_archive_close_shell')) {
aksrt_archive_close_shell(['has_sidebar' => $has_sidebar]);
if (function_exists('jio_archive_close_shell')) {
jio_archive_close_shell(['has_sidebar' => $has_sidebar]);
} else {
echo '</div></div>';
if ($has_sidebar) { get_sidebar(); }
+6 -6
View File
@@ -104,7 +104,7 @@ const COMPONENT_STYLES = [
]
async function extractStyles() {
console.log('\n[AKSRT] 开始提取 NaiveUI 组件样式...\n')
console.log('\n[Jio] 开始提取 NaiveUI 组件样式...\n')
const allCss = []
let successCount = 0
@@ -137,9 +137,9 @@ async function extractStyles() {
// 静默跳过的后果是组件样式整体缺失(取色器曾因此没有尺寸和边框,糊成一团),
// 而页面不报错,只能靠肉眼发现。
if (code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND') {
console.error(`[AKSRT] 样式路径不存在,已跳过: ${componentPath}`)
console.error(`[Jio] 样式路径不存在,已跳过: ${componentPath}`)
} else {
console.error(`[AKSRT] 样式提取异常,已跳过: ${componentPath}: ${err && err.message}`)
console.error(`[Jio] 样式提取异常,已跳过: ${componentPath}: ${err && err.message}`)
}
failCount++
}
@@ -148,7 +148,7 @@ async function extractStyles() {
const cssOutput = allCss.join('\n\n')
if (!cssOutput.trim()) {
console.warn('[AKSRT] 警告:未提取到任何 NaiveUI 样式!')
console.warn('[Jio] 警告:未提取到任何 NaiveUI 样式!')
return null
}
@@ -165,7 +165,7 @@ ${cssOutput}`
await writeFile(cssFile, fullContent, 'utf-8')
console.log(`[AKSRT] NaiveUI 样式提取完成:`)
console.log(`[Jio] NaiveUI 样式提取完成:`)
console.log(` 成功: ${successCount} 个组件`)
console.log(` 跳过: ${failCount} 个组件`)
console.log(` 输出: ${cssFile}`)
@@ -176,6 +176,6 @@ ${cssOutput}`
// 执行
extractStyles().catch((err) => {
console.error('[AKSRT] 样式提取失败:', err)
console.error('[Jio] 样式提取失败:', err)
process.exit(1)
})
+2 -2
View File
@@ -3,10 +3,10 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AKSRT 主题设置</title>
<title>Jio 主题设置</title>
</head>
<body>
<div id="aksrt-admin-app"></div>
<div id="jio-admin-app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
+121 -94
View File
@@ -1,11 +1,11 @@
{
"name": "aksrt-admin",
"name": "jio-admin",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "aksrt-admin",
"name": "jio-admin",
"version": "1.0.0",
"dependencies": {
"@codemirror/lang-css": "^6.3.1",
@@ -21,35 +21,36 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.1.0",
"echarts": "^6.1.0",
"esbuild": "^0.25.12",
"vite": "^6.0.0"
}
},
"node_modules/@babel/helper-string-parser": {
"version": "7.27.1",
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz",
"integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==",
"version": "7.29.11",
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.11.tgz",
"integrity": "sha512-snZbO7MEDOof+hvNa97EjEY7qD7h2kwvQr5AJC3ZhQudKW5dnej6k3kP9NQV88hJwaS8vDqRLFo9rivLEhle2g==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/helper-validator-identifier": {
"version": "7.28.5",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz",
"integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==",
"version": "7.29.7",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz",
"integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==",
"license": "MIT",
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/parser": {
"version": "7.29.3",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.3.tgz",
"integrity": "sha512-b3ctpQwp+PROvU/cttc4OYl4MzfJUWy6FZg+PMXfzmt/+39iHVF0sDfqay8TQM3JA2EUOyKcFZt75jWriQijsA==",
"version": "7.29.12",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.12.tgz",
"integrity": "sha512-WJ7JBp/Q4+z/ImydtI7jS6NVco5++632ExBemSX+Ysb+G1lCwQ5BVo3SY+jGGOcZXI4ZccbZSUSJLNBW6eEpJg==",
"license": "MIT",
"dependencies": {
"@babel/types": "^7.29.0"
"@babel/types": "^7.29.11"
},
"bin": {
"parser": "bin/babel-parser.js"
@@ -59,13 +60,13 @@
}
},
"node_modules/@babel/types": {
"version": "7.29.0",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz",
"integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==",
"version": "7.29.11",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.11.tgz",
"integrity": "sha512-WCsemW40Cpc6gouC1SrY6PBaZ+oLRlEVY9XBvZBI7il/HyUrb2nJ505wE1MHEFyDZNnrWDEuy4jL50WVHfTTSQ==",
"license": "MIT",
"dependencies": {
"@babel/helper-string-parser": "^7.27.1",
"@babel/helper-validator-identifier": "^7.28.5"
"@babel/helper-string-parser": "^7.29.11",
"@babel/helper-validator-identifier": "^7.29.7"
},
"engines": {
"node": ">=6.9.0"
@@ -676,9 +677,9 @@
}
},
"node_modules/@jridgewell/sourcemap-codec": {
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
"integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz",
"integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==",
"license": "MIT"
},
"node_modules/@juggle/resize-observer": {
@@ -1137,53 +1138,53 @@
}
},
"node_modules/@vue/compiler-core": {
"version": "3.5.33",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.33.tgz",
"integrity": "sha512-3PZLQwFw4Za3TC8t0FvTy3wI16Kt+pmwcgNZca4Pj9iWL2E72a/gZlpBtAJvEdDMdCxdG/qq0C7PN0bsJuv0Rw==",
"version": "3.5.44",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.44.tgz",
"integrity": "sha512-k34nCytbK8PQ1gR2mGROYOw6Pnv/mumqIdrZ3x2tbyXZDWm7ViKGLTfdB+DRrWqEQsLgGJvn0WN9jBif5zCTLQ==",
"license": "MIT",
"dependencies": {
"@babel/parser": "^7.29.2",
"@vue/shared": "3.5.33",
"@babel/parser": "^7.29.9",
"@vue/shared": "3.5.44",
"entities": "^7.0.1",
"estree-walker": "^2.0.2",
"source-map-js": "^1.2.1"
"source-map-js": "^1.2.2"
}
},
"node_modules/@vue/compiler-dom": {
"version": "3.5.33",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.33.tgz",
"integrity": "sha512-PXq0yrfCLzzL07rbXO4awtXY1Z06LG2eu6Adg3RJFa/j3Cii217XxxLXG22N330gw7GmALCY0Z8RgXEviwgpjA==",
"version": "3.5.44",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.44.tgz",
"integrity": "sha512-W5AoBFWdw1lQAKiHowkfgFKFab82oSRT6sGsPfw/q1GRjsy/ZJFLHGhJyBRIFN9APLTUduDH9U2JAiPOIyKuYg==",
"license": "MIT",
"dependencies": {
"@vue/compiler-core": "3.5.33",
"@vue/shared": "3.5.33"
"@vue/compiler-core": "3.5.44",
"@vue/shared": "3.5.44"
}
},
"node_modules/@vue/compiler-sfc": {
"version": "3.5.33",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.33.tgz",
"integrity": "sha512-UTUvRO9cY+rROrx/pvN9P5Z7FgA6QGfokUCfhQE4EnmUj3rVnK+CHI0LsEO1pg+I7//iRYMUfcNcCPe7tg0CoA==",
"version": "3.5.44",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.44.tgz",
"integrity": "sha512-dzHmQ4jXTpdr5FjIQUeykVakN/uzqFbUo9/C5ikBFg3a3PeM6uRxeczx1ZbXBML0/zJstEh3ygYipzR5Z7b2Pw==",
"license": "MIT",
"dependencies": {
"@babel/parser": "^7.29.2",
"@vue/compiler-core": "3.5.33",
"@vue/compiler-dom": "3.5.33",
"@vue/compiler-ssr": "3.5.33",
"@vue/shared": "3.5.33",
"@babel/parser": "^7.29.9",
"@vue/compiler-core": "3.5.44",
"@vue/compiler-dom": "3.5.44",
"@vue/compiler-ssr": "3.5.44",
"@vue/shared": "3.5.44",
"estree-walker": "^2.0.2",
"magic-string": "^0.30.21",
"postcss": "^8.5.10",
"source-map-js": "^1.2.1"
"postcss": "^8.5.29",
"source-map-js": "^1.2.2"
}
},
"node_modules/@vue/compiler-ssr": {
"version": "3.5.33",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.33.tgz",
"integrity": "sha512-IErjYdnj1qIupG5xxiVIYiiRvDhGWV4zuh/RCrwfYpuL+HWQzeU6lCk/nF9r7olWMnjKxCAkOctT2qFWFkzb1A==",
"version": "3.5.44",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.44.tgz",
"integrity": "sha512-xr5gb1JVHlfXJwSlRz1FeP6uxoazdzHuMTVLE7up+4Vrqxk219CvxLPxD9NXBt47yvZW7+p4DXfyp4O1fkByIA==",
"license": "MIT",
"dependencies": {
"@vue/compiler-dom": "3.5.33",
"@vue/shared": "3.5.33"
"@vue/compiler-dom": "3.5.44",
"@vue/shared": "3.5.44"
}
},
"node_modules/@vue/devtools-api": {
@@ -1193,53 +1194,51 @@
"license": "MIT"
},
"node_modules/@vue/reactivity": {
"version": "3.5.33",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.33.tgz",
"integrity": "sha512-p8UfIqyIhb0rYGlSgSBV+lPhF2iUSBcRy7enhTmPqKWadHy9kcOFYF1AejYBP9P+avnd3OBbD49DU4pLWX/94A==",
"version": "3.5.44",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.44.tgz",
"integrity": "sha512-u+QJdKeBBEADkPdevsL+6E12QlYVfBD8Zcw5qjDQKtamI6l14KyqazJMobhCKelhWN5zpyKUiEDoTyHE93cqWw==",
"license": "MIT",
"dependencies": {
"@vue/shared": "3.5.33"
"@vue/shared": "3.5.44"
}
},
"node_modules/@vue/runtime-core": {
"version": "3.5.33",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.33.tgz",
"integrity": "sha512-UpFF45RI9//a7rvq7RdOQblb4tup7hHG9QsmIrxkFQLzQ7R8/iNQ5LE15NhLZ1/WcHMU2b47u6P33CPUelHyIQ==",
"version": "3.5.44",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.44.tgz",
"integrity": "sha512-uEa/ndwjhrrhnOfb2p+sZy6zeoamJOISqaLSJGk/8R6nABT1ZldpzcJoPzKj+zHVomVBPcmQYyC2r4LtvDV6CQ==",
"license": "MIT",
"dependencies": {
"@vue/reactivity": "3.5.33",
"@vue/shared": "3.5.33"
"@vue/reactivity": "3.5.44",
"@vue/shared": "3.5.44"
}
},
"node_modules/@vue/runtime-dom": {
"version": "3.5.33",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.33.tgz",
"integrity": "sha512-IOxMsAOwquhfITgmOgaPYl7/j8gKUxUFoflRc+u4LxyD3+783xne8vNta1PONVCvCV9A0w7hkyEepINDqfO0tw==",
"version": "3.5.44",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.44.tgz",
"integrity": "sha512-3fc4ARcXVhVBaJ3ujWiNZJARD6pkyRcwG+ZYhMzjKtKUp7MAY0HLwr7r3Smep3Li6ZaWT6ewdmx8XqdaD5oNZg==",
"license": "MIT",
"dependencies": {
"@vue/reactivity": "3.5.33",
"@vue/runtime-core": "3.5.33",
"@vue/shared": "3.5.33",
"@vue/reactivity": "3.5.44",
"@vue/runtime-core": "3.5.44",
"@vue/shared": "3.5.44",
"csstype": "^3.2.3"
}
},
"node_modules/@vue/server-renderer": {
"version": "3.5.33",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.33.tgz",
"integrity": "sha512-0xylq/8/h44lVG0pZFknv1XIdEgymq2E9n59uTWJBG+dIgiT0TMCSsxrN7nO16Z0MU0MPjFcguBbZV8Itk52Hw==",
"version": "3.5.44",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.44.tgz",
"integrity": "sha512-R4S1UoH4h5Frrauv8Z5XE5TxV9oBiUSgWIC4TyVK1FK+RocRnOLwFA5Xcmo2011RlgJp+AbZCnw6afrhlgRuUQ==",
"license": "MIT",
"dependencies": {
"@vue/compiler-ssr": "3.5.33",
"@vue/shared": "3.5.33"
},
"peerDependencies": {
"vue": "3.5.33"
"@vue/compiler-ssr": "3.5.44",
"@vue/runtime-dom": "3.5.44",
"@vue/shared": "3.5.44"
}
},
"node_modules/@vue/shared": {
"version": "3.5.33",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.33.tgz",
"integrity": "sha512-5vR2QIlmaLG77Ygd4pMP6+SGQ5yox9VhtnbDWTy9DzMzdmeLxZ1QqxrywEZ9sa1AVubfIJyaCG3ytyWU81ufcQ==",
"version": "3.5.44",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.44.tgz",
"integrity": "sha512-H82XLH0DjmSOdbEwO15x3QTo1f5PWEtv237eLpYKc0mqLu+B8hnq16lFWmuBmNurkeiG3wr+oM1FhOll/YVFRg==",
"license": "MIT"
},
"node_modules/async-validator": {
@@ -1310,6 +1309,17 @@
"date-fns": "^3.0.0 || ^4.0.0"
}
},
"node_modules/echarts": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/echarts/-/echarts-6.1.0.tgz",
"integrity": "sha512-q0yaFPggC9FUdsWH4blavRWFmxdrIodbkoKNAjJudAI6CA9gNPxHtV2RcZNEepZVlk4yvBYkOkbk6HIVpIyHZA==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"tslib": "2.3.0",
"zrender": "6.1.0"
}
},
"node_modules/entities": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz",
@@ -1472,9 +1482,9 @@
}
},
"node_modules/nanoid": {
"version": "3.3.12",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz",
"integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==",
"version": "3.3.20",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
"integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
"funding": [
{
"type": "github",
@@ -1531,9 +1541,9 @@
}
},
"node_modules/postcss": {
"version": "8.5.13",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.13.tgz",
"integrity": "sha512-qif0+jGGZoLWdHey3UFHHWP0H7Gbmsk8T5VEqyYFbWqPr1XqvLGBbk/sl8V5exGmcYJklJOhOQq1pV9IcsiFag==",
"version": "8.5.32",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz",
"integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==",
"funding": [
{
"type": "opencollective",
@@ -1550,9 +1560,9 @@
],
"license": "MIT",
"dependencies": {
"nanoid": "^3.3.11",
"nanoid": "^3.3.20",
"picocolors": "^1.1.1",
"source-map-js": "^1.2.1"
"source-map-js": "^1.2.2"
},
"engines": {
"node": "^10 || ^12 || >=14"
@@ -1616,9 +1626,9 @@
"license": "MIT"
},
"node_modules/source-map-js": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
"integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
@@ -1653,6 +1663,13 @@
"integrity": "sha512-M8RGFoKtZ8dF+iwJfAJTOH/SM4KluKOKRJpjCMhI8bG3qB74zrFoArKZ62ll0Fr3mqkMJiQOmWYkdYgDeITYQg==",
"license": "MIT"
},
"node_modules/tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==",
"dev": true,
"license": "0BSD"
},
"node_modules/vdirs": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/vdirs/-/vdirs-0.1.8.tgz",
@@ -1666,9 +1683,9 @@
}
},
"node_modules/vite": {
"version": "6.4.2",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.2.tgz",
"integrity": "sha512-2N/55r4JDJ4gdrCvGgINMy+HH3iRpNIz8K6SFwVsA+JbQScLiC+clmAxBgwiSPgcG9U15QmvqCGWzMbqda5zGQ==",
"version": "6.4.5",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.5.tgz",
"integrity": "sha512-4enwjFfi4IwtEh0w+jPzpLVOFQiPHmmzPxcHXQOyEur47o6u0jE573DmGpjA+7irXoMLYRZD5ZaFUEneS3abPg==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -1753,16 +1770,16 @@
}
},
"node_modules/vue": {
"version": "3.5.33",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.33.tgz",
"integrity": "sha512-1AgChhx5w3ALgT4oK3acm2Es/7jyZhWSVUfs3rOBlGQC0rjEDkS7G4lWlJJGGNQD+BV3reCwbQrOe1mPNwKHBQ==",
"version": "3.5.44",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.44.tgz",
"integrity": "sha512-dvvmaOCG7lAMkJTPqPwWeGMsPS6DIsFsfZDUgBp9V6mHf9b3+/wyVwYR4Es+WV6uJC0FKRxp81Obcq0ZwUcGFQ==",
"license": "MIT",
"dependencies": {
"@vue/compiler-dom": "3.5.33",
"@vue/compiler-sfc": "3.5.33",
"@vue/runtime-dom": "3.5.33",
"@vue/server-renderer": "3.5.33",
"@vue/shared": "3.5.33"
"@vue/compiler-dom": "3.5.44",
"@vue/compiler-sfc": "3.5.44",
"@vue/runtime-dom": "3.5.44",
"@vue/server-renderer": "3.5.44",
"@vue/shared": "3.5.44"
},
"peerDependencies": {
"typescript": "*"
@@ -1849,6 +1866,16 @@
"resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz",
"integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==",
"license": "MIT"
},
"node_modules/zrender": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/zrender/-/zrender-6.1.0.tgz",
"integrity": "sha512-oEGMDB6pOP2S6OwRR4PdVv610zrjnA3Bh+JnSG12fYJlBKjtNAoEb5fSUoCOOINlH96I2fU38/A2UpRKs67xYQ==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"tslib": "2.3.0"
}
}
}
}
+1 -1
View File
@@ -1 +1 @@
{"name":"aksrt-admin","version":"1.0.0","private":true,"type":"module","scripts":{"dev":"vite","build":"vite build && node extract-naive-styles.mjs","build:public":"node ../../tools/build-public-assets.mjs","preview":"vite preview"},"dependencies":{"@codemirror/lang-css":"^6.3.1","@codemirror/lang-html":"^6.4.11","@codemirror/lang-javascript":"^6.2.5","@codemirror/theme-one-dark":"^6.1.3","codemirror":"^6.0.2","naive-ui":"^2.40.0","pinia":"^2.2.0","vue":"^3.5.0","vue-router":"^4.4.0","vuedraggable":"^4.1.0"},"devDependencies":{"@vitejs/plugin-vue":"^5.1.0","esbuild":"^0.25.12","vite":"^6.0.0"}}
{"name":"jio-admin","version":"1.0.0","private":true,"type":"module","scripts":{"dev":"vite","build":"vite build && node extract-naive-styles.mjs","build:public":"node ../../tools/build-public-assets.mjs","build:pay-charts":"node ../../tools/build-pay-charts.mjs","preview":"vite preview"},"dependencies":{"@codemirror/lang-css":"^6.3.1","@codemirror/lang-html":"^6.4.11","@codemirror/lang-javascript":"^6.2.5","@codemirror/theme-one-dark":"^6.1.3","codemirror":"^6.0.2","naive-ui":"^2.40.0","pinia":"^2.2.0","vue":"^3.5.0","vue-router":"^4.4.0","vuedraggable":"^4.1.0"},"devDependencies":{"@vitejs/plugin-vue":"^5.1.0","echarts":"^6.1.0","esbuild":"^0.25.12","vite":"^6.0.0"},"allowScripts":{"esbuild@0.25.12":true,"vue-demi@0.14.10":true}}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

+45 -45
View File
@@ -6,9 +6,9 @@
<n-message-provider>
<n-dialog-provider>
<n-notification-provider>
<n-layout v-if="!isMobile" class="aksrt-admin-layout" has-sider>
<n-layout v-if="!isMobile" class="jio-admin-layout" has-sider>
<n-layout-sider
class="aksrt-admin-sider"
class="jio-admin-sider"
bordered
collapse-mode="width"
:collapsed-width="64"
@@ -19,16 +19,16 @@
@collapse="collapsed = true"
@expand="collapsed = false"
>
<div class="aksrt-logo">
<div class="jio-logo">
<span class="logo-icon">AK</span>
<span v-if="!collapsed" class="aksrt-logo__copy">
<span class="logo-text">AKSRT</span>
<span class="aksrt-logo__version">v{{ themeVersion }}</span>
<span v-if="!collapsed" class="jio-logo__copy">
<span class="logo-text">Jio</span>
<span class="jio-logo__version">v{{ themeVersion }}</span>
</span>
</div>
<n-menu
class="aksrt-admin-menu"
class="jio-admin-menu"
:value="activeMenuKey"
:collapsed="collapsed"
:collapsed-width="64"
@@ -37,39 +37,39 @@
/>
</n-layout-sider>
<n-layout :native-scrollbar="false" class="aksrt-admin-content">
<div class="aksrt-admin-content__inner">
<n-layout :native-scrollbar="false" class="jio-admin-content">
<div class="jio-admin-content__inner">
<router-view v-slot="{ Component }">
<transition name="fade-slide" mode="out-in">
<div class="aksrt-page-wrapper" :key="route.fullPath">
<div class="jio-page-wrapper" :key="route.fullPath">
<component :is="Component" />
</div>
</transition>
</router-view>
<div v-if="pageError" class="aksrt-error-fallback">
<p class="aksrt-error-title">页面渲染异常</p>
<p class="aksrt-error-msg">{{ pageError }}</p>
<div v-if="pageError" class="jio-error-fallback">
<p class="jio-error-title">页面渲染异常</p>
<p class="jio-error-msg">{{ pageError }}</p>
<n-button size="small" @click="pageError = null">重试</n-button>
</div>
</div>
</n-layout>
</n-layout>
<div v-else class="aksrt-admin-mobile">
<div v-else class="jio-admin-mobile">
<MobileTopBar :title="currentPageTitle" @toggle="drawerActive = true" />
<n-drawer v-model:show="drawerActive" placement="left" :width="280">
<n-drawer-content :native-scrollbar="false" body-content-style="padding:0;">
<div class="aksrt-logo aksrt-logo--drawer">
<div class="jio-logo jio-logo--drawer">
<span class="logo-icon">AK</span>
<span class="aksrt-logo__copy">
<span class="logo-text">AKSRT</span>
<span class="aksrt-logo__version">v{{ themeVersion }}</span>
<span class="jio-logo__copy">
<span class="logo-text">Jio</span>
<span class="jio-logo__version">v{{ themeVersion }}</span>
</span>
</div>
<n-menu
class="aksrt-admin-menu"
class="jio-admin-menu"
:value="activeMenuKey"
:options="menuOptions"
@update:value="handleMenuClick"
@@ -77,18 +77,18 @@
</n-drawer-content>
</n-drawer>
<div class="aksrt-admin-mobile__body">
<div class="jio-admin-mobile__body">
<router-view v-slot="{ Component }">
<transition name="fade-slide" mode="out-in">
<div class="aksrt-page-wrapper" :key="route.fullPath">
<div class="jio-page-wrapper" :key="route.fullPath">
<component :is="Component" />
</div>
</transition>
</router-view>
<div v-if="pageError" class="aksrt-error-fallback">
<p class="aksrt-error-title">页面渲染异常</p>
<p class="aksrt-error-msg">{{ pageError }}</p>
<div v-if="pageError" class="jio-error-fallback">
<p class="jio-error-title">页面渲染异常</p>
<p class="jio-error-msg">{{ pageError }}</p>
<n-button size="small" @click="pageError = null">重试</n-button>
</div>
</div>
@@ -113,7 +113,7 @@ const collapsed = ref(false)
const pageError = ref(null)
const isMobile = ref(false)
const drawerActive = ref(false)
const themeVersion = window.aksrtAdminData?.themeVersion || window.aksrtAdminData?.version || '9.0'
const themeVersion = window.jioAdminData?.themeVersion || window.jioAdminData?.version || '9.0'
const MOBILE_BREAKPOINT = 960
const adminThemeOverrides = {
@@ -184,7 +184,7 @@ onBeforeUnmount(() => {
provide('collapsed', collapsed)
onErrorCaptured((err) => {
console.error('[AKSRT] 组件渲染错误:', err)
console.error('[Jio] 组件渲染错误:', err)
pageError.value = err?.message || String(err)
return false
})
@@ -224,7 +224,7 @@ const menuOptions = ADMIN_SECTIONS.filter((section) => !section.hidden).map((sec
children: section.children.map((child) => ({
label: child.secondaryEntry ? `${child.label} · 次级` : child.label,
key: child.key,
props: child.secondaryEntry ? { class: 'aksrt-menu-item--secondary' } : undefined,
props: child.secondaryEntry ? { class: 'jio-menu-item--secondary' } : undefined,
})),
}
})
@@ -254,7 +254,7 @@ const activeMenuKey = computed(() => {
return ADMIN_SECTIONS[0]?.children?.[0]?.key || 'global-common'
})
const currentPageTitle = computed(() => route.meta?.title || 'AKSRT')
const currentPageTitle = computed(() => route.meta?.title || 'Jio')
function handleMenuClick(key) {
if (keyToPath[key]) {
@@ -267,17 +267,17 @@ function handleMenuClick(key) {
</script>
<style scoped>
.aksrt-logo {
.jio-logo {
display: flex;
align-items: center;
justify-content: flex-start;
height: 64px;
gap: 11px;
padding: 0 18px;
border-bottom: 1px solid var(--aksrt-color-border);
border-bottom: 1px solid var(--jio-color-border);
}
.aksrt-logo--drawer {
.jio-logo--drawer {
height: 64px;
}
@@ -289,14 +289,14 @@ function handleMenuClick(key) {
height: 28px;
flex: 0 0 28px;
border-radius: 7px;
background: var(--aksrt-color-primary);
background: var(--jio-color-primary);
color: #fff;
font-size: 12px;
font-weight: 700;
letter-spacing: 0.08em;
}
.aksrt-logo__copy {
.jio-logo__copy {
display: flex;
align-items: baseline;
gap: 7px;
@@ -306,56 +306,56 @@ function handleMenuClick(key) {
.logo-text {
font-size: 17px;
font-weight: 700;
color: var(--aksrt-color-text);
color: var(--jio-color-text);
letter-spacing: .08em;
}
.aksrt-logo__version {
color: var(--aksrt-color-muted);
.jio-logo__version {
color: var(--jio-color-muted);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 10px;
letter-spacing: .02em;
}
.aksrt-admin-content__inner {
.jio-admin-content__inner {
width: 100%;
max-width: 1236px;
margin: 0 auto;
padding: 26px 28px 42px;
}
.aksrt-admin-mobile {
background: var(--aksrt-color-canvas);
.jio-admin-mobile {
background: var(--jio-color-canvas);
min-height: 100vh;
}
.aksrt-admin-mobile__body {
.jio-admin-mobile__body {
padding: 14px 12px 32px;
}
.aksrt-page-wrapper {
.jio-page-wrapper {
min-height: calc(100vh - 120px);
}
.aksrt-error-fallback {
.jio-error-fallback {
padding: 48px 20px;
text-align: center;
}
.aksrt-error-title {
.jio-error-title {
margin: 0 0 10px;
font-size: 16px;
color: #d03050;
}
.aksrt-error-msg {
.jio-error-msg {
margin: 0 0 16px;
font-size: 13px;
color: #777;
}
@media (max-width: 1100px) {
.aksrt-admin-content__inner {
.jio-admin-content__inner {
padding: 22px 20px 38px;
}
}
+17 -17
View File
@@ -1,16 +1,16 @@
/**
* AKSRT Admin API Client
* Jio Admin API Client
*
* Communicates with the WordPress REST API at /wp-json/aksrt/v1
* (or index.php?rest_route=/aksrt/v1 when pretty permalinks are off).
* Communicates with the WordPress REST API at /wp-json/jio/v1
* (or index.php?rest_route=/jio/v1 when pretty permalinks are off).
* Methods are organized into domain modules while the client keeps the shared
* request pipeline and schema-domain normalization contract.
*/
import { apiMethods } from './modules/index.js'
const API_ROOT = window.aksrtAdminData?.apiUrl || '/wp-json/aksrt/v1'
const NONCE = window.aksrtAdminData?.nonce || ''
const API_ROOT = window.jioAdminData?.apiUrl || '/wp-json/jio/v1'
const NONCE = window.jioAdminData?.nonce || ''
function createIdempotencyKey() {
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
@@ -34,11 +34,11 @@ function normalizeDomainKey(domain) {
/**
* Join REST base + endpoint correctly for both pretty and plain permalinks.
*
* Pretty: https://site/wp-json/aksrt/v1 + /settings/schema/global/common
* → https://site/wp-json/aksrt/v1/settings/schema/global/common
* Pretty: https://site/wp-json/jio/v1 + /settings/schema/global/common
* → https://site/wp-json/jio/v1/settings/schema/global/common
*
* Plain: https://site/index.php?rest_route=/aksrt/v1 + /settings/schema/global/common
* → https://site/index.php?rest_route=/aksrt/v1/settings/schema/global/common
* Plain: https://site/index.php?rest_route=/jio/v1 + /settings/schema/global/common
* → https://site/index.php?rest_route=/jio/v1/settings/schema/global/common
*
* @param {string} baseUrl
* @param {string} endpoint path starting with /, may include ?query
@@ -56,7 +56,7 @@ function joinRestUrl(baseUrl, endpoint) {
path = '/' + path
}
const base = String(baseUrl || '').trim() || '/wp-json/aksrt/v1'
const base = String(baseUrl || '').trim() || '/wp-json/jio/v1'
// Plain permalinks: rest_route query mode
if (base.includes('rest_route=')) {
@@ -68,11 +68,11 @@ function joinRestUrl(baseUrl, endpoint) {
return base.replace(/\/?$/, '') + path + (extraQuery ? (base.includes('?') ? '&' : '?') + extraQuery : '')
}
const baseRoute = (u.searchParams.get('rest_route') || '/aksrt/v1').replace(/\/$/, '') || '/aksrt/v1'
const baseRoute = (u.searchParams.get('rest_route') || '/jio/v1').replace(/\/$/, '') || '/jio/v1'
let fullRoute
if (path === '/') {
fullRoute = baseRoute
} else if (path.startsWith('/aksrt/')) {
} else if (path.startsWith('/jio/')) {
fullRoute = path
} else {
fullRoute = baseRoute + path
@@ -110,7 +110,7 @@ class ApiClient {
async request(endpointOrConfig, options = {}) {
// Dual-signature support:
// request('/users/1/restrictions')
// request({ url: '/aksrt/v1/users/1/restrictions', method: 'GET' })
// request({ url: '/jio/v1/users/1/restrictions', method: 'GET' })
let endpoint, method, headers, params, body, rest
if (typeof endpointOrConfig === 'object' && endpointOrConfig !== null) {
@@ -134,10 +134,10 @@ class ApiClient {
delete rest.data; delete rest.headers
}
if (endpoint.startsWith('/wp-json/aksrt/v1')) {
endpoint = endpoint.replace('/wp-json/aksrt/v1', '') || '/'
} else if (endpoint.startsWith('/aksrt/v1')) {
endpoint = endpoint.replace('/aksrt/v1', '') || '/'
if (endpoint.startsWith('/wp-json/jio/v1')) {
endpoint = endpoint.replace('/wp-json/jio/v1', '') || '/'
} else if (endpoint.startsWith('/jio/v1')) {
endpoint = endpoint.replace('/jio/v1', '') || '/'
}
let url = joinRestUrl(this.baseUrl, endpoint)
-5
View File
@@ -12,11 +12,6 @@ export const globalApiMethods = {
getFloatingButtons() { return this.request('/settings/floating-buttons') },
saveFloatingButtons(data) { return this.request('/settings/floating-buttons', { method: 'POST', body: JSON.stringify(data) }) },
getFriendLinks() { return this.request('/friend-links') },
addFriendLink(data) { return this.request('/friend-links', { method: 'POST', body: JSON.stringify(data) }) },
deleteFriendLink(id) { return this.request(`/friend-links/${id}`, { method: 'DELETE' }) },
reorderFriendLinks(ids) { return this.request('/friend-links/reorder', { method: 'POST', body: JSON.stringify({ ids }) }) },
getCmsFeatures() { return this.request('/settings/cms-features') },
saveCmsFeatures(cms_features) { return this.request('/settings/cms-features', { method: 'POST', body: JSON.stringify({ cms_features }) }) },
}
+5 -5
View File
@@ -1,13 +1,13 @@
/**
* 工单管理端 REST(命名空间 aksrt/v1/admin)。
* 工单管理端 REST(命名空间 jio/v1/admin)。
*
* TicketRestAdmin 把三块字典 CRUD(工单状态 / 部门 / 预设回复)挂在
* aksrt/v1/admin 下,全部要求 manage_options。api 客户端的 baseUrl 只到
* aksrt/v1,因此这里必须用 /aksrt/ 全路径形式(joinRestUrl 的
* startsWith('/aksrt/') 分支会原样拼接,不再追加 base 前缀)。
* jio/v1/admin 下,全部要求 manage_options。api 客户端的 baseUrl 只到
* jio/v1,因此这里必须用 /jio/ 全路径形式(joinRestUrl 的
* startsWith('/jio/') 分支会原样拼接,不再追加 base 前缀)。
*/
const ADMIN = '/aksrt/v1/admin/tickets'
const ADMIN = '/jio/v1/admin/tickets'
export const ticketsApiMethods = {
/* ---------------- 工单状态 ---------------- */
-4
View File
@@ -27,8 +27,4 @@ export const usersApiMethods = {
adjustUserCredits(id, asset, delta, remark) {
return this.request(`/assets/accounts/${id}/adjust`, { method: 'POST', body: JSON.stringify({ asset, delta, remark }) })
},
getCreditLog(params = {}) {
const qs = new URLSearchParams(params).toString()
return this.request('/assets/transactions' + (qs ? `?${qs}` : ''))
},
}
+32 -32
View File
@@ -1,35 +1,35 @@
<template>
<div class="aksrt-deferred-page">
<div class="aksrt-deferred-page__icon">
<div class="jio-deferred-page">
<div class="jio-deferred-page__icon">
<FaIcon :icon="resolvedIcon" :size="48" />
</div>
<h2 class="aksrt-deferred-page__title">{{ resolvedTitle }}</h2>
<p class="aksrt-deferred-page__desc">{{ resolvedDesc }}</p>
<div class="aksrt-deferred-page__meta">
<h2 class="jio-deferred-page__title">{{ resolvedTitle }}</h2>
<p class="jio-deferred-page__desc">{{ resolvedDesc }}</p>
<div class="jio-deferred-page__meta">
<n-tag size="small" type="info">{{ resolvedStatus }}</n-tag>
<n-tag v-if="resolvedPhase" size="small" type="warning">Phase {{ resolvedPhase }}</n-tag>
</div>
<div v-if="resolvedDependsOn.length" class="aksrt-deferred-page__depends">
<span class="aksrt-deferred-page__label">依赖</span>
<div class="aksrt-deferred-page__depends-list">
<div v-if="resolvedDependsOn.length" class="jio-deferred-page__depends">
<span class="jio-deferred-page__label">依赖</span>
<div class="jio-deferred-page__depends-list">
<n-tag v-for="item in resolvedDependsOn" :key="item" size="small" type="default">{{ item }}</n-tag>
</div>
</div>
<div v-if="resolvedReason" class="aksrt-deferred-page__reason">
<span class="aksrt-deferred-page__label">原因</span>
<div v-if="resolvedReason" class="jio-deferred-page__reason">
<span class="jio-deferred-page__label">原因</span>
<p>{{ resolvedReason }}</p>
</div>
<div v-if="resolvedFeatures && resolvedFeatures.length" class="aksrt-deferred-page__features">
<div v-if="resolvedFeatures && resolvedFeatures.length" class="jio-deferred-page__features">
<div
v-for="(feat, i) in resolvedFeatures"
:key="i"
class="aksrt-deferred-page__feature"
class="jio-deferred-page__feature"
>
<FaIcon icon="fa fas fa-check-circle" :size="14" />
<span>{{ feat }}</span>
</div>
</div>
<div class="aksrt-deferred-page__badge">
<div class="jio-deferred-page__badge">
<n-tag type="info" size="small">即将推出</n-tag>
</div>
</div>
@@ -78,7 +78,7 @@ const resolvedFeatures = computed(() => {
</script>
<style scoped>
.aksrt-deferred-page {
.jio-deferred-page {
display: flex;
flex-direction: column;
align-items: center;
@@ -88,75 +88,75 @@ const resolvedFeatures = computed(() => {
padding: 40px 20px;
}
.aksrt-deferred-page__icon {
color: var(--aksrt-color-border-strong);
.jio-deferred-page__icon {
color: var(--jio-color-border-strong);
margin-bottom: 20px;
}
.aksrt-deferred-page__title {
.jio-deferred-page__title {
margin: 0 0 10px;
font-size: 20px;
font-weight: 600;
color: var(--aksrt-color-text);
color: var(--jio-color-text);
}
.aksrt-deferred-page__desc {
.jio-deferred-page__desc {
margin: 0 0 20px;
font-size: 14px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
max-width: 400px;
line-height: 1.6;
}
.aksrt-deferred-page__meta {
.jio-deferred-page__meta {
display: flex;
gap: 10px;
margin-bottom: 18px;
}
.aksrt-deferred-page__depends,
.aksrt-deferred-page__reason {
.jio-deferred-page__depends,
.jio-deferred-page__reason {
width: min(520px, 100%);
margin-bottom: 18px;
text-align: left;
}
.aksrt-deferred-page__label {
.jio-deferred-page__label {
display: inline-block;
margin-bottom: 8px;
font-size: 12px;
font-weight: 600;
color: var(--aksrt-color-text-secondary);
color: var(--jio-color-text-secondary);
}
.aksrt-deferred-page__depends-list {
.jio-deferred-page__depends-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.aksrt-deferred-page__reason p {
.jio-deferred-page__reason p {
margin: 0;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
line-height: 1.7;
}
.aksrt-deferred-page__features {
.jio-deferred-page__features {
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 20px;
}
.aksrt-deferred-page__feature {
.jio-deferred-page__feature {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
}
.aksrt-deferred-page__feature :deep(i) {
.jio-deferred-page__feature :deep(i) {
color: #52c41a;
}
</style>
+11 -11
View File
@@ -1,10 +1,10 @@
<template>
<div class="aksrt-empty-state">
<div class="aksrt-empty-state__icon">
<div class="jio-empty-state">
<div class="jio-empty-state__icon">
<i :class="icon" style="font-size: 48px;"></i>
</div>
<h3 class="aksrt-empty-state__title">{{ title }}</h3>
<p class="aksrt-empty-state__desc">{{ desc }}</p>
<h3 class="jio-empty-state__title">{{ title }}</h3>
<p class="jio-empty-state__desc">{{ desc }}</p>
</div>
</template>
@@ -17,7 +17,7 @@ defineProps({
</script>
<style scoped>
.aksrt-empty-state {
.jio-empty-state {
display: flex;
flex-direction: column;
align-items: center;
@@ -26,22 +26,22 @@ defineProps({
text-align: center;
}
.aksrt-empty-state__icon {
.jio-empty-state__icon {
margin-bottom: 20px;
color: var(--aksrt-color-border-strong);
color: var(--jio-color-border-strong);
}
.aksrt-empty-state__title {
.jio-empty-state__title {
margin: 0 0 8px;
font-size: 18px;
font-weight: 600;
color: var(--aksrt-color-text);
color: var(--jio-color-text);
}
.aksrt-empty-state__desc {
.jio-empty-state__desc {
margin: 0;
font-size: 13px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
max-width: 360px;
line-height: 1.65;
}
+16 -16
View File
@@ -1,7 +1,7 @@
<template>
<header class="aksrt-mobile-topbar">
<header class="jio-mobile-topbar">
<button
class="aksrt-mobile-topbar__menu"
class="jio-mobile-topbar__menu"
type="button"
aria-label="打开菜单"
@click="$emit('toggle')"
@@ -13,35 +13,35 @@
</svg>
</button>
<div class="aksrt-mobile-topbar__title">{{ title }}</div>
<div class="jio-mobile-topbar__title">{{ title }}</div>
<div class="aksrt-mobile-topbar__brand">AK</div>
<div class="jio-mobile-topbar__brand">AK</div>
</header>
</template>
<script setup>
defineProps({
title: { type: String, default: 'AKSRT' },
title: { type: String, default: 'Jio' },
})
defineEmits(['toggle'])
</script>
<style scoped>
.aksrt-mobile-topbar {
.jio-mobile-topbar {
display: flex;
align-items: center;
gap: 10px;
height: 48px;
padding: 0 14px;
background: var(--aksrt-color-surface);
border-bottom: 1px solid var(--aksrt-color-border);
background: var(--jio-color-surface);
border-bottom: 1px solid var(--jio-color-border);
position: sticky;
top: 0;
z-index: 50;
}
.aksrt-mobile-topbar__menu {
.jio-mobile-topbar__menu {
display: inline-flex;
align-items: center;
justify-content: center;
@@ -50,26 +50,26 @@ defineEmits(['toggle'])
border: none;
border-radius: 8px;
background: transparent;
color: var(--aksrt-color-text);
color: var(--jio-color-text);
cursor: pointer;
margin-left: -6px;
}
.aksrt-mobile-topbar__menu:hover {
background: var(--aksrt-color-primary-soft);
.jio-mobile-topbar__menu:hover {
background: var(--jio-color-primary-soft);
}
.aksrt-mobile-topbar__title {
.jio-mobile-topbar__title {
flex: 1 1 auto;
font-size: 15px;
font-weight: 600;
color: var(--aksrt-color-text);
color: var(--jio-color-text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.aksrt-mobile-topbar__brand {
.jio-mobile-topbar__brand {
flex: 0 0 auto;
display: inline-flex;
align-items: center;
@@ -77,7 +77,7 @@ defineEmits(['toggle'])
width: 28px;
height: 28px;
border-radius: 8px;
background: var(--aksrt-color-primary);
background: var(--jio-color-primary);
color: #fff;
font-size: 11px;
font-weight: 700;
+17 -17
View File
@@ -1,15 +1,15 @@
<template>
<header class="aksrt-page-header">
<div class="aksrt-page-header__main">
<h2 class="aksrt-page-header__title">{{ title }}</h2>
<p v-if="desc" class="aksrt-page-header__desc">
<header class="jio-page-header">
<div class="jio-page-header__main">
<h2 class="jio-page-header__title">{{ title }}</h2>
<p v-if="desc" class="jio-page-header__desc">
<slot name="desc">{{ desc }}</slot>
</p>
<div v-else-if="$slots.desc" class="aksrt-page-header__desc">
<div v-else-if="$slots.desc" class="jio-page-header__desc">
<slot name="desc" />
</div>
</div>
<div v-if="$slots.actions" class="aksrt-page-header__actions">
<div v-if="$slots.actions" class="jio-page-header__actions">
<slot name="actions" />
</div>
</header>
@@ -23,7 +23,7 @@ defineProps({
</script>
<style scoped>
.aksrt-page-header {
.jio-page-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
@@ -32,28 +32,28 @@ defineProps({
flex-wrap: wrap;
}
.aksrt-page-header__main {
.jio-page-header__main {
flex: 1 1 auto;
min-width: 0;
}
.aksrt-page-header__title {
.jio-page-header__title {
margin: 0 0 6px;
color: var(--aksrt-color-text);
color: var(--jio-color-text);
font-size: 22px;
font-weight: 700;
letter-spacing: -0.02em;
line-height: 1.3;
}
.aksrt-page-header__desc {
.jio-page-header__desc {
margin: 0;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
font-size: 13px;
line-height: 1.65;
}
.aksrt-page-header__actions {
.jio-page-header__actions {
flex: 0 0 auto;
display: flex;
align-items: center;
@@ -61,20 +61,20 @@ defineProps({
}
@media (max-width: 768px) {
.aksrt-page-header {
.jio-page-header {
margin-bottom: 14px;
gap: 10px;
}
.aksrt-page-header__title {
.jio-page-header__title {
font-size: 18px;
}
.aksrt-page-header__desc {
.jio-page-header__desc {
font-size: 12px;
}
.aksrt-page-header__actions {
.jio-page-header__actions {
width: 100%;
}
}
@@ -38,8 +38,9 @@
<n-form-item label="AccessKey Secret">
<n-input
v-model:value="model.access_key_secret"
type="password"
type="text"
show-password-on="click"
class="jio-secret-input"
autocomplete="new-password"
placeholder="阿里云 RAM 用户 AccessKey Secret"
@update:value="onSecretInput('access_key_secret', $event)"
@@ -5,7 +5,7 @@
<n-input v-model:value="model.site_key" placeholder="Cloudflare Turnstile Site Key" autocomplete="off" />
</n-form-item>
<n-form-item label="Secret Key">
<n-input v-model:value="model.secret_key" type="password" show-password-on="click" autocomplete="new-password" @update:value="onSecretInput('secret_key', $event)" />
<n-input v-model:value="model.secret_key" type="text" show-password-on="click" class="jio-secret-input" autocomplete="new-password" @update:value="onSecretInput('secret_key', $event)" />
<n-button v-if="model.secret_key === '***'" size="tiny" type="error" ghost style="margin-left:8px" @click="clearSecret('secret_key')">清除</n-button>
</n-form-item>
<n-form-item label="主题">
@@ -5,7 +5,7 @@
<n-input v-model:value="model.captcha_id" placeholder="极验 GeeTest CaptchaID" autocomplete="off" />
</n-form-item>
<n-form-item label="Captcha Key">
<n-input v-model:value="model.captcha_key" type="password" show-password-on="click" autocomplete="new-password" @update:value="onSecretInput('captcha_key', $event)" />
<n-input v-model:value="model.captcha_key" type="text" show-password-on="click" class="jio-secret-input" autocomplete="new-password" @update:value="onSecretInput('captcha_key', $event)" />
<n-button v-if="model.captcha_key === '***'" size="tiny" type="error" ghost style="margin-left:8px" @click="clearSecret('captcha_key')">清除</n-button>
</n-form-item>
<n-tag v-if="isConfigured" type="success" size="small">✓ 已完整配置</n-tag>
@@ -9,7 +9,7 @@
<n-input v-model:value="model.secret_id" placeholder="腾讯云 API SecretId" autocomplete="off" />
</n-form-item>
<n-form-item label="SecretKey">
<n-input v-model:value="model.secret_key" type="password" placeholder="腾讯云 API SecretKey" autocomplete="new-password" show-password-on="click" @update:value="onSecretInput('secret_key', $event)" />
<n-input v-model:value="model.secret_key" type="text" class="jio-secret-input" placeholder="腾讯云 API SecretKey" autocomplete="off" @update:value="onSecretInput('secret_key', $event)" />
<n-button v-if="model.secret_key === '***'" size="tiny" type="error" ghost style="margin-left:8px" @click="clearSecret('secret_key')">清除</n-button>
</n-form-item>
@@ -18,7 +18,7 @@
<n-input v-model:value="model.app_id" placeholder="从验证码控制台获取 CaptchaAppId" autocomplete="off" />
</n-form-item>
<n-form-item label="AppSecretKey">
<n-input v-model:value="model.app_secret_key" type="password" placeholder="从验证码控制台获取 AppSecretKey" autocomplete="new-password" show-password-on="click" @update:value="onSecretInput('app_secret_key', $event)" />
<n-input v-model:value="model.app_secret_key" type="text" class="jio-secret-input" placeholder="从验证码控制台获取 AppSecretKey" autocomplete="off" @update:value="onSecretInput('app_secret_key', $event)" />
<n-button v-if="model.app_secret_key === '***'" size="tiny" type="error" ghost style="margin-left:8px" @click="clearSecret('app_secret_key')">清除</n-button>
<template #feedback>请从「验证管理 → 基础配置」完整复制,注意区分 I/l/1/O/0</template>
</n-form-item>
@@ -1,5 +1,5 @@
<template>
<n-form label-placement="left" label-width="110" class="aksrt-form float-common-fields">
<n-form label-placement="left" label-width="110" class="jio-form float-common-fields">
<n-form-item label="PC端显示" :show-feedback="false">
<n-switch :value="!!modelValue.pc_s" @update:value="update('pc_s', $event)" />
</n-form-item>
@@ -10,22 +10,20 @@
<div class="float-common-fields__colors">
<div class="float-common-fields__color">
<span>自定义图标颜色</span>
<n-color-picker
:value="modelValue.color?.color || null"
:show-alpha="true"
:modes="['hex', 'rgb']"
<JioColorPicker
:model-value="modelValue.color?.color || ''"
alpha
clearable
@update:value="updateColor('color', $event)"
@update:model-value="updateColor('color', $event)"
/>
</div>
<div class="float-common-fields__color">
<span>自定义背景颜色</span>
<n-color-picker
:value="modelValue.color?.bg || null"
:show-alpha="true"
:modes="['hex', 'rgb']"
<JioColorPicker
:model-value="modelValue.color?.bg || ''"
alpha
clearable
@update:value="updateColor('bg', $event)"
@update:model-value="updateColor('bg', $event)"
/>
</div>
</div>
@@ -35,6 +33,8 @@
</template>
<script setup>
import JioColorPicker from '@/components/form/JioColorPicker.vue'
const props = defineProps({
modelValue: { type: Object, required: true },
})
@@ -1,23 +1,29 @@
<template>
<div class="float-btn-panel">
<div class="float-btn-panel__head" @click="expanded = !expanded">
<button type="button" class="float-btn-panel__handle" aria-label="拖拽排序" @click.stop>
<i class="fa fas fa-arrows-alt-v" />
</button>
<strong class="float-btn-panel__title">{{ meta.title }}</strong>
<template v-if="modelValue.type !== 'more'">
<n-tag v-if="modelValue.pc_s" size="small" type="info" :bordered="false">PC</n-tag>
<n-tag v-if="modelValue.m_s" size="small" type="warning" :bordered="false">移动</n-tag>
<n-tag v-if="!modelValue.pc_s && !modelValue.m_s" size="small" :bordered="false">未显示</n-tag>
</template>
<n-tag v-else size="small" :bordered="false">{{ modelValue.buttons.length }} 个</n-tag>
<span v-if="meta.warn" class="float-btn-panel__warn">
<i class="fa fas fa-info-circle" /> {{ meta.warn }}
</span>
<i class="fa fas float-btn-panel__arrow" :class="expanded ? 'fa-angle-up' : 'fa-angle-down'" />
<div class="jio-sortable__head" v-bind="headAttrs">
<JioSortHandle @click.stop />
<div class="jio-sortable__main">
<div class="jio-sortable__title-row">
<span class="jio-sortable__title">{{ meta.title }}</span>
<template v-if="modelValue.type !== 'more'">
<n-tag v-if="modelValue.pc_s" size="small" type="info" :bordered="false">PC</n-tag>
<n-tag v-if="modelValue.m_s" size="small" type="warning" :bordered="false">移动</n-tag>
<n-tag v-if="!modelValue.pc_s && !modelValue.m_s" size="small" :bordered="false">未显示</n-tag>
</template>
<n-tag v-else size="small" :bordered="false">{{ modelValue.buttons.length }} 个</n-tag>
</div>
<span v-if="meta.warn" class="jio-sortable__desc float-btn-panel__warn">
<i class="fa fas fa-info-circle" aria-hidden="true" /> {{ meta.warn }}
</span>
</div>
<i
class="fa fas jio-sortable__toggle"
:class="expanded ? 'fa-chevron-down' : 'fa-chevron-right'"
aria-hidden="true"
/>
</div>
<div v-show="expanded" class="float-btn-panel__body">
<div v-show="expanded" class="jio-sortable__body">
<div class="float-btn-panel__subtitle">{{ meta.panel }}</div>
<FloatMoreButtonsEditor
@@ -29,7 +35,7 @@
<template v-else>
<FloatBtnCommonFields :model-value="modelValue" @update:model-value="emit('update:modelValue', $event)" />
<n-form label-placement="left" label-width="110" class="aksrt-form float-btn-panel__extra">
<n-form label-placement="left" label-width="110" class="jio-form float-btn-panel__extra">
<n-form-item v-if="modelValue.type === 'qrcode'" label="一句话简介">
<n-input :value="modelValue.desc" @update:value="patch({ desc: $event })" />
</n-form-item>
@@ -43,7 +49,7 @@
</n-form-item>
<n-form-item v-if="modelValue.type === 'service_wechat'" label="微信二维码">
<AksMediaField
<JioMediaField
:model-value="modelValue.wechat_img"
placeholder="选择二维码图片"
@update:model-value="patch({ wechat_img: $event })"
@@ -56,9 +62,12 @@
</template>
<script setup>
/** 悬浮按钮排序列表中的单个卡片;外层 .jio-sortable__item 由 FloatingButtonsSettings 提供。 */
import { computed, ref } from 'vue'
import FaIconPicker from '@/components/form/FaIconPicker.vue'
import AksMediaField from '@/components/form/AksMediaField.vue'
import JioMediaField from '@/components/form/JioMediaField.vue'
import JioSortHandle from '@/components/form/JioSortHandle.vue'
import { collapseHeadAttrs } from '@/components/form/useCollapsibleItems.js'
import FloatBtnCommonFields from './FloatBtnCommonFields.vue'
import FloatMoreButtonsEditor from './FloatMoreButtonsEditor.vue'
import { FLOAT_BTN_META } from './floating-defaults.js'
@@ -69,6 +78,7 @@ const props = defineProps({
const emit = defineEmits(['update:modelValue'])
const expanded = ref(false)
const headAttrs = computed(() => collapseHeadAttrs(expanded.value, () => { expanded.value = !expanded.value }))
const meta = computed(() => FLOAT_BTN_META[props.modelValue.type] || { title: props.modelValue.type, panel: '' })
const addIcon = computed({
@@ -82,76 +92,18 @@ function patch(partial) {
</script>
<style scoped>
.float-btn-panel {
border: 1px solid var(--n-border-color, rgba(0, 0, 0, 0.09));
border-radius: 8px;
background: var(--n-card-color, #fff);
}
.float-btn-panel__head {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 14px;
cursor: pointer;
user-select: none;
}
.float-btn-panel__handle {
width: 26px;
height: 26px;
border: 0;
background: transparent;
color: var(--n-text-color-3, #999);
cursor: grab;
}
.float-btn-panel__handle:active {
cursor: grabbing;
}
.float-btn-panel__title {
font-size: 14px;
}
.float-btn-panel__arrow {
margin-left: auto;
color: var(--n-text-color-3, #999);
}
.float-btn-panel__warn {
font-size: 12px;
color: #f0a020;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
min-width: 0;
}
.float-btn-panel__body {
padding: 12px 16px 16px;
border-top: 1px solid var(--n-border-color, rgba(0, 0, 0, 0.09));
color: var(--jio-color-warning, #D97706);
}
.float-btn-panel__subtitle {
font-weight: 600;
font-size: 13px;
margin-bottom: 12px;
color: var(--jio-color-text);
font-size: 13px;
font-weight: 600;
}
.float-btn-panel__extra {
margin-top: 12px;
}
.float-btn-panel__block {
display: flex;
flex-direction: column;
gap: 6px;
width: 100%;
}
.float-btn-panel__desc {
font-size: 12px;
color: var(--n-text-color-3, #999);
}
</style>
@@ -24,7 +24,7 @@
</n-button>
</template>
<n-form label-placement="left" label-width="110" class="aksrt-form">
<n-form label-placement="left" label-width="110" class="jio-form">
<n-form-item label="按钮简介">
<n-input :value="btn.desc" @update:value="patch(index, { desc: $event })" />
</n-form-item>
@@ -16,32 +16,21 @@ export const FLOAT_BTN_META = {
more: { title: '更多按钮', panel: '添加更多自定义按钮' },
}
const themeUri = (window.aksrtAdminData?.themeUri || '').replace(/\/$/, '')
/** 「更多按钮」出厂默认项(对齐参考主题 float_btn.more 默认值)。 */
/** 「更多按钮」出厂默认项:不预设任何第三方指向,只给一个图标按钮。 */
export function giftMoreButton() {
return {
desc: '本站同款主题模板',
icon: 'zibsvg-gift-color',
desc: '',
icon: 'jiosvg-gift-color',
link: { url: '', target: '' },
hover: `<a href="https://www.zibll.com/" target="_blank">
<div class="flex c-red">
<img class="flex0" alt="zibll子比主题" src="${themeUri}/assets/img/logo.png" height="30">
<div class="flex1 ml10">
<dt>本站同款主题模板</dt>
<div class="px12 mt10 muted-color">zibll子比主题是一款漂亮优雅的网站主题模板,功能强大,配置简单。</div>
<div class="but mt10 p2-10 c-blue btn-block px12">查看详情</div>
</div>
</div>
</a>`,
hover_width: 240,
hover: '',
hover_width: 200,
pc_s: true,
m_s: true,
color: { color: '', bg: 'rgba(255, 111, 6, 0.2)' },
}
}
/** 「添加按钮」新增项默认值(参考主题 group 字段默认值)。 */
/** 「添加按钮」新增项默认值。 */
export function defaultMoreButton() {
return {
desc: '',
@@ -1,128 +0,0 @@
<template>
<div class="aksrt-array-table">
<n-data-table
:columns="tableColumns"
:data="modelValue || []"
:bordered="false"
size="small"
max-height="400"
/>
<n-button
size="small"
dashed
block
class="aksrt-array-table__add"
@click="addItem"
>
<FaIcon icon="fa fas fa-plus" :size="12" />
{{ addText || '添加行' }}
</n-button>
</div>
</template>
<script setup>
/**
* AksArrayTable — table-style editor for array data.
* Renders rows in a data table with inline editing.
*/
import { computed, h } from 'vue'
import { NInput, NSwitch, NButton, NSelect, NInputNumber } from 'naive-ui'
import FaIcon from './FaIcon.vue'
const props = defineProps({
modelValue: { type: Array, default: () => [] },
/** Column definitions: [{ key, label, type?, options?, width? }] */
columns: { type: Array, required: true },
defaults: { type: Object, default: () => ({}) },
addText: { type: String, default: '' },
maxRows: { type: Number, default: Infinity },
})
const emit = defineEmits(['update:modelValue'])
function updateCell(rowIndex, key, value) {
const list = [...(props.modelValue || [])]
list[rowIndex] = { ...list[rowIndex], [key]: value }
emit('update:modelValue', list)
}
function removeItem(index) {
const list = (props.modelValue || []).filter((_, i) => i !== index)
emit('update:modelValue', list)
}
function addItem() {
if ((props.modelValue || []).length >= props.maxRows) return
const item = {}
for (const col of props.columns) {
item[col.key] = col.default ?? (col.type === 'switch' ? false : '')
}
emit('update:modelValue', [...(props.modelValue || []), { ...item, ...props.defaults }])
}
function moveUp(index) {
if (index <= 0) return
const list = [...(props.modelValue || [])]
;[list[index - 1], list[index]] = [list[index], list[index - 1]]
emit('update:modelValue', list)
}
function moveDown(index) {
const list = [...(props.modelValue || [])]
if (index >= list.length - 1) return
;[list[index], list[index + 1]] = [list[index + 1], list[index]]
emit('update:modelValue', list)
}
const tableColumns = computed(() => {
const cols = props.columns.map(col => ({
title: col.label,
key: col.key,
width: col.width || 150,
render(row, rowIndex) {
const val = row[col.key]
const update = (v) => updateCell(rowIndex, col.key, v)
if (col.type === 'switch') {
return h(NSwitch, { value: val, size: 'small', 'onUpdate:value': update })
}
if (col.type === 'select') {
return h(NSelect, { value: val, options: col.options || [], size: 'small', 'onUpdate:value': update })
}
if (col.type === 'number') {
return h(NInputNumber, { value: val, size: 'small', style: 'width:100%', 'onUpdate:value': update })
}
return h(NInput, { value: val, size: 'small', 'onUpdate:value': update })
},
}))
// Add actions column
cols.push({
title: '操作',
key: '_actions',
width: 100,
render(row, rowIndex) {
return h('div', { style: 'display:flex;gap:2px' }, [
rowIndex > 0 ? h(NButton, { size: 'tiny', quaternary: true, onClick: () => moveUp(rowIndex) }, {
default: () => h(FaIcon, { icon: 'fa fas fa-arrow-up', size: 12 }),
}) : null,
rowIndex < (props.modelValue?.length || 0) - 1 ? h(NButton, { size: 'tiny', quaternary: true, onClick: () => moveDown(rowIndex) }, {
default: () => h(FaIcon, { icon: 'fa fas fa-arrow-down', size: 12 }),
}) : null,
h(NButton, { size: 'tiny', quaternary: true, type: 'error', onClick: () => removeItem(rowIndex) }, {
default: () => h(FaIcon, { icon: 'fa fas fa-trash-alt', size: 12 }),
}),
])
},
})
return cols
})
</script>
<style scoped>
.aksrt-array-table__add {
margin-top: 10px;
}
</style>
File diff suppressed because it is too large. Load diff
@@ -1,185 +0,0 @@
<template>
<div class="aksrt-repeater">
<div v-if="modelValue && modelValue.length" class="aksrt-repeater__list">
<div
v-for="(item, index) in modelValue"
:key="index"
class="aksrt-repeater__item"
>
<div class="aksrt-repeater__item-header">
<span class="aksrt-repeater__item-index">#{{ index + 1 }}</span>
<div class="aksrt-repeater__item-actions">
<n-button
v-if="index > 0"
size="tiny"
quaternary
@click="moveUp(index)"
>
<FaIcon icon="fa fas fa-arrow-up" :size="12" />
</n-button>
<n-button
v-if="index < modelValue.length - 1"
size="tiny"
quaternary
@click="moveDown(index)"
>
<FaIcon icon="fa fas fa-arrow-down" :size="12" />
</n-button>
<n-button
size="tiny"
quaternary
type="error"
@click="removeItem(index)"
>
<FaIcon icon="fa fas fa-trash-alt" :size="12" />
</n-button>
</div>
</div>
<div class="aksrt-repeater__item-fields">
<AksField
v-for="field in fields"
:key="field.key"
:schema="field"
:model-value="item[field.key]"
@update:model-value="updateField(index, field.key, $event)"
/>
</div>
</div>
</div>
<div v-else class="aksrt-repeater__empty">
<FaIcon icon="fa fas fa-inbox" :size="20" />
<span>{{ emptyText || '暂无数据' }}</span>
</div>
<n-button
size="small"
dashed
block
class="aksrt-repeater__add"
@click="addItem"
>
<FaIcon icon="fa fas fa-plus" :size="12" />
{{ addText || '添加项目' }}
</n-button>
</div>
</template>
<script setup>
/**
* AksRepeaterField — dynamic add/remove rows of structured data.
* Each row renders fields based on the provided field schemas.
*/
import AksField from './AksField.vue'
import FaIcon from './FaIcon.vue'
const props = defineProps({
modelValue: { type: Array, default: () => [] },
/** Array of field schemas for each row */
fields: { type: Array, required: true },
/** Default value for a new item */
defaults: { type: Object, default: () => ({}) },
emptyText: { type: String, default: '' },
addText: { type: String, default: '' },
maxItems: { type: Number, default: Infinity },
})
const emit = defineEmits(['update:modelValue'])
function createItem() {
const item = {}
for (const field of props.fields) {
item[field.key] = field.default ?? (field.type === 'switch' ? false : '')
}
return { ...item, ...props.defaults }
}
function addItem() {
if (props.modelValue.length >= props.maxItems) return
const list = [...props.modelValue, createItem()]
emit('update:modelValue', list)
}
function removeItem(index) {
const list = props.modelValue.filter((_, i) => i !== index)
emit('update:modelValue', list)
}
function moveUp(index) {
if (index <= 0) return
const list = [...props.modelValue]
;[list[index - 1], list[index]] = [list[index], list[index - 1]]
emit('update:modelValue', list)
}
function moveDown(index) {
if (index >= props.modelValue.length - 1) return
const list = [...props.modelValue]
;[list[index], list[index + 1]] = [list[index + 1], list[index]]
emit('update:modelValue', list)
}
function updateField(index, key, value) {
const list = [...props.modelValue]
list[index] = { ...list[index], [key]: value }
emit('update:modelValue', list)
}
</script>
<style scoped>
.aksrt-repeater__list {
display: flex;
flex-direction: column;
gap: 10px;
margin-bottom: 10px;
}
.aksrt-repeater__item {
border: 1px solid var(--aksrt-color-border);
border-radius: 8px;
padding: 12px;
background: var(--aksrt-color-canvas);
}
.aksrt-repeater__item-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
}
.aksrt-repeater__item-index {
font-size: 12px;
font-weight: 600;
color: var(--aksrt-color-primary);
background: var(--aksrt-color-primary-soft);
padding: 2px 8px;
border-radius: 4px;
}
.aksrt-repeater__item-actions {
display: flex;
gap: 2px;
}
.aksrt-repeater__item-fields {
display: flex;
flex-direction: column;
gap: 4px;
}
.aksrt-repeater__empty {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
padding: 24px;
color: var(--aksrt-color-border-strong);
font-size: 13px;
}
.aksrt-repeater__add {
margin-top: 4px;
}
</style>
@@ -1,112 +0,0 @@
<template>
<div class="aksrt-sorter">
<div class="aksrt-sorter__column">
<div class="aksrt-sorter__title">
<span>已启用</span>
<n-tag size="small" type="success" :bordered="false">{{ columns.enabled.length }}</n-tag>
</div>
<draggable
v-model="columns.enabled"
item-key="value"
group="aksrt-sorter"
handle=".aksrt-sorter__handle"
ghost-class="aksrt-sorter__ghost"
animation="180"
class="aksrt-sorter__list"
@change="commit"
>
<template #item="{ element }">
<div class="aksrt-sorter__item">
<i class="fa fas fa-grip-vertical aksrt-sorter__handle" aria-hidden="true"></i>
<i v-if="element.icon" :class="element.icon" aria-hidden="true"></i>
<span>{{ element.label }}</span>
</div>
</template>
</draggable>
<n-empty v-if="columns.enabled.length === 0" size="small" description="暂无启用项" />
</div>
<div class="aksrt-sorter__column aksrt-sorter__column--disabled">
<div class="aksrt-sorter__title">
<span>未启用</span>
<n-tag size="small" :bordered="false">{{ columns.disabled.length }}</n-tag>
</div>
<draggable
v-model="columns.disabled"
item-key="value"
group="aksrt-sorter"
handle=".aksrt-sorter__handle"
ghost-class="aksrt-sorter__ghost"
animation="180"
class="aksrt-sorter__list"
@change="commit"
>
<template #item="{ element }">
<div class="aksrt-sorter__item">
<i class="fa fas fa-grip-vertical aksrt-sorter__handle" aria-hidden="true"></i>
<i v-if="element.icon" :class="element.icon" aria-hidden="true"></i>
<span>{{ element.label }}</span>
</div>
</template>
</draggable>
<n-empty v-if="columns.disabled.length === 0" size="small" description="暂无未启用项" />
</div>
</div>
</template>
<script setup>
import { reactive, watch } from 'vue'
import draggable from 'vuedraggable'
const props = defineProps({
modelValue: { type: Object, default: () => ({}) },
options: { type: Array, default: () => [] },
})
const emit = defineEmits(['update:modelValue'])
const columns = reactive({ enabled: [], disabled: [] })
let syncing = false
function keysOf(value) {
if (Array.isArray(value)) return value.map(String)
return value && typeof value === 'object' ? Object.keys(value) : []
}
function syncColumns() {
syncing = true
const byKey = new Map(props.options.map(option => [String(option.value), option]))
const used = new Set()
const normalize = keys => keys.filter(key => byKey.has(key) && !used.has(key)).map(key => {
used.add(key)
return byKey.get(key)
})
columns.enabled = normalize(keysOf(props.modelValue?.enabled))
columns.disabled = normalize(keysOf(props.modelValue?.disabled))
for (const option of props.options) {
if (!used.has(String(option.value))) columns.disabled.push(option)
}
syncing = false
}
function commit() {
if (syncing) return
const toMap = items => Object.fromEntries(items.map(item => [String(item.value), String(item.label)]))
emit('update:modelValue', {
enabled: toMap(columns.enabled),
disabled: toMap(columns.disabled),
})
}
watch(() => [props.modelValue, props.options], syncColumns, { immediate: true, deep: true })
</script>
<style scoped>
.aksrt-sorter { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.aksrt-sorter__column { min-height:210px; padding:12px; border:1px solid var(--aksrt-color-border); border-radius:6px; background:var(--aksrt-color-surface); }
.aksrt-sorter__column--disabled { background:var(--aksrt-color-canvas); }
.aksrt-sorter__title { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; font-weight:600; }
.aksrt-sorter__list { display:grid; gap:7px; min-height:44px; }
.aksrt-sorter__item { display:flex; align-items:center; gap:9px; min-height:38px; padding:7px 10px; border:1px solid var(--aksrt-color-border); border-radius:4px; background:var(--aksrt-color-surface); }
.aksrt-sorter__handle { color:var(--aksrt-color-text-tertiary); cursor:grab; }
.aksrt-sorter__ghost { opacity:.45; border-color:var(--aksrt-color-primary); }
@media (max-width:720px) { .aksrt-sorter { grid-template-columns:1fr; } }
</style>
@@ -1,5 +1,5 @@
<template>
<div class="aksrt-fa-icon-picker">
<div class="jio-fa-icon-picker">
<n-popover v-model:show="popoverShow" trigger="click" placement="bottom-start" :width="460" :style="{ padding: 0 }">
<template #trigger>
<n-input
@@ -19,8 +19,8 @@
</n-input>
</template>
<div class="aksrt-icon-picker__panel" @click="onPanelClick">
<div class="aksrt-icon-picker__search">
<div class="jio-icon-picker__panel" @click="onPanelClick">
<div class="jio-icon-picker__search">
<n-input v-model:value="search" placeholder="搜索图标..." size="small" clearable>
<template #prefix>
<FaIcon icon="fa fas fa-search" :size="12" />
@@ -28,12 +28,12 @@
</n-input>
</div>
<div class="aksrt-icon-picker__tabs">
<div class="jio-icon-picker__tabs">
<button
v-for="tab in tabs"
:key="tab.id"
type="button"
class="aksrt-icon-picker__tab"
class="jio-icon-picker__tab"
:class="{ 'is-active': activeTab === tab.id }"
@click="activeTab = tab.id"
>
@@ -42,23 +42,23 @@
</div>
<!-- Custom SVG tab -->
<div v-if="activeTab === 'custom'" class="aksrt-icon-picker__custom">
<div v-if="activeTab === 'custom'" class="jio-icon-picker__custom">
<n-input v-model:value="customCode" type="textarea" placeholder='&lt;svg viewBox="0 0 1024 1024"&gt;&lt;path d="…"&gt;&lt;/path&gt;&lt;/svg&gt;' :rows="4" />
<div class="aksrt-icon-picker__custom-actions">
<span class="aksrt-icon-picker__custom-preview" v-html="customPreview"></span>
<div class="jio-icon-picker__custom-actions">
<span class="jio-icon-picker__custom-preview" v-html="customPreview"></span>
<n-button size="small" type="primary" :disabled="!customPreview" @click="insertCustom">
确认插入
</n-button>
</div>
<div
v-if="sessionCustom.length"
class="aksrt-icon-picker__grid aksrt-icon-picker__grid--session"
data-aksrt-icon-grid="custom"
class="jio-icon-picker__grid jio-icon-picker__grid--session"
data-jio-icon-grid="custom"
>
<div
v-for="(svg, i) in sessionCustom"
:key="i"
class="aksrt-icon-picker__item"
class="jio-icon-picker__item"
:class="{ 'is-active': modelValue === `customsvg-${svg}` }"
title="customsvg"
:data-icon="`customsvg-${svg}`"
@@ -68,11 +68,11 @@
</div>
<!-- Catalog tab -->
<div v-else class="aksrt-icon-picker__grid" data-aksrt-icon-grid="catalog">
<div v-else class="jio-icon-picker__grid" data-jio-icon-grid="catalog">
<div
v-for="icon in filteredIcons"
:key="icon"
class="aksrt-icon-picker__item"
class="jio-icon-picker__item"
:class="{ 'is-active': modelValue === composeIconValue(activeGroup, icon) }"
:title="icon"
:data-icon="composeIconValue(activeGroup, icon)"
@@ -80,11 +80,11 @@
<i v-if="activeGroup.type === 'fa'" :class="[activeTab, 'fa-' + icon]"></i>
<span
v-else
class="aksrt-icon-picker__preview-svg"
v-html="zibsvgMarkup(`zibsvg-${icon}`)"
class="jio-icon-picker__preview-svg"
v-html="jiosvgMarkup(`jiosvg-${icon}`)"
></span>
</div>
<div v-if="filteredIcons.length === 0" class="aksrt-icon-picker__empty">
<div v-if="filteredIcons.length === 0" class="jio-icon-picker__empty">
未找到匹配图标
</div>
</div>
@@ -96,7 +96,7 @@
<script setup>
/**
* FaIconPicker — universal icon picker backed by the server catalog
* (GET /aksrt/v1/icons/catalog): full FA5 free set, the theme's built-in
* (GET /jio/v1/icons/catalog): full FA5 free set, the theme's built-in
* SVG sprite keys and inline custom SVG values.
*/
import { ref, computed, onMounted } from 'vue'
@@ -105,7 +105,7 @@ import IconValue from './IconValue.vue'
import api from '@/api/index.js'
import {
cleanSvg,
zibsvgMarkup,
jiosvgMarkup,
composeIconValue,
} from '@/utils/icons.js'
@@ -120,7 +120,7 @@ const FALLBACK_TABS = [
{ id: 'fas', title: 'Solid', type: 'fa', icons: [] },
{ id: 'far', title: 'Regular', type: 'fa', icons: [] },
{ id: 'fab', title: 'Brands', type: 'fa', icons: [] },
{ id: 'zibsvg', title: '内置 SVG', type: 'svg', icons: [] },
{ id: 'jiosvg', title: '内置 SVG', type: 'svg', icons: [] },
{ id: 'custom', title: '自定义', type: 'custom', icons: [] },
]
@@ -176,53 +176,53 @@ onMounted(async () => {
</script>
<style scoped>
.aksrt-icon-picker__panel {
/* The popover teleports to <body>, outside #aksrt-admin-app where the
.jio-icon-picker__panel {
/* The popover teleports to <body>, outside #jio-admin-app where the
palette is declared — re-declare every token the panel consumes. */
--aksrt-color-primary: #18A058;
--aksrt-color-primary-hover: #36AD6A;
--aksrt-color-primary-soft: rgba(24, 160, 88, 0.12);
--aksrt-color-text-secondary: #465149;
--aksrt-color-muted: #6F7A72;
--aksrt-color-border: #E2E8E3;
--jio-color-primary: #18A058;
--jio-color-primary-hover: #36AD6A;
--jio-color-primary-soft: rgba(24, 160, 88, 0.12);
--jio-color-text-secondary: #465149;
--jio-color-muted: #6F7A72;
--jio-color-border: #E2E8E3;
padding: 12px;
}
.aksrt-icon-picker__search {
.jio-icon-picker__search {
margin-bottom: 10px;
}
.aksrt-icon-picker__tabs {
.jio-icon-picker__tabs {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 10px;
}
.aksrt-icon-picker__tab {
.jio-icon-picker__tab {
padding: 3px 10px;
font-size: 13px;
line-height: 20px;
border: 1px solid var(--aksrt-color-border);
border: 1px solid var(--jio-color-border);
border-radius: 4px;
background: transparent;
color: var(--aksrt-color-text-secondary);
color: var(--jio-color-text-secondary);
cursor: pointer;
transition: all 0.15s;
}
.aksrt-icon-picker__tab:hover {
border-color: var(--aksrt-color-primary);
color: var(--aksrt-color-primary);
.jio-icon-picker__tab:hover {
border-color: var(--jio-color-primary);
color: var(--jio-color-primary);
}
.aksrt-icon-picker__tab.is-active {
border-color: var(--aksrt-color-primary);
background: var(--aksrt-color-primary);
.jio-icon-picker__tab.is-active {
border-color: var(--jio-color-primary);
background: var(--jio-color-primary);
color: #fff;
}
.aksrt-icon-picker__grid {
.jio-icon-picker__grid {
display: grid;
grid-template-columns: repeat(8, 1fr);
gap: 4px;
@@ -230,7 +230,7 @@ onMounted(async () => {
overflow-y: auto;
}
.aksrt-icon-picker__item {
.jio-icon-picker__item {
display: flex;
align-items: center;
justify-content: center;
@@ -239,60 +239,60 @@ onMounted(async () => {
border-radius: 6px;
cursor: pointer;
font-size: 16px;
color: var(--aksrt-color-text-secondary);
color: var(--jio-color-text-secondary);
transition: all 0.15s;
}
.aksrt-icon-picker__item:hover {
background: var(--aksrt-color-primary-soft);
color: var(--aksrt-color-primary);
.jio-icon-picker__item:hover {
background: var(--jio-color-primary-soft);
color: var(--jio-color-primary);
}
.aksrt-icon-picker__item.is-active {
background: var(--aksrt-color-primary);
.jio-icon-picker__item.is-active {
background: var(--jio-color-primary);
color: #fff;
}
.aksrt-icon-picker__item :deep(svg),
.aksrt-icon-picker__preview-svg :deep(svg),
.aksrt-icon-picker__preview-svg svg {
.jio-icon-picker__item :deep(svg),
.jio-icon-picker__preview-svg :deep(svg),
.jio-icon-picker__preview-svg svg {
width: 18px;
height: 18px;
fill: currentColor;
}
.aksrt-icon-picker__preview-svg {
.jio-icon-picker__preview-svg {
display: inline-flex;
}
.aksrt-icon-picker__empty {
.jio-icon-picker__empty {
grid-column: 1 / -1;
text-align: center;
padding: 20px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
font-size: 13px;
}
.aksrt-icon-picker__custom-actions {
.jio-icon-picker__custom-actions {
display: flex;
align-items: center;
gap: 10px;
margin-top: 8px;
}
.aksrt-icon-picker__custom-preview {
.jio-icon-picker__custom-preview {
display: inline-flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border: 1px dashed var(--aksrt-color-muted);
border: 1px dashed var(--jio-color-muted);
border-radius: 4px;
}
.aksrt-icon-picker__grid--session {
.jio-icon-picker__grid--session {
margin-top: 10px;
padding-top: 8px;
border-top: 1px solid var(--aksrt-color-muted);
border-top: 1px solid var(--jio-color-muted);
}
</style>
@@ -3,25 +3,25 @@
<i v-if="isFaValue(value)" :class="faClass" aria-hidden="true"></i>
<!-- Built-in sprite value -->
<span
v-else-if="isZibsvgValue(value)"
class="aksrt-icon-value__svg"
v-html="zibsvgMarkup(value)"
v-else-if="isJiosvgValue(value)"
class="jio-icon-value__svg"
v-html="jiosvgMarkup(value)"
></span>
<!-- Inline custom SVG value -->
<span
v-else-if="isCustomSvgValue(value)"
class="aksrt-icon-value__svg"
class="jio-icon-value__svg"
v-html="cleanSvg(value.slice(10))"
></span>
</template>
<script setup>
/**
* IconValue — renders any icon-picker value ("fa fas fa-star", "zibsvg-key",
* IconValue — renders any icon-picker value ("fa fas fa-star", "jiosvg-key",
* "customsvg-<svg>") as inline preview markup.
*/
import { computed } from 'vue'
import { cleanSvg, isFaValue, isZibsvgValue, isCustomSvgValue, zibsvgMarkup } from '@/utils/icons.js'
import { cleanSvg, isFaValue, isJiosvgValue, isCustomSvgValue, jiosvgMarkup } from '@/utils/icons.js'
const props = defineProps({
value: { type: String, default: '' },
@@ -35,12 +35,12 @@ const faClass = computed(() => {
</script>
<style scoped>
.aksrt-icon-value__svg {
.jio-icon-value__svg {
display: inline-flex;
}
.aksrt-icon-value__svg :deep(svg),
.aksrt-icon-value__svg svg {
.jio-icon-value__svg :deep(svg),
.jio-icon-value__svg svg {
width: 1em;
height: 1em;
fill: currentColor;
@@ -1,5 +1,5 @@
<template>
<div ref="editorRef" class="aks-code-editor" :class="{ 'is-disabled': disabled }" />
<div ref="editorRef" class="jio-code-editor" :class="{ 'is-disabled': disabled }" />
</template>
<script setup>
@@ -86,19 +86,19 @@ onBeforeUnmount(() => {
</script>
<style scoped>
.aks-code-editor {
.jio-code-editor {
border: 1px solid var(--n-border-color, #e0e0e6);
border-radius: 4px;
overflow: hidden;
min-height: calc(var(--rows, 8) * 22px);
}
.aks-code-editor :deep(.cm-editor) {
.jio-code-editor :deep(.cm-editor) {
font-size: 13px;
}
.aks-code-editor :deep(.cm-editor.cm-focused) {
.jio-code-editor :deep(.cm-editor.cm-focused) {
outline: none;
}
.aks-code-editor.is-disabled {
.jio-code-editor.is-disabled {
opacity: 0.6;
pointer-events: none;
}
@@ -0,0 +1,41 @@
<template>
<n-color-picker
:value="pickerValue"
:modes="modes"
:show-alpha="alpha"
:swatches="swatches"
:actions="clearable ? ['clear'] : undefined"
:disabled="disabled"
@update:value="onUpdate"
>
<template v-if="$slots.trigger" #trigger="slotProps">
<slot name="trigger" v-bind="slotProps" />
</template>
</n-color-picker>
</template>
<script setup>
/**
* 后台唯一取色器:所有颜色字段都经由此组件,输出与
* PHP `Jio\Core\Color::sanitize($value, $allow_alpha)` 同一规则的规范值。
* 清空 / 非法值统一回传空串。
*/
import { computed } from 'vue'
import { normalizeColor } from '@/utils/color.js'
const props = defineProps({
modelValue: { type: String, default: '' },
alpha: { type: Boolean, default: false },
clearable: { type: Boolean, default: false },
swatches: { type: Array, default: undefined },
disabled: { type: Boolean, default: false },
})
const emit = defineEmits(['update:modelValue'])
const modes = computed(() => (props.alpha ? ['hex', 'rgb'] : ['hex']))
const pickerValue = computed(() => normalizeColor(props.modelValue, props.alpha) || null)
function onUpdate(value) {
emit('update:modelValue', normalizeColor(value, props.alpha))
}
</script>
@@ -0,0 +1,75 @@
<template>
<!-- Between number (min/max pair) -->
<div class="jio-composite jio-composite--between">
<n-input-number
:value="betweenValue('min')"
:min="schema.min"
:max="schema.max"
:step="schema.step || 1"
:placeholder="schema.minPlaceholder || '最小'"
:disabled="schema.disabled"
style="flex: 1"
@update:value="update('min', $event)"
/>
<span class="jio-composite__sep">—</span>
<n-input-number
:value="betweenValue('max')"
:min="schema.min"
:max="schema.max"
:step="schema.step || 1"
:placeholder="schema.maxPlaceholder || '最大'"
:disabled="schema.disabled"
style="flex: 1"
@update:value="update('max', $event)"
/>
<span v-if="schema.unit" class="jio-composite__unit">{{ schema.unit }}</span>
</div>
</template>
<script setup>
/** 对象型复合字段:between_number(min / max 数值区间)。 */
import { computed } from 'vue'
const props = defineProps({
schema: { type: Object, required: true },
modelValue: { default: null },
})
const emit = defineEmits(['update:modelValue'])
const current = computed(() => (
props.modelValue && typeof props.modelValue === 'object' && !Array.isArray(props.modelValue)
? props.modelValue
: {}
))
function update(part, value) {
emit('update:modelValue', { ...current.value, [part]: value })
}
function betweenValue(part) {
return current.value[part] !== undefined ? current.value[part] : (props.schema.default?.[part] ?? 0)
}
</script>
<style scoped>
.jio-composite {
display: flex;
align-items: center;
gap: 8px;
}
.jio-composite--between {
max-width: 360px;
}
.jio-composite__sep {
color: var(--jio-color-border-strong);
font-size: 14px;
}
.jio-composite__unit {
color: var(--jio-color-muted);
font-size: 13px;
white-space: nowrap;
}
</style>
File diff suppressed because it is too large. Load diff
@@ -1,26 +1,26 @@
<template>
<div class="aksrt-field-group" :class="{ 'is-collapsible': collapsible, 'is-collapsed': collapsible && collapsed }">
<div class="jio-field-group" :class="{ 'is-collapsible': collapsible, 'is-collapsed': collapsible && collapsed }">
<div
v-if="title"
class="aksrt-field-group__header"
class="jio-field-group__header"
:class="{ 'is-clickable': collapsible }"
@click="collapsible ? toggleCollapse() : undefined"
>
<div class="aksrt-field-group__header-left">
<FaIcon v-if="icon" :icon="icon" :size="16" class="aksrt-field-group__icon" />
<div class="jio-field-group__header-left">
<FaIcon v-if="icon" :icon="icon" :size="16" class="jio-field-group__icon" />
<div>
<h3 class="aksrt-field-group__title">{{ title }}</h3>
<p v-if="description" class="aksrt-field-group__desc">{{ description }}</p>
<h3 class="jio-field-group__title">{{ title }}</h3>
<p v-if="description" class="jio-field-group__desc">{{ description }}</p>
</div>
</div>
<div class="aksrt-field-group__header-right">
<div v-if="$slots.actions" class="aksrt-field-group__actions" @click.stop>
<div class="jio-field-group__header-right">
<div v-if="$slots.actions" class="jio-field-group__actions" @click.stop>
<slot name="actions" />
</div>
<button
v-if="collapsible"
type="button"
class="aksrt-field-group__collapse-btn"
class="jio-field-group__collapse-btn"
:aria-expanded="(!collapsed).toString()"
:title="collapsed ? '展开配置' : '收起配置'"
@click.stop="toggleCollapse"
@@ -34,8 +34,8 @@
</div>
</div>
<transition name="aksrt-collapse">
<div v-show="!collapsed" class="aksrt-field-group__body">
<transition name="jio-collapse">
<div v-show="!collapsed" class="jio-field-group__body">
<slot />
</div>
</transition>
@@ -44,11 +44,10 @@
<script setup>
/**
* AksFieldGroup — card-style container for grouping related form fields.
* JioFieldGroup — card-style container for grouping related form fields.
* Supports collapsible sections, icon headers, and description text.
*
* defaultCollapsed only seeds initial state. Parent should remount the group
* (e.g. via :key when a channel turns on) if it wants to force expand again.
* defaultCollapsed only seeds the initial state; afterwards the user toggles freely.
*/
import { ref } from 'vue'
import FaIcon from './FaIcon.vue'
@@ -70,16 +69,16 @@ function toggleCollapse() {
</script>
<style scoped>
.aksrt-field-group {
.jio-field-group {
margin-bottom: 20px;
border: 1px solid var(--aksrt-color-border);
border: 1px solid var(--jio-color-border);
border-radius: 12px;
background: var(--aksrt-color-surface);
box-shadow: var(--aksrt-shadow-card);
background: var(--jio-color-surface);
box-shadow: var(--jio-shadow-card);
overflow: hidden;
}
.aksrt-field-group__header {
.jio-field-group__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
@@ -87,66 +86,66 @@ function toggleCollapse() {
gap: 12px;
}
.aksrt-field-group__header.is-clickable {
.jio-field-group__header.is-clickable {
cursor: pointer;
user-select: none;
}
.aksrt-field-group__header.is-clickable:hover .aksrt-field-group__title {
color: var(--aksrt-color-primary);
.jio-field-group__header.is-clickable:hover .jio-field-group__title {
color: var(--jio-color-primary);
}
.aksrt-field-group.is-collapsed .aksrt-field-group__header {
.jio-field-group.is-collapsed .jio-field-group__header {
padding-bottom: 18px;
}
.aksrt-field-group__header-left {
.jio-field-group__header-left {
display: flex;
align-items: flex-start;
gap: 10px;
min-width: 0;
}
.aksrt-field-group__header-right {
.jio-field-group__header-right {
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
}
.aksrt-field-group__icon {
color: var(--aksrt-color-primary);
.jio-field-group__icon {
color: var(--jio-color-primary);
margin-top: 2px;
}
.aksrt-field-group__title {
.jio-field-group__title {
margin: 0;
font-size: 15px;
font-weight: 600;
color: var(--aksrt-color-text);
color: var(--jio-color-text);
transition: color 0.15s;
}
.aksrt-field-group__desc {
.jio-field-group__desc {
margin: 4px 0 0;
font-size: 12px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
line-height: 1.5;
}
.aksrt-field-group__actions {
.jio-field-group__actions {
display: flex;
align-items: center;
gap: 8px;
}
.aksrt-field-group__collapse-btn {
.jio-field-group__collapse-btn {
display: inline-flex;
align-items: center;
gap: 6px;
border: 1px solid var(--aksrt-color-border);
background: var(--aksrt-color-canvas);
color: var(--aksrt-color-text-secondary);
border: 1px solid var(--jio-color-border);
background: var(--jio-color-canvas);
color: var(--jio-color-text-secondary);
border-radius: 999px;
padding: 4px 10px;
font-size: 12px;
@@ -154,25 +153,25 @@ function toggleCollapse() {
transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.aksrt-field-group__collapse-btn:hover {
color: var(--aksrt-color-primary);
border-color: var(--aksrt-color-primary);
background: var(--aksrt-color-primary-soft);
.jio-field-group__collapse-btn:hover {
color: var(--jio-color-primary);
border-color: var(--jio-color-primary);
background: var(--jio-color-primary-soft);
}
.aksrt-field-group__body {
.jio-field-group__body {
padding: 16px 20px 20px;
}
/* Collapse transition */
.aksrt-collapse-enter-active,
.aksrt-collapse-leave-active {
.jio-collapse-enter-active,
.jio-collapse-leave-active {
transition: all 0.2s ease;
overflow: hidden;
}
.aksrt-collapse-enter-from,
.aksrt-collapse-leave-to {
.jio-collapse-enter-from,
.jio-collapse-leave-to {
opacity: 0;
max-height: 0;
padding-top: 0;
@@ -1,20 +1,22 @@
<template>
<div class="aksrt-form-renderer">
<div class="jio-form-renderer">
<!-- Page header with title and description -->
<div v-if="title" class="aksrt-form-renderer__header">
<div class="aksrt-form-renderer__header-left">
<FaIcon v-if="icon" :icon="icon" :size="22" class="aksrt-form-renderer__header-icon" />
<div v-if="title" class="jio-form-renderer__header">
<div class="jio-form-renderer__header-left">
<FaIcon v-if="icon" :icon="icon" :size="22" class="jio-form-renderer__header-icon" />
<div>
<h1 class="aksrt-form-renderer__title">{{ title }}</h1>
<p v-if="description" class="aksrt-form-renderer__desc">{{ description }}</p>
<h1 class="jio-form-renderer__title">{{ title }}</h1>
<p v-if="description" class="jio-form-renderer__desc">{{ description }}</p>
</div>
</div>
<div v-if="showSearch" class="aksrt-form-renderer__search">
<div v-if="showSearch" class="jio-form-renderer__search">
<n-input
v-model:value="searchQuery"
placeholder="搜索设置项..."
size="small"
clearable
name="jio-settings-search"
:input-props="searchInputProps"
>
<template #prefix>
<FaIcon icon="fa fas fa-search" :size="12" />
@@ -24,7 +26,7 @@
</div>
<!-- Loading state -->
<div v-if="loading" class="aksrt-form-renderer__loading">
<div v-if="loading" class="jio-form-renderer__loading">
<n-spin size="medium" />
<span>加载中...</span>
</div>
@@ -45,7 +47,7 @@
<!-- Form content -->
<template v-else-if="schema && schema.length">
<template v-for="group in filteredSchema" :key="groupKey(group)">
<AksFieldGroup
<JioFieldGroup
v-if="isGroupVisible(group)"
:title="group.title"
:description="group.description"
@@ -59,7 +61,7 @@
<!-- Tabbed: renders tabs whose sub-fields are flat top-level keys -->
<div
v-if="field.type === 'tabbed' && (field.tabs || []).length"
class="aksrt-form-renderer__tabbed"
class="jio-form-renderer__tabbed"
>
<n-tabs type="line" animated>
<n-tab-pane
@@ -69,7 +71,7 @@
:tab="tabName(tab)"
>
<template v-for="sub in (tab.fields || [])" :key="sub.key">
<AksField
<JioField
v-if="isFieldVisible(sub)"
:schema="sub"
:model-value="getFieldValue(sub.key)"
@@ -82,7 +84,7 @@
</n-tab-pane>
</n-tabs>
</div>
<AksSorterField
<JioSorterField
v-else-if="field.type === 'custom' && field.renderer === 'sorter'"
:model-value="getFieldValue(field.key) || {}"
:options="field.options || []"
@@ -93,7 +95,7 @@
:name="`field-${field.key}`"
v-bind="{ field, value: getFieldValue(field.key), setValue: (value) => setFieldValue(field.key, value), formData }"
>
<AksField
<JioField
:schema="field"
:model-value="getFieldValue(field.key)"
:form-data="formData"
@@ -102,7 +104,7 @@
@action="emit('field-action', $event)"
/>
</slot>
<AksField
<JioField
v-else
:schema="field"
:model-value="getFieldValue(field.key)"
@@ -117,24 +119,24 @@
<!-- Custom group content slot -->
<slot :name="`group-${group.key}`" v-bind="{ group, formData }" />
</AksFieldGroup>
</JioFieldGroup>
</template>
</template>
<!-- Empty state -->
<div v-else class="aksrt-form-renderer__empty">
<div v-else class="jio-form-renderer__empty">
<FaIcon icon="fa fas fa-cog" :size="32" />
<p>暂无配置项</p>
</div>
<!-- Sticky save bar -->
<AksSaveBar :dirty="dirty" :saving="saving" @save="$emit('save')" @reload="$emit('reload')" />
<JioSaveBar :dirty="dirty" :saving="saving" @save="$emit('save')" @reload="$emit('reload')" />
</div>
</template>
<script setup>
/**
* AksFormRenderer — the core schema-driven form engine.
* JioFormRenderer — the core schema-driven form engine.
*
* Takes a schema definition (array of field groups) and a reactive form data object,
* and renders a complete settings page with:
@@ -146,10 +148,10 @@
*/
import { ref, computed, useSlots } from 'vue'
import FaIcon from './FaIcon.vue'
import AksSaveBar from './AksSaveBar.vue'
import AksFieldGroup from './AksFieldGroup.vue'
import AksField from './AksField.vue'
import AksSorterField from './AksSorterField.vue'
import JioSaveBar from './JioSaveBar.vue'
import JioFieldGroup from './JioFieldGroup.vue'
import JioField from './JioField.vue'
import JioSorterField from './JioSorterField.vue'
const props = defineProps({
/** Page title */
@@ -185,6 +187,18 @@ const slots = useSlots()
const searchQuery = ref('')
// 同一页面上存在大量 type="password" 的凭证字段,Chrome 会把整页当成登录
// 表单,并把保存的账号灌进第一个文本框(也就是这个搜索框)。改名成搜索语义,
// 并显式关掉各类自动填充,才能让浏览器不再识别它。
const searchInputProps = {
autocomplete: 'off',
autocorrect: 'off',
autocapitalize: 'off',
spellcheck: 'false',
'data-lpignore': 'true',
'data-1p-ignore': 'true',
}
/** Evaluate dependsOn rule against current form data */
function matchDependsOn(dependsOn) {
if (!dependsOn) return true
@@ -248,26 +262,13 @@ function isGroupVisible(group) {
return matchDependsOn(group.dependsOn)
}
/**
* Collapse preference for a group.
* - expandWhen: form key; when truthy, start expanded (channel just enabled → open form)
* - defaultCollapsed: static default
*/
/** 可折叠分组的初始状态:defaultCollapsed 为真时默认收起。 */
function resolveGroupCollapsed(group) {
if (group.expandWhen) {
const on = !!props.formData?.[group.expandWhen]
return !on
}
return !!group.defaultCollapsed
}
/** Stable key; remount when expandWhen flips so newly enabled channels open expanded. */
function groupKey(group) {
const base = group.key || group.title || 'group'
if (group.expandWhen) {
return `${base}:${props.formData?.[group.expandWhen] ? 'on' : 'off'}`
}
return base
return group.key || group.title || 'group'
}
/** Get field value from formData */
@@ -321,7 +322,7 @@ const filteredSchema = computed(() => {
</script>
<style scoped>
.aksrt-form-renderer__header {
.jio-form-renderer__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
@@ -330,73 +331,73 @@ const filteredSchema = computed(() => {
flex-wrap: wrap;
}
.aksrt-form-renderer__header-left {
.jio-form-renderer__header-left {
display: flex;
align-items: flex-start;
gap: 12px;
}
.aksrt-form-renderer__header-icon {
color: var(--aksrt-color-primary);
.jio-form-renderer__header-icon {
color: var(--jio-color-primary);
margin-top: 4px;
}
.aksrt-form-renderer__title {
.jio-form-renderer__title {
margin: 0;
font-size: 22px;
font-weight: 700;
color: var(--aksrt-color-text);
color: var(--jio-color-text);
letter-spacing: -0.02em;
}
.aksrt-form-renderer__desc {
.jio-form-renderer__desc {
margin: 4px 0 0;
font-size: 13px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
line-height: 1.6;
}
.aksrt-form-renderer__tabbed {
.jio-form-renderer__tabbed {
margin-bottom: 8px;
}
.aksrt-form-renderer__search {
.jio-form-renderer__search {
min-width: 200px;
max-width: 280px;
}
.aksrt-form-renderer__loading {
.jio-form-renderer__loading {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
padding: 60px 0;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
font-size: 14px;
}
.aksrt-form-renderer__empty {
.jio-form-renderer__empty {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
padding: 60px 0;
color: var(--aksrt-color-border-strong);
color: var(--jio-color-border-strong);
}
.aksrt-form-renderer__empty p {
.jio-form-renderer__empty p {
margin: 0;
font-size: 14px;
}
/* Mobile */
@media (max-width: 768px) {
.aksrt-form-renderer__header {
.jio-form-renderer__header {
flex-direction: column;
gap: 10px;
}
.aksrt-form-renderer__search {
.jio-form-renderer__search {
max-width: 100%;
width: 100%;
}
@@ -1,23 +1,23 @@
<template>
<div class="aksrt-gallery-field">
<div v-if="attachmentIds.length" class="aksrt-gallery-field__grid">
<div class="jio-gallery-field">
<div v-if="attachmentIds.length" class="jio-gallery-field__grid">
<article
v-for="(attachmentId, index) in attachmentIds"
:key="attachmentId"
class="aksrt-gallery-field__item"
class="jio-gallery-field__item"
>
<img
v-if="previews[attachmentId]?.url"
:src="previews[attachmentId].url"
:alt="previews[attachmentId].alt || `附件 ${attachmentId}`"
class="aksrt-gallery-field__image"
class="jio-gallery-field__image"
/>
<div v-else class="aksrt-gallery-field__placeholder">
<div v-else class="jio-gallery-field__placeholder">
<FaIcon icon="fa fas fa-image" :size="22" />
<span>#{{ attachmentId }}</span>
</div>
<div class="aksrt-gallery-field__actions">
<div class="jio-gallery-field__actions">
<n-button
size="tiny"
quaternary
@@ -49,12 +49,12 @@
</article>
</div>
<div v-else class="aksrt-gallery-field__empty">
<div v-else class="jio-gallery-field__empty">
<FaIcon icon="fa fas fa-images" :size="28" />
<span>尚未选择图片</span>
</div>
<div class="aksrt-gallery-field__buttons">
<div class="jio-gallery-field__buttons">
<n-button type="primary" secondary @click="openMediaLibrary">
<FaIcon icon="fa fas fa-plus" />
{{ attachmentIds.length ? '编辑图片' : '选择图片' }}
@@ -64,7 +64,7 @@
</n-button>
</div>
<p v-if="mediaError" class="aksrt-gallery-field__error">{{ mediaError }}</p>
<p v-if="mediaError" class="jio-gallery-field__error">{{ mediaError }}</p>
</div>
</template>
@@ -124,7 +124,7 @@ async function hydratePreviews() {
const sizes = attachment.get('sizes') || {}
return [attachmentId, {
url: sizes.thumbnail?.url || sizes.medium?.url || attachment.get('url') || '',
url: sizes.medium?.url || attachment.get('url') || '',
alt: attachment.get('alt') || attachment.get('title') || '',
}]
}))
@@ -172,61 +172,70 @@ watch(attachmentIds, hydratePreviews, { immediate: true })
</script>
<style scoped>
.aksrt-gallery-field__grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
gap: 10px;
}
.aksrt-gallery-field__item {
overflow: hidden;
border: 1px solid var(--aksrt-color-border);
border-radius: 8px;
background: var(--aksrt-color-canvas);
}
.aksrt-gallery-field__image,
.aksrt-gallery-field__placeholder {
.jio-gallery-field__grid {
display: flex;
width: 100%;
aspect-ratio: 4 / 3;
flex-wrap: wrap;
align-items: flex-start;
gap: 8px;
}
.jio-gallery-field__item {
display: inline-flex;
flex-direction: column;
max-width: 100%;
padding: 4px 4px 0;
overflow: hidden;
border: 1px solid var(--jio-color-border);
border-radius: 8px;
background: var(--jio-color-canvas);
}
.jio-gallery-field__image {
display: block;
width: auto;
height: auto;
max-width: 100%;
max-height: 90px;
border-radius: 4px;
}
.jio-gallery-field__placeholder {
display: flex;
flex-direction: column;
width: 90px;
height: 90px;
align-items: center;
justify-content: center;
object-fit: cover;
}
.aksrt-gallery-field__placeholder {
flex-direction: column;
gap: 4px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
}
.aksrt-gallery-field__actions {
.jio-gallery-field__actions {
display: flex;
justify-content: center;
padding: 4px;
border-top: 1px solid var(--aksrt-color-border);
border-top: 1px solid var(--jio-color-border);
}
.aksrt-gallery-field__empty {
.jio-gallery-field__empty {
display: flex;
min-height: 116px;
align-items: center;
justify-content: center;
flex-direction: column;
gap: 8px;
border: 1px dashed var(--aksrt-color-border-strong);
border: 1px dashed var(--jio-color-border-strong);
border-radius: 8px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
}
.aksrt-gallery-field__buttons {
.jio-gallery-field__buttons {
display: flex;
gap: 8px;
margin-top: 10px;
}
.aksrt-gallery-field__error {
.jio-gallery-field__error {
margin: 8px 0 0;
color: #d03050;
font-size: 12px;
@@ -0,0 +1,115 @@
<template>
<div class="jio-image-select" role="radiogroup">
<button
v-for="opt in options"
:key="opt.value"
type="button"
role="radio"
class="jio-image-select__item"
:class="{ 'is-active': modelValue === opt.value }"
:aria-checked="modelValue === opt.value"
:disabled="disabled"
@click="emit('update:modelValue', opt.value)"
>
<img v-if="opt.image" :src="opt.image" :alt="opt.label" class="jio-image-select__img" :style="imgStyle(opt)" />
<span v-else class="jio-image-select__placeholder" :style="imgStyle(opt)">
<FaIcon :icon="opt.icon || 'fa fas fa-image'" :size="20" />
</span>
<span class="jio-image-select__label">{{ opt.label }}</span>
</button>
</div>
</template>
<script setup>
/** image_select:带预览图的单选。 */
import FaIcon from './FaIcon.vue'
const props = defineProps({
modelValue: { default: null },
options: { type: Array, default: () => [] },
disabled: { type: Boolean, default: false },
// Preview width in px. Layout strips (header/footer) are very wide and only
// need enough width to be legible; near-square previews want more room.
previewWidth: { type: [Number, String], default: 140 },
})
const emit = defineEmits(['update:modelValue'])
// An option may override the group width via its own `width`.
function imgStyle(opt) {
const width = opt && opt.width ? opt.width : props.previewWidth
return { '--jio-image-select-max': typeof width === 'number' ? `${width}px` : width }
}
</script>
<style scoped>
.jio-image-select {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.jio-image-select__item {
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
min-width: 80px;
padding: 8px;
border: 2px solid var(--jio-color-border);
border-radius: 8px;
background: var(--jio-color-surface);
cursor: pointer;
transition: border-color .15s ease, background-color .15s ease;
}
.jio-image-select__item:hover,
.jio-image-select__item:focus-visible {
outline: none;
border-color: var(--jio-color-primary);
}
.jio-image-select__item.is-active {
border-color: var(--jio-color-primary);
background: var(--jio-color-primary-soft);
}
.jio-image-select__item:disabled {
cursor: not-allowed;
}
.jio-image-select__img {
display: block;
/* Preview images are wide layout strips (header 597x57, footer 800x190, slide
align 200x101), so let them keep their own aspect ratio inside the card.
A fixed square box with object-fit:cover crops the layout to an
unrecognisable sliver — the width is capped instead and the height follows. */
width: 100%;
max-width: var(--jio-image-select-max, 140px);
height: auto;
border-radius: 4px;
background: var(--jio-color-canvas);
}
.jio-image-select__placeholder {
display: flex;
align-items: center;
justify-content: center;
width: var(--jio-image-select-max, 140px);
height: 60px;
border-radius: 4px;
background: var(--jio-color-canvas);
color: var(--jio-color-border-strong);
}
.jio-image-select__label {
color: var(--jio-color-text-secondary);
font-size: 11px;
text-align: center;
}
@media (prefers-reduced-motion: reduce) {
.jio-image-select__item {
transition: none;
}
}
</style>
@@ -1,27 +1,27 @@
<template>
<div class="aksrt-media-field">
<div v-if="modelValue" class="aksrt-media-field__preview">
<div class="jio-media-field">
<div v-if="modelValue" class="jio-media-field__preview">
<img
v-if="isImage"
:src="modelValue"
:alt="placeholder"
class="aksrt-media-field__image"
class="jio-media-field__image"
/>
<div v-else class="aksrt-media-field__file">
<div v-else class="jio-media-field__file">
<FaIcon icon="fa fas fa-file" :size="24" />
<span class="aksrt-media-field__filename">{{ fileName }}</span>
<span class="jio-media-field__filename">{{ fileName }}</span>
</div>
<div class="aksrt-media-field__overlay">
<n-button size="tiny" quaternary @click="openMediaLibrary">
<FaIcon icon="fa fas fa-exchange-alt" /> 更换
<div class="jio-media-field__overlay">
<n-button size="tiny" secondary circle title="更换" @click="openMediaLibrary">
<FaIcon icon="fa fas fa-exchange-alt" />
</n-button>
<n-button size="tiny" quaternary type="error" @click="clearMedia">
<FaIcon icon="fa fas fa-trash-alt" /> 移除
<n-button size="tiny" secondary circle type="error" title="移除" @click="clearMedia">
<FaIcon icon="fa fas fa-trash-alt" />
</n-button>
</div>
</div>
<div v-else class="aksrt-media-field__empty" @click="openMediaLibrary">
<div v-else class="jio-media-field__empty" @click="openMediaLibrary">
<FaIcon icon="fa fas fa-cloud-upload-alt" :size="28" />
<span>{{ placeholder }}</span>
</div>
@@ -30,7 +30,7 @@
:value="modelValue"
:placeholder="'或直接输入 URL'"
size="small"
class="aksrt-media-field__url"
class="jio-media-field__url"
@update:value="emit('update:modelValue', $event)"
/>
</div>
@@ -38,7 +38,7 @@
<script setup>
/**
* AksMediaField — image/file selector with preview.
* JioMediaField — image/file selector with preview.
*
* In the WordPress admin context, this can open the WP Media Library.
* For now, it supports direct URL input with preview.
@@ -95,73 +95,82 @@ function clearMedia() {
</script>
<style scoped>
.aksrt-media-field__preview {
.jio-media-field__preview {
position: relative;
display: inline-flex;
max-width: 100%;
min-width: 72px;
min-height: 44px;
padding: 4px;
border-radius: 8px;
overflow: hidden;
border: 1px solid var(--aksrt-color-border);
border: 1px solid var(--jio-color-border);
background: var(--jio-color-canvas);
margin-bottom: 8px;
vertical-align: top;
}
.aksrt-media-field__image {
.jio-media-field__image {
display: block;
width: 100%;
max-height: 200px;
object-fit: cover;
width: auto;
height: auto;
max-width: 100%;
max-height: 120px;
border-radius: 4px;
}
.aksrt-media-field__file {
.jio-media-field__file {
display: flex;
align-items: center;
gap: 8px;
padding: 16px;
background: var(--aksrt-color-canvas);
background: var(--jio-color-canvas);
}
.aksrt-media-field__filename {
.jio-media-field__filename {
font-size: 13px;
color: var(--aksrt-color-text-secondary);
color: var(--jio-color-text-secondary);
word-break: break-all;
}
.aksrt-media-field__overlay {
.jio-media-field__overlay {
position: absolute;
top: 0;
right: 0;
display: flex;
gap: 4px;
padding: 6px;
padding: 4px;
opacity: 0;
transition: opacity 0.2s;
}
.aksrt-media-field__preview:hover .aksrt-media-field__overlay {
.jio-media-field__preview:hover .jio-media-field__overlay {
opacity: 1;
}
.aksrt-media-field__empty {
.jio-media-field__empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
padding: 32px;
border: 2px dashed var(--aksrt-color-border-strong);
border: 2px dashed var(--jio-color-border-strong);
border-radius: 8px;
cursor: pointer;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
font-size: 13px;
transition: all 0.2s;
margin-bottom: 8px;
}
.aksrt-media-field__empty:hover {
border-color: var(--aksrt-color-primary);
color: var(--aksrt-color-primary);
background: var(--aksrt-color-primary-soft);
.jio-media-field__empty:hover {
border-color: var(--jio-color-primary);
color: var(--jio-color-primary);
background: var(--jio-color-primary-soft);
}
.aksrt-media-field__url {
.jio-media-field__url {
margin-top: 4px;
}
</style>
@@ -0,0 +1,183 @@
<template>
<div class="jio-repeater-list">
<draggable
v-if="rows.length"
v-model="rows"
v-bind="SORTABLE_LIST_ATTRS"
:item-key="rowKey"
:disabled="schema.disabled"
class="jio-sortable"
>
<template #item="{ element, index }">
<div class="jio-sortable__item">
<div class="jio-sortable__head">
<JioSortHandle />
<span class="jio-sortable__icon" :class="preview(element).iconClass">
<span v-if="preview(element).customIcon" class="jio-repeater-list__icon-html" v-html="preview(element).customIcon" />
<i v-else-if="preview(element).icon" :class="preview(element).icon" aria-hidden="true" />
<FaIcon v-else icon="fa fas fa-star" :size="16" />
</span>
<div class="jio-sortable__main">
<span class="jio-sortable__title">{{ preview(element).title }}</span>
<span class="jio-sortable__desc">{{ preview(element).desc }}</span>
</div>
<div class="jio-sortable__actions">
<n-button size="tiny" quaternary type="primary" :disabled="schema.disabled" @click="openModal(index)">
<template #icon><FaIcon icon="fa fas fa-edit" :size="12" /></template>
编辑
</n-button>
<n-button size="tiny" quaternary type="error" :disabled="schema.disabled || reachedMinimum" @click="remove(index)">
<template #icon><FaIcon icon="fa fas fa-trash-alt" :size="12" /></template>
删除
</n-button>
</div>
</div>
</div>
</template>
</draggable>
<div v-else class="jio-sortable__empty">
<FaIcon icon="fa fas fa-inbox" :size="18" />
<span>{{ schema.emptyText || '暂无数据' }}</span>
</div>
<n-button size="small" dashed block :disabled="schema.disabled || reachedMaximum" @click="openModal(-1)">
<template #icon><FaIcon icon="fa fas fa-plus" :size="12" /></template>
{{ schema.button_title || schema.addText || '添加一项' }}
</n-button>
<n-modal
v-model:show="modalShow"
:mask-closable="false"
preset="card"
:title="editingIndex >= 0 ? (schema.editText || '编辑项目') : (schema.addText || '添加项目')"
class="jio-modal-card"
style="max-width: 640px; width: 92vw;"
>
<div class="jio-repeater-list__modal-fields">
<JioField
v-for="field in draftFields"
:key="field.key"
:schema="field"
:model-value="draft[field.key]"
:form-data="formData"
@update:model-value="draft = { ...draft, [field.key]: $event }"
/>
</div>
<div class="jio-modal-footer">
<n-button @click="closeModal">取消</n-button>
<n-button type="primary" @click="confirmModal">确定</n-button>
</div>
</n-modal>
</div>
</template>
<script setup>
/** repeater / group 的 list-modal 形态:可拖拽卡片列表 + 弹窗编辑单行。 */
import { computed, ref } from 'vue'
import draggable from 'vuedraggable'
import FaIcon from './FaIcon.vue'
import JioField from './JioField.vue'
import JioSortHandle from './JioSortHandle.vue'
import { matchDependency } from './field-dependency.js'
import { SORTABLE_LIST_ATTRS } from './sortable-options.js'
import { createRepeaterRow, createRepeaterRowId, repeaterRowPreview } from './repeater-rows.js'
const props = defineProps({
schema: { type: Object, required: true },
modelValue: { default: null },
formData: { type: Object, default: () => ({}) },
})
const emit = defineEmits(['update:modelValue'])
const rows = computed({
get: () => (Array.isArray(props.modelValue) ? props.modelValue : []),
set: (value) => emit('update:modelValue', Array.isArray(value) ? value : []),
})
const reachedMinimum = computed(() => rows.value.length <= Number(props.schema.min || 0))
const reachedMaximum = computed(() => Number(props.schema.max || 0) > 0 && rows.value.length >= Number(props.schema.max))
const keys = new WeakMap()
let keySeed = 0
function rowKey(row) {
if (!row || typeof row !== 'object') return String(row)
if (row._id) return row._id
if (!keys.has(row)) keys.set(row, `rpt_list_${++keySeed}`)
return keys.get(row)
}
function preview(row) {
return repeaterRowPreview(row, props.schema.listPreview || {})
}
function remove(index) {
if (reachedMinimum.value) return
const next = [...rows.value]
next.splice(index, 1)
emit('update:modelValue', next)
}
const modalShow = ref(false)
const editingIndex = ref(-1)
const draft = ref({})
const draftFields = computed(() => (props.schema.fields || []).filter(field => matchDependency(field.dependsOn, draft.value)))
function openModal(index) {
if (props.schema.disabled) return
if (index < 0 && reachedMaximum.value) return
const base = createRepeaterRow(props.schema.fields)
draft.value = index >= 0 ? { ...base, ...(rows.value[index] || {}) } : base
editingIndex.value = index
modalShow.value = true
}
function closeModal() {
modalShow.value = false
editingIndex.value = -1
draft.value = {}
}
function confirmModal() {
const next = [...rows.value]
const row = { ...draft.value }
if (!row._id) row._id = createRepeaterRowId()
if (editingIndex.value >= 0 && editingIndex.value < next.length) {
next[editingIndex.value] = row
} else {
next.push(row)
}
emit('update:modelValue', next)
closeModal()
}
</script>
<style scoped>
.jio-repeater-list {
display: flex;
flex-direction: column;
gap: 10px;
}
.jio-repeater-list__icon-html {
display: inline-flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
.jio-repeater-list__icon-html :deep(svg),
.jio-repeater-list__icon-html :deep(img) {
width: 20px;
height: 20px;
object-fit: contain;
}
.jio-repeater-list__modal-fields {
display: flex;
flex-direction: column;
gap: 4px;
max-height: min(70vh, 560px);
overflow: auto;
padding-right: 2px;
}
</style>
@@ -1,11 +1,11 @@
<template>
<div v-if="dirty" class="aksrt-form-renderer__save-bar">
<div class="aksrt-form-renderer__save-bar__inner">
<div class="aksrt-form-renderer__save-bar__info">
<div v-if="dirty" class="jio-form-renderer__save-bar">
<div class="jio-form-renderer__save-bar__inner">
<div class="jio-form-renderer__save-bar__info">
<FaIcon icon="fa fas fa-exclamation-circle" :size="14" />
<span>您有未保存的更改</span>
</div>
<div class="aksrt-form-renderer__save-bar__actions">
<div class="jio-form-renderer__save-bar__actions">
<n-button size="small" :disabled="saving" @click="emit('reload')">放弃更改</n-button>
<n-button
size="small"
@@ -23,8 +23,8 @@
<script setup>
/**
* AksSaveBar — the admin-wide sticky save bar (shown only when dirty).
* Shared by AksFormRenderer (schema pages) and custom settings pages.
* JioSaveBar — the admin-wide sticky save bar (shown only when dirty).
* Shared by JioFormRenderer (schema pages) and custom settings pages.
*/
import FaIcon from './FaIcon.vue'
@@ -37,19 +37,19 @@ const emit = defineEmits(['save', 'reload'])
</script>
<style scoped>
.aksrt-form-renderer__save-bar {
.jio-form-renderer__save-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 1000;
background: var(--aksrt-color-surface);
border-top: 1px solid var(--aksrt-color-border);
box-shadow: var(--aksrt-shadow-floating);
background: var(--jio-color-surface);
border-top: 1px solid var(--jio-color-border);
box-shadow: var(--jio-shadow-floating);
animation: slideUp 0.2s ease;
}
.aksrt-form-renderer__save-bar__inner {
.jio-form-renderer__save-bar__inner {
display: flex;
align-items: center;
justify-content: space-between;
@@ -59,7 +59,7 @@ const emit = defineEmits(['save', 'reload'])
gap: 16px;
}
.aksrt-form-renderer__save-bar__info {
.jio-form-renderer__save-bar__info {
display: flex;
align-items: center;
gap: 8px;
@@ -67,7 +67,7 @@ const emit = defineEmits(['save', 'reload'])
font-size: 13px;
}
.aksrt-form-renderer__save-bar__actions {
.jio-form-renderer__save-bar__actions {
display: flex;
gap: 8px;
}
@@ -84,17 +84,17 @@ const emit = defineEmits(['save', 'reload'])
}
@media (max-width: 768px) {
.aksrt-form-renderer__save-bar__inner {
.jio-form-renderer__save-bar__inner {
flex-direction: column;
padding: 10px 14px;
gap: 8px;
}
.aksrt-form-renderer__save-bar__actions {
.jio-form-renderer__save-bar__actions {
width: 100%;
}
.aksrt-form-renderer__save-bar__actions .n-button {
.jio-form-renderer__save-bar__actions .n-button {
flex: 1;
}
}
@@ -0,0 +1,36 @@
<template>
<div v-if="visible" class="jio-secret-clear">
<n-button size="small" secondary :type="marked ? 'warning' : 'error'" @click="$emit('toggle')">
{{ marked ? '取消清除' : '清除已配置密钥' }}
</n-button>
<span v-if="marked" class="jio-secret-clear__hint">保存后将删除此密钥</span>
</div>
</template>
<script setup>
/**
* 已配置密钥的「清除 / 取消清除」操作,input 与 textarea 两种 secret 字段共用。
*/
defineProps({
/** 当前存在已配置密钥('***')或已标记清除时显示 */
visible: { type: Boolean, default: false },
/** 是否已标记为保存时清除 */
marked: { type: Boolean, default: false },
})
defineEmits(['toggle'])
</script>
<style scoped>
.jio-secret-clear {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
}
.jio-secret-clear__hint {
color: var(--jio-color-warning, #d97706);
font-size: 12px;
}
</style>
@@ -0,0 +1,53 @@
<template>
<draggable
v-model="values"
v-bind="SORTABLE_LIST_ATTRS"
:item-key="valueKey"
:disabled="disabled"
class="jio-sortable jio-sortable--compact jio-selected-order"
>
<template #item="{ element, index }">
<div class="jio-sortable__item">
<div class="jio-sortable__head">
<JioSortHandle />
<span class="jio-sortable__index">{{ index + 1 }}</span>
<span class="jio-sortable__title">{{ labelOf(element) }}</span>
</div>
</div>
</template>
</draggable>
</template>
<script setup>
/** 多选 + sortable 的已选值排序列表(select / async_select 下方)。 */
import { computed } from 'vue'
import draggable from 'vuedraggable'
import JioSortHandle from './JioSortHandle.vue'
import { SORTABLE_LIST_ATTRS } from './sortable-options.js'
const props = defineProps({
modelValue: { type: Array, required: true },
options: { type: Array, default: () => [] },
disabled: { type: Boolean, default: false },
})
const emit = defineEmits(['update:modelValue'])
const values = computed({
get: () => props.modelValue,
set: (next) => emit('update:modelValue', next),
})
function valueKey(value) {
return String(value)
}
function labelOf(value) {
return props.options.find(option => option.value === value)?.label || String(value)
}
</script>
<style scoped>
.jio-selected-order {
margin-top: 8px;
}
</style>
@@ -0,0 +1,12 @@
<template>
<button type="button" class="jio-sortable__handle" :title="label" :aria-label="label">
<i class="fa fas fa-grip-vertical" aria-hidden="true"></i>
</button>
</template>
<script setup>
/** 拖拽排序手柄;SORTABLE_LIST_ATTRS.handle 指向它的类名。 */
defineProps({
label: { type: String, default: '拖拽排序' },
})
</script>
@@ -0,0 +1,143 @@
<template>
<div class="jio-sorter">
<div
v-for="column in COLUMNS"
:key="column.key"
class="jio-sorter__column"
:class="`jio-sorter__column--${column.key}`"
>
<div class="jio-sorter__title">
<span>{{ column.title }}</span>
<n-tag size="small" :type="column.tagType" :bordered="false">{{ columns[column.key].length }}</n-tag>
</div>
<draggable
v-model="columns[column.key]"
v-bind="SORTABLE_LIST_ATTRS"
item-key="value"
group="jio-sorter"
class="jio-sortable jio-sortable--compact jio-sorter__list"
@change="commit"
>
<template #item="{ element }">
<div class="jio-sortable__item">
<div class="jio-sortable__head">
<JioSortHandle />
<i v-if="element.icon" :class="element.icon" class="jio-sorter__icon" aria-hidden="true"></i>
<span class="jio-sortable__title">{{ element.label }}</span>
</div>
</div>
</template>
</draggable>
<div v-if="columns[column.key].length === 0" class="jio-sortable__empty jio-sorter__empty">
{{ column.empty }}
</div>
</div>
</div>
</template>
<script setup>
/** 启用 / 未启用两列拖拽排序器;样式见 styles/sortable-list.css。 */
import { reactive, watch } from 'vue'
import draggable from 'vuedraggable'
import JioSortHandle from './JioSortHandle.vue'
import { SORTABLE_LIST_ATTRS } from './sortable-options.js'
const COLUMNS = [
{ key: 'enabled', title: '已启用', tagType: 'success', empty: '拖拽到此处启用' },
{ key: 'disabled', title: '未启用', tagType: 'default', empty: '拖拽到此处停用' },
]
const props = defineProps({
modelValue: { type: Object, default: () => ({}) },
options: { type: Array, default: () => [] },
})
const emit = defineEmits(['update:modelValue'])
const columns = reactive({ enabled: [], disabled: [] })
let syncing = false
function keysOf(value) {
if (Array.isArray(value)) return value.map(String)
return value && typeof value === 'object' ? Object.keys(value) : []
}
function syncColumns() {
syncing = true
const byKey = new Map(props.options.map(option => [String(option.value), option]))
const used = new Set()
const normalize = keys => keys.filter(key => byKey.has(key) && !used.has(key)).map(key => {
used.add(key)
return byKey.get(key)
})
columns.enabled = normalize(keysOf(props.modelValue?.enabled))
columns.disabled = normalize(keysOf(props.modelValue?.disabled))
for (const option of props.options) {
if (!used.has(String(option.value))) columns.disabled.push(option)
}
syncing = false
}
function commit() {
if (syncing) return
const toMap = items => Object.fromEntries(items.map(item => [String(item.value), String(item.label)]))
emit('update:modelValue', {
enabled: toMap(columns.enabled),
disabled: toMap(columns.disabled),
})
}
watch(() => [props.modelValue, props.options], syncColumns, { immediate: true, deep: true })
</script>
<style scoped>
.jio-sorter {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
}
.jio-sorter__column {
position: relative;
min-height: 210px;
padding: 12px;
border: 1px solid var(--jio-color-border);
border-radius: 8px;
background: var(--jio-color-canvas);
}
.jio-sorter__title {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
color: var(--jio-color-text);
font-size: 13px;
font-weight: 600;
}
/* 空列也要留出可放置区域,拖拽目标不能塌成 0 高度。 */
.jio-sorter__list {
min-height: 44px;
}
.jio-sorter__empty {
position: absolute;
right: 12px;
bottom: 12px;
left: 12px;
top: 46px;
pointer-events: none;
}
.jio-sorter__icon {
flex: 0 0 auto;
width: 16px;
color: var(--jio-color-primary);
text-align: center;
}
@media (max-width: 720px) {
.jio-sorter {
grid-template-columns: 1fr;
}
}
</style>
@@ -0,0 +1,18 @@
/**
* schema 字段的 dependsOn 规则求值。sourceValue 是规则引用的数据对象
* (fieldset 值 / repeater 行 / 弹窗草稿)。
*/
export function matchDependency(rule, sourceValue) {
if (!rule) return true
const source = sourceValue && typeof sourceValue === 'object' ? sourceValue : {}
if (rule.all) return rule.all.every(item => matchDependency(item, source))
if (rule.any) return rule.any.some(item => matchDependency(item, source))
const value = source[rule.key]
if (rule.operator === 'truthy') return !!value
if (rule.operator === 'falsy') return !value
if (rule.operator === 'not_empty') return Array.isArray(value) ? value.length > 0 : value !== '' && value != null
if (rule.operator === 'empty') return Array.isArray(value) ? value.length === 0 : value === '' || value == null
if (rule.operator === 'eq') return value === rule.value
if (rule.operator === 'neq') return value !== rule.value
return rule.value === undefined || value === rule.value
}
@@ -0,0 +1,76 @@
/**
* repeater / group 行的纯函数:新行默认值、行 ID、listPreview 摘要与预览。
* inline 与 list-modal 两种渲染共用。
*/
let rowIdCounter = 0
export function createRepeaterRowId() {
return `rpt_${Date.now()}_${++rowIdCounter}`
}
export function createRepeaterRow(fields) {
const row = { _id: createRepeaterRowId() }
for (const field of (Array.isArray(fields) ? fields : [])) {
// UI-only chrome rows (notice / alert) are presentation only.
if (field.ui_only) continue
if (field.default !== undefined) {
row[field.key] = field.default
} else if (field.type === 'switch') {
row[field.key] = false
} else if (field.type === 'checkbox' || field.type === 'repeater') {
row[field.key] = []
} else {
row[field.key] = ''
}
}
return row
}
/** time/unit 形态的时长摘要:0 视为永久,其余按 day/month 补单位。 */
function rowDuration(row, cfg) {
if (!cfg.descKey) return ''
const raw = row[cfg.descKey]
if (raw === '' || raw == null) return ''
const amount = Number(raw)
if (!Number.isFinite(amount)) return String(raw)
if (amount <= 0) return '永久'
if (!cfg.descUnitKey) return String(raw)
const unit = String(row[cfg.descUnitKey] || '')
if (unit === 'month') return `${amount} 个月`
if (unit === 'day') return `${amount} 天`
return String(raw)
}
/** 未配置 titleKey 时,取首个值为非空字符串/数字的字段作为标题。 */
function fallbackTitleKey(row, fields) {
if (row.title != null && String(row.title).trim() !== '') return 'title'
for (const field of (Array.isArray(fields) ? fields : [])) {
if (field.ui_only) continue
const value = row[field.key]
if ((typeof value === 'string' && value.trim() !== '') || typeof value === 'number') return field.key
}
return 'title'
}
/** 收起态标题行上的一行摘要,取自 listPreview 配置。 */
export function repeaterRowSummary(row, cfg = {}, fields = []) {
if (!row) return ''
const title = String(row[cfg.titleKey || fallbackTitleKey(row, fields)] ?? '').trim()
const prefix = String(cfg.prefix || '')
if (title === '') return prefix
const duration = rowDuration(row, cfg)
return duration ? `${prefix}${title} · ${duration}` : `${prefix}${title}`
}
/** list-modal 卡片预览:图标 / 自定义图标 HTML / 图标类 / 标题 / 描述。 */
export function repeaterRowPreview(row, cfg = {}) {
const read = (key) => String(row?.[key] || '').trim()
const desc = read(cfg.descKey || 'desc') || read(cfg.urlKey || 'url')
return {
icon: read(cfg.iconKey || 'icon'),
customIcon: read(cfg.customIconKey || 'custom_icon'),
iconClass: read(cfg.iconClassKey || 'icon_class'),
title: read(cfg.titleKey || 'title') || '未命名卡片',
desc: desc || '暂无描述',
}
}
@@ -0,0 +1,15 @@
/**
* 所有后台 vuedraggable 列表共用的 Sortable 选项(v-bind 到 <draggable>)。
* 配套样式见 src/styles/sortable-list.css,拖拽手柄统一用 JioSortHandle。
*/
const prefersReducedMotion = typeof window !== 'undefined'
&& typeof window.matchMedia === 'function'
&& window.matchMedia('(prefers-reduced-motion: reduce)').matches
export const SORTABLE_LIST_ATTRS = Object.freeze({
handle: '.jio-sortable__handle',
ghostClass: 'jio-sortable__ghost',
chosenClass: 'jio-sortable__chosen',
dragClass: 'jio-sortable__drag',
animation: prefersReducedMotion ? 0 : 180,
})
@@ -0,0 +1,46 @@
/**
* 可排序卡片列表的折叠状态:所有带展开区的卡片默认收起,点击行头展开/收起。
*
* 状态按行的稳定 key 记录(而不是下标),拖拽换位后每张卡片保持自己的开合状态。
* 行头属性统一由 collapseHeadAttrs 生成:可点击、可键盘操作(Enter / Space)、
* 带 aria-expanded,样式见 styles/sortable-list.css。
*/
import { ref } from 'vue'
export function collapseHeadAttrs(open, toggle) {
return {
class: 'is-clickable',
role: 'button',
tabindex: 0,
'aria-expanded': open ? 'true' : 'false',
onClick: toggle,
onKeydown: (event) => {
// 只响应行头本身的按键,行内按钮 / 输入框的 Enter、空格不触发折叠。
if (event.target !== event.currentTarget) return
if (event.key !== 'Enter' && event.key !== ' ') return
event.preventDefault()
toggle()
},
}
}
export function useCollapsibleItems() {
const openKeys = ref(new Set())
function isOpen(key) {
return openKeys.value.has(key)
}
function toggle(key) {
const next = new Set(openKeys.value)
if (next.has(key)) next.delete(key)
else next.add(key)
openKeys.value = next
}
function headAttrs(key) {
return collapseHeadAttrs(isOpen(key), () => toggle(key))
}
return { isOpen, toggle, headAttrs }
}
@@ -0,0 +1,120 @@
import { onMounted, ref } from 'vue'
import api from '@/api'
/**
* JioField 的远程选项加载:async_select / taxonomy_select / user_select / page_select。
* 仅按 schema.type 在挂载时拉取对应数据源。
*/
export function useFieldRemoteOptions(props) {
const asyncOptions = ref([])
const asyncLoading = ref(false)
const taxonomyOptions = ref([])
const taxonomyLoading = ref(false)
const userOptions = ref([])
const userLoading = ref(false)
const pageOptions = ref([])
const pageLoading = ref(false)
let asyncTimer = null
let userTimer = null
let pageTimer = null
async function loadAsyncOptions(query = '') {
asyncLoading.value = true
try {
const selected = Array.isArray(props.modelValue) ? props.modelValue : (props.modelValue ? [props.modelValue] : [])
const response = await api.searchPageDisplayOptions(props.schema.source, query, query ? [] : selected)
asyncOptions.value = response?.data || []
} catch (error) {
asyncOptions.value = []
} finally {
asyncLoading.value = false
}
}
function handleAsyncSearch(query) {
clearTimeout(asyncTimer)
asyncTimer = setTimeout(() => loadAsyncOptions(query), 250)
}
async function loadTaxonomyTerms() {
if (!props.schema.taxonomy) return
taxonomyLoading.value = true
try {
const res = await api.getCategories(props.schema.taxonomy || 'category')
const items = res?.data || res || []
taxonomyOptions.value = (Array.isArray(items) ? items : []).map(t => ({
label: t.name + (t.count ? ' (' + t.count + ')' : ''),
value: t.term_id,
}))
} catch (e) {
console.warn('[JioField] taxonomy load failed:', e)
taxonomyOptions.value = []
} finally {
taxonomyLoading.value = false
}
}
async function loadUsers(query = '') {
userLoading.value = true
try {
const res = await api.searchUsers(query, 20)
const items = res?.data || res || []
userOptions.value = (Array.isArray(items) ? items : []).map(u => ({
label: u.display_name + ' (' + u.user_login + ')',
value: u.id,
}))
} catch (e) {
console.warn('[JioField] user load failed:', e)
userOptions.value = []
} finally {
userLoading.value = false
}
}
function handleUserSearch(query) {
clearTimeout(userTimer)
userTimer = setTimeout(() => loadUsers(query || ''), 300)
}
async function loadPages(query = '') {
pageLoading.value = true
try {
const selected = props.modelValue ? [props.modelValue] : []
const res = await api.searchPageDisplayOptions('pages', query, query ? [] : selected)
const items = res?.data || res || []
pageOptions.value = Array.isArray(items) ? items : []
} catch (e) {
console.warn('[JioField] page load failed:', e)
pageOptions.value = []
} finally {
pageLoading.value = false
}
}
function handlePageSearch(query) {
clearTimeout(pageTimer)
pageTimer = setTimeout(() => loadPages(query), 250)
}
onMounted(() => {
const type = props.schema.type
if (type === 'taxonomy_select') loadTaxonomyTerms()
if (type === 'user_select') loadUsers()
if (type === 'async_select') loadAsyncOptions()
if (type === 'page_select') loadPages()
})
return {
asyncOptions,
asyncLoading,
handleAsyncSearch,
taxonomyOptions,
taxonomyLoading,
userOptions,
userLoading,
handleUserSearch,
pageOptions,
pageLoading,
handlePageSearch,
}
}
@@ -0,0 +1,73 @@
import { renderFaIcon, schemaPage } from './helpers'
export const forumSection = {
key: 'forum',
label: '社区论坛',
icon: renderFaIcon('fa fas fa-comments'),
route: '/forum',
children: [
schemaPage({
key: 'forum-general',
name: 'Forum_general',
label: '全局设置',
title: '全局设置',
route: '/forum/general',
canonicalDomain: 'forum',
section: 'general',
}),
schemaPage({
key: 'forum-home',
name: 'Forum_home',
label: '首页与列表',
title: '首页与列表',
route: '/forum/home',
canonicalDomain: 'forum',
section: 'home',
}),
schemaPage({
key: 'forum-publishing',
name: 'Forum_publishing',
label: '发布与审核',
title: '发布与审核',
route: '/forum/publishing',
canonicalDomain: 'forum',
section: 'publishing',
}),
schemaPage({
key: 'forum-access',
name: 'Forum_access',
label: '权限与版主',
title: '权限与版主',
route: '/forum/access',
canonicalDomain: 'forum',
section: 'access',
}),
schemaPage({
key: 'forum-replies',
name: 'Forum_replies',
label: '回复与互动',
title: '回复与互动',
route: '/forum/replies',
canonicalDomain: 'forum',
section: 'replies',
}),
schemaPage({
key: 'forum-payment',
name: 'Forum_payment',
label: '付费与积分',
title: '付费与积分',
route: '/forum/payment',
canonicalDomain: 'forum',
section: 'payment',
}),
schemaPage({
key: 'forum-urls',
name: 'Forum_urls',
label: '链接设置',
title: '链接设置',
route: '/forum/urls',
canonicalDomain: 'forum',
section: 'urls',
}),
],
}
@@ -12,7 +12,7 @@ export const globalSection = {
label: '常用功能',
route: '/global/common',
title: '常用功能',
desc: '评论、性能、头像源与备案等全局基础配置。',
desc: '评论、性能、头像源等全局基础配置。',
canonicalDomain: 'global',
section: 'common',
}),
@@ -8,6 +8,7 @@ import { extensionsSection } from './extensions'
import { themeInfoSection } from './theme-info'
import { docsSection } from './docs'
import { toolsSection } from './tools'
import { forumSection } from './forum'
const SECTION_DEFAULT_CHILDREN = {
global: 'global-common',
@@ -18,6 +19,7 @@ const SECTION_DEFAULT_CHILDREN = {
payment: 'payment-knowledge',
extensions: 'extensions-system',
tools: 'tools-import-export',
forum: 'forum-general',
'theme-info': 'theme-info-dashboard',
docs: 'docs-dashboard',
}
@@ -43,6 +45,7 @@ export const ADMIN_SECTIONS = [
attachSectionDefaultRoute(permissionsSection),
attachSectionDefaultRoute(usersSection),
attachSectionDefaultRoute(paymentSection),
attachSectionDefaultRoute(forumSection),
attachSectionDefaultRoute(extensionsSection),
attachSectionDefaultRoute(toolsSection),
attachSectionDefaultRoute(themeInfoSection),
@@ -60,6 +60,15 @@ export const pageDisplaySection = {
canonicalDomain: 'page_display',
section: 'tag',
}),
schemaPage({
key: 'page-display-topics',
name: 'PageDisplayTopics',
label: '专题页面',
route: '/page-display/topics',
title: '专题页面',
canonicalDomain: 'page_display',
section: 'topics',
}),
schemaPage({
key: 'page-display-user-home',
name: 'PageDisplayUserHome',
+12 -11
View File
@@ -4,6 +4,7 @@ import NaiveUI from 'naive-ui'
import App from './App.vue'
import router from './router'
import './style.css'
import './styles/sortable-list.css'
import { styleMountTarget } from './style-target'
const app = createApp(App)
@@ -13,35 +14,35 @@ app.use(NaiveUI)
// 全局错误处理
app.config.errorHandler = (err, vm, info) => {
console.error('[AKSRT] 全局错误:', err, info)
console.error('[Jio] 全局错误:', err, info)
}
// 兜底:立即显示加载状态(防止白屏)
function showFallback(el) {
el.innerHTML = '<div style="padding:40px;text-align:center;color:#666;font-family:sans-serif;">'
+ '<p style="font-size:18px;margin-bottom:8px;">AKSRT 正在加载...</p>'
+ '<p style="font-size:18px;margin-bottom:8px;">Jio 正在加载...</p>'
+ '<p style="font-size:13px;color:#999;">如果长时间停留在此页面,请按 F12 查看控制台错误</p>'
+ '</div>'
}
showFallback(document.getElementById('aksrt-admin-app') || document.body.appendChild(
Object.assign(document.createElement('div'), { id: 'aksrt-admin-app' })
showFallback(document.getElementById('jio-admin-app') || document.body.appendChild(
Object.assign(document.createElement('div'), { id: 'jio-admin-app' })
))
/**
* 获取或创建一个干净的挂载容器
* 核心问题:WordPress 后台的 jQuery/脚本会在页面加载后持续操作 DOM,
* 导致 PHP 输出的 <div id="aksrt-admin-app"> 可能被外部修改或其兄弟节点被移除,
* 导致 PHP 输出的 <div id="jio-admin-app"> 可能被外部修改或其兄弟节点被移除,
* Vue patch 时遍历到 null 节点 → nextSibling 报错。
*
* 解决方案:在挂载前一刻,动态创建一个全新的容器元素替换旧的,
* 确保该节点及其父级在 Vue 接管前不被任何外部脚本污染。
*/
function getCleanContainer() {
const existing = document.getElementById('aksrt-admin-app')
const existing = document.getElementById('jio-admin-app')
if (!existing) {
// 极端情况:PHP 没有输出容器,手动创建
const fresh = document.createElement('div')
fresh.id = 'aksrt-admin-app'
fresh.id = 'jio-admin-app'
document.body.appendChild(fresh)
return fresh
}
@@ -52,13 +53,13 @@ function getCleanContainer() {
if (!parent) {
// 旧容器已脱离文档树,重新创建
const fresh = document.createElement('div')
fresh.id = 'aksrt-admin-app'
fresh.id = 'jio-admin-app'
document.body.appendChild(fresh)
return fresh
}
const fresh = document.createElement('div')
fresh.id = 'aksrt-admin-app'
fresh.id = 'jio-admin-app'
// 将旧容器的位置信息转移给新容器(保留 fallback 内容)
fresh.innerHTML = existing.innerHTML || ''
@@ -90,12 +91,12 @@ router.isReady().then(() => {
styleMountTarget.value = container
app.mount(container)
} catch (err) {
console.error('[AKSRT] Vue 挂载失败:', err)
console.error('[Jio] Vue 挂载失败:', err)
showError(getCleanContainer(), err)
}
})
})
})
}).catch((err) => {
console.error('[AKSRT] Router 初始化失败:', err)
console.error('[Jio] Router 初始化失败:', err)
})
+64 -145
View File
@@ -1,20 +1,20 @@
<template>
<div class="aksrt-page-container">
<h2 class="aksrt-page-title">积分配置</h2>
<p class="aksrt-page-desc">
<div class="jio-page-container">
<h2 class="jio-page-title">积分配置</h2>
<p class="jio-page-desc">
配置积分规则与发放策略。可自定义货币名称(如”金币”、”魔石”等)。用户余额与手工调整在 WordPress 原生”用户”菜单中管理。
</p>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header"><h3>主开关 + 基础设置</h3></div>
<n-form :model="cfg" label-placement="left" label-width="200" class="aksrt-form">
<n-card class="jio-section-card">
<div class="jio-section-header"><h3>主开关 + 基础设置</h3></div>
<n-form :model="cfg" label-placement="left" label-width="200" class="jio-form">
<n-form-item label="启用积分系统">
<n-switch v-model:value="cfg.enabled" />
</n-form-item>
<n-form-item label="自定义货币名称">
<n-input v-model:value="cfg.currency_name" placeholder="积分" maxlength="20" />
<template #feedback>
<span class="aksrt-hint-text">自定义货币显示名称,如"金币"、"魔石"等。留空则使用默认名称"积分"。</span>
<span class="jio-hint-text">自定义货币显示名称,如"金币"、"魔石"等。留空则使用默认名称"积分"。</span>
</template>
</n-form-item>
<n-form-item label="注册赠送积分">
@@ -23,36 +23,9 @@
</n-form>
</n-card>
<n-card title="用户近期资产记录" class="aksrt-section-card">
<n-space vertical :size="12">
<n-space wrap>
<n-input v-model:value="ledgerFilters.user_id" placeholder="用户 ID" clearable style="width: 130px" />
<n-select v-model:value="ledgerFilters.asset" :options="assetOptions" placeholder="资产" style="width: 130px" />
<n-input v-model:value="ledgerFilters.date_from" type="date" placeholder="开始日期" style="width: 160px" />
<n-input v-model:value="ledgerFilters.date_to" type="date" placeholder="结束日期" style="width: 160px" />
<n-button type="primary" :loading="ledgerLoading" @click="searchLedger">查询</n-button>
<n-button @click="resetLedger">重置</n-button>
</n-space>
<n-data-table
:columns="ledgerColumns"
:data="ledgerRows"
:loading="ledgerLoading"
:row-key="row => row.id"
:scroll-x="1100"
size="small"
/>
<n-pagination
v-model:page="ledgerPage"
:page-count="ledgerPageCount"
:page-size="10"
@update:page="loadLedger"
/>
</n-space>
</n-card>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header"><h3>每日签到</h3></div>
<n-form :model="cfg.daily_signin" label-placement="left" label-width="200" class="aksrt-form">
<n-card class="jio-section-card">
<div class="jio-section-header"><h3>每日签到</h3></div>
<n-form :model="cfg.daily_signin" label-placement="left" label-width="200" class="jio-form">
<n-form-item label="启用">
<n-switch v-model:value="cfg.daily_signin.enabled" />
</n-form-item>
@@ -67,15 +40,15 @@
:autosize="{ minRows: 2 }"
/>
<template #feedback>
<span class="aksrt-hint-text">连续 N 天时额外发放的积分。</span>
<span class="jio-hint-text">连续 N 天时额外发放的积分。</span>
</template>
</n-form-item>
</n-form>
</n-card>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header"><h3>评论奖励</h3></div>
<n-form :model="cfg.comment_reward" label-placement="left" label-width="200" class="aksrt-form">
<n-card class="jio-section-card">
<div class="jio-section-header"><h3>评论奖励</h3></div>
<n-form :model="cfg.comment_reward" label-placement="left" label-width="200" class="jio-form">
<n-form-item label="启用">
<n-switch v-model:value="cfg.comment_reward.enabled" />
</n-form-item>
@@ -94,9 +67,9 @@
</n-form>
</n-card>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header"><h3>Ref 推广奖励</h3></div>
<n-form :model="cfg.referral_reward" label-placement="left" label-width="200" class="aksrt-form">
<n-card class="jio-section-card">
<div class="jio-section-header"><h3>Ref 推广奖励</h3></div>
<n-form :model="cfg.referral_reward" label-placement="left" label-width="200" class="jio-form">
<n-form-item label="启用">
<n-switch v-model:value="cfg.referral_reward.enabled" />
</n-form-item>
@@ -118,142 +91,88 @@
</n-form>
</n-card>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header"><h3>下载消费(参考)</h3></div>
<n-form :model="cfg" label-placement="left" label-width="200" class="aksrt-form">
<n-card class="jio-section-card">
<div class="jio-section-header"><h3>下载消费(参考)</h3></div>
<n-form :model="cfg" label-placement="left" label-width="200" class="jio-form">
<n-form-item :label="`默认积分价参考(${cfg.currency_name || '积分'})`">
<n-input-number v-model:value="cfg.download_default_cost" :min="0" :max="100000" />
<template #feedback>
<span class="aksrt-hint-text">实际价格以文章「付费内容设置」的积分价或现金价为准;下载解锁走收银台订单,不按次扣费。</span>
<span class="jio-hint-text">实际价格以文章「付费内容设置」的积分价或现金价为准;下载解锁走收银台订单,不按次扣费。</span>
</template>
</n-form-item>
</n-form>
</n-card>
<div class="aksrt-form-footer">
<n-button type="primary" :loading="saving" @click="saveCfg">保存配置</n-button>
</div>
<JioSaveBar :dirty="dirty" :saving="saving" @save="saveCfg" @reload="loadCfg" />
</div>
</template>
<script setup>
import { ref, reactive, onMounted } from 'vue'
import { computed, ref, reactive, onMounted } from 'vue'
import { useMessage } from 'naive-ui'
import api from '@/api'
import JioSaveBar from '@/components/form/JioSaveBar.vue'
const message = useMessage()
// ---------- 配置 ----------
const cfg = reactive({
enabled: true,
currency_name: '',
register_bonus: 10,
daily_signin: { enabled: true, base: 1, streak: { 3: 2, 7: 5, 30: 20 } },
comment_reward: { enabled: true, amount: 1, daily_cap: 5, min_length: 10, on_approved: true },
referral_reward: {
function defaultCfg() {
return {
enabled: true,
promoter_amount: 5,
referred_amount: 2,
level_points: 0,
require_verify: true,
ip_daily_cap: 3,
},
download_default_cost: 0,
})
const streakJson = ref('{}')
const saving = ref(false)
const ledgerLoading = ref(false)
const ledgerRows = ref([])
const ledgerPage = ref(1)
const ledgerPageCount = ref(1)
const ledgerFilters = reactive({
user_id: '',
asset: 'points',
date_from: '',
date_to: '',
})
const assetOptions = [
{ label: '积分', value: 'points' },
{ label: '余额', value: 'balance' },
]
const ledgerColumns = [
{ title: '类型', key: 'reason', width: 150 },
{ title: '订单号', key: 'ref_key', width: 200 },
{ title: '变动 / 变动后', key: 'delta_label', width: 190 },
{ title: '说明', key: 'remark', width: 240, ellipsis: { tooltip: true } },
{ title: '时间', key: 'created_at', width: 170 },
]
function formatAssetValue(asset, value) {
const raw = Number(value ?? 0)
if (!Number.isFinite(raw)) return asset === 'balance' ? '0.00' : '0'
if (asset !== 'balance') return String(raw)
const negative = raw < 0
const digits = String(Math.abs(Math.trunc(raw))).padStart(3, '0')
const whole = digits.slice(0, -2).replace(/^0+(?=\d)/, '')
return (negative ? '-' : '') + whole + '.' + digits.slice(-2)
}
async function loadLedger() {
ledgerLoading.value = true
try {
if (!/^\d+$/.test(String(ledgerFilters.user_id).trim())) {
message.warning('请输入用户 ID 后查询该用户近期记录')
return
}
const params = { page: ledgerPage.value, per_page: 10 }
Object.entries(ledgerFilters).forEach(([key, value]) => {
if (value !== null && String(value).trim() !== '') params[key] = value
})
const response = await api.getCreditLog(params)
const data = response?.data || response || {}
ledgerRows.value = (data.items || []).map((row) => {
const entries = Array.isArray(row.entries) ? row.entries : []
const entry = entries[0] || {}
return {
...row,
delta_label: `${formatAssetValue(entry.asset, entry.delta)} / ${formatAssetValue(entry.asset, entry.balance_after)}`,
remark: row.remark || '—',
}
})
ledgerPageCount.value = Math.max(1, Math.ceil(Number(data.total || 0) / Number(data.per_page || 10)))
} catch (e) {
message.error(e.message || '加载资产记录失败')
} finally {
ledgerLoading.value = false
currency_name: '',
register_bonus: 10,
daily_signin: { enabled: true, base: 1, streak: { 3: 2, 7: 5, 30: 20 } },
comment_reward: { enabled: true, amount: 1, daily_cap: 5, min_length: 10, on_approved: true },
referral_reward: {
enabled: true,
promoter_amount: 5,
referred_amount: 2,
level_points: 0,
require_verify: true,
ip_daily_cap: 3,
},
download_default_cost: 0,
}
}
function searchLedger() {
ledgerPage.value = 1
loadLedger()
}
function resetLedger() {
Object.assign(ledgerFilters, { user_id: '', asset: 'points', date_from: '', date_to: '' })
ledgerRows.value = []
ledgerPage.value = 1
ledgerPageCount.value = 1
}
const cfg = reactive(defaultCfg())
const streakJson = ref('{}')
const loading = ref(true)
const saving = ref(false)
const initial = ref('')
const snapshot = computed(() => JSON.stringify({ cfg, streakJson: streakJson.value }))
const dirty = computed(() => !loading.value && initial.value !== '' && snapshot.value !== initial.value)
async function loadCfg() {
loading.value = true
try {
const response = await api.getCreditSettings()
const data = response?.data || response || {}
Object.assign(cfg, data)
Object.assign(cfg, defaultCfg(), data)
streakJson.value = JSON.stringify(cfg.daily_signin?.streak || {}, null, 0)
initial.value = snapshot.value
} catch (e) {
message.error(e.message || '加载失败')
} finally {
loading.value = false
}
}
async function saveCfg() {
let streak
try {
streak = JSON.parse(streakJson.value || '{}')
} catch (error) {
message.error('连续奖励 JSON 格式错误')
return
}
if (!streak || typeof streak !== 'object' || Array.isArray(streak)) {
message.error('连续奖励必须是 JSON 对象')
return
}
saving.value = true
try {
let streak = {}
try { streak = JSON.parse(streakJson.value || '{}') } catch (_) { /* ignore */ }
await api.saveCreditSettings({ ...cfg, daily_signin: { ...cfg.daily_signin, streak } })
cfg.daily_signin.streak = streak
await api.saveCreditSettings(cfg)
initial.value = snapshot.value
message.success('已保存')
} catch (e) {
message.error(e.message || '保存失败')
+17 -17
View File
@@ -1,6 +1,6 @@
<template>
<div class="aksrt-schema-page">
<AksFormRenderer
<div class="jio-schema-page">
<JioFormRenderer
:title="pageMeta.title"
:description="pageMeta.description"
:icon="pageMeta.icon"
@@ -24,7 +24,7 @@
v-model:value="captchaProviderTab"
type="segment"
animated
class="aksrt-tabs aksrt-captcha-provider-tabs"
class="jio-tabs jio-captcha-provider-tabs"
>
<n-tab-pane
v-for="provider in captchaProviders"
@@ -48,18 +48,18 @@
#field-geoip_block_countries="{ value, setValue }"
>
<n-dynamic-tags :value="Array.isArray(value) ? value : []" @update:value="setValue" />
<p class="aksrt-schema-page__field-hint">使用 ISO 国家代码,如 CN / US / RU。</p>
<p class="jio-schema-page__field-hint">使用 ISO 国家代码,如 CN / US / RU。</p>
</template>
<!-- Slot for custom group content (override per page if needed) -->
<template v-for="(_, name) in $slots" #[name]="slotData">
<slot :name="name" v-bind="slotData" />
</template>
</AksFormRenderer>
</JioFormRenderer>
<div
v-if="isPermissionsLogin && !loading"
class="aksrt-schema-page__tool-actions"
class="jio-schema-page__tool-actions"
>
<n-button
:disabled="!formData?.enabled || !formData?.active_provider"
@@ -80,7 +80,7 @@
<n-spin />
<p style="margin-top:10px;color:#999;">加载中...</p>
</div>
<div v-if="testResult && !testLoading" :style="{color: testResult.success ? 'var(--aksrt-color-primary)' : '#d03050', textAlign:'center', padding:'20px'}">
<div v-if="testResult && !testLoading" :style="{color: testResult.success ? 'var(--jio-color-primary)' : '#d03050', textAlign:'center', padding:'20px'}">
<p style="font-size:16px;margin:0;">{{ testResult.message }}</p>
</div>
<div v-if="!testLoading && !testResult" id="captcha-test-box" style="min-height:150px;"></div>
@@ -95,7 +95,7 @@
* SchemaPage — generic Schema-driven settings page.
*
* Reads the schema from the Vue-side schema registry, fetches/saves settings
* via the API client, and renders using AksFormRenderer.
* via the API client, and renders using JioFormRenderer.
*
* Usage (in router or parent):
* <SchemaPage domain="global" section="logo" />
@@ -106,7 +106,7 @@
import { computed, watch, ref, nextTick, onBeforeUnmount } from 'vue'
import { useRoute } from 'vue-router'
import { useMessage } from 'naive-ui'
import AksFormRenderer from '@/components/form/AksFormRenderer.vue'
import JioFormRenderer from '@/components/form/JioFormRenderer.vue'
import { useSectionForm } from '@/composables/useSectionForm'
import { getSchema, normalizeSchemaDomain } from '@/schema/index.js'
import api from '@/api/index.js'
@@ -170,7 +170,7 @@ function resolveSectionFromPath(path) {
/** Load schema from the Vue-side registry */
const pageMeta = computed(() => {
const schema = (isEmailPage.value || resolvedDomain.value === 'page_display')
const schema = (isEmailPage.value || ['page_display', 'forum'].includes(resolvedDomain.value))
? serverSchema.value
: getSchema(resolvedDomain.value, resolvedSection.value)
if (schema && schema.groups && schema.groups.length > 0) {
@@ -192,7 +192,7 @@ const pageMeta = computed(() => {
/** Default values from schema */
const defaults = computed(() => {
const schema = (isEmailPage.value || resolvedDomain.value === 'page_display')
const schema = (isEmailPage.value || ['page_display', 'forum'].includes(resolvedDomain.value))
? serverSchema.value
: getSchema(resolvedDomain.value, resolvedSection.value)
if (!schema) return {}
@@ -221,7 +221,7 @@ const {
const payload = { ...data }
const clearSecrets = []
Object.keys(payload).forEach((key) => {
if (payload[key] === '__AKSRT_CLEAR_SECRET__') {
if (payload[key] === '__JIO_CLEAR_SECRET__') {
clearSecrets.push(key)
delete payload[key]
}
@@ -417,7 +417,7 @@ function loadProviderSDK(provider, cfg) {
sitekey: cfg.site_key,
theme: cfg.theme || 'auto',
size: cfg.size || 'normal',
action: 'aksrt-admin-test',
action: 'jio-admin-test',
cdata: 'admin-captcha-test',
callback: function(token) {
submitCaptchaTest('cloudflare', { cf_turnstile_response: token })
@@ -539,21 +539,21 @@ onBeforeUnmount(() => {
</script>
<style scoped>
.aksrt-schema-page {
.jio-schema-page {
max-width: none;
margin: 0;
}
.aksrt-schema-page__tool-actions {
.jio-schema-page__tool-actions {
display: flex;
justify-content: flex-end;
margin-top: 16px;
}
.aksrt-schema-page__field-hint {
.jio-schema-page__field-hint {
margin: 8px 0 0;
font-size: 12px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
}
.captcha-test-overlay {
@@ -1,5 +1,5 @@
<template>
<div class="aksrt-page-container content-page">
<div class="jio-page-container content-page">
<PageHeader title="右侧悬浮按钮" desc="显示在页面右侧的悬浮按钮,支持排序及添加自定义按钮。" />
<n-spin :show="loading" style="width: 100%; min-height: 200px;">
@@ -7,8 +7,8 @@
<b>全局悬浮按钮:</b>显示在页面右侧的悬浮按钮,支持排序及添加自定义按钮
</n-alert>
<n-card class="aksrt-section-card">
<n-form :model="form" label-placement="left" label-width="160" class="aksrt-form">
<n-card class="jio-section-card">
<n-form :model="form" label-placement="left" label-width="160" class="jio-form">
<n-form-item label="按钮样式">
<n-radio-group v-model:value="form.style">
<n-space>
@@ -51,11 +51,9 @@
<div class="float-settings__desc">设置并排序需要显示的按钮</div>
<draggable
v-model="form.items"
v-bind="SORTABLE_LIST_ATTRS"
item-key="type"
handle=".float-btn-panel__handle"
ghost-class="float-settings__ghost"
animation="180"
class="float-settings__list"
class="jio-sortable"
>
<template #item="{ element, index }">
<FloatBtnItemPanel :model-value="element" @update:model-value="updateItem(index, $event)" />
@@ -65,7 +63,7 @@
</n-card>
</n-spin>
<AksSaveBar :dirty="dirty" :saving="saving" @save="handleSave" @reload="loadSettings" />
<JioSaveBar :dirty="dirty" :saving="saving" @save="handleSave" @reload="loadSettings" />
</div>
</template>
@@ -75,7 +73,8 @@ import { useMessage } from 'naive-ui'
import draggable from 'vuedraggable'
import api from '@/api'
import PageHeader from '@/components/PageHeader.vue'
import AksSaveBar from '@/components/form/AksSaveBar.vue'
import JioSaveBar from '@/components/form/JioSaveBar.vue'
import { SORTABLE_LIST_ATTRS } from '@/components/form/sortable-options.js'
import FloatBtnItemPanel from '@/components/floating/FloatBtnItemPanel.vue'
import { defaultSettings, normalizeItems } from '@/components/floating/floating-defaults.js'
@@ -163,13 +162,13 @@ onMounted(loadSettings)
.float-settings__desc {
font-size: 12px;
color: var(--n-text-color-3, #999);
color: var(--jio-color-muted, #6F7A72);
}
.float-settings__label {
margin-left: 12px;
font-size: 13px;
color: var(--n-text-color-3, #999);
color: var(--jio-color-muted, #6F7A72);
}
.float-settings__section {
@@ -183,14 +182,4 @@ onMounted(loadSettings)
font-weight: 600;
font-size: 14px;
}
.float-settings__list {
display: flex;
flex-direction: column;
gap: 8px;
}
.float-settings__ghost {
opacity: 0.45;
}
</style>
@@ -1,31 +1,27 @@
<template>
<div class="aksrt-page-container content-page">
<PageHeader title="底部Tab配置" desc="自定义移动端底部导航栏的按钮,支持排序、图标配置和返回顶部功能。">
<template #actions>
<n-button type="primary" :loading="saving" @click="handleSave">保存</n-button>
</template>
</PageHeader>
<div class="jio-page-container content-page">
<PageHeader title="底部Tab配置" desc="自定义移动端底部导航栏的按钮,支持排序、图标配置和返回顶部功能。" />
<n-spin :show="loading" style="width: 100%; min-height: 200px;">
<!-- 基础设置 -->
<n-card class="aksrt-section-card">
<n-card class="jio-section-card">
<template #header>
<div class="aksrt-card-header-row">
<div class="aksrt-card-header-row__left">
<div class="jio-card-header-row">
<div class="jio-card-header-row__left">
<span class="header-icon"><i class="fa fas fa-cog"></i></span>
<strong class="aksrt-card-header-row__title">基础设置</strong>
<strong class="jio-card-header-row__title">基础设置</strong>
</div>
</div>
</template>
<n-form :model="form" label-placement="left" label-width="140" class="aksrt-form">
<n-form :model="form" label-placement="left" label-width="140" class="jio-form">
<n-form-item label="启用底部Tab">
<n-switch v-model:value="form.enabled" />
<span class="aksrt-hint-text" style="margin-left: 12px;">移动端底部导航栏总开关</span>
<span class="jio-hint-text" style="margin-left: 12px;">移动端底部导航栏总开关</span>
</n-form-item>
<n-form-item label="向下滚动隐藏">
<n-switch v-model:value="form.scroll_down_hide" />
<span class="aksrt-hint-text" style="margin-left: 12px;">页面向下滚动时隐藏,向上滚动时显示</span>
<span class="jio-hint-text" style="margin-left: 12px;">页面向下滚动时隐藏,向上滚动时显示</span>
</n-form-item>
<n-form-item label="文章页专属Tab">
<n-select
@@ -36,18 +32,18 @@
]"
style="width: 240px;"
/>
<span class="aksrt-hint-text" style="margin-left: 12px;">文章详情页底部显示的Tab按钮类型</span>
<span class="jio-hint-text" style="margin-left: 12px;">文章详情页底部显示的Tab按钮类型</span>
</n-form-item>
</n-form>
</n-card>
<!-- Tab按钮配置 -->
<n-card class="aksrt-section-card">
<n-card class="jio-section-card">
<template #header>
<div class="aksrt-card-header-row">
<div class="aksrt-card-header-row__left">
<div class="jio-card-header-row">
<div class="jio-card-header-row__left">
<span class="header-icon"><i class="fa fas fa-list-ul"></i></span>
<strong class="aksrt-card-header-row__title">Tab按钮配置 ({{ form.items.length }})</strong>
<strong class="jio-card-header-row__title">Tab按钮配置 ({{ form.items.length }})</strong>
</div>
<n-button type="primary" size="small" @click="addItem">
<template #icon><i class="fa fas fa-plus"></i></template>
@@ -61,64 +57,58 @@
<draggable
v-if="form.items.length"
v-model="form.items"
v-bind="SORTABLE_LIST_ATTRS"
item-key="id"
handle=".tabbar-sort__handle"
ghost-class="tabbar-sort__ghost"
animation="180"
class="tabbar-sort"
class="jio-sortable"
@end="resetSortOrder"
>
<template #item="{ element, index }">
<div class="tabbar-sort__item">
<div class="tabbar-sort__main">
<button type="button" class="tabbar-sort__handle" aria-label="拖拽排序">
<i class="fa fas fa-bars"></i>
</button>
<span class="tabbar-sort__icon">
<div class="jio-sortable__item">
<div class="jio-sortable__head">
<JioSortHandle />
<span class="jio-sortable__icon">
<IconValue v-if="element.icon" :value="element.icon" />
</span>
<div class="tabbar-sort__meta">
<div class="tabbar-sort__title-row">
<strong>{{ element.text || '按钮' }}</strong>
<div class="jio-sortable__main">
<div class="jio-sortable__title-row">
<span class="jio-sortable__title">{{ element.text || '按钮' }}</span>
<n-tag size="small" :bordered="false">{{ typeLabelMap[element.type] || element.type }}</n-tag>
<n-tag v-if="element.badge" size="small" type="error" :bordered="false">徽标 {{ element.badge }}</n-tag>
<n-tag v-if="element.type === 'home' && element.ontop" size="small" type="success" :bordered="false">返回顶部</n-tag>
<n-tag size="small" :type="element.enabled ? 'success' : 'default'" :bordered="false">{{ element.enabled ? '启用' : '禁用' }}</n-tag>
</div>
<div class="tabbar-sort__desc">{{ getItemSummary(element) }}</div>
<div class="jio-sortable__desc">{{ getItemSummary(element) }}</div>
</div>
<div class="jio-sortable__actions">
<n-button size="tiny" quaternary type="primary" @click="editItem(index)">
<template #icon><i class="fa fas fa-edit" style="font-size:12px;" /></template>
编辑
</n-button>
<n-button size="tiny" quaternary type="error" @click="deleteItem(index)">
<template #icon><i class="fa fas fa-trash-alt" style="font-size:12px;" /></template>
删除
</n-button>
</div>
</div>
<div class="tabbar-sort__actions">
<n-button size="tiny" quaternary type="primary" @click="editItem(index)">
<template #icon><i class="fa fas fa-edit" style="font-size:12px;" /></template>
编辑
</n-button>
<n-button size="tiny" quaternary type="error" @click="deleteItem(index)">
<template #icon><i class="fa fas fa-trash-alt" style="font-size:12px;" /></template>
删除
</n-button>
</div>
</div>
</template>
</draggable>
<n-empty v-else description="暂无Tab按钮,请点击上方按钮添加" />
</n-card>
<div class="aksrt-form-actions">
<n-button type="primary" :loading="saving" @click="handleSave">保存底部Tab配置</n-button>
</div>
</n-spin>
<JioSaveBar :dirty="dirty" :saving="saving" @save="handleSave" @reload="loadSettings" />
<!-- 编辑弹窗 -->
<n-modal
v-model:show="showModal"
:mask-closable="false"
preset="card"
:title="editingIndex >= 0 ? '编辑Tab按钮' : '添加Tab按钮'"
class="aksrt-modal-card"
class="jio-modal-card"
style="max-width: 520px;"
>
<n-form :model="editingItem" label-placement="top" class="aksrt-form">
<n-form :model="editingItem" label-placement="top" class="jio-form">
<n-form-item label="按钮类型">
<n-select
v-model:value="editingItem.type"
@@ -216,22 +206,21 @@
<div v-if="editingItem.add_items.length" class="add-items-editor__list">
<draggable
v-model="editingItem.add_items"
v-bind="SORTABLE_LIST_ATTRS"
item-key="id"
handle=".add-items-editor__drag"
ghost-class="add-items-editor__ghost"
animation="180"
class="jio-sortable jio-sortable--compact"
>
<template #item="{ element, index: subIndex }">
<div class="add-items-editor__row">
<button type="button" class="add-items-editor__drag" aria-label="拖拽排序">
<i class="fa fas fa-bars"></i>
</button>
<n-input v-model:value="element.label" placeholder="名称,例如:写文章" />
<FaIconPicker v-model="element.icon" placeholder="选择图标" />
<n-input v-model:value="element.url" placeholder="链接,例如:/wp-admin/post-new.php" />
<n-button quaternary type="error" @click="removeAddItem(subIndex)">
<template #icon><i class="fa fas fa-trash-alt" /></template>
</n-button>
<div class="jio-sortable__item">
<div class="jio-sortable__head add-items-editor__row">
<JioSortHandle />
<n-input v-model:value="element.label" placeholder="名称,例如:写文章" />
<FaIconPicker v-model="element.icon" placeholder="选择图标" />
<n-input v-model:value="element.url" placeholder="链接,例如:/wp-admin/post-new.php" />
<n-button quaternary type="error" aria-label="删除子项" @click="removeAddItem(subIndex)">
<template #icon><i class="fa fas fa-trash-alt" /></template>
</n-button>
</div>
</div>
</template>
</draggable>
@@ -241,7 +230,7 @@
<n-form-item v-if="editingItem.type === 'home'" label="返回顶部功能">
<n-switch v-model:value="editingItem.ontop" />
<span class="aksrt-hint-text" style="margin-left: 12px;">页面滚动后切换为返回顶部按钮</span>
<span class="jio-hint-text" style="margin-left: 12px;">页面滚动后切换为返回顶部按钮</span>
</n-form-item>
<n-form-item label="启用状态">
@@ -250,7 +239,7 @@
</n-form>
<template #footer>
<div class="aksrt-modal-footer">
<div class="jio-modal-footer">
<n-button @click="showModal = false">取消</n-button>
<n-button type="primary" @click="saveItem">保存</n-button>
</div>
@@ -265,8 +254,11 @@ import { NButton, NTag, useDialog, useMessage } from 'naive-ui'
import draggable from 'vuedraggable'
import api from '@/api'
import PageHeader from '@/components/PageHeader.vue'
import JioSaveBar from '@/components/form/JioSaveBar.vue'
import FaIconPicker from '@/components/form/FaIconPicker.vue'
import IconValue from '@/components/form/IconValue.vue'
import JioSortHandle from '@/components/form/JioSortHandle.vue'
import { SORTABLE_LIST_ATTRS } from '@/components/form/sortable-options.js'
const message = useMessage()
const dialog = useDialog()
@@ -283,6 +275,12 @@ const form = reactive({
footer_tabbar_single: 'default',
items: [],
})
const snapshot = ref('')
const serialize = () => JSON.stringify(form)
const dirty = computed(() => !loading.value && snapshot.value !== '' && serialize() !== snapshot.value)
function markClean() {
snapshot.value = serialize()
}
const editingItem = reactive({
id: '',
@@ -555,6 +553,7 @@ async function loadSettings() {
add_items: Array.isArray(item.add_items) ? item.add_items : [],
sort_order: item.sort_order ?? idx,
}))
markClean()
}
} catch (e) {
console.error('[FooterTabbar] load failed:', e)
@@ -584,6 +583,7 @@ async function handleSave() {
}
const res = await api.saveFooterTabbarSettings(payload)
if (res.code === 'success') {
markClean()
message.success(res.message || '保存成功')
} else {
message.error(res.message || '保存失败')
@@ -609,7 +609,7 @@ onMounted(loadSettings)
}
.icon-preview-row a {
color: var(--n-primary-color);
color: var(--jio-color-primary, #18A058);
text-decoration: none;
}
@@ -618,18 +618,12 @@ onMounted(loadSettings)
}
.muted-text {
color: #999;
color: var(--jio-color-muted, #6F7A72);
font-size: 12px;
}
.aksrt-modal-footer {
display: flex;
justify-content: flex-end;
gap: 10px;
}
.section-desc {
color: var(--n-text-color-3);
color: var(--jio-color-muted, #6F7A72);
font-size: 13px;
margin: 0 0 16px;
}
@@ -659,127 +653,19 @@ onMounted(loadSettings)
.add-items-editor__presets-label {
font-size: 12px;
color: var(--n-text-color-3, #999);
}
.add-items-editor__list {
display: flex;
flex-direction: column;
gap: 10px;
color: var(--jio-color-muted, #6F7A72);
}
.add-items-editor__row {
display: grid;
grid-template-columns: 32px 1fr 1fr 1.2fr 40px;
grid-template-columns: 28px 1fr 1fr 1.2fr 34px;
gap: 8px;
align-items: center;
}
.add-items-editor__drag {
width: 32px;
height: 32px;
border: 0;
border-radius: 10px;
background: #f3f5f7;
color: #6b7280;
cursor: grab;
}
.add-items-editor__ghost {
opacity: 0.5;
}
.tabbar-sort {
display: flex;
flex-direction: column;
gap: 12px;
}
.tabbar-sort__item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 14px 16px;
border: 1px solid var(--n-border-color);
border-radius: 14px;
background: #fff;
}
.tabbar-sort__main {
min-width: 0;
display: flex;
align-items: center;
gap: 12px;
flex: 1;
}
.tabbar-sort__handle {
width: 32px;
height: 32px;
border: 0;
border-radius: 10px;
background: #f3f5f7;
color: #6b7280;
cursor: grab;
}
.tabbar-sort__icon {
width: 38px;
height: 38px;
border-radius: 12px;
display: inline-flex;
align-items: center;
justify-content: center;
background: rgba(24, 160, 88, 0.12);
color: var(--aksrt-color-primary);
font-size: 18px;
flex: 0 0 auto;
}
.tabbar-sort__meta {
min-width: 0;
flex: 1;
}
.tabbar-sort__title-row {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 4px;
}
.tabbar-sort__desc {
color: var(--n-text-color-3);
font-size: 13px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.tabbar-sort__actions {
display: flex;
gap: 6px;
flex: 0 0 auto;
}
.tabbar-sort__ghost {
opacity: 0.5;
}
@media (max-width: 1023px) {
.tabbar-sort__item {
flex-direction: column;
align-items: stretch;
}
.tabbar-sort__actions {
justify-content: flex-end;
}
.add-items-editor__row {
grid-template-columns: 32px 1fr;
grid-template-columns: 28px 1fr;
}
}
</style>
@@ -1,5 +1,5 @@
<template>
<div class="aksrt-page-container content-page">
<div class="jio-page-container content-page">
<PageHeader title="通知管理" desc="管理通知内容开关、user 徽标统计口径和自动清理策略。">
<template #actions>
<n-space>
@@ -10,7 +10,7 @@
</PageHeader>
<n-spin :show="loading" style="width: 100%; min-height: 200px;">
<n-card title="通知内容开关" class="aksrt-section-card">
<n-card title="通知内容开关" class="jio-section-card">
<n-form :model="settings" label-placement="left" label-width="180">
<n-form-item label="评论回复通知">
<n-switch v-model:value="settings.enabled_types.comment_reply" />
@@ -35,21 +35,21 @@
<n-grid :cols="2" :x-gap="16" responsive="screen" item-responsive style="margin-top: 16px;">
<n-grid-item span="24 l:10">
<n-card title="user 徽标规则" class="aksrt-section-card">
<n-card title="user 徽标规则" class="jio-section-card">
<n-form :model="settings" label-placement="left" label-width="180">
<n-form-item label="启用 user 动态徽标">
<n-switch v-model:value="settings.user_badge_enabled" />
</n-form-item>
<n-form-item label="徽标包含状态提醒">
<n-switch v-model:value="settings.badge_include_stateful" />
<span class="aksrt-hint-text" style="margin-left: 12px;">未读持久化通知之外,叠加邮箱待验证、待审核评论等即时提醒</span>
<span class="jio-hint-text" style="margin-left: 12px;">未读持久化通知之外,叠加邮箱待验证、待审核评论等即时提醒</span>
</n-form-item>
</n-form>
</n-card>
</n-grid-item>
<n-grid-item span="24 l:14">
<n-card title="通知清理策略" class="aksrt-section-card">
<n-card title="通知清理策略" class="jio-section-card">
<n-form :model="settings" label-placement="left" label-width="180">
<n-form-item label="已读通知保留天数">
<n-input-number v-model:value="settings.read_retention_days" :min="1" :max="365" style="width: 180px;" />
+42 -42
View File
@@ -1,12 +1,12 @@
<template>
<div class="aksrt-page-container">
<div class="jio-page-container">
<PageHeader title="文档中心" desc="主题使用文档、开发指南、迁移说明和更新日志。" />
<!-- Quick Actions -->
<n-card title="常用操作" size="small" class="aksrt-docs__section">
<n-card title="常用操作" size="small" class="jio-docs__section">
<n-grid :cols="2" :x-gap="12" :y-gap="12">
<n-grid-item>
<div class="aksrt-docs__action">
<div class="jio-docs__action">
<FaIcon icon="fa fas fa-paint-brush" :size="16" />
<div>
<strong>全局设置</strong>
@@ -16,7 +16,7 @@
</div>
</n-grid-item>
<n-grid-item>
<div class="aksrt-docs__action">
<div class="jio-docs__action">
<FaIcon icon="fa fas fa-home" :size="16" />
<div>
<strong>首页配置</strong>
@@ -26,7 +26,7 @@
</div>
</n-grid-item>
<n-grid-item>
<div class="aksrt-docs__action">
<div class="jio-docs__action">
<FaIcon icon="fa fas fa-users" :size="16" />
<div>
<strong>用户管理</strong>
@@ -36,7 +36,7 @@
</div>
</n-grid-item>
<n-grid-item>
<div class="aksrt-docs__action">
<div class="jio-docs__action">
<FaIcon icon="fa fas fa-wrench" :size="16" />
<div>
<strong>工具</strong>
@@ -49,30 +49,30 @@
</n-card>
<!-- Reference Docs -->
<div class="aksrt-docs__grid">
<div class="jio-docs__grid">
<n-card
v-for="doc in docs"
:key="doc.key"
class="aksrt-docs__card"
class="jio-docs__card"
size="small"
hoverable
@click="openDoc(doc)"
>
<div class="aksrt-docs__card-inner">
<div class="aksrt-docs__card-icon" :style="{ background: doc.color }">
<div class="jio-docs__card-inner">
<div class="jio-docs__card-icon" :style="{ background: doc.color }">
<FaIcon :icon="doc.icon" :size="20" color="#fff" />
</div>
<div class="aksrt-docs__card-body">
<h4 class="aksrt-docs__card-title">{{ doc.title }}</h4>
<p class="aksrt-docs__card-desc">{{ doc.description }}</p>
<div class="jio-docs__card-body">
<h4 class="jio-docs__card-title">{{ doc.title }}</h4>
<p class="jio-docs__card-desc">{{ doc.description }}</p>
</div>
<FaIcon icon="fa fas fa-external-link-alt" :size="12" class="aksrt-docs__card-arrow" />
<FaIcon icon="fa fas fa-external-link-alt" :size="12" class="jio-docs__card-arrow" />
</div>
</n-card>
</div>
<!-- Version Info -->
<n-card title="当前版本" size="small" class="aksrt-docs__section">
<n-card title="当前版本" size="small" class="jio-docs__section">
<n-descriptions :column="2" bordered label-placement="left" size="small">
<n-descriptions-item label="主题版本">
<n-tag type="success" size="small">{{ themeVersion }}</n-tag>
@@ -91,12 +91,12 @@ import PageHeader from '@/components/PageHeader.vue'
import FaIcon from '@/components/form/FaIcon.vue'
import api from '@/api/index.js'
const themeVersion = ref(window.aksrtAdminData?.themeVersion || '3.4.0-dev')
const themeVersion = ref(window.jioAdminData?.themeVersion || '3.4.0-dev')
const dbSchemaVersion = ref('—')
const docs = ref([
{ key: 'admin-ia-map', title: '后台 IA 蓝图', description: '完整的后台信息架构映射,12 个顶级分区及子页面清单。', icon: 'fa fas fa-sitemap', color: 'var(--aksrt-color-primary)', file: 'admin-ia-map.md' },
{ key: 'legacy-gap-matrix', title: '对标差异矩阵', description: 'AKSRT 当前 → 原主题参考 → AKSRT 目标三层对照表。', icon: 'fa fas fa-columns', color: '#722ed1', file: 'legacy-gap-matrix.md' },
{ key: 'admin-ia-map', title: '后台 IA 蓝图', description: '完整的后台信息架构映射,12 个顶级分区及子页面清单。', icon: 'fa fas fa-sitemap', color: 'var(--jio-color-primary)', file: 'admin-ia-map.md' },
{ key: 'legacy-gap-matrix', title: '对标差异矩阵', description: 'Jio 当前 → 原主题参考 → Jio 目标三层对照表。', icon: 'fa fas fa-columns', color: '#722ed1', file: 'legacy-gap-matrix.md' },
{ key: 'frontend-page-matrix', title: '前端页面矩阵', description: '前端模板、CSS、JS 资产映射与覆盖范围。', icon: 'fa fas fa-desktop', color: '#13c2c2', file: 'frontend-page-matrix.md' },
{ key: 'manual-acceptance-baseline', title: '验收基线', description: '每个 Phase 的人工验收标准和检查清单。', icon: 'fa fas fa-clipboard', color: '#52c41a', file: 'manual-acceptance-baseline.md' },
{ key: 'feature-domain-map', title: '功能域地图', description: '业务域划分、依赖关系和模块边界说明。', icon: 'fa fas fa-map', color: '#fa8c16', file: 'feature-domain-map.md' },
@@ -117,35 +117,35 @@ onMounted(async () => {
function openDoc(doc) {
// Link to local docs directory (admin can open in new tab)
const base = window.aksrtAdminData?.siteUrl || window.location.origin
window.open(`${base}/wp-content/themes/AKSRT-theme/docs/${doc.file}`, '_blank')
const base = window.jioAdminData?.siteUrl || window.location.origin
window.open(`${base}/wp-content/themes/Jio/docs/${doc.file}`, '_blank')
}
</script>
<style scoped>
.aksrt-docs__grid {
.jio-docs__grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
gap: 12px;
margin-bottom: 16px;
}
.aksrt-docs__card {
.jio-docs__card {
cursor: pointer;
transition: box-shadow 0.2s;
}
.aksrt-docs__card:hover {
.jio-docs__card:hover {
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.aksrt-docs__card-inner {
.jio-docs__card-inner {
display: flex;
align-items: center;
gap: 12px;
}
.aksrt-docs__card-icon {
.jio-docs__card-icon {
flex-shrink: 0;
width: 40px;
height: 40px;
@@ -155,38 +155,38 @@ function openDoc(doc) {
justify-content: center;
}
.aksrt-docs__card-body {
.jio-docs__card-body {
flex: 1;
min-width: 0;
}
.aksrt-docs__card-title {
.jio-docs__card-title {
margin: 0 0 2px;
font-size: 14px;
font-weight: 600;
color: var(--aksrt-color-text);
color: var(--jio-color-text);
}
.aksrt-docs__card-desc {
.jio-docs__card-desc {
margin: 0;
font-size: 12px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
line-height: 1.5;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.aksrt-docs__card-arrow {
.jio-docs__card-arrow {
flex-shrink: 0;
color: #c0c4cc;
}
.aksrt-docs__section {
.jio-docs__section {
margin-bottom: 16px;
}
.aksrt-docs__action {
.jio-docs__action {
display: flex;
gap: 12px;
align-items: flex-start;
@@ -195,31 +195,31 @@ function openDoc(doc) {
background: #fafafa;
}
.aksrt-docs__action i {
color: var(--aksrt-color-primary);
.jio-docs__action i {
color: var(--jio-color-primary);
margin-top: 2px;
}
.aksrt-docs__action strong {
.jio-docs__action strong {
display: block;
font-size: 14px;
color: var(--aksrt-color-text);
color: var(--jio-color-text);
margin-bottom: 2px;
}
.aksrt-docs__action p {
.jio-docs__action p {
margin: 0 0 4px;
font-size: 12px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
}
.aksrt-docs__action a {
.jio-docs__action a {
font-size: 12px;
color: var(--aksrt-color-primary);
color: var(--jio-color-primary);
text-decoration: none;
}
.aksrt-docs__action a:hover {
.jio-docs__action a:hover {
text-decoration: underline;
}
</style>
@@ -1,5 +1,5 @@
<template>
<div class="aksrt-page-container">
<div class="jio-page-container">
<PageHeader :title="title" :desc="desc">
<template #actions>
<n-space v-if="links.length">
@@ -10,7 +10,7 @@
</template>
</PageHeader>
<n-card v-if="note" class="aksrt-section-card">
<n-card v-if="note" class="jio-section-card">
<n-alert type="info" :show-icon="false">
{{ note }}
</n-alert>
@@ -1,5 +1,5 @@
<template>
<div class="aksrt-page-container">
<div class="jio-page-container">
<PageHeader
title="基本权限 / 能力矩阵"
desc="统一管理用户治理、投稿和评论的角色能力矩阵。"
@@ -17,8 +17,8 @@
<n-spin :show="loading" style="width: 100%; min-height: 240px;">
<n-card class="aksrt-section-card" v-if="summary.cap_count">
<div class="aksrt-section-header">
<n-card class="jio-section-card" v-if="summary.cap_count">
<div class="jio-section-header">
<h3>矩阵概览</h3>
</div>
<n-space>
@@ -28,12 +28,12 @@
</n-space>
</n-card>
<n-card v-for="group in groups" :key="group.key" class="aksrt-section-card">
<n-card v-for="group in groups" :key="group.key" class="jio-section-card">
<template #header>
<div class="aksrt-cap-matrix__header">
<div class="jio-cap-matrix__header">
<div>
<h3 class="aksrt-cap-matrix__title">{{ group.title }}</h3>
<p class="aksrt-cap-matrix__desc">共 {{ group.items.length }} 项能力</p>
<h3 class="jio-cap-matrix__title">{{ group.title }}</h3>
<p class="jio-cap-matrix__desc">共 {{ group.items.length }} 项能力</p>
</div>
</div>
</template>
@@ -47,20 +47,19 @@
:scroll-x="1200"
/>
</n-card>
<div class="aksrt-form-actions">
<n-button type="primary" :loading="saving" @click="handleSave">保存能力矩阵</n-button>
</div>
</n-spin>
<JioSaveBar :dirty="dirty" :saving="saving" @save="handleSave" @reload="load" />
</div>
</template>
<script setup>
import { h, onMounted, reactive, ref } from 'vue'
import { computed, h, onMounted, reactive, ref } from 'vue'
import { NInputNumber, NSwitch, NTag } from 'naive-ui'
import { useMessage } from 'naive-ui'
import api from '@/api'
import PageHeader from '@/components/PageHeader.vue'
import JioSaveBar from '@/components/form/JioSaveBar.vue'
const message = useMessage()
const loading = ref(true)
@@ -74,6 +73,7 @@ const summary = reactive({
})
const userCaps = reactive({})
const defaultsSnapshot = ref({})
const dirty = computed(() => !loading.value && JSON.stringify(userCaps) !== JSON.stringify(defaultsSnapshot.value))
onMounted(load)
@@ -117,7 +117,7 @@ function buildColumns(group) {
key: 'label',
fixed: 'left',
width: 280,
render: (row) => h('div', { class: 'aksrt-cap-matrix__cap' }, [
render: (row) => h('div', { class: 'jio-cap-matrix__cap' }, [
h('strong', row.label),
h('code', row.cap_id),
]),
@@ -148,7 +148,7 @@ function buildColumns(group) {
function renderCapCell(row, col) {
const hidden = !(row.visible_columns || []).includes(col)
if (hidden) {
return h('span', { class: 'aksrt-cap-matrix__empty' }, '—')
return h('span', { class: 'jio-cap-matrix__empty' }, '—')
}
if (!userCaps[row.cap_id]) {
@@ -186,18 +186,11 @@ function resetDefaults() {
message.info('已恢复默认矩阵')
}
function expandAll() {
message.info('当前矩阵为平铺展示,无需展开')
}
function collapseAll() {
message.info('当前矩阵为平铺展示,无需折叠')
}
async function handleSave() {
saving.value = true
try {
await api.saveCapabilities(JSON.parse(JSON.stringify(userCaps)))
const res = await api.saveCapabilities(JSON.parse(JSON.stringify(userCaps)))
if (res?.data?.user_caps) replaceReactive(userCaps, res.data.user_caps)
defaultsSnapshot.value = JSON.parse(JSON.stringify(userCaps))
message.success('能力矩阵已保存')
} catch (error) {
@@ -209,42 +202,36 @@ async function handleSave() {
</script>
<style scoped>
.aksrt-cap-matrix__header {
.jio-cap-matrix__header {
display: flex;
align-items: center;
justify-content: space-between;
}
.aksrt-cap-matrix__title {
.jio-cap-matrix__title {
margin: 0;
font-size: 15px;
font-weight: 600;
}
.aksrt-cap-matrix__desc {
.jio-cap-matrix__desc {
margin: 4px 0 0;
font-size: 12px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
}
.aksrt-cap-matrix__cap {
.jio-cap-matrix__cap {
display: flex;
flex-direction: column;
gap: 4px;
}
.aksrt-cap-matrix__cap code {
.jio-cap-matrix__cap code {
font-size: 11px;
color: #667085;
}
.aksrt-cap-matrix__empty {
.jio-cap-matrix__empty {
color: #c0c4cc;
}
.aksrt-form-actions {
display: flex;
justify-content: flex-end;
margin-top: 16px;
}
</style>
@@ -1,5 +1,5 @@
<template>
<div class="aks-native-ops-redirect">
<div class="jio-native-ops-redirect">
<h2>{{ title }}</h2>
<p class="desc">
此运营功能已迁移到 WordPress 原生后台侧栏(对齐 legacy)。正在跳转…
@@ -21,7 +21,7 @@ const title = computed(() => route.meta?.title || '运营功能已迁移')
const nativeUrl = computed(() => {
const path = route.meta?.nativeAdminPath || ''
if (!path) return ''
const base = (window.aksrtAdminData?.adminUrl || '/wp-admin/').replace(/\/?$/, '/')
const base = (window.jioAdminData?.adminUrl || '/wp-admin/').replace(/\/?$/, '/')
return base + path.replace(/^\//, '')
})
@@ -33,13 +33,13 @@ onMounted(() => {
</script>
<style scoped>
.aks-native-ops-redirect {
.jio-native-ops-redirect {
max-width: 640px;
margin: 48px auto;
padding: 24px;
background: var(--aks-surface, #fff);
background: var(--jio-surface, #fff);
border-radius: 8px;
border: 1px solid var(--aks-border, #e5e7eb);
border: 1px solid var(--jio-border, #e5e7eb);
}
.desc {
color: #646970;
@@ -1,5 +1,5 @@
<template>
<div class="aksrt-page-container">
<div class="jio-page-container">
<PageHeader
title="主题授权"
desc="当前版本按产品决策不实现在线授权/撤销授权,仅保留主题信息与更新能力。"
@@ -12,14 +12,14 @@
</template>
</PageHeader>
<n-card class="aksrt-section-card">
<n-card class="jio-section-card">
<n-alert type="info" title="按设计省略" :show-icon="true">
本主题当前不实现 原主题风格的授权码校验、域名绑定、撤销授权、本地免授权等机制。
`AKSRT_Update_Checker` 仅负责匿名版本检测与更新提示,不与授权系统耦合。
`JIO_Update_Checker` 仅负责匿名版本检测与更新提示,不与授权系统耦合。
</n-alert>
</n-card>
<n-card class="aksrt-section-card" title="当前策略" size="small">
<n-card class="jio-section-card" title="当前策略" size="small">
<n-list bordered>
<n-list-item>不提供授权码输入框或“立即授权”按钮</n-list-item>
<n-list-item>不提供“已授权 / 未授权 / 本地免授权”三态逻辑</n-list-item>
+27 -27
View File
@@ -1,14 +1,14 @@
<template>
<div class="aksrt-page-container">
<div class="jio-page-container">
<PageHeader title="主题信息" desc="主题版本、运行环境、已启用模块和关键系统信息。" />
<div v-if="loading" class="aksrt-theme-info__loading">
<div v-if="loading" class="jio-theme-info__loading">
<n-spin size="medium" />
</div>
<template v-else>
<!-- Version Card -->
<n-card class="aksrt-theme-info__card" title="版本信息" size="small">
<n-card class="jio-theme-info__card" title="版本信息" size="small">
<n-descriptions :column="2" bordered label-placement="left" size="small">
<n-descriptions-item label="主题版本">
<n-tag type="success" size="small">{{ info.themeVersion }}</n-tag>
@@ -33,7 +33,7 @@
</n-card>
<!-- Environment Card -->
<n-card class="aksrt-theme-info__card" title="运行环境" size="small">
<n-card class="jio-theme-info__card" title="运行环境" size="small">
<n-descriptions :column="2" bordered label-placement="left" size="small">
<n-descriptions-item label="站点地址">
<n-text code>{{ info.siteUrl }}</n-text>
@@ -61,14 +61,14 @@
</n-card>
<!-- Modules Card -->
<n-card class="aksrt-theme-info__card" title="已启用模块" size="small">
<div class="aksrt-theme-info__modules">
<n-card class="jio-theme-info__card" title="已启用模块" size="small">
<div class="jio-theme-info__modules">
<n-tag
v-for="mod in info.modules"
:key="mod.key"
:type="mod.enabled ? 'success' : 'default'"
size="small"
class="aksrt-theme-info__module-tag"
class="jio-theme-info__module-tag"
>
<FaIcon :icon="mod.enabled ? 'fa fas fa-check-circle' : 'fa fas fa-circle'" :size="10" />
{{ mod.label }}
@@ -80,7 +80,7 @@
</n-card>
<!-- Data Tables Card -->
<n-card class="aksrt-theme-info__card" title="数据表状态" size="small">
<n-card class="jio-theme-info__card" title="数据表状态" size="small">
<n-data-table
:columns="tableColumns"
:data="info.tables"
@@ -91,25 +91,25 @@
</n-card>
<!-- Docs Links Card -->
<n-card class="aksrt-theme-info__card" title="快速入口" size="small">
<div class="aksrt-theme-info__links">
<router-link to="/docs" class="aksrt-theme-info__link">
<n-card class="jio-theme-info__card" title="快速入口" size="small">
<div class="jio-theme-info__links">
<router-link to="/docs" class="jio-theme-info__link">
<FaIcon icon="fa fas fa-book" :size="16" />
<span>文档中心</span>
</router-link>
<router-link to="/tools/update" class="aksrt-theme-info__link">
<router-link to="/tools/update" class="jio-theme-info__link">
<FaIcon icon="fa fas fa-cloud-download-alt" :size="16" />
<span>更新中心</span>
</router-link>
<router-link to="/tools/backup" class="aksrt-theme-info__link">
<router-link to="/tools/backup" class="jio-theme-info__link">
<FaIcon icon="fa fas fa-archive" :size="16" />
<span>数据备份</span>
</router-link>
<router-link to="/tools/health" class="aksrt-theme-info__link">
<router-link to="/tools/health" class="jio-theme-info__link">
<FaIcon icon="fa fas fa-heartbeat" :size="16" />
<span>健康检查</span>
</router-link>
<router-link to="/tools/import-export" class="aksrt-theme-info__link">
<router-link to="/tools/import-export" class="jio-theme-info__link">
<FaIcon icon="fa fas fa-exchange-alt" :size="16" />
<span>导入导出</span>
</router-link>
@@ -173,13 +173,13 @@ onMounted(async () => {
const data = res?.data || res || {}
info.value = {
themeVersion: window.aksrtAdminData?.themeVersion || data.theme_version || '3.4.0-dev',
themeVersion: window.jioAdminData?.themeVersion || data.theme_version || '3.4.0-dev',
wpVersion: data.wp_version || '',
phpVersion: data.php_version || '',
dbSchemaVersion: data.db_schema_version || '',
emailBackfillDone: !!data.email_backfill_done,
siteUrl: data.site_url || window.aksrtAdminData?.siteUrl || '',
apiUrl: data.api_url || window.aksrtAdminData?.apiUrl || '',
siteUrl: data.site_url || window.jioAdminData?.siteUrl || '',
apiUrl: data.api_url || window.jioAdminData?.apiUrl || '',
themeDir: data.theme_dir || '',
uploadDir: data.upload_dir || '',
isMultisite: !!data.is_multisite,
@@ -191,8 +191,8 @@ onMounted(async () => {
console.error('[ThemeInfo] Failed to load health data:', err)
// Fallback with minimal info
info.value.themeVersion = '3.4.0-dev'
info.value.siteUrl = window.aksrtAdminData?.siteUrl || ''
info.value.apiUrl = window.aksrtAdminData?.apiUrl || ''
info.value.siteUrl = window.jioAdminData?.siteUrl || ''
info.value.apiUrl = window.jioAdminData?.apiUrl || ''
} finally {
loading.value = false
}
@@ -218,35 +218,35 @@ function normalizeTables(raw) {
</script>
<style scoped>
.aksrt-theme-info__loading {
.jio-theme-info__loading {
display: flex;
justify-content: center;
padding: 60px 0;
}
.aksrt-theme-info__card {
.jio-theme-info__card {
margin-bottom: 16px;
}
.aksrt-theme-info__modules {
.jio-theme-info__modules {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.aksrt-theme-info__module-tag {
.jio-theme-info__module-tag {
display: inline-flex;
align-items: center;
gap: 5px;
}
.aksrt-theme-info__links {
.jio-theme-info__links {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.aksrt-theme-info__link {
.jio-theme-info__link {
display: inline-flex;
align-items: center;
gap: 6px;
@@ -259,7 +259,7 @@ function normalizeTables(raw) {
transition: background 0.2s;
}
.aksrt-theme-info__link:hover {
.jio-theme-info__link:hover {
background: #e8eaed;
}
</style>
+13 -13
View File
@@ -1,5 +1,5 @@
<template>
<div class="aksrt-page-container">
<div class="jio-page-container">
<PageHeader
title="数据备份"
desc="管理设置快照、创建手动备份,并执行恢复或删除。"
@@ -12,8 +12,8 @@
</PageHeader>
<n-spin :show="loading" style="width: 100%; min-height: 200px;">
<n-card class="aksrt-section-card">
<div class="aksrt-section-header">
<n-card class="jio-section-card">
<div class="jio-section-header">
<h3>备份策略</h3>
</div>
<n-space vertical size="small" style="width: 100%;">
@@ -26,19 +26,19 @@
<n-tag round :type="backups.length ? 'success' : 'default'">现有快照:{{ backups.length }} 份</n-tag>
</n-space>
<n-space align="center" wrap>
<span class="aksrt-backup__label">自动备份</span>
<span class="jio-backup__label">自动备份</span>
<n-switch v-model:value="settings.backup_auto" />
<span class="aksrt-backup__label">频率</span>
<span class="jio-backup__label">频率</span>
<n-select v-model:value="settings.backup_frequency" :options="frequencyOptions" style="width: 140px;" />
<span class="aksrt-backup__label">保留</span>
<span class="jio-backup__label">保留</span>
<n-input-number v-model:value="settings.backup_retain" :min="3" :max="20" style="width: 140px;" />
<n-button type="primary" :loading="savingPolicy" @click="handleSavePolicy">保存策略</n-button>
</n-space>
</n-space>
</n-card>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header">
<n-card class="jio-section-card">
<div class="jio-section-header">
<h3>手动创建快照</h3>
</div>
<n-space vertical size="small" style="width: 100%;">
@@ -50,8 +50,8 @@
</n-space>
</n-card>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header">
<n-card class="jio-section-card">
<div class="jio-section-header">
<h3>快照列表</h3>
</div>
<n-empty v-if="!backups.length" description="暂无设置快照" />
@@ -64,7 +64,7 @@
:single-line="false"
:scroll-x="900"
/>
<p class="aksrt-backup__hint">
<p class="jio-backup__hint">
恢复非当前网站 / 非当前版本的快照可能导致配置异常,恢复前请确认站点环境一致。
</p>
</n-card>
@@ -264,14 +264,14 @@ async function handleDelete(row) {
</script>
<style scoped>
.aksrt-backup__hint {
.jio-backup__hint {
margin: 12px 0 0;
color: #667085;
font-size: 12px;
line-height: 1.7;
}
.aksrt-backup__label {
.jio-backup__label {
color: #344054;
font-size: 12px;
}
+5 -5
View File
@@ -1,5 +1,5 @@
<template>
<div class="aksrt-page-container">
<div class="jio-page-container">
<PageHeader
title="健康检查"
desc="集中查看运行环境、数据库表和系统诊断状态。"
@@ -12,9 +12,9 @@
</PageHeader>
<n-spin :show="loading" style="width: 100%; min-height: 200px;">
<div class="aksrt-health-grid">
<n-card v-for="check in checkItems" :key="check.key" class="aksrt-section-card">
<div class="aksrt-section-header">
<div class="jio-health-grid">
<n-card v-for="check in checkItems" :key="check.key" class="jio-section-card">
<div class="jio-section-header">
<h3>{{ check.label }}</h3>
<n-tag round :type="statusToTag(check.status)">{{ check.status }}</n-tag>
</div>
@@ -76,7 +76,7 @@ onMounted(load)
</script>
<style scoped>
.aksrt-health-grid {
.jio-health-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
gap: 16px;
@@ -1,5 +1,5 @@
<template>
<div class="aksrt-page-container">
<div class="jio-page-container">
<PageHeader
title="导入导出"
desc="导出当前设置快照、执行 dry-run 导入校验,并支持按域重置到 schema 默认值。"
@@ -12,8 +12,8 @@
</template>
</PageHeader>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header">
<n-card class="jio-section-card">
<div class="jio-section-header">
<h3>导出与导入</h3>
</div>
<n-space style="margin-bottom: 16px;">
@@ -27,13 +27,13 @@
:autosize="{ minRows: 12, maxRows: 20 }"
placeholder="导出的 JSON 会出现在这里,也可以直接粘贴导入。"
/>
<p class="aksrt-tools-hint">
<p class="jio-tools-hint">
正式导入前会自动创建一份“导入前自动快照”,与“数据备份”页的快照体系共用,便于回滚。
</p>
</n-card>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header">
<n-card class="jio-section-card">
<div class="jio-section-header">
<h3>按域重置</h3>
</div>
<n-space align="center" wrap>
@@ -41,14 +41,14 @@
<n-button :loading="resetting" @click="handleReset">重置所选域</n-button>
<n-button type="error" tertiary :loading="resettingAll" @click="handleResetAll">重置全部</n-button>
</n-space>
<p class="aksrt-tools-hint">仅支持重置 schema 托管的业务域。健康检查和迁移状态属于运维面板,不参与按域回滚。</p>
<p class="jio-tools-hint">仅支持重置 schema 托管的业务域。健康检查和迁移状态属于运维面板,不参与按域回滚。</p>
</n-card>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header">
<n-card class="jio-section-card">
<div class="jio-section-header">
<h3>最近结果</h3>
</div>
<pre class="aksrt-tools-output">{{ resultText || '尚未执行操作。' }}</pre>
<pre class="jio-tools-output">{{ resultText || '尚未执行操作。' }}</pre>
</n-card>
</div>
</template>
@@ -169,7 +169,7 @@ async function handleResetAll() {
</script>
<style scoped>
.aksrt-tools-output {
.jio-tools-output {
margin: 0;
padding: 14px;
border-radius: 12px;
@@ -181,7 +181,7 @@ async function handleResetAll() {
word-break: break-word;
}
.aksrt-tools-hint {
.jio-tools-hint {
margin: 12px 0 0;
color: #667085;
font-size: 12px;
+18 -18
View File
@@ -1,5 +1,5 @@
<template>
<div class="aksrt-page-container">
<div class="jio-page-container">
<PageHeader
title="更新中心"
desc="查看版本状态、检测更新并浏览更新日志与教程入口。"
@@ -13,8 +13,8 @@
</PageHeader>
<n-spin :show="loading" style="width: 100%; min-height: 220px;">
<n-card class="aksrt-section-card">
<div class="aksrt-section-header">
<n-card class="jio-section-card">
<div class="jio-section-header">
<h3>版本状态</h3>
</div>
<n-space>
@@ -26,8 +26,8 @@
</n-space>
</n-card>
<n-card class="aksrt-section-card" v-if="updateInfo.update_available">
<div class="aksrt-section-header">
<n-card class="jio-section-card" v-if="updateInfo.update_available">
<div class="jio-section-header">
<h3>可用更新</h3>
</div>
<n-alert type="warning" style="margin-bottom: 12px;">
@@ -39,18 +39,18 @@
</n-button>
<n-button @click="handleDismiss" :loading="dismissing">忽略此版本</n-button>
</n-space>
<div v-if="updateInfo.changelog" class="aksrt-update__changelog">
<div v-if="updateInfo.changelog" class="jio-update__changelog">
<h4>更新日志</h4>
<pre>{{ updateInfo.changelog }}</pre>
</div>
</n-card>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header">
<n-card class="jio-section-card">
<div class="jio-section-header">
<h3>常用教程入口</h3>
</div>
<div class="aksrt-update__grid">
<a v-for="item in guides" :key="item.key" class="aksrt-update__guide" :href="item.url" target="_blank" rel="noreferrer">
<div class="jio-update__grid">
<a v-for="item in guides" :key="item.key" class="jio-update__guide" :href="item.url" target="_blank" rel="noreferrer">
<strong>{{ item.title }}</strong>
<span>{{ item.desc }}</span>
</a>
@@ -152,11 +152,11 @@ async function handleDismiss() {
</script>
<style scoped>
.aksrt-update__changelog {
.jio-update__changelog {
margin-top: 16px;
}
.aksrt-update__changelog pre {
.jio-update__changelog pre {
margin: 8px 0 0;
padding: 12px 14px;
border-radius: 12px;
@@ -168,30 +168,30 @@ async function handleDismiss() {
word-break: break-word;
}
.aksrt-update__grid {
.jio-update__grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 12px;
}
.aksrt-update__guide {
.jio-update__guide {
display: flex;
flex-direction: column;
gap: 4px;
padding: 14px;
border: 1px solid var(--aksrt-color-border);
border: 1px solid var(--jio-color-border);
border-radius: 12px;
text-decoration: none;
color: inherit;
background: #fafafa;
}
.aksrt-update__guide:hover {
border-color: var(--aksrt-color-primary);
.jio-update__guide:hover {
border-color: var(--jio-color-primary);
background: #f5faff;
}
.aksrt-update__guide span {
.jio-update__guide span {
font-size: 12px;
color: #667085;
}
+100 -173
View File
@@ -1,9 +1,6 @@
<template>
<div class="aksrt-page-container">
<PageHeader
title="用户徽章"
desc="配置勋章分类、自动授予条件(get_type / get_val)与公开展示。路由 /users/badge,存储键 user_medal_*。"
>
<div class="jio-page-container">
<PageHeader title="用户徽章" desc="配置勋章分类、自动授予条件与前台公开展示。">
<template #actions>
<n-space>
<n-button quaternary @click="go('/users/notifications')">消息通知</n-button>
@@ -13,106 +10,65 @@
</PageHeader>
<n-spin :show="loading" style="width: 100%; min-height: 200px;">
<n-card class="aksrt-section-card">
<div class="aksrt-section-header">
<h3>当前摘要</h3>
</div>
<n-space>
<n-tag round :type="form.user_medal_s ? 'success' : 'default'">
徽章系统:{{ form.user_medal_s ? '已启用' : '已关闭' }}
</n-tag>
<n-tag round :type="form.user_medal_public_display ? 'info' : 'default'">
公开展示:{{ form.user_medal_public_display ? '开启' : '关闭' }}
</n-tag>
<n-tag round type="info">最多显示:{{ form.user_medal_limit }} 枚</n-tag>
<n-tag round type="info">分类:{{ form.user_medal_args.length }}</n-tag>
<n-tag round type="info">条目:{{ itemCount }}</n-tag>
</n-space>
</n-card>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header">
<n-card class="jio-section-card">
<div class="jio-section-header">
<h3>徽章展示</h3>
</div>
<n-form :model="form" label-placement="left" label-width="180" class="aksrt-form">
<n-form :model="form" label-placement="left" label-width="180" class="jio-form">
<n-form-item label="启用徽章/勋章系统">
<n-switch v-model:value="form.user_medal_s" />
</n-form-item>
<n-form-item v-if="form.user_medal_s" label="公开页显示徽章">
<n-switch v-model:value="form.user_medal_public_display" />
</n-form-item>
<n-form-item v-if="form.user_medal_s" label="最多显示数量">
<n-input-number v-model:value="form.user_medal_limit" :min="1" :max="8" style="width: 180px;" />
</n-form-item>
<template v-if="form.user_medal_s">
<n-form-item label="公开页显示徽章">
<n-switch v-model:value="form.user_medal_public_display" />
</n-form-item>
<n-form-item label="最多显示数量">
<n-input-number v-model:value="form.user_medal_limit" :min="1" :max="8" style="width: 180px;">
<template #suffix>枚</template>
</n-input-number>
</n-form-item>
</template>
</n-form>
</n-card>
<n-card v-if="form.user_medal_s" class="aksrt-section-card">
<div class="aksrt-section-header" style="display:flex;justify-content:space-between;align-items:center;">
<h3>徽章明细(分类 → 条目)</h3>
<n-button size="small" @click="addCategory">添加分类</n-button>
<n-card v-if="form.user_medal_s" class="jio-section-card">
<div class="jio-section-header users-badge__header">
<h3>徽章明细</h3>
<span class="users-badge__stats">{{ form.user_medal_args.length }} 个分类 · {{ itemCount }} 枚徽章</span>
</div>
<p class="users-badge__hint">
拖动手柄调整分类与条目顺序,点击行头展开编辑。获取条件选择「仅手动授予」时不自动发放。
</p>
<n-empty v-if="!form.user_medal_args.length" description="暂无分类,请添加" />
<div v-for="(cat, ci) in form.user_medal_args" :key="'cat-' + ci" class="medal-cat-block">
<n-card size="small" embedded>
<n-space vertical :size="12">
<n-space align="center">
<n-input v-model:value="cat.cat_name" placeholder="分类名称" style="width: 220px;" />
<n-button size="small" @click="addItem(ci)">添加条目</n-button>
<n-button size="small" quaternary type="error" @click="removeCategory(ci)">删除分类</n-button>
</n-space>
<n-empty v-if="!(cat.items && cat.items.length)" description="该分类暂无条目" />
<div v-for="(item, ii) in cat.items || []" :key="'item-' + ci + '-' + ii" class="medal-item-row">
<n-grid cols="1 s:2 m:3" :x-gap="12" :y-gap="8" responsive="screen">
<n-grid-item>
<n-input v-model:value="item.slug" placeholder="slug" />
</n-grid-item>
<n-grid-item>
<n-input v-model:value="item.name" placeholder="名称" />
</n-grid-item>
<n-grid-item>
<n-select v-model:value="item.get_type" :options="getTypeOptions" placeholder="获取条件" />
</n-grid-item>
<n-grid-item>
<n-input-number
v-model:value="item.get_val"
:min="0"
:disabled="item.get_type === 'manually_add'"
placeholder="阈值"
style="width: 100%;"
/>
</n-grid-item>
<n-grid-item>
<n-input v-model:value="item.icon" placeholder="图标 URL" />
</n-grid-item>
<n-grid-item>
<n-input v-model:value="item.desc" placeholder="描述" />
</n-grid-item>
</n-grid>
<div style="margin-top: 8px; text-align: right;">
<n-button size="tiny" quaternary type="error" @click="removeItem(ci, ii)">删除条目</n-button>
</div>
</div>
</n-space>
</n-card>
<div v-if="!form.user_medal_args.length" class="jio-sortable__empty">
<i class="fa fas fa-trophy" aria-hidden="true" />
<span>暂无分类,请添加</span>
</div>
</n-card>
<draggable
v-else
v-model="form.user_medal_args"
v-bind="SORTABLE_LIST_ATTRS"
:item-key="rowKey"
class="jio-sortable"
>
<template #item="{ element, index }">
<MedalCategoryCard
:category="element"
:index="index"
:open="cats.isOpen(rowKey(element))"
:head-attrs="cats.headAttrs(rowKey(element))"
@remove="form.user_medal_args.splice(index, 1)"
/>
</template>
</draggable>
<n-card class="aksrt-section-card">
<n-alert type="info" :show-icon="false">
前台已授予徽章保存在用户 meta aksrt_user_badges;佩戴为 aksrt_wear_badge(slug)。
字典来自 user_medal_args;运行时 AKSRT_User_Badges 读取 identity badge.dictionary 派生列表。
</n-alert>
<n-button class="users-badge__add" dashed block @click="addCategory">
<i class="fa fas fa-plus" aria-hidden="true" />&nbsp;添加分类
</n-button>
</n-card>
<div class="aksrt-form-actions">
<n-button type="primary" :loading="saving" @click="handleSave">保存配置</n-button>
</div>
</n-spin>
<JioSaveBar :dirty="dirty" :saving="saving" @save="handleSave" @reload="load" />
</div>
</template>
@@ -120,16 +76,22 @@
import { computed, onMounted, reactive, ref } from 'vue'
import { useRouter } from 'vue-router'
import { useMessage } from 'naive-ui'
import draggable from 'vuedraggable'
import api from '@/api'
import PageHeader from '@/components/PageHeader.vue'
import { MEDAL_GET_TYPES, defaultMedalArgs } from '@/schema/sections/users/badge.js'
import JioSaveBar from '@/components/form/JioSaveBar.vue'
import { SORTABLE_LIST_ATTRS } from '@/components/form/sortable-options.js'
import { useCollapsibleItems } from '@/components/form/useCollapsibleItems.js'
import { defaultMedalArgs } from '@/schema/sections/users/badge.js'
import { emptyCategory, findInvalidItem, normalizeArgs, rowKey } from './partials/badge/badge-model.js'
import MedalCategoryCard from './partials/badge/MedalCategoryCard.vue'
const router = useRouter()
const message = useMessage()
const cats = useCollapsibleItems()
const loading = ref(true)
const saving = ref(false)
const getTypeOptions = MEDAL_GET_TYPES
const form = reactive({
user_medal_s: false,
@@ -138,82 +100,38 @@ const form = reactive({
user_medal_args: defaultMedalArgs(),
})
const itemCount = computed(() =>
form.user_medal_args.reduce((n, c) => n + (Array.isArray(c.items) ? c.items.length : 0), 0),
)
// 与全局保存栏一致:仅在有未保存更改时显示。以最近一次加载/保存的快照为基准。
const snapshot = ref('')
const serialize = () => JSON.stringify(form)
const dirty = computed(() => !loading.value && snapshot.value !== '' && serialize() !== snapshot.value)
function markClean() {
snapshot.value = serialize()
}
const itemCount = computed(() => form.user_medal_args.reduce((n, c) => n + c.items.length, 0))
function go(path) {
router.push(path)
}
function extractData(response) {
return response?.data ?? response ?? {}
}
function emptyItem() {
return {
slug: '',
name: '',
desc: '',
icon: '',
get_type: 'manually_add',
get_val: 0,
}
}
function normalizeArgs(raw) {
if (!Array.isArray(raw)) {
return defaultMedalArgs()
}
return raw.map((cat) => ({
cat_name: String(cat?.cat_name || cat?.name || '未命名').trim() || '未命名',
items: Array.isArray(cat?.items)
? cat.items.map((it) => ({
slug: String(it?.slug || '').trim(),
name: String(it?.name || '').trim(),
desc: String(it?.desc || '').trim(),
icon: String(it?.icon || it?.icon_url || '').trim(),
get_type: String(it?.get_type || 'manually_add').trim() || 'manually_add',
get_val: Math.max(0, Number(it?.get_val ?? 0) || 0),
}))
: [],
}))
}
function addCategory() {
form.user_medal_args.push({ cat_name: '新分类', items: [emptyItem()] })
form.user_medal_args.push(emptyCategory())
cats.toggle(rowKey(form.user_medal_args[form.user_medal_args.length - 1]))
}
function removeCategory(ci) {
form.user_medal_args.splice(ci, 1)
}
function addItem(ci) {
if (!form.user_medal_args[ci].items) {
form.user_medal_args[ci].items = []
}
form.user_medal_args[ci].items.push(emptyItem())
}
function removeItem(ci, ii) {
form.user_medal_args[ci].items.splice(ii, 1)
function applySettings(data) {
form.user_medal_s = !!data.user_medal_s
form.user_medal_public_display = data.user_medal_public_display !== false
form.user_medal_limit = Number(data.user_medal_limit ?? 3)
form.user_medal_args = normalizeArgs(data.user_medal_args ?? null)
}
async function load() {
loading.value = true
try {
const schemaRes = await api.getSchemaPage('users', 'badge')
const schemaData = extractData(schemaRes)
form.user_medal_s = !!(schemaData.user_medal_s ?? schemaData.user_badge_enabled)
form.user_medal_public_display =
schemaData.user_medal_public_display !== undefined
? schemaData.user_medal_public_display !== false
: schemaData.user_badge_public_display !== false
form.user_medal_limit = Number(
schemaData.user_medal_limit ?? schemaData.user_badge_limit ?? 3,
)
form.user_medal_args = normalizeArgs(schemaData.user_medal_args ?? null)
const res = await api.getSchemaPage('users', 'badge')
applySettings(res?.data ?? res ?? {})
markClean()
} catch (error) {
message.error(error.message || '加载用户徽章配置失败')
} finally {
@@ -222,18 +140,14 @@ async function load() {
}
async function handleSave() {
const args = normalizeArgs(form.user_medal_args)
const invalid = form.user_medal_s ? findInvalidItem(args) : ''
if (invalid) {
message.error(invalid)
return
}
saving.value = true
try {
const args = normalizeArgs(form.user_medal_args)
for (const cat of args) {
for (const it of cat.items) {
if (!it.slug || !it.name || !it.get_type) {
message.error('每个条目需要 slug、名称和获取条件')
saving.value = false
return
}
}
}
await api.saveSchemaPage('users', 'badge', {
user_medal_s: !!form.user_medal_s,
user_medal_public_display: !!form.user_medal_public_display,
@@ -241,6 +155,7 @@ async function handleSave() {
user_medal_args: args,
})
form.user_medal_args = args
markClean()
message.success('用户徽章配置已保存')
} catch (error) {
message.error(error.message || '保存失败')
@@ -253,13 +168,25 @@ onMounted(load)
</script>
<style scoped>
.medal-cat-block {
margin-bottom: 16px;
.users-badge__header {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 12px;
}
.medal-item-row {
padding: 12px;
border: 1px solid var(--n-border-color, #efeff5);
border-radius: 8px;
margin-bottom: 8px;
.users-badge__stats {
color: var(--jio-color-muted, #6F7A72);
font-size: 12px;
}
.users-badge__hint {
margin: 0 0 12px;
color: var(--jio-color-muted, #6F7A72);
font-size: 13px;
}
.users-badge__add {
margin-top: 12px;
}
</style>
+23 -16
View File
@@ -1,5 +1,5 @@
<template>
<div class="aksrt-page-container">
<div class="jio-page-container">
<PageHeader
title="用户等级"
desc="配置等级开关、最高等级、升级经验阈值与经验获取矩阵(对齐 legacy 用户等级 / 经验值)。"
@@ -13,8 +13,8 @@
</PageHeader>
<n-spin :show="loading" style="width: 100%; min-height: 200px;">
<n-card class="aksrt-section-card">
<div class="aksrt-section-header"><h3>当前摘要</h3></div>
<n-card class="jio-section-card">
<div class="jio-section-header"><h3>当前摘要</h3></div>
<n-space>
<n-tag round :type="form.user_level_s ? 'success' : 'default'">
等级系统:{{ form.user_level_s ? '已启用' : '已关闭' }}
@@ -24,9 +24,9 @@
</n-space>
</n-card>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header"><h3>等级显示</h3></div>
<n-form :model="form" label-placement="left" label-width="180" class="aksrt-form">
<n-card class="jio-section-card">
<div class="jio-section-header"><h3>等级显示</h3></div>
<n-form :model="form" label-placement="left" label-width="180" class="jio-form">
<n-form-item label="启用用户等级">
<n-switch v-model:value="form.user_level_s" />
</n-form-item>
@@ -42,17 +42,17 @@
</n-form>
</n-card>
<n-card v-if="form.user_level_s" class="aksrt-section-card">
<div class="aksrt-section-header"><h3>升级所需经验(累计)</h3></div>
<n-card v-if="form.user_level_s" class="jio-section-card">
<div class="jio-section-header"><h3>升级所需经验(累计)</h3></div>
<n-alert type="info" :show-icon="false" style="margin-bottom: 12px;">
Lv.1 通常为 0。数值为升到该级所需的累计经验。修改最高等级后会自动补齐/截断行。
</n-alert>
<n-data-table :columns="levelColumns" :data="levelRows" :bordered="false" size="small" />
</n-card>
<n-card v-if="form.user_level_s" class="aksrt-section-card">
<div class="aksrt-section-header"><h3>经验值得分</h3></div>
<n-form :model="form" label-placement="left" label-width="180" class="aksrt-form">
<n-card v-if="form.user_level_s" class="jio-section-card">
<div class="jio-section-header"><h3>经验值得分</h3></div>
<n-form :model="form" label-placement="left" label-width="180" class="jio-form">
<n-form-item label="每日上限">
<n-input-number v-model:value="form.user_integral_opt.day_max" :min="0" :max="10000" style="width: 180px;" />
</n-form-item>
@@ -70,11 +70,8 @@
</n-grid>
</div>
</n-card>
<div class="aksrt-form-actions">
<n-button type="primary" :loading="saving" @click="handleSave">保存配置</n-button>
</div>
</n-spin>
<JioSaveBar :dirty="dirty" :saving="saving" @save="handleSave" @reload="load" />
</div>
</template>
@@ -84,6 +81,7 @@ import { useRouter } from 'vue-router'
import { NInput, NInputNumber, useMessage } from 'naive-ui'
import api from '@/api'
import PageHeader from '@/components/PageHeader.vue'
import JioSaveBar from '@/components/form/JioSaveBar.vue'
import {
INTEGRAL_CATALOG,
defaultIntegralOpt,
@@ -104,6 +102,13 @@ const form = reactive({
user_level_notify: true,
})
const snapshot = ref('')
const serialize = () => JSON.stringify(form)
const dirty = computed(() => !loading.value && snapshot.value !== '' && serialize() !== snapshot.value)
function markClean() {
snapshot.value = serialize()
}
const integralGroups = computed(() => [...new Set(INTEGRAL_CATALOG.map((r) => r.group))])
const levelRows = computed(() => {
@@ -140,7 +145,7 @@ const levelColumns = [
h(NInput, {
value: form.user_level_opt['icon_img_' + row.level] ?? '',
size: 'small',
placeholder: row.level <= 10 ? '留空使用主题内置图标' : '请输入图片 URL',
placeholder: row.level <= 10 ? '默认使用主题自带等级图标' : '请输入图片 URL',
onUpdateValue: (v) => {
form.user_level_opt['icon_img_' + row.level] = v
},
@@ -245,6 +250,7 @@ async function load() {
form.user_level_notify = d.user_level_notify !== false
form.user_level_opt = normalizeLevelOpt(d.user_level_opt, form.user_level_max)
form.user_integral_opt = normalizeIntegral(d.user_integral_opt)
markClean()
} catch (error) {
message.error(error.message || '加载用户等级配置失败')
} finally {
@@ -270,6 +276,7 @@ async function handleSave() {
user_level_opt: payload.user_level_opt,
user_integral_opt: payload.user_integral_opt,
})
markClean()
message.success('用户等级配置已保存')
} catch (error) {
message.error(error.message || '保存失败')
+5 -5
View File
@@ -1,5 +1,5 @@
<template>
<div class="aksrt-page-container">
<div class="jio-page-container">
<PageHeader
title="工单中心"
desc="工单功能开关、提交公告与提交表单配置,以及部门、状态、预设回复三块字典维护。工单的日常处理在 WordPress 用户菜单的「工单管理」中完成。"
@@ -11,7 +11,7 @@
</template>
</PageHeader>
<n-tabs v-model:value="activeTab" type="segment" animated class="aksrt-ticket-tabs">
<n-tabs v-model:value="activeTab" type="segment" animated class="jio-ticket-tabs">
<n-tab-pane name="settings" tab="基础配置">
<SchemaPage domain="users" section="ticket" />
</n-tab-pane>
@@ -57,13 +57,13 @@ watch(activeTab, (name) => {
})
function openNativeList() {
const base = (window.aksrtAdminData?.adminUrl || '/wp-admin/').replace(/\/?$/, '/')
window.location.href = base + 'users.php?page=aksrt_tickets'
const base = (window.jioAdminData?.adminUrl || '/wp-admin/').replace(/\/?$/, '/')
window.location.href = base + 'users.php?page=jio_tickets'
}
</script>
<style scoped>
.aksrt-ticket-tabs {
.jio-ticket-tabs {
margin-bottom: 4px;
}
</style>
+5 -7
View File
@@ -1,8 +1,8 @@
<template>
<div class="aksrt-page-container">
<div class="jio-page-container">
<PageHeader title="身份认证" desc="配置通用认证申请规则;申请审核和用户认证资料管理位于 WordPress 用户菜单。" />
<n-spin :show="loading" style="width: 100%; min-height: 240px">
<n-card class="aksrt-section-card" title="认证申请设置">
<n-card class="jio-section-card" title="认证申请设置">
<n-form :model="form" label-placement="left" label-width="190">
<n-form-item label="启用身份认证"><n-switch v-model:value="form.user_auth_s" /></n-form-item>
<n-form-item label="允许用户前台申请"><n-switch v-model:value="form.user_auth_apply_s" :disabled="!form.user_auth_s" /></n-form-item>
@@ -18,11 +18,8 @@
</n-form-item>
</n-form>
</n-card>
<div class="aksrt-form-actions">
<n-button :disabled="!dirty || saving" @click="load">放弃更改</n-button>
<n-button type="primary" :disabled="!dirty" :loading="saving" @click="save">保存设置</n-button>
</div>
</n-spin>
<JioSaveBar :dirty="dirty" :saving="saving" @save="save" @reload="load" />
</div>
</template>
@@ -30,6 +27,7 @@
import { computed, onMounted, reactive, ref } from 'vue'
import { useMessage } from 'naive-ui'
import PageHeader from '@/components/PageHeader.vue'
import JioSaveBar from '@/components/form/JioSaveBar.vue'
import api from '@/api'
const defaults = {
@@ -45,7 +43,7 @@ const initial = ref('')
const loading = ref(true)
const saving = ref(false)
const snapshot = computed(() => JSON.stringify(form))
const dirty = computed(() => initial.value !== '' && snapshot.value !== initial.value)
const dirty = computed(() => !loading.value && initial.value !== '' && snapshot.value !== initial.value)
function extractData(response) {
return response?.data ?? response ?? {}
@@ -1,257 +1,195 @@
<template>
<div class="aksrt-page-container">
<PageHeader title="微信模板消息" desc="配置微信公众号模板消息推送。" />
<div class="jio-page-container">
<PageHeader title="微信模板消息" desc="按通知事件配置公众号模板及参数。" />
<!-- 状态卡片 -->
<div class="aksrt-wechat__status">
<div class="aksrt-wechat__status-card">
<div class="aksrt-wechat__status-icon" :class="status.configured ? 'aksrt-wechat__status-icon--ok' : 'aksrt-wechat__status-icon--warn'">
<i :class="status.configured ? 'fa fas fa-check' : 'fa fas fa-exclamation'"></i>
</div>
<div class="aksrt-wechat__status-info">
<div class="aksrt-wechat__status-label">配置状态</div>
<div class="aksrt-wechat__status-value">{{ status.configured ? '已配置' : '未配置' }}</div>
</div>
</div>
<div class="aksrt-wechat__status-card">
<div class="aksrt-wechat__status-icon" :class="status.has_token ? 'aksrt-wechat__status-icon--ok' : 'aksrt-wechat__status-icon--warn'">
<i :class="status.has_token ? 'fa fas fa-key' : 'fa fas fa-key'"></i>
</div>
<div class="aksrt-wechat__status-info">
<div class="aksrt-wechat__status-label">Access Token</div>
<div class="aksrt-wechat__status-value">{{ status.has_token ? '已获取' : '未获取' }}</div>
</div>
</div>
<div class="aksrt-wechat__status-card">
<div class="aksrt-wechat__status-icon" :class="status.has_template ? 'aksrt-wechat__status-icon--ok' : 'aksrt-wechat__status-icon--warn'">
<i :class="status.has_template ? 'fa fas fa-file-alt' : 'fa fas fa-file-alt'"></i>
</div>
<div class="aksrt-wechat__status-info">
<div class="aksrt-wechat__status-label">模板 ID</div>
<div class="aksrt-wechat__status-value">{{ status.has_template ? '已配置' : '未配置' }}</div>
</div>
</div>
<div class="aksrt-wechat__status-card">
<div class="aksrt-wechat__status-icon aksrt-wechat__status-icon--info">
<i class="fa fas fa-users"></i>
</div>
<div class="aksrt-wechat__status-info">
<div class="aksrt-wechat__status-label">绑定用户</div>
<div class="aksrt-wechat__status-value">{{ status.bound_users || 0 }} 人</div>
</div>
</div>
</div>
<n-spin :show="loading" style="width: 100%; min-height: 240px">
<n-alert v-if="loadError" type="error" class="wechat-notice">
{{ loadError }}
<template #action><n-button size="small" @click="load">重试</n-button></template>
</n-alert>
<template v-else>
<n-alert :type="oauthReady ? 'info' : 'warning'" class="wechat-notice">
<div>模板消息依赖已启用的微信公众号登录服务号,以及公众号的模板消息权限。</div>
<div>只有绑定并关注该公众号的用户才能收到通知。当前账号:{{ currentUserBound ? '已绑定' : '未绑定' }};已绑定用户:{{ boundUsers }} 人。</div>
<template #action>
<router-link to="/users/oauth">公众号登录设置</router-link>
</template>
</n-alert>
<!-- 配置表单 -->
<div class="aksrt-wechat__form-card">
<h3>基本配置</h3>
<div class="aksrt-form-group">
<label>
<input type="checkbox" v-model="form.enabled"> 启用微信模板消息
</label>
</div>
<div class="aksrt-form-group">
<label>AppID</label>
<input v-model="form.app_id" type="text" class="aksrt-input" placeholder="微信公众号 AppID">
</div>
<div class="aksrt-form-group">
<label>AppSecret</label>
<input v-model="form.app_secret" type="password" class="aksrt-input" placeholder="微信公众号 AppSecret">
<p class="aksrt-form-hint">保存后不会回显完整密钥</p>
</div>
<div class="aksrt-form-group">
<label>模板 ID</label>
<input v-model="form.template_id" type="text" class="aksrt-input" placeholder="微信模板消息模板 ID">
</div>
<div class="aksrt-form-actions">
<button class="aksrt-button aksrt-button--primary" :disabled="saving" @click="saveSettings">
{{ saving ? '保存中...' : '保存设置' }}
</button>
</div>
</div>
<section class="wechat-section">
<div class="wechat-section__head">
<h3>消息推送</h3>
<n-switch v-model:value="form.enabled" :disabled="loading" aria-label="启用微信模板消息" />
</div>
<p class="wechat-muted">通过微信公众号将网站通知推送给绑定用户。配置模板后保存,测试会发送到当前管理员账号。</p>
</section>
<!-- 通知类型 -->
<div class="aksrt-wechat__form-card">
<h3>支持的通知类型</h3>
<p class="aksrt-form-hint">以下事件类型可触发微信模板消息推送(需用户绑定微信且开启对应订阅):</p>
<table class="aksrt-table aksrt-table--sm">
<thead>
<tr>
<th>事件类型</th>
<th>说明</th>
<th>状态</th>
</tr>
</thead>
<tbody>
<tr v-for="evt in eventTypes" :key="evt.key">
<td><code>{{ evt.key }}</code></td>
<td>{{ evt.desc }}</td>
<td>
<span class="aksrt-badge" :class="evt.ready ? 'aksrt-badge--success' : 'aksrt-badge--warning'">
{{ evt.ready ? '可用' : '待接入' }}
</span>
</td>
</tr>
</tbody>
</table>
</div>
<section v-for="group in groups" :key="group.name" class="wechat-section">
<h3>{{ group.name }}</h3>
<div v-for="type in group.types" :key="type.key" class="wechat-template">
<div class="wechat-template__head">
<div>
<strong>{{ type.label }}</strong>
<span class="wechat-template__key">{{ type.key }}</span>
</div>
<n-switch v-model:value="form.templates[type.key].enabled" :disabled="!form.enabled" :aria-label="`启用${type.label}`" />
</div>
<div v-if="form.enabled && form.templates[type.key].enabled" class="wechat-template__body">
<label class="wechat-field">
<span>模板 ID</span>
<n-input v-model:value="form.templates[type.key].id" placeholder="公众号模板消息 ID" maxlength="128" clearable />
</label>
<div class="wechat-field">
<span>模板参数</span>
<div class="wechat-params">
<label v-for="field in type.fields" :key="field.key" class="wechat-param">
<span>{{ field.label }} <code>{{ field.key }}</code></span>
<n-input v-model:value="form.templates[type.key].keys[field.key]" :placeholder="`留空使用 keyword${field.index}`" maxlength="64" clearable />
</label>
</div>
<small>填写公众号模板中的参数名,例如 thing1、time2;留空时依次使用 keyword1、keyword2。</small>
</div>
</div>
</div>
</section>
<section class="wechat-section wechat-test">
<h3>发送测试</h3>
<p class="wechat-muted">先保存配置,再选择已启用的模板。测试消息会发送到当前管理员绑定的公众号账号。</p>
<div class="wechat-test__controls">
<n-select v-model:value="testType" :options="testOptions" placeholder="选择需要测试的模板" :disabled="!testOptions.length" />
<n-button type="primary" :loading="testing" :disabled="dirty || !testType || !currentUserBound || !oauthReady || !form.enabled" @click="sendTest">发送测试</n-button>
</div>
</section>
</template>
</n-spin>
<JioSaveBar :dirty="dirty" :saving="saving" @save="save" @reload="load" />
</div>
</template>
<script>
import { ref, reactive, computed, onMounted } from 'vue';
import PageHeader from '@/components/PageHeader.vue';
import api from '@/api';
<script setup>
import { computed, onMounted, reactive, ref } from 'vue'
import { useMessage } from 'naive-ui'
import PageHeader from '@/components/PageHeader.vue'
import JioSaveBar from '@/components/form/JioSaveBar.vue'
import api from '@/api'
export default {
name: 'UsersWechatTemplate',
components: { PageHeader },
setup() {
const status = ref({
enabled: false,
configured: false,
has_token: false,
has_template: false,
bound_users: 0,
});
const message = useMessage()
const loading = ref(true)
const saving = ref(false)
const testing = ref(false)
const loadError = ref('')
const oauthReady = ref(false)
const currentUserBound = ref(false)
const boundUsers = ref(0)
const definitions = ref({})
const form = reactive({ enabled: false, templates: {} })
const initial = ref('')
const testType = ref(null)
const snapshot = computed(() => JSON.stringify(form))
const dirty = computed(() => !loading.value && initial.value !== '' && initial.value !== snapshot.value)
const form = reactive({
enabled: false,
app_id: '',
app_secret: '',
template_id: '',
});
const groups = computed(() => {
const grouped = new Map()
for (const [key, definition] of Object.entries(definitions.value)) {
const name = definition.group || '其他'
if (!grouped.has(name)) grouped.set(name, [])
grouped.get(name).push({
key,
label: definition.label,
fields: Object.entries(definition.fields || {}).map(([fieldKey, label], index) => ({ key: fieldKey, label, index: index + 1 })),
})
}
return Array.from(grouped, ([name, types]) => ({ name, types }))
})
const saving = ref(false);
const testOptions = computed(() => Object.entries(definitions.value)
.filter(([key]) => form.templates[key]?.enabled && form.templates[key]?.id)
.map(([key, definition]) => ({ label: definition.label, value: key })))
// Event type definitions — readiness driven by backend allowed_types
const eventTypeDefs = [
{ key: 'comment_reply', desc: '评论回复通知' },
{ key: 'system_notice', desc: '系统公告通知' },
{ key: 'order_paid', desc: '订单支付通知' },
{ key: 'credits_change', desc: '积分变动通知' },
];
const allowedTypes = ref([]);
const eventTypes = computed(() =>
eventTypeDefs.map(et => ({
...et,
ready: allowedTypes.value.length === 0 || allowedTypes.value.includes(et.key),
}))
);
async function loadStatus() {
try {
const json = await api.request('/wechat/status');
if (json.success) {
status.value = json.data;
form.enabled = json.data.enabled || false;
form.app_id = json.data.appid || '';
form.app_secret = json.data.app_secret === '***' ? '' : '';
form.template_id = json.data.template_id || '';
// Use backend allowed_types for readiness (empty = all allowed)
allowedTypes.value = json.data.allowed_types || [];
}
} catch (e) {
console.error('Load WeChat status failed:', e);
}
async function load() {
loading.value = true
loadError.value = ''
try {
const response = await api.request('/wechat/status')
const data = response.data || {}
definitions.value = data.types || {}
form.enabled = Boolean(data.config?.enabled)
form.templates = structuredClone(data.config?.templates || {})
oauthReady.value = Boolean(data.oauth_ready)
currentUserBound.value = Boolean(data.current_user_bound)
boundUsers.value = Number(data.bound_users || 0)
if (!testOptions.value.some(option => option.value === testType.value)) {
testType.value = testOptions.value[0]?.value || null
}
initial.value = snapshot.value
} catch (error) {
loadError.value = error.message || '加载微信模板消息设置失败'
message.error(loadError.value)
} finally {
loading.value = false
}
}
async function saveSettings() {
saving.value = true;
try {
const payload = { ...form };
// 如果密码为空且状态显示已配置,发送掩码保留原值
if (!payload.app_secret && status.value.configured) {
payload.app_secret = '***';
}
const json = await api.request('/wechat/settings', {
method: 'POST',
data: payload,
});
if (json.success) {
alert('设置已保存');
loadStatus();
} else {
alert(json.message || '保存失败');
}
} catch (e) {
console.error('Save failed:', e);
alert('保存失败: ' + (e.message || '未知错误'));
} finally {
saving.value = false;
}
async function save() {
saving.value = true
try {
const response = await api.request('/wechat/settings', { method: 'POST', data: JSON.parse(snapshot.value) })
const config = response.data || {}
form.enabled = Boolean(config.enabled)
form.templates = structuredClone(config.templates || {})
if (!testOptions.value.some(option => option.value === testType.value)) {
testType.value = testOptions.value[0]?.value || null
}
initial.value = snapshot.value
message.success('微信模板消息设置已保存')
} catch (error) {
message.error(error.message || '保存失败')
} finally {
saving.value = false
}
}
onMounted(() => loadStatus());
async function sendTest() {
testing.value = true
try {
await api.request('/wechat/test', { method: 'POST', data: { type: testType.value } })
message.success('测试消息已发送')
} catch (error) {
message.error(error.message || '测试发送失败')
} finally {
testing.value = false
}
}
return { status, form, saving, eventTypes, saveSettings };
},
};
onMounted(load)
</script>
<style scoped>
.aksrt-wechat__status {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px;
margin-bottom: 24px;
}
.aksrt-wechat__status-card {
display: flex;
align-items: center;
gap: 12px;
padding: 16px;
background: #fff;
border-radius: 8px;
border: 1px solid #e8e8e8;
}
.aksrt-wechat__status-icon {
width: 40px;
height: 40px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
}
.aksrt-wechat__status-icon--ok {
background: #d4edda;
color: #155724;
}
.aksrt-wechat__status-icon--warn {
background: #fff3cd;
color: #856404;
}
.aksrt-wechat__status-icon--info {
background: #d1ecf1;
color: #0c5460;
}
.aksrt-wechat__status-value {
font-size: 18px;
font-weight: 600;
color: var(--aksrt-color-text);
}
.aksrt-wechat__status-label {
font-size: 12px;
color: #888;
}
.aksrt-wechat__form-card {
background: #fff;
border: 1px solid #e8e8e8;
border-radius: 8px;
padding: 24px;
margin-bottom: 16px;
}
.aksrt-wechat__form-card h3 {
margin: 0 0 16px;
font-size: 16px;
font-weight: 600;
}
.aksrt-form-hint {
font-size: 12px;
color: #888;
margin-top: 4px;
.wechat-notice { margin-bottom: 20px; }
.wechat-section { border-top: 1px solid #e6e9ed; padding: 20px 0; }
.wechat-section h3 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.wechat-section__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wechat-section__head h3 { margin: 0; }
.wechat-muted { margin: 8px 0 0; color: #64707d; font-size: 13px; line-height: 1.6; }
.wechat-template { border-bottom: 1px solid #edf0f2; padding: 14px 0; }
.wechat-template:last-child { border-bottom: 0; }
.wechat-template__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 32px; }
.wechat-template__head strong { font-size: 14px; font-weight: 600; }
.wechat-template__key { display: block; color: #7b8590; font-size: 11px; margin-top: 3px; }
.wechat-template__body { display: grid; grid-template-columns: minmax(200px, 320px) minmax(0, 1fr); gap: 24px; padding: 16px 0 4px; }
.wechat-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; font-size: 13px; }
.wechat-field > span { font-weight: 600; }
.wechat-field small { color: #64707d; line-height: 1.5; }
.wechat-params { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.wechat-param { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.wechat-param span { color: #4c5966; font-size: 12px; }
.wechat-param code { color: #7b8590; font-size: 11px; }
.wechat-test__controls { display: flex; gap: 10px; margin-top: 14px; max-width: 520px; }
.wechat-test__controls :deep(.n-select) { flex: 1; min-width: 0; }
@media (max-width: 780px) {
.wechat-template__body { grid-template-columns: 1fr; gap: 16px; }
.wechat-test__controls { flex-wrap: wrap; }
.wechat-test__controls :deep(.n-select) { flex-basis: 100%; }
}
</style>
@@ -0,0 +1,97 @@
<template>
<div class="jio-sortable__item">
<div class="jio-sortable__head" v-bind="headAttrs">
<JioSortHandle @click.stop />
<span class="jio-sortable__index">{{ index + 1 }}</span>
<div class="jio-sortable__main">
<div class="jio-sortable__title-row">
<span class="jio-sortable__title">{{ category.cat_name || '未命名分类' }}</span>
<n-tag size="small" :bordered="false">{{ category.items.length }} 枚</n-tag>
</div>
<span class="jio-sortable__desc">{{ previewNames || '该分类暂无条目' }}</span>
</div>
<div class="jio-sortable__actions">
<n-popconfirm @positive-click="emit('remove')">
<template #trigger>
<n-button size="tiny" quaternary type="error" title="删除分类" @click.stop>
<i class="fa fas fa-trash-alt" aria-hidden="true" />
</n-button>
</template>
删除分类「{{ category.cat_name || '未命名分类' }}」及其全部条目?
</n-popconfirm>
</div>
<i class="fa fas jio-sortable__toggle" :class="open ? 'fa-chevron-down' : 'fa-chevron-right'" aria-hidden="true" />
</div>
<div v-if="open" class="jio-sortable__body">
<n-form label-placement="left" label-width="96" class="jio-form">
<n-form-item label="分类名称">
<n-input v-model:value="category.cat_name" placeholder="如:成长" style="max-width: 320px;" />
</n-form-item>
</n-form>
<div v-if="!category.items.length" class="jio-sortable__empty">
<i class="fa fas fa-medal" aria-hidden="true" />
<span>该分类暂无条目</span>
</div>
<draggable
v-else
v-model="category.items"
v-bind="SORTABLE_LIST_ATTRS"
:item-key="rowKey"
class="jio-sortable jio-sortable--compact"
>
<template #item="{ element, index: ii }">
<MedalItemCard
:item="element"
:open="items.isOpen(rowKey(element))"
:head-attrs="items.headAttrs(rowKey(element))"
@remove="category.items.splice(ii, 1)"
/>
</template>
</draggable>
<n-button class="medal-category-card__add" size="small" dashed block @click="addItem">
<i class="fa fas fa-plus" aria-hidden="true" />&nbsp;添加条目
</n-button>
</div>
</div>
</template>
<script setup>
/** 徽章分类卡片:行头显示条目数与名称预览,展开后编辑分类名并拖拽排序条目。 */
import { computed } from 'vue'
import draggable from 'vuedraggable'
import JioSortHandle from '@/components/form/JioSortHandle.vue'
import { SORTABLE_LIST_ATTRS } from '@/components/form/sortable-options.js'
import { useCollapsibleItems } from '@/components/form/useCollapsibleItems.js'
import { emptyItem, rowKey } from './badge-model.js'
import MedalItemCard from './MedalItemCard.vue'
const props = defineProps({
category: { type: Object, required: true },
index: { type: Number, required: true },
open: { type: Boolean, default: false },
headAttrs: { type: Object, required: true },
})
const emit = defineEmits(['remove'])
const items = useCollapsibleItems()
const previewNames = computed(() =>
props.category.items.map((it) => it.name || it.slug).filter(Boolean).slice(0, 4).join('、'),
)
function addItem() {
const item = emptyItem()
props.category.items.push(item)
// 新条目直接展开,方便立即填写。
items.toggle(rowKey(props.category.items[props.category.items.length - 1]))
}
</script>
<style scoped>
.medal-category-card__add {
margin-top: 10px;
}
</style>
@@ -0,0 +1,82 @@
<template>
<div class="medal-icon-picker">
<div class="medal-icon-picker__presets" role="listbox" aria-label="预设勋章图标">
<button
v-for="(src, i) in MEDAL_PRESET_ICONS"
:key="src"
type="button"
role="option"
class="medal-icon-picker__preset"
:class="{ 'is-active': src === modelValue }"
:aria-selected="src === modelValue ? 'true' : 'false'"
:title="`预设图标 ${i + 1}`"
@click="emit('update:modelValue', src)"
>
<img :src="src" :alt="`预设图标 ${i + 1}`" />
</button>
</div>
<JioMediaField
:model-value="modelValue"
placeholder="或从媒体库选择自定义图标"
@update:model-value="emit('update:modelValue', $event)"
/>
</div>
</template>
<script setup>
/** 勋章图标选择:主题预设 SVG 一键选用,或走媒体库 / 直接填 URL。 */
import JioMediaField from '@/components/form/JioMediaField.vue'
import { MEDAL_PRESET_ICONS } from '@/schema/sections/users/badge.js'
defineProps({
modelValue: { type: String, default: '' },
})
const emit = defineEmits(['update:modelValue'])
</script>
<style scoped>
.medal-icon-picker {
display: flex;
flex-direction: column;
gap: 10px;
width: 100%;
}
.medal-icon-picker__presets {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
gap: 6px;
max-width: 520px;
}
.medal-icon-picker__preset {
display: inline-flex;
align-items: center;
justify-content: center;
height: 36px;
padding: 0;
border: 1px solid var(--jio-color-border, #E2E8E3);
border-radius: 8px;
background: var(--jio-color-surface, #fff);
cursor: pointer;
transition: border-color .15s ease, background-color .15s ease;
}
.medal-icon-picker__preset img {
width: 22px;
height: 22px;
object-fit: contain;
}
.medal-icon-picker__preset:hover,
.medal-icon-picker__preset:focus-visible {
border-color: var(--jio-color-primary, #18A058);
outline: none;
}
.medal-icon-picker__preset.is-active {
border-color: var(--jio-color-primary, #18A058);
background: var(--jio-color-primary-soft, #EAF7EF);
box-shadow: 0 0 0 1px var(--jio-color-primary, #18A058);
}
</style>
@@ -0,0 +1,79 @@
<template>
<div class="jio-sortable__item">
<div class="jio-sortable__head" v-bind="headAttrs">
<JioSortHandle @click.stop />
<span class="jio-sortable__icon">
<img v-if="item.icon" :src="item.icon" alt="" />
<i v-else class="fa fas fa-medal" aria-hidden="true" />
</span>
<div class="jio-sortable__main">
<div class="jio-sortable__title-row">
<span class="jio-sortable__title">{{ item.name || '未命名徽章' }}</span>
<n-tag size="small" :bordered="false" :type="item.get_type === 'manually_add' ? 'default' : 'info'">
{{ conditionSummary(item) }}
</n-tag>
<n-tag v-if="!item.slug" size="small" type="warning" :bordered="false">缺少 slug</n-tag>
</div>
<span class="jio-sortable__desc">{{ item.slug || '—' }}{{ item.desc ? ` · ${item.desc}` : '' }}</span>
</div>
<div class="jio-sortable__actions">
<n-button size="tiny" quaternary type="error" title="删除条目" @click.stop="emit('remove')">
<i class="fa fas fa-trash-alt" aria-hidden="true" />
</n-button>
</div>
<i class="fa fas jio-sortable__toggle" :class="open ? 'fa-chevron-down' : 'fa-chevron-right'" aria-hidden="true" />
</div>
<div v-if="open" class="jio-sortable__body">
<n-form label-placement="left" label-width="96" class="jio-form medal-item-card__form">
<n-grid cols="1 m:2" :x-gap="16" responsive="screen">
<n-form-item-gi label="名称">
<n-input v-model:value="item.name" placeholder="如:签到达人" />
</n-form-item-gi>
<n-form-item-gi label="slug">
<n-input v-model:value="item.slug" placeholder="唯一标识,如 checkin-30" />
</n-form-item-gi>
<n-form-item-gi label="获取条件">
<n-select v-model:value="item.get_type" :options="MEDAL_GET_TYPES" />
</n-form-item-gi>
<n-form-item-gi label="达成阈值">
<n-input-number
v-model:value="item.get_val"
:min="0"
:disabled="item.get_type === 'manually_add'"
:placeholder="item.get_type === 'manually_add' ? '手动授予无需阈值' : '达到该数值自动授予'"
style="width: 100%;"
/>
</n-form-item-gi>
<n-form-item-gi :span="2" label="描述">
<n-input v-model:value="item.desc" placeholder="前台展示的获取说明" />
</n-form-item-gi>
<n-form-item-gi :span="2" label="图标">
<MedalIconPicker v-model="item.icon" />
</n-form-item-gi>
</n-grid>
</n-form>
</div>
</div>
</template>
<script setup>
/** 徽章条目卡片:行头摘要(图标 / 名称 / 条件),展开后编辑字段。条目对象由父级直接持有并原地修改。 */
import JioSortHandle from '@/components/form/JioSortHandle.vue'
import { MEDAL_GET_TYPES } from '@/schema/sections/users/badge.js'
import { conditionSummary } from './badge-model.js'
import MedalIconPicker from './MedalIconPicker.vue'
defineProps({
item: { type: Object, required: true },
open: { type: Boolean, default: false },
headAttrs: { type: Object, required: true },
})
const emit = defineEmits(['remove'])
</script>
<style scoped>
.medal-item-card__form :deep(.n-form-item) {
margin-bottom: 4px;
}
</style>
@@ -0,0 +1,63 @@
/**
* 用户徽章编辑页的数据模型:空条目、规范化与拖拽用的稳定行 key。
*/
import { MEDAL_GET_TYPES, defaultMedalArgs } from '@/schema/sections/users/badge.js'
const GET_TYPE_LABELS = Object.fromEntries(MEDAL_GET_TYPES.map((t) => [t.value, t.label]))
export function getTypeLabel(type) {
return GET_TYPE_LABELS[type] || '未设置条件'
}
export function conditionSummary(item) {
if (!item.get_type) return '未设置条件'
if (item.get_type === 'manually_add') return getTypeLabel(item.get_type)
return `${getTypeLabel(item.get_type)} ≥ ${Number(item.get_val || 0)}`
}
export function emptyItem() {
return { slug: '', name: '', desc: '', icon: '', get_type: 'manually_add', get_val: 0 }
}
export function emptyCategory() {
return { cat_name: '新分类', items: [emptyItem()] }
}
export function normalizeArgs(raw) {
if (!Array.isArray(raw)) return defaultMedalArgs()
return raw.map((cat) => ({
cat_name: String(cat?.cat_name || '').trim() || '未命名',
items: Array.isArray(cat?.items)
? cat.items.map((it) => ({
slug: String(it?.slug || '').trim(),
name: String(it?.name || '').trim(),
desc: String(it?.desc || '').trim(),
icon: String(it?.icon || '').trim(),
get_type: String(it?.get_type || 'manually_add').trim() || 'manually_add',
get_val: Math.max(0, Number(it?.get_val ?? 0) || 0),
}))
: [],
}))
}
/** 首个不完整条目的位置描述;全部完整时返回空字符串。 */
export function findInvalidItem(args) {
const slugs = new Set()
for (const cat of args) {
for (const it of cat.items) {
const where = `「${cat.cat_name}」中的条目「${it.name || it.slug || '未命名'}」`
if (!it.slug || !it.name || !it.get_type) return `${where}缺少 slug、名称或获取条件`
if (slugs.has(it.slug)) return `${where}的 slug「${it.slug}」重复`
slugs.add(it.slug)
}
}
return ''
}
// 对象 → 稳定 key:拖拽换位后展开状态与 DOM 跟随对象本身。
const rowKeys = new WeakMap()
let rowSeq = 0
export function rowKey(obj) {
if (!rowKeys.has(obj)) rowKeys.set(obj, `row-${++rowSeq}`)
return rowKeys.get(obj)
}
@@ -1,6 +1,6 @@
<template>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header">
<n-card class="jio-section-card">
<div class="jio-section-header">
<h3>预设回复</h3>
<n-space>
<n-button size="small" :disabled="saving || !reorderable" :loading="savingOrder" @click="saveOrder">
@@ -19,20 +19,23 @@
<draggable
v-else
v-model="rows"
v-bind="SORTABLE_LIST_ATTRS"
item-key="id"
handle=".aksrt-ticket-prereply__handle"
:animation="160"
class="aksrt-ticket-prereply"
class="jio-sortable"
>
<template #item="{ element, index }">
<div class="aksrt-ticket-prereply__row">
<span class="aksrt-ticket-prereply__handle" title="拖动排序">⋮⋮</span>
<span class="aksrt-ticket-prereply__index">{{ index + 1 }}</span>
<span class="aksrt-ticket-prereply__content">{{ element.content }}</span>
<n-space size="small">
<n-button size="tiny" type="primary" quaternary @click="openEdit(element)">编辑</n-button>
<n-button size="tiny" type="error" quaternary @click="handleDelete(element)">删除</n-button>
</n-space>
<div class="jio-sortable__item">
<div class="jio-sortable__head">
<JioSortHandle />
<span class="jio-sortable__index">{{ index + 1 }}</span>
<div class="jio-sortable__main">
<span class="jio-ticket-prereply__content">{{ element.content }}</span>
</div>
<div class="jio-sortable__actions">
<n-button size="tiny" type="primary" quaternary @click="openEdit(element)">编辑</n-button>
<n-button size="tiny" type="error" quaternary @click="handleDelete(element)">删除</n-button>
</div>
</div>
</div>
</template>
</draggable>
@@ -71,6 +74,8 @@ import { computed, onMounted, ref } from 'vue'
import { NButton, NSpace, useDialog, useMessage } from 'naive-ui'
import draggable from 'vuedraggable'
import api from '@/api'
import JioSortHandle from '@/components/form/JioSortHandle.vue'
import { SORTABLE_LIST_ATTRS } from '@/components/form/sortable-options.js'
const message = useMessage()
const dialog = useDialog()
@@ -188,38 +193,11 @@ defineExpose({ reload: load })
</script>
<style scoped>
.aksrt-ticket-prereply {
display: grid;
gap: 8px;
}
.aksrt-ticket-prereply__row {
display: grid;
grid-template-columns: 20px 28px 1fr auto;
align-items: center;
gap: 10px;
padding: 10px 12px;
border: 1px var(--n-border-color, #efeff5) solid;
border-radius: 8px;
background: var(--n-color, #fff);
}
.aksrt-ticket-prereply__handle {
color: var(--aksrt-color-muted);
cursor: grab;
user-select: none;
}
.aksrt-ticket-prereply__index {
color: var(--aksrt-color-muted);
font-size: 12px;
font-variant-numeric: tabular-nums;
}
.aksrt-ticket-prereply__content {
white-space: pre-wrap;
word-break: break-word;
.jio-ticket-prereply__content {
color: var(--jio-color-text, #1F2923);
font-size: 13px;
line-height: 1.6;
white-space: pre-wrap;
word-break: break-word;
}
</style>
@@ -1,6 +1,6 @@
<template>
<n-card class="aksrt-section-card aksrt-ticket-status-panel">
<div class="aksrt-section-header">
<n-card class="jio-section-card jio-ticket-status-panel">
<div class="jio-section-header">
<h3>工单状态</h3>
<n-button size="small" type="primary" :disabled="saving" @click="openCreate">新增状态</n-button>
</div>
@@ -24,13 +24,13 @@
v-model:show="visible"
:title="editing ? '编辑状态' : '新增状态'"
preset="card"
class="aksrt-status-modal"
class="jio-status-modal"
style="width: 460px; max-width: 92vw;"
:mask-closable="false"
>
<div class="aksrt-status-preview" aria-live="polite">
<span class="aksrt-status-preview__label">预览</span>
<span class="aksrt-ticket-badge" :style="{ '--aksrt-ticket-color': previewColor }">
<div class="jio-status-preview" aria-live="polite">
<span class="jio-status-preview__label">预览</span>
<span class="jio-ticket-badge" :style="{ '--jio-ticket-color': previewColor }">
{{ form.name.trim() || '状态名称' }}
</span>
</div>
@@ -39,15 +39,31 @@
<n-form-item label="状态名称" path="name">
<n-input v-model:value="form.name" placeholder="如:处理中" maxlength="60" show-count />
</n-form-item>
<n-form-item label="标识" path="status_key">
<div class="jio-status-key">
<n-input
v-model:value="form.status_key"
class="jio-status-key__input"
:placeholder="editing ? '' : '留空则按名称自动生成'"
maxlength="24"
show-count
:input-props="{ autocomplete: 'off', spellcheck: false }"
@blur="form.status_key = normalizeKey(form.status_key)"
/>
<span class="jio-ticket-status__hint">
小写字母开头,仅含小写字母、数字与下划线(2–24 位)。修改后,使用该状态的工单会同步改为新标识。
</span>
</div>
</n-form-item>
<n-form-item label="状态颜色" path="color">
<div class="aksrt-status-color">
<div class="aksrt-status-color__swatches" role="radiogroup" aria-label="状态颜色">
<div class="jio-status-color">
<div class="jio-status-color__swatches" role="radiogroup" aria-label="状态颜色">
<button
v-for="swatch in SWATCHES"
:key="swatch"
type="button"
role="radio"
class="aksrt-status-color__swatch"
class="jio-status-color__swatch"
:class="{ 'is-active': currentHex === swatch }"
:style="{ '--swatch': swatch }"
:aria-checked="currentHex === swatch"
@@ -56,18 +72,16 @@
@click="form.color = swatch"
/>
<!-- 自定义色:未选中时显示色环,选中后显示当前色并带选中环。 -->
<n-color-picker
:value="previewColor"
:modes="['hex']"
:show-alpha="false"
@update:value="setColor"
<JioColorPicker
:model-value="previewColor"
@update:model-value="setColor"
>
<template #trigger="{ onClick, ref: setTriggerRef }">
<button
:ref="setTriggerRef"
type="button"
role="radio"
class="aksrt-status-color__swatch aksrt-status-color__swatch--custom"
class="jio-status-color__swatch jio-status-color__swatch--custom"
:class="{ 'is-active': isCustomColor }"
:style="{ '--swatch': previewColor }"
:aria-checked="isCustomColor"
@@ -76,25 +90,25 @@
@click="onClick"
/>
</template>
</n-color-picker>
</JioColorPicker>
</div>
<n-input
v-model:value="form.color"
class="aksrt-status-color__hex"
class="jio-status-color__hex"
maxlength="7"
placeholder="#6b7280"
@blur="form.color = toHex(form.color) || form.color.trim()"
>
<template #prefix>
<i class="aksrt-status-color__chip" :style="{ background: previewColor }" />
<i class="jio-status-color__chip" :style="{ background: previewColor }" />
</template>
</n-input>
</div>
</n-form-item>
<n-form-item label="完结状态" path="is_closed" :show-feedback="false">
<div class="aksrt-status-closed">
<div class="jio-status-closed">
<n-switch v-model:value="form.is_closed" />
<span class="aksrt-ticket-status__hint">开启后该状态视为终态,工单不可再流转</span>
<span class="jio-ticket-status__hint">开启后该状态视为终态,工单不可再流转</span>
</div>
</n-form-item>
</n-form>
@@ -112,6 +126,8 @@
import { computed, h, onMounted, ref } from 'vue'
import { NButton, NSpace, useDialog, useMessage } from 'naive-ui'
import api from '@/api'
import JioColorPicker from '@/components/form/JioColorPicker.vue'
import { toHex } from '@/utils/color.js'
const message = useMessage()
const dialog = useDialog()
@@ -130,18 +146,14 @@ const editing = ref(null)
const rows = ref([])
const DEFAULT_COLOR = '#6b7280'
const HEX_RE = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i
const form = ref({ name: '', color: DEFAULT_COLOR, is_closed: false })
/** 与 TicketStatusService::KEY_PATTERN 保持一致。 */
const KEY_RE = /^[a-z][a-z0-9_]{1,23}$/
/**
* 归一化为 TicketStatusService::sanitize_color() 接受的小写 #rgb / #rrggbb;
* 允许省略 #。非法值返回空串。
*/
function toHex(value) {
let hex = String(value || '').trim().toLowerCase()
if (hex && !hex.startsWith('#')) hex = `#${hex}`
return HEX_RE.test(hex) ? hex : ''
const form = ref({ name: '', status_key: '', color: DEFAULT_COLOR, is_closed: false })
function normalizeKey(value) {
return String(value || '').trim().toLowerCase()
}
const rules = {
@@ -149,6 +161,26 @@ const rules = {
{ required: true, message: '请填写状态名称', trigger: 'blur' },
{ max: 60, message: '状态名称不能超过 60 字', trigger: 'blur' },
],
status_key: [
{
// 新增时可留空(后端按名称生成);编辑时必须填写。
validator: (_rule, value) => {
const key = normalizeKey(value)
if (key === '') return !editing.value
return KEY_RE.test(key)
},
message: '标识需以小写字母开头,仅含小写字母、数字与下划线,长度 2–24 位',
trigger: ['blur', 'input'],
},
{
validator: (_rule, value) => {
const key = normalizeKey(value)
return key === '' || !rows.value.some((row) => row.status_key === key && row.id !== editing.value?.id)
},
message: '该标识已被其他状态使用',
trigger: ['blur', 'input'],
},
],
color: [
{
validator: (_rule, value) => toHex(value) !== '',
@@ -162,10 +194,7 @@ const currentHex = computed(() => toHex(form.value.color))
const previewColor = computed(() => currentHex.value || DEFAULT_COLOR)
const isCustomColor = computed(() => currentHex.value !== '' && !SWATCHES.includes(currentHex.value))
/**
* 取色器已关闭 alpha(默认开启时回传 #rrggbbaa,会被后端回落成灰色),
* 这里仍只接受合法十六进制,其余忽略。
*/
/** JioColorPicker 已归一化为 hex;清空(空串)时保留当前色。 */
function setColor(value) {
const hex = toHex(value)
if (hex) form.value.color = hex
@@ -179,15 +208,15 @@ const columns = computed(() => [
minWidth: 160,
// 注意:原生元素用 h('span', ...) 时,文本必须作为 children 直接传入;
// 写成 () => row.name 的插槽函数对原生元素不生效,单元格会是空的。
render: (row) => h('span', { class: 'aksrt-ticket-badge', style: { '--aksrt-ticket-color': row.color } }, row.name),
render: (row) => h('span', { class: 'jio-ticket-badge', style: { '--jio-ticket-color': row.color } }, row.name),
},
{
title: '颜色',
key: 'color',
width: 140,
render: (row) => h('span', { class: 'aksrt-ticket-color-cell' }, [
h('i', { class: 'aksrt-ticket-color-dot', style: { background: row.color } }),
h('span', { class: 'aksrt-ticket-color-value' }, row.color),
render: (row) => h('span', { class: 'jio-ticket-color-cell' }, [
h('i', { class: 'jio-ticket-color-dot', style: { background: row.color } }),
h('span', { class: 'jio-ticket-color-value' }, row.color),
]),
},
{
@@ -206,7 +235,7 @@ const columns = computed(() => [
title: '标识',
key: 'status_key',
minWidth: 140,
render: (row) => h('span', { class: 'aksrt-ticket-key' }, row.status_key),
render: (row) => h('span', { class: 'jio-ticket-key' }, row.status_key),
},
{
title: '操作',
@@ -245,7 +274,7 @@ async function load() {
function openCreate() {
editing.value = null
form.value = { name: '', color: DEFAULT_COLOR, is_closed: false }
form.value = { name: '', status_key: '', color: DEFAULT_COLOR, is_closed: false }
visible.value = true
}
@@ -253,6 +282,7 @@ function openEdit(row) {
editing.value = row
form.value = {
name: String(row.name || ''),
status_key: String(row.status_key || ''),
color: toHex(row.color) || DEFAULT_COLOR,
is_closed: !!row.is_closed,
}
@@ -269,6 +299,7 @@ async function handleSubmit() {
try {
const payload = {
name: form.value.name.trim(),
status_key: normalizeKey(form.value.status_key),
color: currentHex.value,
is_closed: form.value.is_closed ? 1 : 0,
}
@@ -317,13 +348,13 @@ defineExpose({ reload: load })
(此前色块 <i> 因此没有尺寸,颜色列只剩色值文本。)
-->
<style>
.aksrt-ticket-status-panel .aksrt-ticket-color-cell {
.jio-ticket-status-panel .jio-ticket-color-cell {
display: inline-flex;
align-items: center;
gap: 8px;
}
.aksrt-ticket-status-panel .aksrt-ticket-color-dot {
.jio-ticket-status-panel .jio-ticket-color-dot {
display: inline-block;
width: 16px;
height: 16px;
@@ -332,21 +363,21 @@ defineExpose({ reload: load })
flex: 0 0 auto;
}
.aksrt-ticket-status-panel .aksrt-ticket-color-value,
.aksrt-ticket-status-panel .aksrt-ticket-key {
.jio-ticket-status-panel .jio-ticket-color-value,
.jio-ticket-status-panel .jio-ticket-key {
font-family: var(--n-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
font-size: 12px;
color: var(--aksrt-color-muted);
color: var(--jio-color-muted);
}
/* 徽章与前台 assets/css/routes/tickets.css 的 .aksrt-ticket-badge 同构;表格与弹窗预览共用。 */
.aksrt-ticket-status-panel .aksrt-ticket-badge,
.aksrt-status-modal .aksrt-ticket-badge {
/* 徽章与前台 assets/css/routes/tickets.css 的 .jio-ticket-badge 同构;表格与弹窗预览共用。 */
.jio-ticket-status-panel .jio-ticket-badge,
.jio-status-modal .jio-ticket-badge {
display: inline-block;
padding: 2px 10px;
border-radius: 999px;
background: color-mix(in srgb, var(--aksrt-ticket-color, #6b7280) 16%, transparent);
color: var(--aksrt-ticket-color, #6b7280);
background: color-mix(in srgb, var(--jio-ticket-color, #6b7280) 16%, transparent);
color: var(--jio-ticket-color, #6b7280);
font-size: 12px;
font-weight: 600;
line-height: 1.6;
@@ -356,24 +387,24 @@ defineExpose({ reload: load })
<style scoped>
/* —— 弹窗:顶部实时预览 —— */
.aksrt-status-preview {
.jio-status-preview {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 18px;
padding: 14px 16px;
border: 1px dashed var(--aksrt-color-border);
border: 1px dashed var(--jio-color-border);
border-radius: 8px;
background: rgba(0, 0, 0, 0.02);
}
.aksrt-status-preview__label {
color: var(--aksrt-color-muted);
.jio-status-preview__label {
color: var(--jio-color-muted);
font-size: 12px;
}
.aksrt-status-preview .aksrt-ticket-badge {
.jio-status-preview .jio-ticket-badge {
max-width: 70%;
overflow: hidden;
text-overflow: ellipsis;
@@ -381,20 +412,20 @@ defineExpose({ reload: load })
}
/* —— 弹窗:颜色选择(预设色板 + 自定义 + 十六进制输入) —— */
.aksrt-status-color {
.jio-status-color {
display: flex;
flex-direction: column;
gap: 12px;
width: 100%;
}
.aksrt-status-color__swatches {
.jio-status-color__swatches {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.aksrt-status-color__swatch {
.jio-status-color__swatch {
position: relative;
width: 28px;
height: 28px;
@@ -407,21 +438,21 @@ defineExpose({ reload: load })
transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.aksrt-status-color__swatch:hover {
.jio-status-color__swatch:hover {
transform: scale(1.1);
}
.aksrt-status-color__swatch:focus-visible {
outline: 2px solid var(--aksrt-color-primary, #2271b1);
.jio-status-color__swatch:focus-visible {
outline: 2px solid var(--jio-color-primary, #2271b1);
outline-offset: 2px;
}
/* 选中态:白色内圈 + 同色外环,深浅主题都清晰。 */
.aksrt-status-color__swatch.is-active {
.jio-status-color__swatch.is-active {
box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--swatch);
}
.aksrt-status-color__swatch.is-active::after {
.jio-status-color__swatch.is-active::after {
content: '';
position: absolute;
left: 50%;
@@ -434,11 +465,11 @@ defineExpose({ reload: load })
}
/* 自定义:未选中时显示色环,提示「更多颜色」。 */
.aksrt-status-color__swatch--custom:not(.is-active) {
.jio-status-color__swatch--custom:not(.is-active) {
background: conic-gradient(#ef4444, #f59e0b, #eab308, #22c55e, #06b6d4, #3b82f6, #8b5cf6, #ec4899, #ef4444);
}
.aksrt-status-color__swatch--custom:not(.is-active)::after {
.jio-status-color__swatch--custom:not(.is-active)::after {
content: '+';
position: absolute;
inset: 5px;
@@ -453,12 +484,12 @@ defineExpose({ reload: load })
line-height: 1;
}
.aksrt-status-color__hex {
.jio-status-color__hex {
width: 160px;
font-family: var(--n-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
}
.aksrt-status-color__chip {
.jio-status-color__chip {
display: inline-block;
width: 14px;
height: 14px;
@@ -466,15 +497,27 @@ defineExpose({ reload: load })
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
/* —— 弹窗:标识 —— */
.jio-status-key {
display: flex;
flex-direction: column;
gap: 6px;
width: 100%;
}
.jio-status-key__input {
font-family: var(--n-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
}
/* —— 弹窗:完结开关 —— */
.aksrt-status-closed {
.jio-status-closed {
display: flex;
align-items: center;
gap: 10px;
}
.aksrt-ticket-status__hint {
color: var(--aksrt-color-muted);
.jio-ticket-status__hint {
color: var(--jio-color-muted);
font-size: 12px;
}
</style>
@@ -1,6 +1,6 @@
<template>
<n-card class="aksrt-section-card">
<div class="aksrt-section-header">
<n-card class="jio-section-card">
<div class="jio-section-header">
<h3>工单部门</h3>
<n-button size="small" type="primary" :disabled="saving" @click="openCreate">新增部门</n-button>
</div>
+4 -4
View File
@@ -12,7 +12,7 @@ function resolveComponent(page) {
// Log missing component for debugging — avoids silent fallback to DeferredPage
if (page.component && page.component !== 'DeferredPage') {
console.warn(
`[AKSRT Route] Component "${page.component}" not found in componentLoaders for route "${page.route}". Falling back to DeferredPage.`
`[Jio Route] Component "${page.component}" not found in componentLoaders for route "${page.route}". Falling back to DeferredPage.`
)
}
@@ -77,9 +77,9 @@ function createSectionRedirectRoutes() {
* (封禁/举报 as a sidebar entry lives in constants/sections/users.js → /users/ban.)
*/
const NATIVE_OPS_REDIRECTS = [
{ path: '/users/messages', title: '消息中心', nativeAdminPath: 'users.php?page=aksrt_messages' },
{ path: '/users/report', title: '禁封/举报', nativeAdminPath: 'users.php?page=aksrt_user_ban' },
{ path: '/users/tickets', title: '工单管理', nativeAdminPath: 'users.php?page=aksrt_tickets' },
{ path: '/users/messages', title: '消息中心', nativeAdminPath: 'users.php?page=jio_messages' },
{ path: '/users/report', title: '禁封/举报', nativeAdminPath: 'users.php?page=jio_user_ban' },
{ path: '/users/tickets', title: '工单管理', nativeAdminPath: 'users.php?page=jio_tickets' },
]
const routes = [
+1 -1
View File
@@ -2,7 +2,7 @@
* Schema Registry — central index for all admin section schemas.
*
* Each section's schema defines the form fields, groups, API endpoints,
* and default values for a settings page. The AksFormRenderer component
* and default values for a settings page. The JioFormRenderer component
* consumes these schemas to render settings pages automatically.
*
* Schema shape per section:
@@ -1,68 +0,0 @@
export const codeHighlightSchema = {
key: 'global.code-highlight',
title: '代码高亮',
icon: 'fa fas fa-code',
description: '代码块语法高亮主题、行号、最大高度等配置。',
defaults: {
highlight_kg: true,
highlight_hh: false,
highlight_btn: true,
highlight_maxheight: 400,
highlight_zt: 'enlighter',
highlight_dark_zt: 'monokai',
},
groups: [
{
key: 'basic',
title: '代码高亮设置',
icon: 'fa fas fa-pen',
fields: [
{ key: 'highlight_kg', label: '代码高亮开关', type: 'switch', default: true },
{ key: 'highlight_hh', label: '显示行号', type: 'switch', default: false },
{ key: 'highlight_btn', label: '显示扩展按钮', type: 'switch', default: true, help: '控制原始代码 / 信息 / 新窗口按钮的显示' },
{ key: 'highlight_maxheight', label: '最大高度(px,0=不限)', type: 'number', default: 400, min: 0, max: 2000, help: '代码块最大高度,超出滚动显示。0 表示不限制' },
],
},
{
key: 'theme',
title: '主题设置',
icon: 'fa fas fa-paint-brush',
fields: [
{
key: 'highlight_zt',
label: '日间默认主题',
type: 'select',
default: 'enlighter',
options: [
{ label: 'Enlighter', value: 'enlighter' },
{ label: 'Bootstrap 4', value: 'bootstrap4' },
{ label: 'Classic', value: 'classic' },
{ label: 'Beyond', value: 'beyond' },
{ label: 'Mowtwo', value: 'mowtwo' },
{ label: 'Eclipse', value: 'eclipse' },
{ label: 'Droide', value: 'droide' },
{ label: 'Minimal', value: 'minimal' },
{ label: 'Rowhammer', value: 'rowhammer' },
{ label: 'Godzilla', value: 'godzilla' },
{ label: 'Dracula', value: 'dracula' },
{ label: 'Atomic', value: 'atomic' },
{ label: 'Monokai', value: 'monokai' },
],
},
{
key: 'highlight_dark_zt',
label: '暗色默认主题',
type: 'select',
default: 'monokai',
options: [
{ label: 'Dracula', value: 'dracula' },
{ label: 'Atomic', value: 'atomic' },
{ label: 'Monokai', value: 'monokai' },
{ label: 'Enlighter', value: 'enlighter' },
{ label: 'Bootstrap 4', value: 'bootstrap4' },
],
},
],
},
],
}
+156 -12
View File
@@ -1,13 +1,23 @@
const themeRoot = typeof window !== 'undefined' && window.aksrtAdminData?.themeUri
? String(window.aksrtAdminData.themeUri).replace(/\/$/, '')
const themeRoot = typeof window !== 'undefined' && window.jioAdminData?.themeUri
? String(window.jioAdminData.themeUri).replace(/\/$/, '')
: ''
const defaultThumbnail = themeRoot ? `${themeRoot}/assets/img/thumbnail.svg` : ''
const noticeColorOptions = [
{ label: '主题色', value: 'primary' },
{ label: '成功绿', value: 'success' },
{ label: '警告橙', value: 'warning' },
{ label: '危险红', value: 'danger' },
{ label: '信息蓝', value: 'info' },
{ label: '深紫', value: 'purple' },
{ label: '深灰', value: 'dark' },
]
export const commonSchema = {
key: 'global.common',
title: '常用功能',
icon: 'fa fas fa-cog',
description: '管理站点常用开关、懒加载与备案信息等基础配置。',
description: '图像懒加载、代码高亮与弹窗公告等全站常用配置。',
defaults: {
lazy_posts_thumb: true,
lazy_avatar: true,
@@ -18,9 +28,35 @@ export const commonSchema = {
lazy_other: true,
lazy_animation: 'blur',
thumbnail: defaultThumbnail,
icp_filing: '',
police_filing: '',
footer_text: '',
highlight_kg: true,
highlight_hh: false,
highlight_btn: true,
highlight_maxheight: 400,
highlight_zt: 'enlighter',
highlight_dark_zt: 'monokai',
system_notice_enabled: true,
system_notice_policy: '',
system_notice_title: '',
system_notice_content: '',
system_notice_btn1_text: '',
system_notice_btn1_link: '',
system_notice_btn1_color: 'primary',
system_notice_btn2_text: '',
system_notice_btn2_link: '',
system_notice_btn2_color: 'primary',
system_notice_btn3_text: '',
system_notice_btn3_link: '',
system_notice_btn3_color: 'primary',
system_notice_btn4_text: '',
system_notice_btn4_link: '',
system_notice_btn4_color: 'primary',
system_notice_size: '',
system_notice_radius: false,
system_notice_class: '',
system_notice_title_icon: '',
system_notice_title_class: '',
system_notice_title_style: '',
system_notice_expires: 24,
},
groups: [
{
@@ -57,13 +93,121 @@ export const commonSchema = {
],
},
{
key: 'filing',
title: '备案信息',
icon: 'fa fas fa-shield-alt',
key: 'code-highlight',
title: '代码高亮',
icon: 'fa fas fa-code',
fields: [
{ key: 'icp_filing', label: 'ICP 备案号', type: 'input', placeholder: '例如:京ICP备12345678号', help: '显示在页脚的备案信息' },
{ key: 'police_filing', label: '公安备案号', type: 'input', placeholder: '例如:公网安备11000000000000号', help: '显示在页脚的备案信息' },
{ key: 'footer_text', label: '页脚附加文字', type: 'input', placeholder: '自定义页脚文字', help: '显示在版权信息下方' },
{ key: 'highlight_kg', label: '代码高亮开关', type: 'switch', default: true },
{ key: 'highlight_hh', label: '显示行号', type: 'switch', default: false, dependsOn: { key: 'highlight_kg', value: true } },
{ key: 'highlight_btn', label: '显示扩展按钮', type: 'switch', default: true, dependsOn: { key: 'highlight_kg', value: true }, help: '控制原始代码 / 信息 / 新窗口按钮的显示' },
{ key: 'highlight_maxheight', label: '最大高度(px,0=不限)', type: 'number', default: 400, min: 0, max: 2000, dependsOn: { key: 'highlight_kg', value: true }, help: '代码块最大高度,超出滚动显示。0 表示不限制' },
{
key: 'highlight_zt',
label: '日间默认主题',
type: 'select',
default: 'enlighter',
dependsOn: { key: 'highlight_kg', value: true },
options: [
{ label: 'Enlighter', value: 'enlighter' },
{ label: 'Bootstrap 4', value: 'bootstrap4' },
{ label: 'Classic', value: 'classic' },
{ label: 'Beyond', value: 'beyond' },
{ label: 'Mowtwo', value: 'mowtwo' },
{ label: 'Eclipse', value: 'eclipse' },
{ label: 'Droide', value: 'droide' },
{ label: 'Minimal', value: 'minimal' },
{ label: 'Rowhammer', value: 'rowhammer' },
{ label: 'Godzilla', value: 'godzilla' },
{ label: 'Dracula', value: 'dracula' },
{ label: 'Atomic', value: 'atomic' },
{ label: 'Monokai', value: 'monokai' },
],
},
{
key: 'highlight_dark_zt',
label: '暗色默认主题',
type: 'select',
default: 'monokai',
dependsOn: { key: 'highlight_kg', value: true },
options: [
{ label: 'Dracula', value: 'dracula' },
{ label: 'Atomic', value: 'atomic' },
{ label: 'Monokai', value: 'monokai' },
{ label: 'Enlighter', value: 'enlighter' },
{ label: 'Bootstrap 4', value: 'bootstrap4' },
],
},
],
},
{
key: 'system-notice',
title: '弹窗通知',
icon: 'fa fas fa-bullhorn',
fields: [
{ key: 'system_notice_enabled', label: '启用系统公告', type: 'switch', default: true },
{
key: 'system_notice_policy',
label: '显示对象',
type: 'select',
default: '',
options: [
{ label: '所有访客', value: '' },
{ label: '仅登录用户', value: 'signin' },
{ label: '仅 VIP 会员', value: 'vip' },
{ label: '仅非 VIP', value: 'free' },
{ label: '仅认证用户', value: 'auth' },
],
dependsOn: { key: 'system_notice_enabled', value: true },
},
{ key: 'system_notice_title', label: '公告标题', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_content', label: '公告内容', type: 'textarea', default: '', rows: 5, dependsOn: { key: 'system_notice_enabled', value: true }, help: '支持 HTML 标签' },
{ key: 'system_notice_btn1_text', label: '按钮 1 文案', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn1_link', label: '按钮 1 链接', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true }, help: '可选,填写后按钮变为链接' },
{ key: 'system_notice_btn1_color', label: '按钮 1 颜色', type: 'select', default: 'primary', options: noticeColorOptions, dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn2_text', label: '按钮 2 文案', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn2_link', label: '按钮 2 链接', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn2_color', label: '按钮 2 颜色', type: 'select', default: 'primary', options: noticeColorOptions, dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn3_text', label: '按钮 3 文案', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn3_link', label: '按钮 3 链接', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn3_color', label: '按钮 3 颜色', type: 'select', default: 'primary', options: noticeColorOptions, dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn4_text', label: '按钮 4 文案', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn4_link', label: '按钮 4 链接', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn4_color', label: '按钮 4 颜色', type: 'select', default: 'primary', options: noticeColorOptions, dependsOn: { key: 'system_notice_enabled', value: true } },
{
key: 'system_notice_size',
label: '弹窗尺寸',
type: 'select',
default: '',
options: [
{ label: '默认', value: '' },
{ label: '迷你', value: 'modal-mini' },
{ label: '小号', value: 'modal-sm' },
{ label: '大号', value: 'modal-lg' },
],
dependsOn: { key: 'system_notice_enabled', value: true },
},
{ key: 'system_notice_radius', label: '按钮圆角', type: 'switch', default: false, dependsOn: { key: 'system_notice_enabled', value: true }, help: '开启后弹窗按钮使用圆角样式' },
{ key: 'system_notice_class', label: '公告样式类', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_title_icon', label: '标题图标', type: 'icon', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{
key: 'system_notice_title_class',
label: '标题背景配色',
type: 'select',
default: '',
dependsOn: { key: 'system_notice_enabled', value: true },
options: [
{ label: '无', value: '' },
{ label: '炫彩黄', value: 'jb-yellow' },
{ label: '炫彩蓝', value: 'jb-blue' },
{ label: '炫彩绿', value: 'jb-green' },
{ label: '炫彩紫', value: 'jb-purple' },
{ label: '炫彩红', value: 'jb-red' },
{ label: '炫彩橙', value: 'jb-orange' },
],
help: '弹窗标题区域的背景配色方案',
},
{ key: 'system_notice_title_style', label: '标题样式', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_expires', label: '弹窗周期(小时)', type: 'number', default: 24, min: 0, max: 720, dependsOn: { key: 'system_notice_enabled', value: true }, help: '0 表示永不过期' },
],
},
],
@@ -37,7 +37,7 @@ export const i18nSchema = {
],
dependsOn: { key: 'i18n_enabled', value: true },
},
{ key: 'i18n_auto_detect', label: '自动检测浏览器语言', type: 'switch', default: true, dependsOn: { key: 'i18n_enabled', value: true }, help: '基于浏览器 Accept-Language 自动切换(AKSRT 方案,区别于 legacy IP 定位方案)' },
{ key: 'i18n_auto_detect', label: '自动检测浏览器语言', type: 'switch', default: true, dependsOn: { key: 'i18n_enabled', value: true }, help: '基于浏览器 Accept-Language 自动切换(Jio 方案,区别于 legacy IP 定位方案)' },
],
},
{
@@ -12,8 +12,6 @@ import { tabbarSchema } from './tabbar.js'
import { i18nSchema } from './i18n.js'
import { customCodeSchema } from './custom-code.js'
import { seoSchema } from './seo.js'
import { codeHighlightSchema } from './code-highlight.js'
import { systemNoticeSchema } from './system-notice.js'
import { shareSchema } from './share.js'
export const globalSchemas = {
@@ -26,7 +24,5 @@ export const globalSchemas = {
i18n: i18nSchema,
'custom-code': customCodeSchema,
seo: seoSchema,
'code-highlight': codeHighlightSchema,
'system-notice': systemNoticeSchema,
share: shareSchema,
}
@@ -1,3 +1,52 @@
const bgDefault = {
color: '',
image: '',
position: 'center top',
repeat: 'no-repeat',
attachment: 'fixed',
size: '100%',
origin: '',
}
const opts = (pairs) => pairs.map(([value, label]) => ({ label, value }))
// 与 Settings ThemeSearch::background_css() 的白名单一致。
const bgField = (key, label, help) => ({
key,
label,
type: 'fieldset',
default: { ...bgDefault },
help,
fields: [
{ key: 'color', label: '背景颜色', type: 'color', default: '' },
{ key: 'image', label: '背景图片', type: 'media', default: '' },
{ key: 'position', label: '背景位置', type: 'select', default: 'center top', options: opts([
['', '默认'], ['left top', '左上'], ['left center', '左中'], ['left bottom', '左下'],
['center top', '中上'], ['center center', '居中'], ['center bottom', '中下'],
['right top', '右上'], ['right center', '右中'], ['right bottom', '右下'],
]) },
{ key: 'repeat', label: '背景重复', type: 'select', default: 'no-repeat', options: opts([
['', '默认'], ['repeat', '重复'], ['no-repeat', '不重复'], ['repeat-x', '水平重复'], ['repeat-y', '垂直重复'],
]) },
{ key: 'attachment', label: '背景附着', type: 'select', default: 'fixed', options: opts([
['', '默认'], ['scroll', '滚动'], ['fixed', '固定'],
]) },
{ key: 'size', label: '背景尺寸', type: 'select', default: '100%', options: opts([
['', '默认'], ['100%', '100%'], ['cover', '覆盖 (cover)'], ['contain', '包含 (contain)'], ['auto', '自动 (auto)'],
]) },
{ key: 'origin', label: '背景原点', type: 'select', default: '', options: opts([
['', '默认'], ['padding-box', 'Padding Box'], ['border-box', 'Border Box'], ['content-box', 'Content Box'],
]) },
],
})
// palette 的 label 即色块背景色;ff1856 的色块沿用参考主题的 #fd2760。
const SKIN_PALETTE = [
['ff1856', '#fd2760'], ['f04494', '#f04494'], ['ae53f3', '#ae53f3'], ['627bf5', '#627bf5'],
['00a2e3', '#00a2e3'], ['16b597', '#16b597'], ['36af18', '#36af18'], ['8fb107', '#8fb107'],
['b18c07', '#b18c07'], ['e06711', '#e06711'], ['f74735', '#f74735'],
].map(([value, label]) => ({ label, value }))
export const layoutSchema = {
key: 'global.layout',
title: '显示 & 布局',
@@ -6,11 +55,13 @@ export const layoutSchema = {
defaults: {
theme_mode: 'time-auto',
theme_mode_button: ['pc_nav', 'm_menu'],
primary_color: '#1890ff',
theme_img_bg: { ...bgDefault },
dark_theme_img_bg: { ...bgDefault },
theme_skin_custom: '',
theme_skin: 'f04494',
dark_primary_color: '',
border_radius: 8,
theme_main_radius: 12,
dark_theme_skin_custom: '',
close_backdrop: false,
theme_main_radius: 8,
container_max_width: 1200,
sidebar_enabled: true,
sidebar_position: 'right',
@@ -22,6 +73,7 @@ export const layoutSchema = {
sidebar_page_enabled: true,
sidebar_search_enabled: true,
font_family: 'system',
font_family_custom: '',
qj_loading: false,
qj_dh_xs: 'no1',
},
@@ -61,50 +113,41 @@ export const layoutSchema = {
fields: [
{
key: 'theme_mode',
label: '默认主题模式',
label: '主题模式',
type: 'radio',
default: 'time-auto',
options: [
{ label: '浅色', value: 'white-theme' },
{ label: '深色', value: 'dark-theme' },
{ label: '跟随系统', value: 'time-auto' },
{ label: '日间亮色主题', value: 'white-theme' },
{ label: '夜间深色主题', value: 'dark-theme' },
{ label: '早晚8点自动切换', value: 'time-auto' },
],
help: '此处设置为默认风格,实际显示风格以用户设置优先。如需固定风格,则关闭还需下方主题切换按钮',
},
{
key: 'theme_mode_button',
label: '主题切换按钮位置',
label: '主题切换按钮',
type: 'checkbox',
default: ['pc_nav', 'm_menu'],
options: [
{ label: 'PC 顶部导航', value: 'pc_nav' },
{ label: '移动端菜单', value: 'm_menu' },
{ label: 'PC端顶部导航', value: 'pc_nav' },
{ label: '移动端弹出菜单', value: 'm_menu' },
],
help: '控制主题切换按钮在哪些位置显示',
help: '如果关闭此功能,则前端不会显示切换按钮',
},
{ key: 'primary_color', label: '主题色', type: 'color', default: '#f04494', help: '按钮、链接和强调元素的主色调' },
bgField('theme_img_bg', '全局背景图', '注意:要达到良好的效果需要图片与参数配合,同时需注意颜色搭配!配合不好容易降低显示美感'),
bgField('dark_theme_img_bg', '夜间模式背景图', '如未设置夜间模式背景图,则夜间模式也显示上方背景图'),
{ key: 'theme_skin_custom', label: '全局主题色', type: 'color', default: '', help: '默认主题高亮颜色。如需选择下方预置颜色,请先清空上方颜色' },
{
key: 'theme_skin',
label: '预设主题色',
label: ' ',
type: 'palette',
default: 'f04494',
options: [
{ label: '玫红', value: 'ff1856' },
{ label: '粉色', value: 'f04494' },
{ label: '紫色', value: 'ae53f3' },
{ label: '靛蓝', value: '627bf5' },
{ label: '天蓝', value: '00a2e3' },
{ label: '青绿', value: '16b597' },
{ label: '翠绿', value: '36af18' },
{ label: '黄绿', value: '8fb107' },
{ label: '棕金', value: 'b18c07' },
{ label: '橘橙', value: 'e06711' },
{ label: '朱红', value: 'f74735' },
],
help: '选择预设主题色,将覆盖上方自定义主题色',
dependsOn: { key: 'theme_skin_custom', operator: 'empty' },
options: SKIN_PALETTE,
},
{ key: 'dark_primary_color', label: '暗色模式主题色', type: 'color', default: '', help: '暗色模式下独立的主题色,留空则跟随浅色模式' },
{ key: 'border_radius', label: '全局圆角 (px)', type: 'slider', min: 0, max: 20, step: 1, default: 8 },
{ key: 'theme_main_radius', label: '卡片圆角 (px)', type: 'number', min: 0, max: 30, default: 12, help: '独立卡片圆角,留空则使用全局圆角 +4' },
{ key: 'dark_theme_skin_custom', label: '夜间模式主题色', type: 'color', default: '', help: '在此可单独设置夜间模式的高亮色,清空此处则使用上方默认高亮色' },
{ key: 'close_backdrop', label: '全局关闭背景高斯模糊', type: 'switch', default: false, help: '在支持的浏览器上部分UI(例如导航栏)会显示背景高斯模糊的特效,但此功能比较消耗浏览器性能。同时系统会自动检测用户浏览器性能情况,如果性能较差,将自动关闭此特效,以提供更流畅的体验' },
{ key: 'theme_main_radius', label: '卡片圆角', type: 'spinner', default: 8, min: 0, max: 30, step: 1, unit: 'PX', description: '页面卡片的圆角尺寸' },
],
},
{
@@ -112,16 +155,7 @@ export const layoutSchema = {
title: '布局设置',
icon: 'fa fas fa-columns',
fields: [
{ key: 'container_max_width', label: '内容最大宽度 (px)', type: 'select', default: 1200, options: [
{ label: '1200px', value: 1200 },
{ label: '1320px', value: 1320 },
{ label: '1440px', value: 1440 },
{ label: '1600px', value: 1600 },
{ label: '1800px', value: 1800 },
{ label: '2000px', value: 2000 },
{ label: '2200px', value: 2200 },
{ label: '全宽', value: 0 },
]},
{ key: 'container_max_width', label: '内容最大宽度', type: 'number', default: 1200, min: 1200, max: 2200, step: 50, unit: 'PX', help: '页面布局的最大宽度,可设置 1200–2200PX。宽度过大会造成显示不协调,非特殊需求请勿调整。' },
{ key: 'sidebar_enabled', label: '开启侧边栏', type: 'switch', default: true },
{ key: 'sidebar_position', label: '侧边栏位置', type: 'radio', default: 'right', dependsOn: { key: 'sidebar_enabled', value: true }, options: [
{ label: '左侧', value: 'left' },
@@ -153,7 +187,8 @@ export const layoutSchema = {
{ label: '思源黑体', value: 'noto-sans-sc' },
{ label: '思源宋体', value: 'noto-serif-sc' },
{ label: '自定义', value: 'custom' },
]},
], help: '思源字体不会远程加载,访客设备未安装时回退到系统字体。' },
{ key: 'font_family_custom', label: '自定义字体', type: 'input', default: '', placeholder: '例如:"LXGW WenKai", "PingFang SC", sans-serif', dependsOn: { key: 'font_family', value: 'custom' }, help: 'CSS font-family 字体栈,多个字体用英文逗号分隔;留空使用系统字体。' },
],
},
],
+14 -10
View File
@@ -1,14 +1,19 @@
const themeRoot = typeof window !== 'undefined' && window.jioAdminData?.themeUri
? String(window.jioAdminData.themeUri).replace(/\/$/, '')
: ''
const defaultLogo = themeRoot ? `${themeRoot}/assets/img/logo.png` : ''
const defaultFavicon = themeRoot ? `${themeRoot}/assets/img/favicon.png` : ''
export const logoSchema = {
key: 'global.logo',
title: 'LOGO & 品牌',
icon: 'fa fas fa-image',
description: '管理站点 Logo、站点图标和品牌标识。',
defaults: {
site_logo: '',
site_logo_dark: '',
site_favicon: '',
site_icon: '',
logo_width: 150,
site_logo: defaultLogo,
site_logo_dark: defaultLogo,
site_favicon: defaultFavicon,
site_icon: defaultFavicon,
logo_text: '',
},
groups: [
@@ -17,9 +22,8 @@ export const logoSchema = {
title: 'Logo 设置',
icon: 'fa fas fa-image',
fields: [
{ key: 'site_logo', label: '站点 Logo', type: 'media', help: '建议尺寸 300x80,支持 PNG/SVG 透明背景' },
{ key: 'site_logo_dark', label: '暗色模式 Logo', type: 'media', help: '暗色模式下显示的 Logo,留空则使用默认 Logo' },
{ key: 'logo_width', label: 'Logo 宽度 (px)', type: 'number', min: 50, max: 400, step: 10, help: '导航栏中 Logo 显示宽度' },
{ key: 'site_logo', label: '站点 Logo', type: 'media', default: defaultLogo, help: '建议尺寸 300x80,支持 PNG/SVG 透明背景' },
{ key: 'site_logo_dark', label: '暗色模式 Logo', type: 'media', default: defaultLogo, help: '暗色模式下显示的 Logo,留空则使用默认 Logo' },
{ key: 'logo_text', label: 'Logo 文字', type: 'input', placeholder: '当无 Logo 图片时显示的文字', help: '同时作为首页标题和 alt 文本使用' },
],
},
@@ -28,8 +32,8 @@ export const logoSchema = {
title: '站点图标',
icon: 'fa fas fa-id-badge',
fields: [
{ key: 'site_favicon', label: '浏览器图标 (Favicon)', type: 'media', help: '建议 32x32 或 16x16 的 ICO/PNG 文件' },
{ key: 'site_icon', label: '移动端图标', type: 'media', help: '建议 192x192 的 PNG,用于移动端添加到桌面' },
{ key: 'site_favicon', label: '浏览器图标 (Favicon)', type: 'media', default: defaultFavicon, help: '建议 32x32 或 16x16 的 ICO/PNG 文件' },
{ key: 'site_icon', label: '移动端图标', type: 'media', default: defaultFavicon, help: '建议 192x192 的 PNG,用于移动端添加到桌面' },
],
},
],
@@ -20,7 +20,7 @@ export const searchSchema = {
search_custom_key: ['title', 'content', 'excerpt', 'category', 'post_tag'],
search_facets: {},
search_ms_s: false,
search_ms_opt: { api_url: 'http://127.0.0.1:7700', api_key: '', index_prefix: 'aksrt', synonyms: [{ key: 'wordpress', val: 'wp,wordp,wordpre' }] },
search_ms_opt: { api_url: 'http://127.0.0.1:7700', api_key: '', index_prefix: 'jio', synonyms: [{ key: 'wordpress', val: 'wp,wordp,wordpre' }] },
},
groups: [
{
@@ -63,12 +63,13 @@ export const searchSchema = {
{ key: 'search_custom_key_s', label: '自定义匹配范围', type: 'switch', default: true, help: '启用后可配置搜索匹配字段范围' },
{ key: 'search_custom_key', label: '匹配字段', type: 'checkbox', default: ['title', 'content', 'excerpt', 'category', 'post_tag'], dependsOn: { key: 'search_custom_key_s', value: true }, options: [
{ label: '标题', value: 'title' }, { label: '内容', value: 'content' }, { label: '简介', value: 'excerpt' },
{ label: '分类', value: 'category' }, { label: '标签', value: 'post_tag' },
{ label: '分类', value: 'category' }, { label: '标签', value: 'post_tag' }, { label: '专题', value: 'topics' },
{ label: '评论', value: 'coment' }, { label: '作者昵称', value: 'user' },
] },
{ key: 'search_facets', label: '搜索筛选', type: 'fieldset', sanitizeType: 'array', default: {}, dependsOn: { key: 'search_ms_s', value: false }, help: '搜索结果中显示的筛选列表;启用 Meilisearch 后由搜索引擎生成关联筛选。', fields: [
{ key: 'category', label: '[文章] 分类', type: 'taxonomy_select', taxonomy: 'category', multiple: true, default: [] },
{ key: 'post_tag', label: '[文章] 标签', type: 'taxonomy_select', taxonomy: 'post_tag', multiple: true, default: [] },
{ key: 'topics', label: '[文章] 专题', type: 'taxonomy_select', taxonomy: 'topics', multiple: true, default: [] },
] },
],
},
@@ -98,10 +99,10 @@ export const searchSchema = {
icon: 'fa fas fa-bolt',
fields: [
{ key: 'search_ms_s', label: '启用 Meilisearch', type: 'switch', default: false },
{ key: 'search_ms_opt', label: 'Meilisearch 参数', type: 'fieldset', sanitizeType: 'array', dependsOn: { key: 'search_ms_s', value: true }, default: { api_url: 'http://127.0.0.1:7700', api_key: '', index_prefix: 'aksrt', synonyms: [{ key: 'wordpress', val: 'wp,wordp,wordpre' }] }, fields: [
{ key: 'search_ms_opt', label: 'Meilisearch 参数', type: 'fieldset', sanitizeType: 'array', dependsOn: { key: 'search_ms_s', value: true }, default: { api_url: 'http://127.0.0.1:7700', api_key: '', index_prefix: 'jio', synonyms: [{ key: 'wordpress', val: 'wp,wordp,wordpre' }] }, fields: [
{ key: 'api_url', label: 'API 地址', type: 'input', default: 'http://127.0.0.1:7700' },
{ key: 'api_key', label: 'API 密钥', type: 'input', default: '' },
{ key: 'index_prefix', label: '索引前缀', type: 'input', default: 'aksrt' },
{ key: 'index_prefix', label: '索引前缀', type: 'input', default: 'jio' },
{ key: 'synonyms', label: '同义词', type: 'repeater', default: [{ key: 'wordpress', val: 'wp,wordp,wordpre' }], addText: '添加同义词', fields: [
{ key: 'key', label: '关键词', type: 'input', default: '' },
{ key: 'val', label: '同义词', type: 'textarea', default: '' },
@@ -1,5 +1,5 @@
const themeRoot = typeof window !== 'undefined' && window.aksrtAdminData?.themeUri
? String(window.aksrtAdminData.themeUri).replace(/\/$/, '')
const themeRoot = typeof window !== 'undefined' && window.jioAdminData?.themeUri
? String(window.jioAdminData.themeUri).replace(/\/$/, '')
: ''
const shareOptions = [
@@ -1,149 +0,0 @@
export const systemNoticeSchema = {
key: 'global.system-notice',
title: '弹窗通知',
icon: 'fa fas fa-bullhorn',
description: '全站弹窗公告配置,支持按用户身份定向、多按钮组、弹窗尺寸与过期周期。',
defaults: {
system_notice_enabled: true,
system_notice_policy: '',
system_notice_title: '',
system_notice_content: '',
system_notice_btn1_text: '',
system_notice_btn1_link: '',
system_notice_btn1_color: 'primary',
system_notice_btn2_text: '',
system_notice_btn2_link: '',
system_notice_btn2_color: 'primary',
system_notice_btn3_text: '',
system_notice_btn3_link: '',
system_notice_btn3_color: 'primary',
system_notice_btn4_text: '',
system_notice_btn4_link: '',
system_notice_btn4_color: 'primary',
system_notice_size: '',
system_notice_radius: false,
system_notice_class: '',
system_notice_title_icon: '',
system_notice_title_class: '',
system_notice_title_style: '',
system_notice_expires: 24,
},
groups: [
{
key: 'basic',
title: '公告设置',
icon: 'fa fas fa-bullhorn',
fields: [
{ key: 'system_notice_enabled', label: '启用系统公告', type: 'switch', default: true },
{
key: 'system_notice_policy',
label: '显示对象',
type: 'select',
default: '',
options: [
{ label: '所有访客', value: '' },
{ label: '仅登录用户', value: 'signin' },
{ label: '仅 VIP 会员', value: 'vip' },
{ label: '仅非 VIP', value: 'free' },
{ label: '仅认证用户', value: 'auth' },
],
dependsOn: { key: 'system_notice_enabled', value: true },
},
{ key: 'system_notice_title', label: '公告标题', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_content', label: '公告内容', type: 'textarea', default: '', rows: 5, dependsOn: { key: 'system_notice_enabled', value: true }, help: '支持 HTML 标签' },
],
},
{
key: 'buttons',
title: '按钮组(留空则不显示)',
icon: 'fa fas fa-th-large',
fields: [
{ key: 'system_notice_btn1_text', label: '按钮 1 文案', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn1_link', label: '按钮 1 链接', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true }, help: '可选,填写后按钮变为链接' },
{ key: 'system_notice_btn1_color', label: '按钮 1 颜色', type: 'select', default: 'primary', options: [
{ label: '主题色', value: 'primary' },
{ label: '成功绿', value: 'success' },
{ label: '警告橙', value: 'warning' },
{ label: '危险红', value: 'danger' },
{ label: '信息蓝', value: 'info' },
{ label: '深紫', value: 'purple' },
{ label: '深灰', value: 'dark' },
], dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn2_text', label: '按钮 2 文案', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn2_link', label: '按钮 2 链接', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn2_color', label: '按钮 2 颜色', type: 'select', default: 'primary', options: [
{ label: '主题色', value: 'primary' },
{ label: '成功绿', value: 'success' },
{ label: '警告橙', value: 'warning' },
{ label: '危险红', value: 'danger' },
{ label: '信息蓝', value: 'info' },
{ label: '深紫', value: 'purple' },
{ label: '深灰', value: 'dark' },
], dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn3_text', label: '按钮 3 文案', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn3_link', label: '按钮 3 链接', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn3_color', label: '按钮 3 颜色', type: 'select', default: 'primary', options: [
{ label: '主题色', value: 'primary' },
{ label: '成功绿', value: 'success' },
{ label: '警告橙', value: 'warning' },
{ label: '危险红', value: 'danger' },
{ label: '信息蓝', value: 'info' },
{ label: '深紫', value: 'purple' },
{ label: '深灰', value: 'dark' },
], dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn4_text', label: '按钮 4 文案', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn4_link', label: '按钮 4 链接', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_btn4_color', label: '按钮 4 颜色', type: 'select', default: 'primary', options: [
{ label: '主题色', value: 'primary' },
{ label: '成功绿', value: 'success' },
{ label: '警告橙', value: 'warning' },
{ label: '危险红', value: 'danger' },
{ label: '信息蓝', value: 'info' },
{ label: '深紫', value: 'purple' },
{ label: '深灰', value: 'dark' },
], dependsOn: { key: 'system_notice_enabled', value: true } },
],
},
{
key: 'style',
title: '样式设置',
icon: 'fa fas fa-paint-brush',
fields: [
{
key: 'system_notice_size',
label: '弹窗尺寸',
type: 'select',
default: '',
options: [
{ label: '默认', value: '' },
{ label: '迷你', value: 'modal-mini' },
{ label: '小号', value: 'modal-sm' },
{ label: '大号', value: 'modal-lg' },
],
dependsOn: { key: 'system_notice_enabled', value: true },
},
{ key: 'system_notice_radius', label: '按钮圆角', type: 'switch', default: false, dependsOn: { key: 'system_notice_enabled', value: true }, help: '开启后弹窗按钮使用圆角样式' },
{ key: 'system_notice_class', label: '公告样式类', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_title_icon', label: '标题图标', type: 'icon', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
{ key: 'system_notice_title_class', label: '标题背景配色', type: 'select', default: '', dependsOn: { key: 'system_notice_enabled', value: true }, options: [
{ label: '无', value: '' },
{ label: '炫彩黄', value: 'jb-yellow' },
{ label: '炫彩蓝', value: 'jb-blue' },
{ label: '炫彩绿', value: 'jb-green' },
{ label: '炫彩紫', value: 'jb-purple' },
{ label: '炫彩红', value: 'jb-red' },
{ label: '炫彩橙', value: 'jb-orange' },
], help: '弹窗标题区域的背景配色方案' },
{ key: 'system_notice_title_style', label: '标题样式', type: 'input', default: '', dependsOn: { key: 'system_notice_enabled', value: true } },
],
},
{
key: 'expire',
title: '过期设置',
icon: 'fa fas fa-clock',
fields: [
{ key: 'system_notice_expires', label: '弹窗周期(小时)', type: 'number', default: 24, min: 0, max: 720, dependsOn: { key: 'system_notice_enabled', value: true }, help: '0 表示永不过期' },
],
},
],
}
Loaded 100 of 1323 files, more files were not shown because too many files have changed in this diff. Show more