@etspress/netflix 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.env.example ADDED
@@ -0,0 +1,2 @@
1
+ NETFLIX_HOME_CONFIG={"brandName":"奈飞小铺","navHomeLabel":"首页","navProductsLabel":"车票","navPromotionLabel":"推广","serviceStats":"全年365天|售后极速响应\n1000000+|上车人次\n70000+|售后群人数\n5年+|网站运营","promotionEnabled":"是","promotionTitle":"邀请好友购买享 20% 佣金","promotionSubtitle":"专属优惠 · 实时到账 · 随时提现","promotionButtonLabel":"去推荐","quickTools":"优惠券|\n签到|\n推广返现|/me/affiliate\n在线咨询|/about\n公众号|\n售后群|","servicePromises":"现号秒发|\n自动售后|\n翻车换号|\n在线客服|","productsTitle":"热门商品","footerProductsTitle":"旗下产品","footerNavigationTitle":"功能导航","footerNavigation":"我的车票|\n我的推广|","footerPoliciesTitle":"条款与政策","footerPolicies":"隐私政策|\n用户协议|","footerContactTitle":"联系我们","brandLogoUrl":"/plugins/appstore/static-plugins/netflix/assets/reference-logo.svg","heroTitle":"","heroSubtitle":"","heroBackgroundUrl":"","promotionUrl":"","productsSubtitle":"","productCardShowTags":"是","productCardShowDescription":"是","productCardShowFaq":"是","productCardShowRecentPurchase":"是","productCardButtonLabel":"买票上车","footerProducts":"爱合租|https://ihezu.com.cn/\n寻星电玩|https://www.findstars.cn/\n搜奈飞|https://www.sounf.com/","contactHours":"电话: 0411 - 84796602 · 周一至周五 9:00 - 18:00","contactLinks":"微信|\nQQ|\nTelegram|https://t.me/joinchat/V2Qxg-u4XncM3F9m\nYouTube|https://www.youtube.com/channel/UC69HrKfh5qKHObN2Uu9GPFQ","copyrightText":"© 2019 - 2026 奈飞小铺","licenseInfo":"众垒科技(大连)有限公司|https://www.ihezu.cn/about/us\n辽ICP备2021010230号|https://beian.miit.gov.cn/#/Integrated/index\nICP经营许可证:辽B2-20220360|https://www.ihezu.cn/about/icp\n辽公网安备21029602001006号|https://beian.mps.gov.cn/#/query/webSearch?code=21029602001006","productCardRibbonLabel":"小铺自营"}
2
+ NETFLIX_PRODUCT_CONFIG={"tags":"高清画质,稳定合租,售后保障","purchaseNotice":"选择适合自己的套餐后下单","faqs":"购买后如何交付?\n如何联系售后?\n可以退款吗?"}
package/README.md CHANGED
@@ -1,3 +1,15 @@
1
- # Temporary Holding Version
1
+ # 流媒体合租主题
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ AppStore npm-static 插件,提供流媒体合租主题配置和前台页面。
4
+
5
+ ## 页面配置
6
+
7
+ - 首页:品牌与顶部导航、主视觉与四项服务数据、邀请推广横幅、快捷工具、服务承诺、商品列表区和页脚栏目/联系信息。
8
+ - 商品详情页:商品标签、购买说明和常见问题。
9
+ - 车票页面:复刻参考站的车票控制台,订单列表和订单统计读取主系统数据;订单详情继续使用主系统页面。
10
+ - 推广页面:复刻参考站的推广链接、推广码、统计卡片、图表和订单明细,数据读取主系统推广接口。
11
+ - 其余订单页面与个人中心继续由主系统路由处理。
12
+
13
+ 插件配置入口由 `plugin.json` 的 `entrypoints.config` 声明,页面调用 AppStore `/api/plugins/netflix/env` 接口读写 `.env`。npm 包发布时包含 `plugin.json`、`.env.example` 和 `public/`。
14
+
15
+ 本地打包前可运行 `npm pack --dry-run` 检查包内容。
package/package.json CHANGED
@@ -1,6 +1,46 @@
1
1
  {
2
2
  "name": "@etspress/netflix",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "private": false,
5
+ "description": "流媒体合租主题插件",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/cnmbdb/dujioka-next-deve.git",
10
+ "directory": "plugins/netflix"
11
+ },
12
+ "files": [
13
+ "plugin.json",
14
+ ".env.example",
15
+ "public"
16
+ ],
17
+ "dujiaoPlugin": {
18
+ "id": "netflix",
19
+ "name": "流媒体合租主题",
20
+ "description": "流媒体合租商店主题与页面展示配置",
21
+ "version": "0.1.1",
22
+ "runtime": {
23
+ "type": "npm-static",
24
+ "publicRoot": "public"
25
+ },
26
+ "entrypoints": {
27
+ "config": {
28
+ "path": "public/config.html"
29
+ },
30
+ "publicContexts": [
31
+ "store",
32
+ "admin"
33
+ ],
34
+ "public": {
35
+ "scripts": [
36
+ "public/inject.js",
37
+ "public/home.js",
38
+ "public/console.js"
39
+ ],
40
+ "styles": [
41
+ "public/console.css"
42
+ ]
43
+ }
44
+ }
45
+ }
46
+ }
package/plugin.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "$schema": "../plugin.schema.json",
3
+ "schemaVersion": 1,
4
+ "id": "netflix",
5
+ "name": "流媒体合租主题",
6
+ "version": "0.1.1",
7
+ "description": "流媒体合租商店主题与页面展示配置。",
8
+ "author": "D&J Studio",
9
+ "license": "MIT",
10
+ "icon": "public/icon.svg",
11
+ "runtime": {
12
+ "type": "npm-static",
13
+ "publicRoot": "public"
14
+ },
15
+ "compatibility": {
16
+ "pluginApi": "^1.0.0",
17
+ "dujiaoNext": ">=1.4.0"
18
+ },
19
+ "entrypoints": {
20
+ "config": {
21
+ "path": "public/config.html"
22
+ },
23
+ "publicContexts": [
24
+ "store",
25
+ "admin"
26
+ ],
27
+ "public": {
28
+ "scripts": [
29
+ "public/inject.js",
30
+ "public/home.js",
31
+ "public/console.js"
32
+ ],
33
+ "styles": [
34
+ "public/console.css"
35
+ ]
36
+ }
37
+ },
38
+ "dependencies": [],
39
+ "permissions": [],
40
+ "data": {
41
+ "paths": [
42
+ "data"
43
+ ],
44
+ "removeOnUninstall": false
45
+ }
46
+ }
Binary file
@@ -0,0 +1 @@
1
+ <svg id='图层_1' data-name='图层 1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 33'><path d='M80.4,6.94H78a11.55,11.55,0,0,0,.42-1.77H76.11a5.16,5.16,0,0,1-2.18,3.95v1.43A6.36,6.36,0,0,0,77,8.7H80.4Z' style='fill:#fff'/><path d='M78.48,11H80v1.68H78.46v.76c-.78-.09-1.56-.16-2.35-.19v-.57h-1.6V11Z' style='fill:#fff'/><path d='M93.59,8.87V7.11H92.08V5.59H89.81V7.11h-1.6v-2H85.86v2H81V8.87h4.87v1.68H81.24v3.73a2.74,2.74,0,0,1,.65.71,3.63,3.63,0,0,1,0,3.41c-.21.5-.44,1-.68,1.5v4.52h2.18v-4.2h2.44v3.86h2.35V20.22h2.44v1.51c0,.62-.31.9-.92.84h-.42v1.68h.92q2.68.09,2.61-2.52V10.55H88.21V8.87Zm-7.73,9.67H83.42V16.27h2.44Zm0-4H83.42V12.32h2.44Zm4.79,4H88.21V16.27h2.44Zm0-6.22V14.5H88.21V12.32Z' style='fill:#fff'/><path d='M80,15.59a1.18,1.18,0,0,1,.42.38l0,.06a2,2,0,0,1-.14,1.67,27.93,27.93,0,0,1-1.58,3.14c-.07.12-.15.23-.22.34-.24.4-.49.8-.76,1.18a5.31,5.31,0,0,1-1,1.32c-.37-.84.17-2.12.39-2.95a3.88,3.88,0,0,0-.11-3,4,4,0,0,0-2.27-1.45l-.61-.19a4.63,4.63,0,0,1-1.86-.95A25.81,25.81,0,0,1,75.14,15l1,0a23,23,0,0,1,2.35.21l.52.07a4,4,0,0,1,.69.15l.28.13' style='fill:#fff'/><path d='M6.14,8.53V6.77H13.2a11.63,11.63,0,0,0,.93-1.68H17a12.77,12.77,0,0,1-.59,1.17l-.26.51H24.8V8.53H19.25a11.83,11.83,0,0,0,5.8,3.87V14a19.41,19.41,0,0,1-4.37-1.68v1.34H10.26V12.32A28.61,28.61,0,0,1,5.89,14V12.4a15.65,15.65,0,0,0,6-3.87Zm0,15V22.07a5.81,5.81,0,0,0,3.7-3.53h2.61Q11.43,22.49,6.14,23.5Zm.17-6V15.76H24.63v1.77H17.07v4.12c.05,1.79-.87,2.66-2.77,2.6H11.86V22.49H13.2c.79.05,1.15-.28,1.1-1V17.53Zm8.66-9A11.64,11.64,0,0,1,11.1,11.9h8.74a12.52,12.52,0,0,1-3.53-3.37Z' style='fill:#fff'/><path d='M57.13,8.62H54.44a17.82,17.82,0,0,1-3.19,10v2.27Q56.88,16.78,57.13,8.62Z' style='fill:#fff'/><path d='M66.63,8.62H64.7a15.58,15.58,0,0,0,3.72,10.32l2-.55A18.18,18.18,0,0,1,67.3,8.62Z' style='fill:#fff'/><path d='M62.33,5.26H59.65V20.94h.08c.94-.18,1.89-.37,2.86-.58V5.26Z' style='fill:#fff'/><path d='M47.56,7.61a17.58,17.58,0,0,1-5.88,1.93v1.77a17.53,17.53,0,0,0,5.88-1.09Z' style='fill:#fff'/><path d='M41.26,13.24v1.85a28.14,28.14,0,0,1,6.22,2.27V14.59A21.43,21.43,0,0,0,41.26,13.24Z' style='fill:#fff'/><path d='M30.06,6.43h9.77q-.16,8.75,1,12.44c.78,2.36,2,3.53,3.53,3.53,1.06,0,1.6-.58,1.6-1.76H47.9a4.3,4.3,0,0,1-.37,2l-1.23.08c-.89,0-1.78.06-2.63.06-1.17,0-2.32,0-3.41-.12q-3.48-3.39-3.37-14.39H28.4V6.43Z' style='fill:#fff'/><path d='M73.68,19.36h0c-4.5,1.3-9,2.49-13.57,3.35-2.27.45-4.55.84-6.83,1.14s-4.56.56-6.83.69c-.92,0-1.83.06-2.74.06-1.36,0-2.72-.05-4.06-.17-2.25-.17-4.47-.36-6.67-.63a36.43,36.43,0,0,1-6.51-1.37,25.28,25.28,0,0,1-6.25-3h0a.16.16,0,0,0-.09,0,.15.15,0,0,0-.11,0,.25.25,0,0,0,0,.31,16.49,16.49,0,0,0,5.54,5.51,22.81,22.81,0,0,0,6.9,2.81,26.16,26.16,0,0,0,5.95.67q.62,0,1.23,0c2.39-.12,4.75-.38,7.09-.72s4.66-.77,7-1.29,4.58-1.18,6.84-1.87a121.41,121.41,0,0,0,13.3-5,.23.23,0,0,0,.11-.25A.18.18,0,0,0,73.68,19.36Z' style='fill:#fff'/></svg>
Binary file
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="#fff" d="M96 224c35.3 0 64-28.7 64-64s-28.7-64-64-64s-64 28.7-64 64s28.7 64 64 64m448 0c35.3 0 64-28.7 64-64s-28.7-64-64-64s-64 28.7-64 64s28.7 64 64 64m32 32h-64c-17.6 0-33.5 7.1-45.1 18.6c40.3 22.1 68.9 62 75.1 109.4h66c17.7 0 32-14.3 32-32v-32c0-35.3-28.7-64-64-64m-256 0c61.9 0 112-50.1 112-112S381.9 32 320 32S208 82.1 208 144s50.1 112 112 112m76.8 32h-8.3c-20.8 10-43.9 16-68.5 16s-47.6-6-68.5-16h-8.3C179.6 288 128 339.6 128 403.2V432c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48v-28.8c0-63.6-51.6-115.2-115.2-115.2m-223.7-13.4C161.5 263.1 145.6 256 128 256H64c-35.3 0-64 28.7-64 64v32c0 17.7 14.3 32 32 32h65.9c6.3-47.4 34.9-87.3 75.2-109.4"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#fff" d="M17 4.5C17 5.9 15.9 7 14.5 7S12 5.9 12 4.5S13.1 2 14.5 2S17 3.1 17 4.5M15 8h-.8c-2.1 0-4.1-1.2-5.1-3.1c-.1-.1-.2-.2-.2-.3l-1.8.8c.5 1.4 2.1 3.2 4.4 4.1l-1.8 5l-3.9-1.1L3 18.9l2 .5l1.8-3.6l4.5 1.2c1 .2 2-.3 2.4-1.2L16 9.4c.2-.7-.3-1.4-1-1.4m3.9-1l-3.4 9.4c-.6 1.6-2.1 2.6-3.7 2.6c-.3 0-.7 0-1-.1l-2.9-.8l-.9 1.8l2 .5l1.4.4c.5.1 1 .2 1.5.2c2.5 0 4.7-1.5 5.6-3.9L21 7z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#fff" d="M12 12h7c-.53 4.11-3.28 7.78-7 8.92zH5V6.3l7-3.11M12 1L3 5v6c0 5.55 3.84 10.73 9 12c5.16-1.27 9-6.45 9-12V5z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#fff" d="M21 8a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-1.062A8 8 0 0 1 12 23v-2a6 6 0 0 0 6-6V9A6 6 0 0 0 6 9v7H3a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1.062a8.001 8.001 0 0 1 15.876 0zM7.76 15.785l1.06-1.696A5.97 5.97 0 0 0 12 15a5.97 5.97 0 0 0 3.18-.911l1.06 1.696A7.96 7.96 0 0 1 12 17a7.96 7.96 0 0 1-4.24-1.215"/></svg>
@@ -0,0 +1,72 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN" data-theme="light">
3
+ <head>
4
+ <meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <title>流媒体合租主题配置</title>
6
+ <!--APPSTORE_CONFIG_CONTEXT-->
7
+ <style>
8
+ :root{font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#09090b;background:transparent;color-scheme:light}*{box-sizing:border-box}body{margin:0;padding:14px 16px 18px;background:transparent;color:#09090b}.shell{max-width:900px;margin:auto}.heading{margin:0 0 3px;font-size:18px;font-weight:600;letter-spacing:-.02em}.sub{margin:0 0 14px;color:#71717a;font-size:13px}.tabs{display:inline-flex;gap:2px;max-width:100%;overflow:auto;border:1px solid #e4e4e7;border-radius:9px;padding:3px;background:#f4f4f5;margin:0 0 12px}.tab{flex:0 0 auto;border:1px solid transparent;border-radius:7px;padding:6px 12px;background:transparent;color:#71717a;font-size:13px;line-height:20px;cursor:pointer;white-space:nowrap}.tab:hover{color:#18181b}.tab[aria-selected=true]{border-color:#e4e4e7;background:#fff;color:#18181b;box-shadow:0 1px 2px #00000012}.card{border:1px solid #e4e4e7;border-radius:10px;background:#fff;padding:14px 16px;box-shadow:0 1px 2px #00000008}.card h2{font-size:14px;font-weight:600;margin:0 0 3px}.hint{color:#71717a;font-size:12px;margin:0 0 10px}.config-group{border-top:1px solid #e4e4e7;margin-top:13px;padding-top:11px}.config-group h3{font-size:13px;font-weight:600;margin:0 0 3px}.group-description{font-size:11px;color:#71717a;line-height:1.45;margin:0 0 8px}.field{display:grid;gap:5px;margin:11px 0}.field label{font-size:13px;font-weight:500}.field small{color:#71717a;font-size:11px}input,textarea{width:100%;border:1px solid #e4e4e7;background:#fff;color:#09090b;border-radius:6px;padding:7px 9px;font:inherit;font-size:13px;box-shadow:0 1px 2px #00000008}textarea{min-height:64px;resize:vertical;line-height:1.45}input:focus,textarea:focus{outline:2px solid #18181b22;border-color:#a1a1aa}.actions{display:flex;align-items:center;gap:10px;margin-top:12px}.save{border:1px solid #18181b;border-radius:6px;background:#18181b;color:#fafafa;padding:7px 11px;font-size:12px;font-weight:500;cursor:pointer}.save:hover{background:#27272a}.save:disabled{opacity:.55;cursor:wait}#status{font-size:12px;color:#71717a}.error{color:#b91c1c!important}.success{color:#15803d!important}:root[data-theme=dark]{color-scheme:dark;color:#fafafa}:root[data-theme=dark] body{color:#fafafa}:root[data-theme=dark] .sub,:root[data-theme=dark] .hint,:root[data-theme=dark] .field small,:root[data-theme=dark] .group-description{color:#a1a1aa}:root[data-theme=dark] .tabs{background:#27272a;border-color:#3f3f46}:root[data-theme=dark] .tab{color:#a1a1aa}:root[data-theme=dark] .tab[aria-selected=true]{background:#18181b;color:#fafafa;border-color:#3f3f46}:root[data-theme=dark] .card{background:#18181b;border-color:#3f3f46}:root[data-theme=dark] .config-group{border-color:#3f3f46}:root[data-theme=dark] input,:root[data-theme=dark] textarea{background:#09090b;color:#fafafa;border-color:#3f3f46}:root[data-theme=dark] .save{background:#fafafa;color:#18181b;border-color:#fafafa}@media(max-width:600px){body{padding:10px}.tab{padding:6px 9px}.card{padding:12px}}
9
+ </style>
10
+ <style>
11
+ :root{--border:#e4e4e7;--card:#fff;--card-foreground:#09090b;--background:#fff;--foreground:#09090b;--muted:#f4f4f5;--muted-foreground:#71717a}
12
+ .panel{border:0;background:transparent;padding:0;box-shadow:none}
13
+ .config-group{display:block;border:1px solid var(--border);border-radius:6px;background:var(--card);color:var(--card-foreground);padding:12px;margin-top:16px;box-shadow:none}
14
+ .config-group-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}
15
+ .config-group-heading{min-width:0}
16
+ .config-group h3{margin:0 0 3px;font-size:13px;font-weight:600;line-height:1.4;color:var(--card-foreground)}
17
+ .config-group-toggle{display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;gap:5px;height:28px;border:1px solid var(--border);border-radius:6px;background:transparent;color:var(--foreground);padding:3px 8px;font:inherit;font-size:11px;cursor:pointer;white-space:nowrap}
18
+ .config-group-toggle:hover{background:var(--muted)}
19
+ .config-group-toggle:focus-visible{outline:2px solid color-mix(in srgb,var(--foreground) 25%,transparent);outline-offset:2px}
20
+ .config-group-toggle svg{width:14px;height:14px}
21
+ .config-group-content{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:14px;align-items:start}
22
+ .config-group-content[hidden]{display:none!important}
23
+ .field-switch{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:8px 0;border:1px solid var(--border);border-radius:6px;background:var(--card);padding:8px 10px}
24
+ .field-switch label{font-weight:500}
25
+ .field-switch .switch{position:relative;display:inline-flex;width:38px;height:22px;flex:0 0 auto;align-items:center;border:0;border-radius:999px;padding:2px;background:var(--muted);cursor:pointer;transition:background .15s ease}
26
+ .field-switch .switch[aria-checked=true]{background:#22c55e}
27
+ .field-switch .switch:focus-visible{outline:2px solid color-mix(in srgb,var(--foreground) 25%,transparent);outline-offset:2px}
28
+ .field-switch .switch-thumb{display:block;width:18px;height:18px;border-radius:999px;background:var(--background);box-shadow:0 1px 2px rgb(0 0 0 / 18%);transition:transform .15s ease}
29
+ .field-switch .switch[aria-checked=true] .switch-thumb{transform:translateX(16px)}
30
+ .field-switch .field-label{font-size:13px;font-weight:500}
31
+ :root[data-theme=dark]{--border:#3f3f46;--card:#18181b;--card-foreground:#fafafa;--background:#09090b;--foreground:#fafafa;--muted:#27272a;--muted-foreground:#a1a1aa}
32
+ .field input:not([type=checkbox]),.field textarea{height:32px;border-radius:6px;border-color:var(--border);background:var(--background);color:var(--foreground);padding:4px 10px;font-size:12px;box-shadow:none}
33
+ .field textarea{height:auto;min-height:72px;padding:6px 10px}
34
+ .field input:focus-visible,.field textarea:focus-visible{outline:2px solid color-mix(in srgb,var(--foreground) 20%,transparent);outline-offset:2px;border-color:transparent}
35
+ .save{height:32px;border-radius:6px;padding:4px 12px;font-size:12px}
36
+ :root[data-theme=dark] .field input:not([type=checkbox]),:root[data-theme=dark] .field textarea{background:var(--background);color:var(--foreground);border-color:var(--border)}
37
+ .config-group .field{min-width:0}
38
+ .config-group-content .field-wide{grid-column:1/-1}
39
+ .config-group .field-switch{grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;justify-content:initial}
40
+ .config-group .field-switch label{grid-column:1;grid-row:1}
41
+ .config-group .field-switch input{grid-column:2;grid-row:1}
42
+ .config-group .field-switch small{grid-column:1/-1}
43
+ @media(max-width:680px){.config-group-content{grid-template-columns:minmax(0,1fr)}}
44
+ .tabs-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px}
45
+ .tabs-row .tabs{margin:0}
46
+ .tabs-row .back-button{margin-left:auto}
47
+ .back-button{display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;gap:6px;height:32px;border:1px solid var(--border);border-radius:6px;background:transparent;color:var(--foreground);padding:4px 10px;font:inherit;font-size:12px;font-weight:500;cursor:pointer;white-space:nowrap}
48
+ .back-button:hover{background:var(--muted)}
49
+ .back-button:focus-visible{outline:2px solid color-mix(in srgb,var(--foreground) 25%,transparent);outline-offset:2px}
50
+ .back-button svg{width:14px;height:14px;flex:0 0 auto}
51
+ @media(max-width:420px){.tabs-row{align-items:flex-start}.tabs-row .back-button{padding:4px 8px}}
52
+ .faq-config{margin:14px 0;border:1px solid var(--border);border-radius:6px;padding:10px}.faq-config h4{font-size:13px;margin:0 0 10px}.faq-config-item{display:grid;gap:8px;margin-bottom:10px;padding-bottom:10px;border-bottom:1px solid var(--border)}.faq-config-item textarea{min-height:60px}.faq-config-item button{justify-self:start}
53
+ .block-editor{grid-column:1/-1;display:grid;grid-template-columns:220px minmax(0,1fr);gap:14px;margin-top:2px}.block-list,.block-detail{min-width:0;border:1px solid var(--border);border-radius:6px;padding:10px}.block-list button,.block-detail button{border:1px solid var(--border);border-radius:6px;background:var(--background);color:var(--foreground);padding:7px 10px;cursor:pointer}.block-list .block-add{width:100%;margin-bottom:8px}.block-item{display:block;width:100%;margin-top:5px;text-align:left;cursor:grab!important}.block-item:active{cursor:grabbing!important}.block-item[aria-selected=true]{background:var(--muted);font-weight:600}.block-detail select{width:100%;height:32px;border:1px solid var(--border);border-radius:6px;background:var(--background);color:var(--foreground);padding:4px 8px}.block-detail-actions{display:flex;gap:8px;margin-top:10px}.block-empty{color:var(--muted-foreground);font-size:12px}@media(max-width:680px){.block-editor{grid-template-columns:1fr}}
54
+ </style>
55
+ </head>
56
+ <body><main class="shell">
57
+ <div class="tabs-row">
58
+ <nav class="tabs" role="tablist" aria-label="主题页面配置">
59
+ <button class="tab" role="tab" aria-selected="true" data-panel="home">首页</button>
60
+ <button class="tab" role="tab" aria-selected="false" data-panel="product">商品详情页</button>
61
+ <button class="tab" role="tab" aria-selected="false" data-panel="ticket">车票页面</button>
62
+ <button class="tab" role="tab" aria-selected="false" data-panel="promotion">推广页面</button>
63
+ </nav>
64
+ <button class="back-button" id="back-button" type="button" data-variant="outline">
65
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg>
66
+ 返回插件管理
67
+ </button>
68
+ </div>
69
+ <section class="panel" role="tabpanel"><div id="fields"></div>
70
+ <div class="actions"><button class="save" id="save" type="button">保存设置</button><span id="status" role="status" aria-live="polite"></span></div>
71
+ </section>
72
+ </main><script>var theme=window.__APPSTORE_PLUGIN_CONFIG__&&window.__APPSTORE_PLUGIN_CONFIG__.theme;if(theme==='dark')document.documentElement.dataset.theme='dark';</script><script src="/plugins/appstore/static-plugins/netflix/config.js" defer></script></body></html>
@@ -0,0 +1,282 @@
1
+ (function () {
2
+ var context = window.__APPSTORE_PLUGIN_CONFIG__ || {};
3
+ var base = String(context.apiBase || '/plugins/appstore/api').replace(/\/$/, '');
4
+ var pluginId = context.pluginId || 'netflix';
5
+ var token = '';
6
+ try { token = window.top.localStorage.getItem('admin_token') || ''; } catch (_error) {}
7
+
8
+ function field(key, label, hint, type, defaultValue) {
9
+ return { key: key, label: label, hint: hint, type: type || 'text', defaultValue: defaultValue || '' };
10
+ }
11
+ var specs = {
12
+ home: {
13
+ key: 'NETFLIX_HOME_CONFIG', title: '首页', hint: '按参考首页的页面区域分别维护内容。', groups: [
14
+ { title: '顶部导航', description: '配置页头品牌和导航文案;登录、车票等业务入口仍由主系统控制。', fields: [
15
+ field('brandName', '品牌名称', '页头展示的店铺名称。', 'text', '奈飞小铺'),
16
+ field('brandLogoUrl', '品牌 Logo 地址', '默认使用参考站标志;清空后显示文字品牌名。', 'text', '/plugins/appstore/static-plugins/netflix/assets/reference-logo.svg'),
17
+ field('navHomeLabel', '首页导航名称', '默认:首页。', 'text', '首页'),
18
+ field('navProductsLabel', '商品导航名称', '默认:车票。', 'text', '车票'),
19
+ field('navPromotionLabel', '推广导航名称', '默认:推广。', 'text', '推广')
20
+ ]},
21
+ { title: '上方内容', description: '配置主视觉、服务统计、推广横幅和商品区前的服务承诺。', fields: [
22
+ field('heroTitle', '主标题', '留空时不显示独立标题。'),
23
+ field('heroSubtitle', '副标题', '展示在主标题下方的介绍。'),
24
+ field('heroBackgroundUrl', '主视觉背景图片 URL', '留空时由主题使用默认背景。'),
25
+ field('serviceStats', '服务统计项', '每行一项,格式为“数值|说明”,最多展示四项。', 'textarea', '全年365天|售后极速响应\n1000000+|上车人次\n70000+|售后群人数\n5年+|网站运营'),
26
+ field('promotionEnabled', '显示推广横幅', '开启后在首页显示邀请推广横幅。', 'switch', '是'),
27
+ field('promotionTitle', '横幅标题', '例如:邀请好友购买享 20% 佣金。'),
28
+ field('promotionSubtitle', '横幅说明', '标题下方的补充说明。'),
29
+ field('promotionButtonLabel', '按钮文案', '例如:去推荐。'),
30
+ field('promotionUrl', '按钮链接', '填写站内路径或完整 URL。'),
31
+ field('servicePromises', '服务承诺列表', '每行一项,格式为“标题|说明”。', 'textarea', '现号秒发|\n自动售后|\n翻车换号|\n在线客服|')
32
+ ]},
33
+ { title: '商品卡片', description: '拖动左侧卡片调整顺序,选择卡片后在右侧绑定商品并编辑展示内容。', fields: [
34
+ field('productsTitle', '区块标题', '留空时使用系统默认标题。', 'text', '热门商品'),
35
+ field('productsSubtitle', '区块说明', '商品卡片上方的简短说明。'),
36
+ field('productCardShowTags', '显示商品标签', '在卡片上展示主系统提供的商品标签。', 'switch', '是'),
37
+ field('productCardShowDescription', '显示商品简介', '在卡片上展示主系统提供的商品简介。', 'switch', '是'),
38
+ field('productCardShowFaq', '显示常见问题入口', '在卡片上展示商品关联的常见问题入口。', 'switch', '是'),
39
+ field('productCardShowRecentPurchase', '显示最近购买信息', '在卡片上展示主系统提供的最近购买信息。', 'switch', '是'),
40
+ field('productCardRibbonLabel', '商品角标文案', '主站商品没有额外角标时使用;留空可隐藏角标。', 'text', '小铺自营'),
41
+ field('productCardButtonLabel', '购买按钮文案', '留空时使用主系统默认文案。', 'text', '买票上车')
42
+ ]},
43
+ { title: '页脚', description: '配置页脚导航栏目、联系信息、版权和备案展示。', fields: [
44
+ field('footerProductsTitle', '旗下产品栏目标题', '默认:旗下产品。', 'text', '旗下产品'),
45
+ field('footerProducts', '旗下产品链接', '每行一项,格式为“名称|链接”。', 'textarea', '爱合租|https://ihezu.com.cn/\n寻星电玩|https://www.findstars.cn/\n搜奈飞|https://www.sounf.com/'),
46
+ field('footerNavigationTitle', '功能导航栏目标题', '默认:功能导航。', 'text', '功能导航'),
47
+ field('footerNavigation', '功能导航链接', '每行一项,格式为“名称|链接”。', 'textarea', '我的车票|\n我的推广|'),
48
+ field('footerPoliciesTitle', '条款栏目标题', '默认:条款与政策。', 'text', '条款与政策'),
49
+ field('footerPolicies', '条款与政策链接', '每行一项,格式为“名称|链接”。', 'textarea', '隐私政策|\n用户协议|'),
50
+ field('footerContactTitle', '联系栏目标题', '默认:联系我们。', 'text', '联系我们'),
51
+ field('contactHours', '客服时间与电话', '展示在联系我们栏目下方。', 'text', '电话: 0411 - 84796602 · 周一至周五 9:00 - 18:00'),
52
+ field('contactLinks', '客服与社交链接', '每行一项,格式为“名称|链接”;留空链接时仅显示图标。', 'textarea', '微信|\nQQ|\nTelegram|https://t.me/joinchat/V2Qxg-u4XncM3F9m\nYouTube|https://www.youtube.com/channel/UC69HrKfh5qKHObN2Uu9GPFQ'),
53
+ field('copyrightText', '版权信息', '留空时由主系统显示默认版权。', 'text', '© 2019 - 2026 奈飞小铺'),
54
+ field('licenseInfo', '备案与许可证信息', '每行一项,填写当前站点适用的备案与许可证信息。', 'textarea', '众垒科技(大连)有限公司|https://www.ihezu.cn/about/us\n辽ICP备2021010230号|https://beian.miit.gov.cn/#/Integrated/index\nICP经营许可证:辽B2-20220360|https://www.ihezu.cn/about/icp\n辽公网安备21029602001006号|https://beian.mps.gov.cn/#/query/webSearch?code=21029602001006')
55
+ ]},
56
+ { title: '右侧浮标', description: '配置参考站右侧的优惠券、签到、推广、咨询、公众号和售后群快捷入口。每项填写“名称|链接”,每行一项。', fields: [
57
+ field('quickTools', '浮标入口列表', '顺序即展示顺序;留空链接可仅展示名称。', 'textarea', '优惠券|\n签到|\n推广返现|/me/affiliate\n在线咨询|/about\n公众号|\n售后群|')
58
+ ]}
59
+ ]
60
+ },
61
+ product: {
62
+ key: 'NETFLIX_PRODUCT_CONFIG', title: '商品详情页', hint: '配置商品详情弹窗、规格提示和特惠增购内容。', groups: [
63
+ { title: '商品详情弹窗', fields: [
64
+ field('productBanner', '顶部保障文案', '显示在弹窗顶部的保障说明。', 'text', '微信客服 · 全年无休 · 7万用户群 · 售后有保障'),
65
+ field('productNewLabel', '新品标签', '商品标题旁显示的标签;留空则隐藏。', 'text', '新购'),
66
+ field('productCategorySectionTitle', '第一层规格标题', '按分类选择商品的标题。', 'text', '订阅国家'),
67
+ field('productSkuSectionTitle', '第二层规格标题', '对应商品内的 SKU 规格选择。', 'text', '套餐时长'),
68
+ field('productAddonsEnabled', '显示特惠增购', '显示可选的特惠增购项目。', 'switch', '是'),
69
+ field('productAddons', '特惠增购项目', '每行一个项目,格式:名称|商品ID|SKU ID|价格。', 'textarea'),
70
+ field('productCouponOptions', '可用优惠券', '每行一项,格式:优惠券名称|优惠码;选择后交由主系统校验。', 'textarea'),
71
+ field('productCouponLabel', '优惠券入口文案', '结算弹窗中的优惠券入口文字。', 'text', '使用优惠券'),
72
+ field('productCouponCodeLabel', '优惠码入口文案', '结算弹窗中的优惠码入口文字。', 'text', '使用优惠码'),
73
+ field('productSubmitLabel', '提交按钮文案', '下单按钮文案。', 'text', '去付款')
74
+ ]},
75
+ { title: '商品说明', fields: [
76
+ field('tags', '商品标签', '用逗号分隔展示标签。', 'text', '高清画质,稳定合租,售后保障'),
77
+ field('purchaseNotice', '购买说明', '商品购买区域的说明文案。', 'textarea', '选择适合自己的套餐后下单'),
78
+ field('faqs', '常见问题', '每行填写一个问题。', 'textarea', '购买后如何交付?\n如何联系售后?\n可以退款吗?')
79
+ ]}
80
+ ]
81
+ },
82
+ ticket: {
83
+ key: 'NETFLIX_HOME_CONFIG', title: '车票页面', hint: '车票页使用主系统订单数据;订单详情仍由主系统打开。', groups: [
84
+ { title: '页面横幅', fields: [
85
+ field('ticketBindingTitle', '绑定社群标题', '', 'text', '绑定TG,加入6万人用户群畅聊'),
86
+ field('ticketBindingDescription', '绑定社群说明', '', 'text', '一键登录 · 优惠领取 · 续费通知'),
87
+ field('ticketBindingButton', '绑定按钮文案', '', 'text', '去绑定'),
88
+ field('ticketBindingUrl', '绑定按钮链接', '填写站内路径或完整 URL。', 'text', '')
89
+ ]},
90
+ { title: '车票与订单', fields: [
91
+ field('ticketPageTitle', '页面标题', '', 'text', '我的车票'),
92
+ field('ticketEmptyTitle', '空状态标题', '', 'text', '您还未购买车票、或车票已经到期'),
93
+ field('ticketEmptyDescription', '空状态说明', '', 'text', '小铺自营、即买即用、售后保障、7*24小时全自动售后、万人售后群'),
94
+ field('ticketBuyLabel', '购买按钮文案', '', 'text', '前往购买'),
95
+ field('ticketPromoTitle', '推广横幅标题', '', 'text', '邀请好友购买享 20% 佣金'),
96
+ field('ticketPromoSubtitle', '推广横幅说明', '', 'text', '专属优惠 · 实时到账 · 随时提现'),
97
+ field('ticketPromoButton', '推广按钮文案', '', 'text', '去推荐')
98
+ ]}
99
+ ]
100
+ },
101
+ promotion: {
102
+ key: 'NETFLIX_HOME_CONFIG', title: '推广页面', hint: '推广数据取自主系统接口;返佣与订单明细保持原生数据。', groups: [
103
+ { title: '推广链接与优惠码', fields: [
104
+ field('affiliatePageTitle', '推广链接标题', '', 'text', '推荐朋友购买立享20%佣金'),
105
+ field('affiliatePageDescription', '推广链接说明', '', 'text', '将链接或二维码发送给好友即可'),
106
+ field('affiliateCodeTitle', '优惠码标题', '', 'text', '专属推广优惠码'),
107
+ field('affiliateCodeHint', '优惠码说明', '', 'text', '优惠码推广优先级最高,结合推广链接100%精准统计推广订单。'),
108
+ field('affiliateCopyLabel', '复制按钮文案', '', 'text', '复制链接')
109
+ ]},
110
+ { title: '统计与明细', fields: [
111
+ field('affiliateClicksLabel', '点击统计名称', '', 'text', '推广点击'),
112
+ field('affiliateOrdersLabel', '订单统计名称', '', 'text', '订单数'),
113
+ field('affiliateCommissionLabel', '佣金统计名称', '', 'text', '佣金数'),
114
+ field('affiliateAvailableLabel', '可提现金额文案', '', 'text', '可提现金额'),
115
+ field('affiliateOrdersTitle', '订单明细标题', '', 'text', '订单详情'),
116
+ field('affiliateOrdersHint', '订单明细说明', '', 'text', '以下显示最近50条')
117
+ ]}
118
+ ]
119
+ }
120
+ };
121
+ var current = 'home';
122
+ var values = {};
123
+ var productBlocks = [];
124
+ var productList = [];
125
+ var selectedBlock = -1;
126
+ var blocksInitialized = false;
127
+ var blocksExplicit = false;
128
+ var draggingBlock = -1;
129
+ function renderBlockEditor(container) {
130
+ var editor = document.createElement('div'); editor.className = 'block-editor';
131
+ var list = document.createElement('div'); list.className = 'block-list';
132
+ var add = document.createElement('button'); add.type = 'button'; add.className = 'block-add'; add.textContent = '+ 添加商品区块';
133
+ add.onclick = function () { blocksExplicit = true; productBlocks.push({ productId: '', title: '', tags: '', description: '', faq: '', ribbon: '', button: '' }); selectedBlock = productBlocks.length - 1; renderBlockEditor(container); };
134
+ list.appendChild(add);
135
+ productBlocks.forEach(function (block, index) {
136
+ var button = document.createElement('button'); button.type = 'button'; button.className = 'block-item'; button.setAttribute('aria-selected', String(index === selectedBlock));
137
+ button.draggable = true;
138
+ var product = productList.find(function (item) { return String(item.id) === String(block.productId); });
139
+ button.textContent = '⠿ ' + (block.title || (product && (product.title && product.title['zh-CN'] || product.slug)) || ('商品区块 ' + (index + 1)));
140
+ button.addEventListener('dragstart', function (event) { draggingBlock = index; event.dataTransfer.effectAllowed = 'move'; event.dataTransfer.setData('text/plain', String(index)); });
141
+ button.addEventListener('dragover', function (event) { event.preventDefault(); event.dataTransfer.dropEffect = 'move'; });
142
+ button.addEventListener('drop', function (event) { event.preventDefault(); if (draggingBlock < 0 || draggingBlock === index) return; var item = productBlocks.splice(draggingBlock, 1)[0]; productBlocks.splice(index, 0, item); selectedBlock = index; draggingBlock = -1; blocksExplicit = true; renderBlockEditor(container); });
143
+ button.addEventListener('dragend', function () { draggingBlock = -1; });
144
+ button.onclick = function () { selectedBlock = index; renderBlockEditor(container); }; list.appendChild(button);
145
+ });
146
+ var detail = document.createElement('div'); detail.className = 'block-detail';
147
+ var block = productBlocks[selectedBlock];
148
+ if (!block) { var empty = document.createElement('p'); empty.className = 'block-empty'; empty.textContent = '在左侧添加或选择商品区块'; detail.appendChild(empty); }
149
+ else {
150
+ var productField = document.createElement('div'); productField.className = 'field';
151
+ var productLabel = document.createElement('label'); productLabel.textContent = '绑定原生商品'; productLabel.htmlFor = 'block-product';
152
+ var select = document.createElement('select'); select.id = 'block-product';
153
+ var placeholder = document.createElement('option'); placeholder.value = ''; placeholder.textContent = '请选择商品'; select.appendChild(placeholder);
154
+ productList.forEach(function (product) { var option = document.createElement('option'); option.value = String(product.id); option.textContent = (product.title && (product.title['zh-CN'] || product.title['en-US'])) || product.slug; select.appendChild(option); });
155
+ if (block.productId && !productList.some(function (product) { return String(product.id) === String(block.productId); })) { var missing = document.createElement('option'); missing.value = block.productId; missing.textContent = '商品不可用(' + block.productId + ')'; select.appendChild(missing); }
156
+ select.value = String(block.productId || ''); select.onchange = function () { block.productId = select.value; };
157
+ productField.append(productLabel, select); detail.appendChild(productField);
158
+ var ribbonWrap = document.createElement('div'); ribbonWrap.className = 'field field-switch'; var ribbonLabel = document.createElement('span'); ribbonLabel.className = 'field-label'; ribbonLabel.textContent = '显示商品角标'; var ribbonSwitch = document.createElement('button'); ribbonSwitch.type = 'button'; ribbonSwitch.className = 'switch'; ribbonSwitch.setAttribute('role','switch'); ribbonSwitch.setAttribute('aria-label','显示商品角标'); ribbonSwitch.setAttribute('aria-checked',String(block.ribbonEnabled !== false)); var ribbonThumb = document.createElement('span'); ribbonThumb.className = 'switch-thumb'; ribbonSwitch.appendChild(ribbonThumb); ribbonSwitch.onclick = function () { block.ribbonEnabled = ribbonSwitch.getAttribute('aria-checked') !== 'true'; ribbonSwitch.setAttribute('aria-checked',String(block.ribbonEnabled)); }; ribbonWrap.append(ribbonLabel,ribbonSwitch); detail.appendChild(ribbonWrap);
159
+ [['title','卡片标题'],['tags','标签(逗号分隔)'],['description','卡片简介'],['ribbon','角标文案'],['button','购买按钮文案'],['priceUnit','价格单位'],['recentText','演示上车文案(每行一条)'],['demoAvatars','演示头像 URL(每行一个)'],['supportLinks','售后支持(每行:名称|链接)']].forEach(function (entry) {
160
+ var wrap = document.createElement('div'); wrap.className = 'field'; var label = document.createElement('label'); label.textContent = entry[1];
161
+ var input = document.createElement(['description','recentText','demoAvatars','supportLinks'].includes(entry[0]) ? 'textarea' : 'input'); input.value = entry[0] === 'supportLinks' && block[entry[0]] == null ? '企业微信|\nTG万人用户群|' : (block[entry[0]] || ''); input.setAttribute('aria-label', entry[1]); input.oninput = function () { block[entry[0]] = input.value; }; wrap.append(label, input); detail.appendChild(wrap);
162
+ });
163
+ if (!Array.isArray(block.faqItems)) block.faqItems = String(block.faq || '').split(/\r?\n/).filter(Boolean).map(function (q) { return { question:q, answer:'' }; });
164
+ var faqSection = document.createElement('div'); faqSection.className = 'faq-config'; var faqHeading = document.createElement('h4'); faqHeading.textContent = '常见问题'; faqSection.appendChild(faqHeading);
165
+ block.faqItems.forEach(function (item, index) { var row = document.createElement('div'); row.className = 'faq-config-item'; var question = document.createElement('input'); question.placeholder = '问题'; question.setAttribute('aria-label','问题 ' + (index + 1)); question.value = item.question || ''; question.oninput = function () { item.question = question.value; }; var answer = document.createElement('textarea'); answer.placeholder = '答案'; answer.setAttribute('aria-label','答案 ' + (index + 1)); answer.value = item.answer || ''; answer.oninput = function () { item.answer = answer.value; }; var del = document.createElement('button'); del.type='button'; del.textContent='删除问题'; del.onclick=function () { block.faqItems.splice(index,1); renderBlockEditor(container); }; row.append(question,answer,del); faqSection.appendChild(row); });
166
+ var addFaq = document.createElement('button'); addFaq.type='button'; addFaq.textContent='+ 添加问题'; addFaq.onclick=function () { block.faqItems.push({question:'',answer:''}); renderBlockEditor(container); }; faqSection.appendChild(addFaq); detail.appendChild(faqSection);
167
+ var actions = document.createElement('div'); actions.className = 'block-detail-actions';
168
+ [['上移',-1],['下移',1]].forEach(function (entry) { var button = document.createElement('button'); button.type = 'button'; button.textContent = entry[0]; button.disabled = selectedBlock + entry[1] < 0 || selectedBlock + entry[1] >= productBlocks.length; button.onclick = function () { var next = selectedBlock + entry[1]; var item = productBlocks.splice(selectedBlock,1)[0]; productBlocks.splice(next,0,item); selectedBlock = next; renderBlockEditor(container); }; actions.appendChild(button); });
169
+ var remove = document.createElement('button'); remove.type = 'button'; remove.textContent = '删除区块'; remove.onclick = function () { blocksExplicit = true; productBlocks.splice(selectedBlock,1); selectedBlock = Math.min(selectedBlock, productBlocks.length - 1); renderBlockEditor(container); }; actions.appendChild(remove); detail.appendChild(actions);
170
+ }
171
+ editor.append(list, detail); container.replaceChildren(editor);
172
+ }
173
+ function defaults(spec) {
174
+ var result = {};
175
+ spec.groups.forEach(function (group) { group.fields.forEach(function (item) { result[item.key] = item.defaultValue; }); });
176
+ return result;
177
+ }
178
+ function api(path, options) {
179
+ var headers = { 'X-AppStore-Actor': 'dujiao-admin' };
180
+ try { token = window.top.localStorage.getItem('admin_token') || token; } catch (_error) {}
181
+ if (token) headers.Authorization = 'Bearer ' + token;
182
+ if (options && options.body !== undefined) headers['Content-Type'] = 'application/json';
183
+ return fetch(base + path, Object.assign({ credentials: 'same-origin', headers: headers }, options || {})).then(async function (response) {
184
+ var payload = await response.json().catch(function () { return {}; });
185
+ if (!response.ok || payload.ok === false) throw new Error(payload.message || ('请求失败(HTTP ' + response.status + ')'));
186
+ return payload;
187
+ });
188
+ }
189
+ function getValue(key, spec) {
190
+ try { return Object.assign(defaults(spec), JSON.parse(values[key] || '{}')); } catch (_error) { return defaults(spec); }
191
+ }
192
+ function render() {
193
+ var spec = specs[current];
194
+ var host = document.getElementById('fields');
195
+ host.replaceChildren();
196
+ var data = getValue(spec.key, spec);
197
+ spec.groups.forEach(function (group) {
198
+ var section = document.createElement('section'); section.className = 'config-group rounded-lg border bg-card p-4';
199
+ var header = document.createElement('div'); header.className = 'config-group-header';
200
+ var copy = document.createElement('div'); copy.className = 'config-group-heading';
201
+ var heading = document.createElement('h3'); heading.textContent = group.title; copy.appendChild(heading);
202
+ if (group.description) { var description = document.createElement('p'); description.className = 'group-description'; description.textContent = group.description; copy.appendChild(description); }
203
+ var content = document.createElement('div'); content.className = 'config-group-content';
204
+ var toggle = document.createElement('button'); toggle.className = 'config-group-toggle'; toggle.type = 'button'; toggle.setAttribute('aria-expanded', 'true');
205
+ var toggleLabel = document.createElement('span'); toggleLabel.textContent = '收起';
206
+ var toggleIcon = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); toggleIcon.setAttribute('viewBox', '0 0 24 24'); toggleIcon.setAttribute('fill', 'none'); toggleIcon.setAttribute('stroke', 'currentColor'); toggleIcon.setAttribute('stroke-width', '2'); toggleIcon.setAttribute('stroke-linecap', 'round'); toggleIcon.setAttribute('stroke-linejoin', 'round'); toggleIcon.setAttribute('aria-hidden', 'true');
207
+ var togglePath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); togglePath.setAttribute('d', 'm6 15 6-6 6 6'); toggleIcon.appendChild(togglePath);
208
+ toggle.append(toggleLabel, toggleIcon);
209
+ toggle.addEventListener('click', function () {
210
+ var expanded = toggle.getAttribute('aria-expanded') !== 'true';
211
+ toggle.setAttribute('aria-expanded', String(expanded));
212
+ content.hidden = !expanded;
213
+ toggleLabel.textContent = expanded ? '收起' : '展开';
214
+ togglePath.setAttribute('d', expanded ? 'm6 15 6-6 6 6' : 'm6 9 6 6 6-6');
215
+ });
216
+ header.append(copy, toggle);
217
+ section.append(header, content);
218
+ (current === 'home' && group.title === '商品卡片' ? [] : group.fields).forEach(function (item) {
219
+ var wrap = document.createElement('div'); wrap.className = item.type === 'switch' ? 'field field-switch' : 'field';
220
+ if (item.type === 'textarea') wrap.classList.add('field-wide');
221
+ if (item.type === 'switch') {
222
+ var label = document.createElement('span'); label.className = 'field-label'; label.textContent = item.label;
223
+ var input = document.createElement('button');
224
+ input.type = 'button';
225
+ input.className = 'switch';
226
+ input.id = 'f-' + item.key;
227
+ input.dataset.key = item.key;
228
+ input.setAttribute('role', 'switch');
229
+ input.setAttribute('aria-label', item.label);
230
+ var checked = ['是', 'true', '1', 'on'].includes(String(data[item.key] || '').toLowerCase());
231
+ input.setAttribute('aria-checked', String(checked));
232
+ var thumb = document.createElement('span'); thumb.className = 'switch-thumb'; input.appendChild(thumb);
233
+ input.addEventListener('click', function () {
234
+ input.setAttribute('aria-checked', String(input.getAttribute('aria-checked') !== 'true'));
235
+ });
236
+ } else {
237
+ var label = document.createElement('label'); label.htmlFor = 'f-' + item.key; label.textContent = item.label;
238
+ var input = document.createElement(item.type === 'textarea' ? 'textarea' : 'input');
239
+ input.id = 'f-' + item.key; input.dataset.key = item.key;
240
+ input.value = data[item.key] || '';
241
+ }
242
+ wrap.append(label, input);
243
+ content.appendChild(wrap);
244
+ });
245
+ if (current === 'home' && group.title === '商品卡片') { var blocksHost = document.createElement('div'); blocksHost.style.gridColumn = '1 / -1'; content.appendChild(blocksHost); renderBlockEditor(blocksHost); }
246
+ host.appendChild(section);
247
+ });
248
+ document.querySelectorAll('.tab').forEach(function (button) { button.setAttribute('aria-selected', String(button.dataset.panel === current)); });
249
+ document.getElementById('status').textContent = '';
250
+ document.getElementById('status').className = '';
251
+ }
252
+ function load() {
253
+ return api('/plugins/' + encodeURIComponent(pluginId) + '/env').then(function (payload) {
254
+ (payload.fields || []).forEach(function (item) { values[item.key] = item.value || ''; });
255
+ if (!blocksInitialized) { var homeConfig = getValue(specs.home.key, specs.home); blocksExplicit = typeof homeConfig.productBlocks === 'string'; try { productBlocks = JSON.parse(homeConfig.productBlocks || '[]'); if (!Array.isArray(productBlocks)) productBlocks = []; } catch (_error) { productBlocks = []; } blocksInitialized = true; }
256
+ return fetch('/api/v1/public/products?page=1&page_size=100', { cache: 'no-store' }).then(function (response) { if (!response.ok) throw new Error('商品列表读取失败'); return response.json(); }).then(function (payload) { productList = Array.isArray(payload.data) ? payload.data : []; if (!blocksExplicit) productBlocks = productList.map(function (product) { return { productId: String(product.id) }; }); if (selectedBlock < 0 && productBlocks.length) selectedBlock = 0; render(); });
257
+ }).catch(function (error) {
258
+ var status = document.getElementById('status'); status.textContent = error.message; status.className = 'error';
259
+ });
260
+ }
261
+ document.getElementById('back-button').addEventListener('click', function () {
262
+ window.parent.postMessage({ type: 'DJ_APPSTORE_CLOSE_PLUGIN_CONFIG' }, window.location.origin);
263
+ });
264
+ document.querySelectorAll('.tab').forEach(function (button) { button.addEventListener('click', function () { current = button.dataset.panel; render(); }); });
265
+ document.getElementById('save').addEventListener('click', function () {
266
+ var button = this; var spec = specs[current]; var data = getValue(spec.key, spec);
267
+ document.querySelectorAll('#fields [data-key]').forEach(function (input) {
268
+ data[input.dataset.key] = input.getAttribute('role') === 'switch'
269
+ ? (input.getAttribute('aria-checked') === 'true' ? '是' : '否')
270
+ : input.value;
271
+ });
272
+ if (current === 'home') { if (productBlocks.some(function (block) { return !block.productId; })) { var status = document.getElementById('status'); status.textContent = '请为每个商品区块绑定原生商品'; status.className = 'error'; return; } data.productBlocks = JSON.stringify(productBlocks); }
273
+ values[spec.key] = JSON.stringify(data); button.disabled = true;
274
+ api('/plugins/' + encodeURIComponent(pluginId) + '/env', { method: 'POST', body: JSON.stringify({ values: values }) }).then(function (payload) {
275
+ (payload.fields || []).forEach(function (item) { values[item.key] = item.value || ''; });
276
+ var status = document.getElementById('status'); status.textContent = '已保存'; status.className = 'success';
277
+ }).catch(function (error) {
278
+ var status = document.getElementById('status'); status.textContent = error.message; status.className = 'error';
279
+ }).finally(function () { button.disabled = false; });
280
+ });
281
+ load();
282
+ })();