PageSourceSearch

https://www.senchengeo.cn/sc/assets/js/AdminDashboard-zCKF-zS2.js

js senchengeo.cn collected 2026-10-05 22:12:42 UTC 69,354 bytes, 1 lines download raw bytes

1import{r as e}from"./rolldown-runtime-DdACKOZr.js";import{T as s}from"./antd-Dfc2fGnp.js";import{r as t}from"./markdown-ArMu7oCU.js";import{c as r,o as a,s as l}from"./vendor-DvieLQTP.js";import{t as n}from"./building-2-vgkJsr2p.js";import{t as d}from"./chart-no-axes-column-CENLB3-p.js";import{t as o}from"./check-B98-ea8B.js";import{t as i}from"./circle-alert-DSJ662QQ.js";import{t as c}from"./circle-check-big-CXnF35dW.js";import{t as x}from"./circle-x-SPLkvgEp.js";import{t as m}from"./copy-BFXhXxkd.js";import{t as u}from"./external-link-Dv9JZEAR.js";import{t as b}from"./file-text-DCMBsAk5.js";import{t as p}from"./globe-C9Q4Mr_S.js";import{n as h,t as g}from"./link-DHM8m1ft.js";import{t as f}from"./layout-template-BY79V0Bu.js";import{t as y}from"./log-out-DSzw4Ew4.js";import{n as j,t as N}from"./settings-DukBW88F.js";import{t as v}from"./refresh-cw-OsgusxNu.js";import{t as w}from"./share-2-90og7S2T.js";import{t as k}from"./shield-Ci0sQ-5Z.js";import{t as _}from"./shopping-cart-CRZxtWHy.js";import{t as C}from"./square-check-big-DsvbUy5x.js";import{t as S}from"./trash-2-DWG5ADmU.js";import{t as z}from"./triangle-alert-DiO63X6L.js";import{t as A}from"./user-6kph8TcY.js";import{t as D}from"./users-d090TQ2q.js";import"./aiService-DtoVekQH.js";import{t as E}from"./request-5RU1Tr6b.js";import{K as I}from"./accountService-B5BrnMiu.js";import{n as T}from"./urlUtils-CrtweBf7.js";import{n as P,s as q}from"./orderService-CM4OMCAr.js";import{n as L,t as $}from"./SecondaryAccountManager-CdEsRROD.js";import{n as B,t as U}from"./TenantStatsPanel-BbnlpHuy.js";var F=e(s(),1),K=t();function M({showToast:e}){const s=s=>e?e(s):alert(s),[t,r]=(0,F.useState)([]),[a,l]=(0,F.useState)([]),[n,d]=(0,F.useState)(!1),[i,u]=(0,F.useState)(!1),[b,p]=(0,F.useState)(!1),[g,f]=(0,F.useState)(null),[y,N]=(0,F.useState)(null),[w,_]=(0,F.useState)(null),[C,A]=(0,F.useState)(1),[D,I]=(0,F.useState)({provider:"deepseek",display_name:"",api_key:"",model:"",base_url:"",is_default:!1,remark:""});(0,F.useEffect)(()=>{T(),P()},[]);const T=async()=>{try{const e=await E("/ai-config/providers");e.success&&l(e.data||[])}catch(e){console.error("加载提供商列表失败:",e)}},P=async()=>{d(!0);try{const e=await E("/ai-config/");e.success?(r(e.data||[]),u(!1)):(u(!0),s(e.error||"加载配置失败"))}catch(e){console.error("加载配置失败:",e),u(!0),s("网络错误,无法加载配置")}finally{d(!1)}},q=a.find(e=>e.provider===D.provider);return(0,K.jsxs)("div",{className:"space-y-6",children:[(0,K.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-xl px-4 py-3 flex items-start gap-3",children:[(0,K.jsx)(k,{size:18,className:"text-blue-500 mt-0.5 shrink-0"}),(0,K.jsxs)("div",{className:"text-sm text-blue-700",children:[(0,K.jsx)("span",{className:"font-bold",children:"API Key 安全加密存储"}),"- 您的 API Key 会被加密存储在数据库中,前端 bundle 中不再暴露任何第三方 AI 平台的密钥。 AI 请求通过后端代理转发,保障密钥安全。"]})]}),i&&(0,K.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-xl px-4 py-3 flex items-center justify-between gap-3",children:[(0,K.jsxs)("div",{className:"flex items-start gap-3",children:[(0,K.jsx)(z,{size:18,className:"text-amber-500 mt-0.5 shrink-0"}),(0,K.jsxs)("div",{className:"text-sm text-amber-800",children:[(0,K.jsx)("span",{className:"font-bold",children:"配置加载失败"}),' - 当前列表可能不完整,请先点击"重试"加载已有配置后再做增删改,避免误操作。']})]}),(0,K.jsx)("button",{onClick:P,className:"px-3 py-1.5 text-sm bg-amber-500 hover:bg-amber-600 text-white rounded-lg font-medium shrink-0",children:"重试加载"})]}),(0,K.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[{label:"总配置数",value:t.length,color:"bg-blue-50 text-blue-600 border-blue-200"},{label:"已启用",value:t.filter(e=>e.is_active).length,color:"bg-green-50 text-green-600 border-green-200"},{label:"已禁用",value:t.filter(e=>!e.is_active).length,color:"bg-red-50 text-red-500 border-red-200"},{label:"默认配置",value:t.filter(e=>e.is_default).length,color:"bg-purple-50 text-purple-600 border-purple-200"}].map((e,s)=>(0,K.jsxs)("div",{className:`${e.color} border rounded-xl p-4`,children:[(0,K.jsx)("div",{className:"text-xs opacity-75 mb-1",children:e.label}),(0,K.jsx)("div",{className:"text-2xl font-bold",children:e.value})]},s))}),b&&(0,K.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden",children:[(0,K.jsxs)("div",{className:"p-5 border-b border-gray-100 flex items-center justify-between bg-gray-50",children:[(0,K.jsxs)("div",{className:"font-bold text-gray-800 flex items-center gap-2",children:[g?(0,K.jsx)(v,{size:18,className:"text-blue-500"}):(0,K.jsx)(j,{size:18,className:"text-green-500"}),g?"编辑 AI 配置":"添加新 AI 配置"]}),(0,K.jsx)("button",{onClick:()=>{p(!1),f(null),I({provider:"deepseek",display_name:"",api_key:"",model:"",base_url:"",is_default:!1,remark:""})},className:"text-gray-400 hover:text-gray-600",children:"✕"})]}),(0,K.jsxs)("div",{className:"p-5 space-y-4",children:[(0,K.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,K.jsxs)("div",{children:[(0,K.jsxs)("label",{className:"block text-sm font-medium text-gray-600 mb-1.5",children:["AI 提供商 ",(0,K.jsx)("span",{className:"text-red-400",children:"*"})]}
1),(0,K.jsx)("select",{value:D.provider,onChange:e=>I(s=>({...s,provider:e.target.value})),disabled:!!g,className:"w-full border border-gray-200 rounded-lg px-3 py-2.5 text-sm outline-none focus:border-blue-500 bg-white",children:a.map(e=>(0,K.jsx)("option",{value:e.provider,children:e.label},e.provider))})]}),(0,K.jsxs)("div",{children:[(0,K.jsx)("label",{className:"block text-sm font-medium text-gray-600 mb-1.5",children:"显示名称(选填)"}),(0,K.jsx)("input",{type:"text",value:D.display_name,onChange:e=>I(s=>({...s,display_name:e.target.value})),placeholder:"如:豆包-生产、千问-测试",className:"w-full border border-gray-200 rounded-lg px-3 py-2.5 text-sm outline-none focus:border-blue-500"})]}),(0,K.jsxs)("div",{className:"md:col-span-2",children:[(0,K.jsxs)("label",{className:"block text-sm font-medium text-gray-600 mb-1.5",children:["API Key ",(0,K.jsx)("span",{className:"text-red-400",children:"*"})]}),(0,K.jsx)("input",{type:"password",value:D.api_key,onChange:e=>I(s=>({...s,api_key:e.target.value})),placeholder:g?"留空则不修改":"请输入 API Key",className:"w-full border border-gray-200 rounded-lg px-3 py-2.5 text-sm outline-none focus:border-blue-500 font-mono"}),q&&(0,K.jsxs)("div",{className:"text-xs text-gray-400 mt-1",children:["默认 Endpoint: ",q.defaultUrl]})]}),(0,K.jsxs)("div",{children:[(0,K.jsx)("label",{className:"block text-sm font-medium text-gray-600 mb-1.5",children:"模型名称(选填)"}),(0,K.jsx)("input",{type:"text",value:D.model,onChange:e=>I(s=>({...s,model:e.target.value})),placeholder:"如:"+(q?.defaultUrl?.includes("deepseek")?"deepseek-chat":"gpt-4"),className:"w-full border border-gray-200 rounded-lg px-3 py-2.5 text-sm outline-none focus:border-blue-500 font-mono"})]}),(0,K.jsxs)("div",{children:[(0,K.jsx)("label",{className:"block text-sm font-medium text-gray-600 mb-1.5",children:"自定义 Endpoint(选填)"}),(0,K.jsx)("input",{type:"text",value:D.base_url,onChange:e=>I(s=>({...s,base_url:e.target.value})),placeholder:"留空使用默认 endpoint",className:"w-full border border-gray-200 rounded-lg px-3 py-2.5 text-sm outline-none focus:border-blue-500 font-mono"})]}),(0,K.jsxs)("div",{className:"md:col-span-2",children:[(0,K.jsx)("label",{className:"block text-sm font-medium text-gray-600 mb-1.5",children:"备注"}),(0,K.jsx)("input",{type:"text",value:D.remark,onChange:e=>I(s=>({...s,remark:e.target.value})),placeholder:"如:生产环境、测试环境",className:"w-full border border-gray-200 rounded-lg px-3 py-2.5 text-sm outline-none focus:border-blue-500"})]})]}),(0,K.jsxs)("div",{className:"flex items-center gap-2",children:[(0,K.jsx)("input",{type:"checkbox",id:"is_default",checked:D.is_default,onChange:e=>I(s=>({...s,is_default:e.target.checked}
1)),className:"accent-blue-500 w-4 h-4"}),(0,K.jsx)("label",{htmlFor:"is_default",className:"text-sm text-gray-600",children:"设为该提供商的默认配置"})]}),(0,K.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,K.jsxs)("button",{onClick:g?()=>(async e=>{if(!t.find(s=>s.id===e))return;const r={...D};r.api_key.trim()||delete r.api_key,r.base_url.trim()||delete r.base_url,r.model.trim()||delete r.model,r.remark.trim()||delete r.remark,r.display_name.trim()||delete r.display_name;try{const t=await E(`/ai-config/${e}`,{method:"PUT",body:r});t.success?(s("配置更新成功!"),f(null),I({provider:"deepseek",display_name:"",api_key:"",model:"",base_url:"",is_default:!1,remark:""}),P()):s(t.error||"更新失败")}catch(a){console.error("更新配置失败:",a),s("网络错误,更新失败")}})(g):async()=>{if(!D.api_key.trim())return s("API Key 必填");const e={...D};e.base_url.trim()||delete e.base_url,e.model.trim()||delete e.model,e.remark.trim()||delete e.remark,e.display_name.trim()||delete e.display_name;try{const t=await E("/ai-config/",{method:"POST",body:e});t.success?(s("配置添加成功!"),p(!1),I({provider:"deepseek",display_name:"",api_key:"",model:"",base_url:"",is_default:!1,remark:""}),P()):s(t.error||"添加失败")}catch(t){console.error("添加配置失败:",t),s("网络错误,添加失败")}},className:"px-6 py-2.5 bg-blue-500 text-white rounded-lg text-sm font-medium hover:bg-blue-600 transition-colors flex items-center gap-2",children:[g?(0,K.jsx)(v,{size:16}):(0,K.jsx)(j,{size:16}),g?"保存修改":"确认添加"]}),(0,K.jsx)("button",{onClick:()=>{p(!1),f(null),I({provider:"deepseek",display_name:"",api_key:"",model:"",base_url:"",is_default:!1,remark:""})},className:"px-6 py-2.5 border border-gray-200 text-gray-500 rounded-lg text-sm hover:bg-gray-50 transition-colors",children:"取消"})]})]})]}),(0,K.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden",children:[(0,K.jsxs)("div",{className:"p-5 border-b border-gray-100 flex items-center justify-between",children:[(0,K.jsxs)("div",{className:"flex items-center gap-2",children:[(0,K.jsx)(h,{size:18,className:"text-blue-500"}),(0,K.jsx)("span",{className:"font-bold text-gray-800",children:"AI 配置列表"}),(0,K.jsxs)("span",{className:"text-sm text-gray-400",children:["(",t.length," 个配置)"]})]}),(0,K.jsxs)("button",{onClick:()=>p(!0),disabled:b||i,title:i?"配置加载失败,请先重试加载":"",className:"px-4 py-2 bg-blue-500 text-white rounded-lg text-sm font-medium hover:bg-blue-600 transition-colors flex items-center gap-2 disabled:bg-gray-300 disabled:cursor-not-allowed",children:[(0,K.jsx)(j,{size:16}),"添加配置"]})]}),n?(0,K.jsx)("div",{className:"p-12 text-center text-gray-400",children:"加载中..."}):0===t.length?(0,K.jsxs)("div",{className:"p-12 text-center text-gray-400",children:[(0,K.jsx)(k,{size:48,className:"mx-auto mb-3 opacity-30"}),(0,K.jsx)("div",{className:"text-sm",children:"暂无 AI 配置,点击右上角添加"}),(0,K.jsx)("div",{className:"text-xs mt-1",children:"添加后即可安全存储 API Key 并用于 AI 代理"})]}):(0,K.jsx)("div",{className:"divide-y divide-gray-100",children:t.slice(10*(C-1),10*C).map(e=>{const r=a.find(s=>s.provider===e.provider);return(0,K.jsxs)("div",{className:"p-5 hover:bg-gray-50 transition-colors",children:[(0,K.jsxs)("div",{className:"flex flex-wrap items-start gap-4",children:[(0,K.jsxs)("div",{className:"flex items-center gap-3 min-w-[200px]",children:[(0,K.jsx)("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center text-white font-bold "+("deepseek"===e.provider?"bg-blue-500":"doubao"===e.provider?"bg-pink-400":"qianwen"===e.provider?"bg-indigo-500":"kimi"===e.provider?"bg-cyan-500":"yuanbao"===e.provider?"bg-green-500":"zhipu"===e.provider?"bg-violet-500":"bg-gray-500"),children:r?.label?.charAt(0)||"?"}),(0,K.jsxs)("div",{children:[(0,K.jsx)("div",{className:"font-semibold text-gray-800",children:e.display_name||r?.label||e.provider}),(0,K.jsx)("div",{className:"text-xs text-gray-400",children:e.provider})]})]}),(0,K.jsxs)("div",{className:"flex-1 grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[(0,K.jsxs)("div",{children:[(0,K.jsx)("div",{className:"text-xs text-gray-400 mb-1",children:"API Key"}),(0,K.jsxs)("div",{className:"flex items-center gap-2",children:[(0,K.jsx)("span",{className:"font-mono text-gray-700 bg-gray-100 px-2 py-1 rounded text-xs",children:e.api_key_masked}),(0,K.jsx)("button",{onClick:()=>{return s=e.api_key_masked,t=e.id,navigator.clipboard.writeText(s),_(t),void setTimeout(()=>_(null),2e3);var s,t},className:"text-gray-400 hover:text-blue-500 transition-colors",title:"复制",children:w===e.id?(0,K.jsx)(o,{size:14,className:"text-green-500"}):(0,K.jsx)(m,{size:14})})]})]}),(0,K.jsxs)("div",{children:[(0,K.jsx)("div",{className:"text-xs text-gray-400 mb-1",children:"模型"}),(0,K.jsx)("div",{className:"text-gray-700",children:e.model||"-"})]}),(0,K.jsxs)("div",{children:[(0,K.jsx)("div",{className:"text-xs text-gray-400 mb-1",children:"Endpoint"}),(0,K.jsx)("div",{className:"text-xs text-gray-700 truncate max-w-[150px]",title:e.base_url||r?.defaultUrl,children:e.base_url||r?.defaultUrl||"-"})]}),(0,K.jsxs)("div",{children:[(0,K.jsx)("div",{className:"text-xs text-gray-400 mb-1",children:"状态"}),(0,K.jsxs)("div",{className:"flex items-center gap-2",children:[e.is_default&&(0,K.jsx)("span",{className:"px-2 py-0.5 bg-purple-100 text-purple-600 rounded text-xs font-medium",children:"默认"}),(0,K.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium "+(e.is_active?"bg-green-100 text-green-600":"bg-red-100 text-red-500"),children:e.is_active?"✓ 启用":"✗ 禁用"})]})]})]}),(0,K.jsxs)("div",{className:"flex items-center gap-2 ml-auto",children:[!e.is_default&&(0,K.jsx)("button",{onClick:()=>(async e=>{try{const t=await E(`/ai-config/${e}/set-default`,{method:"PATCH"});t.success?(s("已设置为默认配置"),P()):s(t.error||"操作失败")}catch(t){console.error("设置默认失败:",t),s("网络错误,操作失败")}})(e.id),className:"px-3 py-1.5 text-xs bg-purple-50 text-purple-600 rounded hover:bg-purple-100 transition-colors",title:"设为默认",children:"设为默认"}),(0,K.jsxs)("button",{onClick:()=>(async e=>{const r=t.find(s=>
1s.id===e);if(r)try{const t=await E(`/ai-config/${e}`,{method:"PUT",body:{is_active:!r.is_active}});t.success?(s(r.is_active?"已禁用":"已启用"),P()):s(t.error||"操作失败")}catch(a){console.error("切换状态失败:",a),s("网络错误,操作失败")}})(e.id),className:"px-3 py-1.5 text-xs rounded hover:opacity-80 transition-colors "+(e.is_active?"bg-orange-50 text-orange-500":"bg-green-50 text-green-600"),children:[e.is_active?(0,K.jsx)(x,{size:14}):(0,K.jsx)(c,{size:14}),e.is_active?"禁用":"启用"]}),(0,K.jsxs)("button",{onClick:()=>(e=>{f(e.id),I({provider:e.provider,display_name:e.display_name||"",api_key:"",model:e.model||"",base_url:e.base_url||"",is_default:e.is_default,remark:e.remark||""}),p(!0)})(e),className:"px-3 py-1.5 text-xs bg-blue-50 text-blue-600 rounded hover:bg-blue-100 transition-colors flex items-center gap-1",children:[(0,K.jsx)(v,{size:14}),"编辑"]}),(0,K.jsxs)("button",{onClick:()=>(async e=>{if(window.confirm("确认删除此配置?删除后无法恢复。"))try{const t=await E(`/ai-config/${e}`,{method:"DELETE"});t.success?(s("配置已删除"),P()):s(t.error||"删除失败")}catch(t){console.error("删除配置失败:",t),s("网络错误,删除失败")}})(e.id),className:"px-3 py-1.5 text-xs bg-red-50 text-red-400 rounded hover:bg-red-100 transition-colors flex items-center gap-1",children:[(0,K.jsx)(S,{size:14}),"删除"]})]})]}),e.remark&&(0,K.jsxs)("div",{className:"mt-3 text-xs text-gray-400 ml-14",children:["备注: ",e.remark]})]},e.id)})}),(0,K.jsx)(L,{total:t.length,currentPage:C,pageSize:10,onChange:A})]}),(0,K.jsx)("div",{className:"text-center text-xs text-gray-400 pb-4",children:"API Key 经过 AES-256-GCM 加密存储,前端无法获取明文。AI 请求通过后端代理转发,保障密钥安全。"})]})}var O=({systemConfig:e,setSystemConfig:s,clientsData:t,setClientsData:o,orders:c,setOrders:m,onLogout:v,showToast:k,initialModule:z,initialDetail:L,hideShell:O})=>{const Q=l(),R=r();a();const[G,H]=(0,F.useState)(z||"clients"),[J,W]=(0,F.useState)(()=>{if("client"===L&&R.id){const e=R.id;return Object.values(t).find(s=>s.username===e||s.username===e.split("-")[0])||null}return null});(0,F.useEffect)(()=>{z&&H(z)},[z]);const[Z,V]=(0,F.useState)(e.apis||[]),[X,Y]=(0,F.useState)(e.publishPlatforms||[]),[ee,se]=(0,F.useState)([]),[te,re]=(0,F.useState)(!0),[ae,le]=(0,F.useState)(!1),[ne,de]=(0,F.useState)(null),[oe,ie]=(0,F.useState)(0),[ce,xe]=(0,F.useState)(0),[me,ue]=(0,F.useState)("正常"),[be,pe]=(0,F.useState)("2099-12-31"),[he,ge]=(0,F.useState)(!1),[fe,ye]=(0,F.useState)({username:"",password:"",name:"",industry:"",contact:"",quota:1e4,expireDate:"2099-12-31"}),[je,Ne]=(0,F.useState)(e.templates[0]||null),[ve,we]=(0,F.useState)(null),[ke,_e]=(0,F.useState)(""),[Ce,Se]=(0,F.useState)(null),[ze,Ae]=(0,F.useState)([]),[De,Ee]=(0,F.useState)(!1),[Ie,Te]=(0,F.useState)(1),[Pe,qe]=(0,F.useState)(0),[Le,$e]=(0,F.useState)(""),[Be,Ue]=(0,F.useState)(null),[Fe,Ke]=(0,F.useState)(""),Me=10,Oe=e=>{const s={clients:T.dashboard(),tenants:"/admin/tenants.html",api:T.apiConfig(),template:T.templates(),platforms:T.platforms(),newsSources:T.newsSources(),orders:T.orders()};Q(s[e]||T.dashboard())},Qe=(e,s,t)=>Y(X.map(r=>r.id===e?{...r,[s]:t}:r)),Re=async()=>{re(!0);try{const e=await E("/media-platforms/admin/all");e?.success&&Array.isArray(e.data)&&se(e.data)}catch(e){console.error("加载媒体平台失败:",e),k("加载媒体平台失败")}finally{re(!1)}};(0,F.useEffect)(()=>{Re()},[]);const Ge=(e,s,t)=>{se(r=>{const a=r.map(r=>r.id===e?{...r,[s]:t}:r),l=a.find(s=>s.id===e);return l&&(clearTimeout(window._mediaSaveTimer?.[e]),window._mediaSaveTimer||(window._mediaSaveTimer={}),window._mediaSaveTimer[e]=setTimeout(async()=>{try{await E(`/media-platforms/${e}`,{method:"PUT",body:{name:l.name,category:l.category,region:l.region,price:l.price,description:l.description,url:l.url,index_type:l.index_type,delivery_time:l.delivery_time,sort_order:l.sort_order,status:l.status}})}catch(s){k("自动保存失败")}},600)),a})},He=(e,s,t)=>Ne(r=>({...r,templates:r.templates.map(r=>r.id===e?{...r,[s]:t}:r)})),Je=(0,F.useCallback)(async()=>{Ee(!0);try{const e=await P({status:Le||void 0,page:Ie,pageSize:Me});e.success?(Ae(e.data||[]),qe(e.total||0)):(k(e.error||"加载订单失败"),Ae([]))}catch(e){console.error("[AdminDashboard] loadRealOrders error:",e),k("加载订单失败")}finally{Ee(!1)}},[Le,Ie,k]);(0,F.useEffect)(()=>{"orders"===G&&Je()},[G,Je]);const We=Object.values(t);return(0,K.jsxs)("div",{className:O?"":"min-h-screen bg-gray-100 flex animate-fadeIn relative",children:[he&&(0,K.jsx)("div",{className:"fixed inset-0 bg-slate-900/60 flex items-center justify-center z-[1000] p-4 backdrop-blur-sm",children:(0,K.jsxs)("div",{className:"bg-white rounded-2xl w-full max-w-[480px] max-h-[90vh] flex flex-col shadow-2xl animate-modal-pop",children:[(0,K.jsxs)("div",{className:"flex justify-between items-center p-6 border-b border-gray-100 shrink-0",children:[(0,K.jsxs)("h3",{className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:[(0,K.jsx)(D,{size:18,className:"text-blue-600"})," 开设新子账号"]}),(0,K.jsx)("button",{onClick:()=>ge(!1),className:"text-gray-400 hover:text-gray-600 transition-colors",children:"×"})]}),(0,K.jsxs)("div",{className:"p-6 flex-1 overflow-y-auto space-y-4",children:[(0,K.jsxs)("div",{className:"flex gap-4",children:[(0,K.jsxs)("div",{className:"flex-1",children:[(0,K.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["登录账号 ",(0,K.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,K.jsx)("input",{type:"text",value:fe.username,onChange:e=>ye({...fe,username:e.target.value}),className:"w-full border border-gray-300 rounded-lg p-2.5 focus:ring-2 focus:ring-blue-500 outline-none text-sm",placeholder:"如: client
101"})]}),(0,K.jsxs)("div",{className:"flex-1",children:[(0,K.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["登录密码 ",(0,K.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,K.jsx)("input",{type:"text",value:fe.password,onChange:e=>ye({...fe,password:e.target.value}),className:"w-full border border-gray-300 rounded-lg p-2.5 focus:ring-2 focus:ring-blue-500 outline-none text-sm",placeholder:"设置密码"})]})]}),(0,K.jsxs)("div",{className:"flex gap-4",children:[(0,K.jsxs)("div",{className:"flex-1",children:[(0,K.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["客户企业名称 ",(0,K.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,K.jsx)("input",{type:"text",value:fe.name,onChange:e=>ye({...fe,name:e.target.value}),className:"w-full border border-gray-300 rounded-lg p-2.5 focus:ring-2 focus:ring-blue-500 outline-none text-sm",placeholder:"全称,将同步至其基础信息"})]}),(0,K.jsxs)("div",{className:"flex-1",children:[(0,K.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"初始分配算力点"}),(0,K.jsx)("input",{type:"number",value:fe.quota,onChange:e=>ye({...fe,quota:e.target.value}),className:"w-full border border-gray-300 rounded-lg p-2.5 focus:ring-2 focus:ring-blue-500 outline-none text-sm"})]})]}),(0,K.jsxs)("div",{className:"flex gap-4",children:[(0,K.jsxs)("div",{className:"flex-1",children:[(0,K.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"所属行业"}),(0,K.jsx)("input",{type:"text",value:fe.industry,onChange:e=>ye({...fe,industry:e.target.value}),className:"w-full border border-gray-300 rounded-lg p-2.5 focus:ring-2 focus:ring-blue-500 outline-none text-sm",placeholder:"请输入所属行业"})]}),(0,K.jsxs)("div",{className:"flex-1",children:[(0,K.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"主要联系人"}),(0,K.jsx)("input",{type:"text",value:fe.contact,onChange:e=>ye({...fe,contact:e.target.value}),className:"w-full border border-gray-300 rounded-lg p-2.5 focus:ring-2 focus:ring-blue-500 outline-none text-sm",placeholder:"姓名"})]})]}),(0,K.jsxs)("div",{children:[(0,K.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["设置账号到期时间 ",(0,K.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,K.jsx)("input",{type:"date",value:fe.expireDate,onChange:e=>ye({...fe,expireDate:e.target.value}),className:"w-full border border-gray-300 rounded-lg p-2.5 focus:ring-2 focus:ring-blue-500 outline-none text-sm"})]})]}),(0,K.jsxs)("div",{className:"flex justify-end gap-3 bg-gray-50 p-5 rounded-b-2xl border-t border-gray-100 shrink-0",children:[(0,K.jsx)("button",{onClick:()=>ge(!1),className:"px-5 py-2 rounded-lg border border-gray-300 text-gray-600 hover:bg-white text-sm font-medium",children:"取消"}),(0,K.jsx)("button",{onClick:async()=>{if(!fe.username.trim()||!fe.password.trim()||!fe.name.trim())return k("请填写必填项:登录账号、密码、企业名称");if(t[fe.username])return k("该登录账号已存在,请更换");try{const e=await E("/accounts",{method:"POST",body:{phone:fe.username||"",username:fe.username,password:fe.password,name:fe.name,parent_id:null,
1status:I.ENABLED,remark:fe.industry||"",company_name:fe.name||"",compute_quota:parseInt(fe.quota)||0,industry:fe.industry||"",expire_date:fe.expireDate||"2099-12-31"}});if(e.success){const e={username:fe.username,password:fe.password,name:fe.name,industry:fe.industry,contact:fe.contact,status:I.ENABLED,expireDate:fe.expireDate,quota:parseInt(fe.quota)||1e4,usedQuota:0,balance:0,companyInfo:{name:fe.name,shortName:fe.name.substring(0,4),industry:fe.industry,phone:"",website:"",companyPositioning:"",companyIntro:"",endorsement:"",customerPersona:"",customerPainPoint:"",competitors:"",productInfo:"",afterSales:"",customerCase:"",otherInfo:""},keywords:[],customDirectives:[],trainingTasks:[],articles:[]};o(s=>({...s,[fe.username]:e})),ge(!1),ye({username:"",password:"",name:"",industry:"",contact:"",quota:1e4,expireDate:"2099-12-31"}),k(`成功添加子账号: ${fe.name},账号信息已存入云端数据库`)}else k(`创建失败: ${e.error||"未知错误"}`)}catch(e){console.error("创建账号失败:",e),k(`创建失败: ${e.message||"网络错误"}`)}},className:"px-5 py-2 rounded-lg bg-gradient-to-r from-[#1a3a6b] to-[#2563eb] text-white hover:from-[#0f2847] hover:to-[#1a3a6b] font-medium shadow-md text-sm",children:"创建账号"})]})]})}),ne&&(0,K.jsx)("div",{className:"fixed inset-0 bg-slate-900/60 flex items-center justify-center z-[1000] p-4 backdrop-blur-sm",children:(0,K.jsxs)("div",{className:"bg-white rounded-2xl w-full max-w-[440px] max-h-[90vh] flex flex-col shadow-2xl animate-modal-pop",children:[(0,K.jsxs)("div",{className:"flex justify-between items-center p-6 border-b border-gray-100 shrink-0",children:[(0,K.jsxs)("h3",{className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:[(0,K.jsx)(N,{size:18})," 资产与权限管控"]}),(0,K.jsx)("button",{onClick:()=>de(null),className:"text-gray-400 hover:text-gray-600",children:"×"})]}),(0,K.jsxs)("div",{className:"p-6 flex-1 overflow-y-auto",children:[(0,K.jsxs)("div",{className:"mb-4 text-sm text-gray-600 bg-blue-50 p-3 rounded-lg border border-blue-100",children:["当前管理客户:",(0,K.jsx)("span",{className:"font-semibold text-blue-700",children:ne.name})]}),(0,K.jsxs)("div",{className:"space-y-4",children:[(0,K.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,K.jsxs)("div",{children:[(0,K.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"账号启停管控"}),(0,K.jsxs)("select",{value:me,onChange:e=>ue(e.target.value),className:"w-full border rounded-lg p-2 focus:ring-2 focus:ring-blue-500 outline-none font-bold "+("正常"===me?"text-blue-600 border-blue-300":"text-red-600 border-red-300"),children:[(0,K.jsx)("option",{value:"正常",children:"正常使用"}),(0,K.jsx)("option",{value:"已停用",children:"强制停用"})]})]}),(0,K.jsxs)("div",{children:[(0,K.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"账号到期时间"}),(0,K.jsx)("input",{type:"date",value:be,onChange:e=>pe(e.target.value),className:"w-full border border-gray-300 rounded-lg p-2 focus:ring-2 focus:ring-blue-500 outline-none"})]})]}),(0,K.jsxs)("div",{className:"pt-4 border-t border-gray-100",children:[(0,K.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["设置总算力点数 (当前已消耗: ",ne.usedQuota," 点)"]}),(0,K.jsx)("input",{type:"number",value:oe,onChange:e=>ie(e.target.value),className:"w-full border border-gray-300 rounded-lg p-2 focus:ring-2 focus:ring-blue-500 outline-none"})]}),(0,K.jsxs)("div",{children:[(0,K.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"设置发稿现金余额 (元)"}),(0,K.jsx)("input",{type:"number",value:ce,onChange:e=>xe(e.target.value),className:"w-full border border-orange-300 rounded-lg p-2 focus:ring-2 focus:ring-orange-500 outline-none text-orange-600 font-bold"})]})]})]}),(0,K.jsxs)("div",{className:"flex justify-end gap-3 bg-gray-50 p-5 rounded-b-2xl border-t border-gray-100 shrink-0",children:[(0,K.jsx)("button",{onClick:()=>de(null),className:"px-4 py-2 rounded-lg border border-gray-300 text-gray-600 hover:bg-white text-sm font-medium",children:"取消"}),(0,K.jsx)("button",{onClick:async()=>
1{if(ne)try{await E(`/accounts/${ne.id}/status`,{method:"PATCH",body:{status:me===I.ENABLED?I.ENABLED:I.DISABLED}}),await E(`/accounts/${ne.id}`,{method:"PUT",body:{phone:ne.contact||"",username:ne.username,password:ne.password,status:me===I.ENABLED?I.ENABLED:I.DISABLED,remark:ne.industry||"",name:ne.name||"",industry:ne.industry||"",expire_date:be||"2099-12-31",quota:parseInt(oe)||0,balance:parseFloat(ce)||0,company_name:ne.name||"",compute_quota:parseInt(oe)||0}}),o(e=>({...e,[ne.username]:{...e[ne.username],quota:parseInt(oe)||0,balance:parseFloat(ce)||0,status:me,expireDate:be}})),k(`已成功更新客户 ${ne.name} 的状态与资产,并同步云端`),de(null)}catch(e){console.error("更新账号失败:",e),k(`更新失败: ${e.message||"网络错误"}`)}},className:"px-4 py-2 rounded-lg bg-gradient-to-r from-[#1a3a6b] to-[#2563eb] text-white hover:from-[#0f2847] hover:to-[#1a3a6b] font-medium shadow-md text-sm",children:"更新配置存入云端"})]})]})}),ve&&(0,K.jsx)("div",{className:"fixed inset-0 bg-slate-900/60 flex items-center justify-center z-[1000] p-4 backdrop-blur-sm",children:(0,K.jsxs)("div",{className:"bg-white rounded-2xl w-full max-w-[480px] max-h-[90vh] flex flex-col shadow-2xl animate-modal-pop",children:[(0,K.jsxs)("div",{className:"flex justify-between items-center p-6 border-b border-gray-100 shrink-0",children:[(0,K.jsx)("h3",{className:"text-lg font-bold text-gray-800",children:"交付发布链接"}),(0,K.jsx)("button",{onClick:()=>we(null),className:"text-gray-400 hover:text-gray-600",children:"×"})]}),(0,K.jsxs)("div",{className:"p-6 flex-1 overflow-y-auto",children:[(0,K.jsxs)("div",{className:"mb-4 text-sm text-gray-600",children:["请为客户 ",(0,K.jsx)("span",{className:"font-bold",children:ve.submitter_name||ve.submitter_username||"-"})," 的 ",(0,K.jsxs)("span",{className:"text-blue-600 font-bold",children:["[",ve.media_name||ve.current_media_name||"-","]"]})," 发稿订单填入实际已发布的链接:"]}),(0,K.jsx)("input",{type:"url",value:ke,onChange:e=>_e(e.target.value),className:"w-full border border-gray-300 rounded-lg p-3 focus:ring-2 focus:ring-blue-500 outline-none font-mono text-sm text-gray-600",placeholder:"http://..."})]}),(0,K.jsxs)("div",{className:"flex justify-end gap-3 bg-gray-50 p-5 rounded-b-2xl border-t border-gray-100 shrink-0",children:[(0,K.jsx)("button",{onClick:()=>we(null),className:"px-4 py-2 rounded-lg border border-gray-300 text-gray-600 hover:bg-white",children:"取消"}),(0,K.jsx)("button",{onClick:async()=>{if(!ke.trim())return k("必须填写发布后的网址链接!");if(!ve)return;if("待处理"===ve.status){const e=await q(ve.id,{status:"处理中",admin_note:"开始处理"});if(!e.success)return void k(e.error||"状态推进失败")}const e=await q(ve.id,{status:"已发布",publish_url:ke.trim()});e.success?(k("订单已成功交付,发布链接已同步给子账号!"),we(null),_e(""),Je()):k(e.error||"交付失败,请重试")},className:"px-4 py-2 rounded-lg bg-gradient-to-r from-[#1a3a6b] to-[#2563eb] text-white hover:from-[#0f2847] hover:to-[#1a3a6b] font-medium shadow-md",children:"确认交付"})]})]})}),Be&&(0,K.jsx)("div",{className:"fixed inset-0 bg-slate-900/60 flex items-center justify-center z-[1000] p-4 backdrop-blur-sm",children:(0,K.jsxs)("div",{className:"bg-white rounded-2xl w-full max-w-[480px] max-h-[90vh] flex flex-col shadow-2xl animate-modal-pop",children:[(0,K.jsxs)("div",{className:"flex justify-between items-center p-6 border-b border-gray-100 shrink-0",children:[(0,K.jsx)("h3",{className:"text-lg font-bold text-gray-800",children:"驳回订单"}),(0,K.jsx)("button",{onClick:()=>Ue(null),className:"text-gray-400 hover:text-gray-600",children:"×"})]}),(0,K.jsxs)("div",{className:"p-6 flex-1 overflow-y-auto space-y-3",children:[(0,K.jsxs)("div",{className:"text-sm text-gray-600",children:["订单 ",(0,K.jsx)("span",{className:"font-bold text-blue-600",children:Be.order_no})," 将被驳回, ¥",Number(Be.amount||0).toFixed(2)," 会自动退还至子账号余额。"]}),(0,K.jsxs)("div",{children:[(0,K.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["驳回原因 ",(0,K.jsx)("span",{className:"text-gray-400 text-xs",children:"(选填)"})]}
1),(0,K.jsx)("textarea",{value:Fe,onChange:e=>Ke(e.target.value),rows:3,maxLength:200,placeholder:'填写后子账号可以看到,不填则显示"主账号驳回"',className:"w-full border border-gray-300 rounded-lg p-3 focus:ring-2 focus:ring-blue-500 outline-none text-sm resize-none"}),(0,K.jsxs)("div",{className:"text-xs text-gray-400 mt-1 text-right",children:[Fe.length,"/200"]})]})]}),(0,K.jsxs)("div",{className:"flex justify-end gap-3 bg-gray-50 p-5 rounded-b-2xl border-t border-gray-100 shrink-0",children:[(0,K.jsx)("button",{onClick:()=>Ue(null),className:"px-4 py-2 rounded-lg border border-gray-300 text-gray-600 hover:bg-white",children:"取消"}),(0,K.jsx)("button",{onClick:async()=>{if(!Be)return;if("待处理"===Be.status){const e=await q(Be.id,{status:"处理中",admin_note:"开始处理(准备驳回)"});if(!e.success)return void k(e.error||"状态推进失败")}const e=await q(Be.id,{status:"已失败",failure_reason:Fe.trim()||"主账号驳回"});e.success?(k(`订单已驳回,Â¥${Number(Be.amount).toFixed(2)} 已退还至子账号余额`),Ue(null),Ke(""),Je()):k(e.error||"驳回失败,请重试")},className:"px-4 py-2 rounded-lg bg-gradient-to-r from-red-500 to-red-600 hover:from-red-600 hover:to-red-700 text-white font-medium shadow-md",children:"确认驳回"})]})]})}),Ce&&(0,K.jsx)("div",{className:"fixed inset-0 bg-slate-900/60 flex items-center justify-center z-[1000] p-4 backdrop-blur-sm overflow-y-auto",children:(0,K.jsxs)("div",{className:"bg-white rounded-2xl w-full max-w-4xl max-h-[90vh] flex flex-col shadow-2xl animate-modal-pop my-auto",children:[(0,K.jsxs)("div",{className:"p-6 border-b border-gray-100 flex justify-between items-start bg-gray-50 rounded-t-2xl shrink-0",children:[(0,K.jsxs)("div",{className:"pr-8",children:[(0,K.jsx)("h3",{className:"text-xl font-bold text-gray-800 mb-2",children:Ce.title}),Ce.media_name&&(0,K.jsxs)("div",{className:"flex gap-4 text-sm",children:[(0,K.jsxs)("span",{className:"bg-blue-100 text-blue-800 px-2 py-0.5 rounded font-medium",children:["目标媒体: ",Ce.media_name]}),(0,K.jsxs)("span",{className:"bg-orange-100 text-orange-800 px-2 py-0.5 rounded font-medium",children:["所属客户: ",Ce.submitter_name||"未填写"]})]})]}),(0,K.jsx)("button",{onClick:()=>Se(null),className:"text-gray-400 hover:text-gray-600 shrink-0 bg-white border border-gray-200 rounded p-1",children:"×"})]}),(0,K.jsxs)("div",{className:"p-6 flex-1 overflow-y-auto",children:[(0,K.jsx)("div",{className:"whitespace-pre-wrap text-gray-700 leading-relaxed font-serif text-base mb-6 pb-6 border-b border-gray-100",children:Ce.content}),Ce.remark&&(0,K.jsxs)("div",{className:"bg-orange-50/50 p-4 rounded-lg border border-orange-100",children:[(0,K.jsxs)("h4",{className:"text-sm font-bold text-orange-800 mb-2 flex items-center gap-1",children:[(0,K.jsx)(i,{size:16})," 发稿特殊备注要求:"]}),(0,K.jsx)("p",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:Ce.remark})]})]}),(0,K.jsx)("div",{className:"p-4 border-t border-gray-100 flex justify-end bg-gray-50 rounded-b-2xl shrink-0",children:(0,K.jsx)("button",{onClick:()=>Se(null),className:"px-6 py-2.5 bg-gradient-to-r from-[#1a3a6b] to-[#2563eb] text-white rounded-lg hover:from-[#0f2847] hover:to-[#1a3a6b] font-medium shadow-sm transition-colors",children:"关闭预览"})})]})}),!O&&(0,K.jsxs)("aside",{className:"w-40 bg-[#0a1628] text-slate-300 flex flex-col shadow-xl z-20 shrink-0",children:[(0,K.jsxs)("div",{className:"h-16 flex items-center justify-center border-b border-slate-800 text-white font-bold text-base tracking-wider gap-2",children:[(0,K.jsx)(N,{size:18,className:"text-blue-500"}),"总控后台"]}),(0,K.jsxs)("nav",{className:"flex-1 py-6 space-y-2 px-3 overflow-y-auto",children:[(0,K.jsxs)("button",{onClick:()=>{Oe("clients"),W(null)},className:"w-full flex items-center gap-2 px-3 py-2.5 rounded-lg transition-colors text-sm "+("clients"===G?"bg-gradient-to-r from-green-400/90 to-cyan-500/90 text-white":"hover:bg-slate-800"),children:[(0,K.jsx)(D,{size:18})," 资产与账号"]}),(0,K.jsxs)("button",{onClick:()=>{Oe("api"),W(null)},className:"w-full flex items-center gap-2 px-3 py-2.5 rounded-lg transition-colors text-sm "+("api"===G?"bg-gradient-to-r from-green-400/90 to-cyan-500/90 text-white":"hover:bg-slate-800"),children:[(0,K.jsx)(h,{size:18})," AI 接口配置"]}),(0,K.jsxs)("button",{onClick:()=>{Oe("template"),W(null)},className:"w-full flex items-center gap-2 px-3 py-2.5 rounded-lg transition-colors text-sm "+("template"===G?"bg-gradient-to-r from-green-400/90 to-cyan-500/90 text-white":"hover:bg-slate-800"),children:[(0,K.jsx)(f,{size:18})," 多模板库"]}),(0,K.jsxs)("button",{onClick:()=>{Oe("platforms"),W(null)},className:"w-full flex items-center gap-2 px-3 py-2.5 rounded-lg transition-colors text-sm "+("platforms"===G?"bg-gradient-to-r from-green-400/90 to-cyan-500/90 text-white":"hover:bg-slate-800"),children:[(0,K.jsx)(w,{size:18})," 发布平台管理"]}),(0,K.jsxs)("button",{onClick:()=>{Oe("newsSources"),W(null)},className:"w-full flex items-center gap-2 px-3 py-2.5 rounded-lg transition-colors text-sm "+("newsSources"===G?"bg-gradient-to-r from-green-400/90 to-cyan-500/90 text-white":"hover:bg-slate-800"),children:[(0,K.jsx)(p,{size:18})," 新闻源管理"]}),(0,K.jsxs)("button",{onClick:()=>{Oe("orders"),W(null)},className:"w-full flex items-center gap-2 px-3 py-2.5 rounded-lg transition-colors text-sm "+("orders"===G?"bg-gradient-to-r from-green-400/90 to-cyan-500/90 text-white":"hover:bg-slate-800"),children:[(0,K.jsx)(_,{size:18})," 发文订单处理"]}),(0,K.jsxs)("button",{onClick:()=>{Oe("tenants"),W(null)},className:"w-full flex items-center gap-2 px-3 py-2.5 rounded-lg transition-colors text-sm "+("tenants"===G?"bg-gradient-to-r from-green-400/90 to-cyan-500/90 text-white":"hover:bg-slate-800"),children:[(0,K.jsx)(n,{size:18})," 租户管理"]})]}),(0,K.jsx)("div",{className:"p-3 border-t border-slate-800",children:(0,K.jsxs)("button",{onClick:v,className:"w-full flex items-center gap-2 px-3 py-2.5 rounded-lg hover:bg-red-500 hover:text-white transition-colors text-sm",children:[(0,K.jsx)(y,{size:18})," 退出登录"]})})]}),(0,K.jsxs)("main",{className:O?"":"flex-1 flex flex-col h-screen overflow-hidden",children:[!O&&(0,K.jsxs)("header",{className:"h-16 bg-white shadow-sm flex items-center justify-between px-8 z-10 shrink-0",children:[(0,K.jsxs)("h2",{className:"text-xl font-semibold text-gray-800 flex items-center gap-2",children:["clients"===G&&J&&(0,K.jsx)("button",{onClick:()=>W(null),className:"text-sm text-blue-600 hover:text-blue-800 bg-blue-50 px-2 py-1 rounded border border-blue-200 mr-2",children:"← 返回列表"}),"clients"===G&&(J?`【${J.name}】后台业务数据明细`:"全全局子账号生命周期与云资产管控"),"api"===G&&"平台 API 接口全局配置","template"===G&&"全局预设文章模板库 (下发至子账号)","platforms"===G&&"分发媒体平台管理 (下发至子账号)","newsSources"===G&&"新闻源发布管理 (下发至子账号)","orders"===G&&"客户新闻æ
1ºå‘布发文订单处理","tenants"===G&&"多租户贴牌账号管理"]}),(0,K.jsxs)("div",{className:"flex items-center gap-3 text-sm text-gray-600",children:[(0,K.jsx)("span",{className:"bg-slate-100 p-2 rounded-full",children:(0,K.jsx)(A,{size:16})}),"超级管理员 (主账号)"]})]}),(0,K.jsxs)("div",{className:O?"":"flex-1 overflow-y-auto p-8 flex flex-col",children:[(0,K.jsxs)("div",{className:O?"":"flex-1",children:["clients"===G&&!J&&(0,K.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden",children:[(0,K.jsxs)("div",{className:"p-4 border-b flex justify-between items-center bg-gray-50",children:[(0,K.jsx)("input",{type:"text",placeholder:"搜索子账号名称...",className:"border border-gray-300 rounded-md px-3 py-1.5 text-sm outline-none focus:border-blue-500"}),(0,K.jsxs)("button",{onClick:()=>ge(!0),className:"bg-gradient-to-r from-[#1a3a6b] to-[#2563eb] text-white px-4 py-1.5 rounded-md text-sm hover:from-[#0f2847] hover:to-[#1a3a6b] flex items-center gap-1",children:[(0,K.jsx)(j,{size:16})," 添加子账号"]})]}),(0,K.jsxs)("table",{className:"w-full text-left text-sm text-gray-600",children:[(0,K.jsx)("thead",{className:"bg-slate-50 text-gray-700 border-b border-gray-200",children:(0,K.jsxs)("tr",{children:[(0,K.jsx)("th",{className:"p-4",children:"登录账号"}),(0,K.jsx)("th",{className:"p-4",children:"企业名称"}),(0,K.jsx)("th",{className:"p-4",children:"到期时间与状态"}),(0,K.jsx)("th",{className:"p-4",children:"算力 (已消耗/总计)"}),(0,K.jsx)("th",{className:"p-4",children:"发稿余额 (元)"}),(0,K.jsx)("th",{className:"p-4 text-center",children:"操作"})]})}),(0,K.jsx)("tbody",{children:We.map(e=>{const s=new Date>new Date(e.expireDate);return(0,K.jsxs)("tr",{className:"border-b border-gray-100 hover:bg-slate-50",children:[(0,K.jsx)("td",{className:"p-4 font-mono text-gray-500",children:e.username}),(0,K.jsx)("td",{className:"p-4 font-medium text-gray-800",children:e.name}),(0,K.jsx)("td",{className:"p-4",children:(0,K.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,K.jsx)("span",{className:"text-gray-600 font-mono text-xs",children:e.expireDate}),(0,K.jsx)("span",{className:"px-2 py-0.5 rounded text-[10px] w-max font-bold "+(e.status!==I.ENABLED||s?"bg-red-100 text-red-700":"bg-blue-100 text-blue-700"),children:e.status===I.DISABLED?"已被手动停用":s?"已过期停用":"账号正常"})]})}),(0,K.jsx)("td",{className:"p-4",children:(0,K.jsxs)("div",{className:"flex items-center gap-2",children:[(0,K.jsx)("span",{className:"font-semibold "+(e.usedQuota+20>e.quota?"text-red-600":"text-blue-700"),children:e.usedQuota})," / ",e.quota]})}),(0,K.jsxs)("td",{className:"p-4 font-bold text-orange-500",children:["Â¥",(e.balance||0).toFixed(2)]}),(0,K.jsxs)("td",{className:"p-4 text-center flex justify-center gap-3",children:[(0,K.jsx)("button",{onClick:()=>(e=>{de(e),ie(e.quota),xe(e.balance||0),ue(e.status||I.ENABLED),pe(e.expireDate||"2099-12-31")})(e),className:"text-blue-600 hover:underline text-xs bg-blue-50 px-2 py-1 rounded border border-blue-200",children:"管理启停与资产"}),(0,K.jsx)("button",{onClick:()=>W(e),className:"text-blue-600 hover:underline text-xs border border-blue-200 px-2 py-1 rounded bg-blue-50",children:"云端数据透视"})]})]},e.username)})})]})]}),"orders"===G&&(0,K.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden",children:[(0,K.jsx)("div",{className:"p-4 border-b bg-gray-50 text-sm",children:(0,K.jsxs)("div",{className:"flex flex-wrap gap-4 items-center justify-between",children:[(0,K.jsxs)("div",{className:"flex gap-4 items-center",children:[(0,K.jsx)("span",{className:"font-bold text-gray-800",children:"全部客户发稿订单"}),(0,K.jsxs)("span",{className:"text-gray-500",children:["待处理/处理中: ",(0,K.jsx)("span",{className:"text-orange-500 font-bold",children:ze.filter(e=>"待处理"===e.status||"处理中"===e.status).length})," 笔"]})]}),(0,K.jsx)("div",{className:"flex gap-2",children:["","待处理","处理中","已发布","已失败","已取消"].map(e=>(0,K.jsx)("button",{onClick:()=>{$e(e),Te(1)},className:"px-3 py-1 rounded text-xs font-medium transition-colors "+(Le===e?"bg-blue-600 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"),children:e||"全部"},e))})]})}),(0,K.jsxs)("table",{className:"w-full text-left text-sm text-gray-600",children:[(0,K.jsx)("thead",{className:"bg-slate-50 text-gray-700 border-b border-gray-200",children:(0,K.jsxs)("tr",{children:[(0,K.jsx)("th",{className:"p-4 w-12 text-center",children:"序号"}),(0,K.jsx)("th",{className:"p-4 w-24",children:"子账号"}),(0,K.jsx)("th",{className:"p-4 w-1/3",children:"提交文章标题"}),(0,K.jsx)("th",{className:"p-4 w-32",children:"指定新闻源媒体"}),(0,K.jsx)("th",{className:"p-4 w-24",children:"扣费(元)"}),(0,K.jsx)("th",{className:"p-4 w-36",children:"提交时间"}),(0,K.jsx)("th",{className:"p-4 w-24 text-center",children:"状态"}),(0,K.jsx)("th",{className:"p-4 text-center",children:"发稿操作"})]})}),(0,K.jsx)("tbody",{children:De?(0,K.jsx)("tr",{children:(0,K.jsx)("td",{colSpan:"8",className:"p-12 text-center text-gray-400",children:"加载中..."})}):0===ze.length?(0,K.jsx)("tr",{children:(0,K.jsx)("td",{colSpan:"8",className:"p-12 text-center text-gray-400",children:"目前没有任何客户提交发稿订单"})}):ze.map((e,s)=>{const t="待处理"===e.status||"处理中"===e.status,r="已发布"===e.status;return"已失败"===e.status||e.status,(0,K.jsxs)("tr",{className:"border-b border-gray-100 hover:bg-slate-50",children:[(0,K.jsx)("td",{className:"p-4 text-center text-gray-400",children:(Ie-1)*Me+s+1}),(0,K.jsx)("td",{className:"p-4 font-bold text-gray-700",children:e.submitter_name||e.submitter_username||"-"}),(0,K.jsx)("td",{className:"p-4",children:(0,K.jsxs)("span",{onClick:()=>Se(e),className:"font-medium text-blue-700 hover:underline cursor-pointer flex items-center gap-1",children:[(0,K.jsx)(b,{size:14})," ",e.title]})}),(0,K.jsx)("td",{className:"p-4 font-bold text-blue-800",children:e.media_name||e.current_media_name||"-"}),(0,K.jsxs)("td",{className:"p-4 font-bold text-orange-500",children:["Â¥",Number(e.amount).toFixed(2)]}),(0,K.jsx)("td",{className:"p-4 text-gray-500 text-xs",children:new Date(e.submitted_at).toLocaleStr
1ing("zh-CN")}),(0,K.jsx)("td",{className:"p-4 text-center",children:(0,K.jsx)("span",{className:"px-2 py-1 rounded text-xs font-medium "+(t?"bg-orange-100 text-orange-700 animate-pulse":r?"bg-blue-100 text-blue-700":"bg-red-100 text-red-700"),children:e.status})}),(0,K.jsx)("td",{className:"p-4 text-center",children:t?(0,K.jsxs)("div",{className:"flex justify-center gap-2",children:[(0,K.jsxs)("button",{onClick:()=>{we(e),_e("")},className:"bg-gradient-to-r from-[#1a3a6b] to-[#2563eb] text-white hover:from-[#0f2847] hover:to-[#1a3a6b] px-3 py-1 rounded text-xs shadow-sm flex items-center gap-1",children:[(0,K.jsx)(C,{size:14})," 发布成功"]}),(0,K.jsxs)("button",{onClick:()=>(e=>{Ue(e),Ke("")})(e),className:"bg-white border border-red-300 text-red-500 hover:bg-red-50 px-3 py-1 rounded text-xs shadow-sm flex items-center gap-1",children:[(0,K.jsx)(x,{size:14})," 驳回退款"]})]}):r?e.publish_url?(0,K.jsxs)("a",{href:e.publish_url,target:"_blank",rel:"noreferrer",className:"text-blue-600 hover:underline text-xs flex items-center justify-center gap-1",children:[(0,K.jsx)(u,{size:14})," 检查已发链接"]}):(0,K.jsx)("span",{className:"text-gray-400 text-xs",children:"无链接"}):"已失败"===e.status?(0,K.jsx)("span",{className:"text-gray-400 text-xs cursor-help",title:e.failure_reason||"主账号驳回",children:"已驳回退款"}):(0,K.jsx)("span",{className:"text-gray-400 text-xs",children:"已取消"})})]},e.id)})})]}),Pe>0&&(0,K.jsxs)("div",{className:"p-4 border-t border-gray-200 flex justify-center items-center gap-2",children:[(0,K.jsx)("button",{onClick:()=>Te(e=>Math.max(1,e-1)),disabled:1===Ie,className:"px-3 py-1.5 border border-gray-300 rounded text-sm text-gray-600 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"上一页"}),(()=>{const e=Math.ceil(Pe/Me),s=[];if(e<=7)for(let t=1;t<=e;t++)s.push(t);else Ie<=4?s.push(1,2,3,4,5,"...",e):Ie>=e-3?s.push(1,"...",e-4,e-3,e-2,e-1,e):s.push(1,"...",Ie-1,Ie,Ie+1,"...",e);return s.map((e,s)=>"..."===e?(0,K.jsx)("span",{className:"px-2 text-gray-400",children:"···"},`dots-${s}`):(0,K.jsx)("button",{onClick:()=>Te(e),className:"min-w-[32px] px-2 py-1.5 border rounded text-sm font-medium transition-colors "+(Ie===e?"bg-blue-600 text-white border-blue-600":"border-gray-300 text-gray-600 hover:bg-gray-50"),children:e},e))})(),(0,K.jsx)("button",{onClick:()=>Te(e=>Math.min(Math.ceil(Pe/Me),e+1)),disabled:Ie>=Math.ceil(Pe/Me),className:"px-3 py-1.5 border border-gray-300 rounded text-sm text-gray-600 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"下一页"}),(0,K.jsxs)("span",{className:"ml-4 text-sm text-gray-500",children:["共 ",Pe," 条, 第 ",Ie," / ",Math.ceil(Pe/Me)," 页"]})]})]}),"clients"===G&&J&&(0,K.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden mb-6",children:[(0,K.jsxs)("div",{className:"p-4 border-b bg-gray-50 flex gap-4 text-sm text-gray-600",children:[(0,K.jsx)("div",{className:"font-bold text-gray-800 border-r pr-4",children:"云端数据透视面板"}),(0,K.jsxs)("div",{children:["子账号: ",(0,K.jsx)("span",{className:"font-bold text-blue-600",children:J.username})]}),(0,K.jsxs)("div",{children:["云端已存长尾词数: ",(0,K.jsxs)("span",{className:"font-bold text-blue-600",children:[(J.keywords||[]).length," 个"]})]}),(0,K.jsxs)("div",{children:["云端已存文章数: ",(0,K.jsxs)("span",{className:"font-bold text-blue-600",children:[J.articles.length," 篇"]})]})]}),(0,K.jsxs)("div",{className:"p-4",children:[(0,K.jsx)("h4",{className:"text-sm font-bold text-gray-700 mb-2 border-l-4 border-blue-600 pl-2",children:"提取出的业务长尾词"}),(0,K.jsx)("div",{className:"flex flex-wrap gap-2 mb-6",children:J.keywords&&0!==J.keywords.length?J.keywords.map((e,s)=>(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 text-blue-700 px-3 py-1 rounded-full text-xs font-medium",children:e},s)):(0,K.jsx)("span",{className:"text-xs text-gray-400",children:"客户暂未配置任何关键词"})}),(0,K.jsx)("h4",{className:"text-sm font-bold text-gray-700 mb-2 border-l-4 border-blue-600 pl-2",children:"生成的优质文章存档"}),(0,K.jsxs)("table",{className:"w-full text-left text-sm text-gray-600 border border-gray-100",children:[(0,K.jsx)("thead",{className:"bg-slate-50 text-gray-700 border-b border-gray-200",children:(0,K.jsxs)("tr",{children:[(0,K.jsx)("th",{className:"p-3 w-16",children:"序号"}),(0,K.jsx)("th",{className:"p-3",children:"文章标题 (AI直出并同步云端)"}),(0,K.jsx)("th",{className:"p-3 text-center",children:"状态"}),(0,K.jsx)("th",{className:"p-3 text-center",children:"操作"})]})}),(0,K.jsx)("tbody",{children:0===J.articles.length?(0,K.jsx)("tr",{children:(0,K.jsx)("td",{colSpan:"4",className:"p-12 text-center text-gray-400",children:"该客户暂未生成任何文章"})}):J.articles.map((e,s)=>(0,K.jsxs)("tr",{className:"border-b border-gray-100 hover:bg-slate-50",children:[(0,K.jsx)("td",{className:"p-3",children:s+1}),(0,K.jsx)("td",{className:"p-3 font-medium text-gray-800",children:e.title}),(0,K.jsx)("td",{className:"p-3 text-center",children:(0,K.jsx)("span",{className:"bg-blue-50 text-blue-600 px-2 py-1 rounded text-xs",children:e.status})}),(0,K.jsx)("td",{className:"p-3 text-center",children:(0,K.jsx)("button",{onClick:()=>Se(e),className:"text-blue-600 text-xs border border-blue-200 px-2 py-1 rounded hover:bg-blue-50",children:"预览内容"})})]},e.id))})]})]})]}),"api"===G&&(0,K.jsx)(M,{showToast:k}),"platforms"===G&&(0,K.jsxs)("div",{className:"bg-white p-8 rounded-xl shadow-sm border border-gray-200 max-w-4xl",children:[(0,K.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,K.jsxs)("div",{children:[(0,K.jsx)("h3",{className:"text-lg font-medium text-gray-800 border-l-4 border-blue-600 pl-3",children:"发布平台与跳转链接管理"}),(0,K.jsxs)("p",{className:"text-sm text-gray-500 mt-2 pl-4",children:["在此处配置平台后,子账号将在【发布系统】中看到这些平台按钮。子账号",(0,K.jsx)("span",{className:"font-bold text-red-500",children:"无法看到"}),'底层真实URL,点击按钮即会"暗链"自动跳转。']})]}),(0,K.jsxs)("button",{onClick:()=>Y([...X,{id:"p_"+Date.now(),name:"新建分发平台",url:"https://"}]),className:"text-sm bg-gradient-to-r from-[#1a3a6b] to-[#2563eb] text-white px-4 py-2 rounded-lg hover:from-[#0f2847] hover:to-[#1a3a6b] flex items-center gap-1 shadow-sm",children:[(0,K.jsx)(j,{size:16})," 添加发布平台"]})]}),(0,K.jsx)("div",{className:"space-y-3 mb-8",children:0===X.length?(0,K.jsx)("div",{className:"text-center p-8 text-gray-400 border border-dashed border-gray-300 rounded-lg",children:"暂无平台配置"}):X.map(e=>(0,K.jsxs)("div",{className:"flex items-center gap-4 p-4 rounded-lg border border-gray-200 bg-gray-50",children:[(0,K.jsxs)("div",{className:"w-1/3",children:[(0,K.jsxs)("label",{className:"block text-xs text-gray-500 mb-1",children:["平台对外展示名称 ",(0,K.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,K.jsx)("input",{type:"text",value:e.name,onChange:s=>Qe(e.id,"name",s.target.value),className:"w-full border border-gray-300 rounded px-3 py-2 outline-none focus:border-blue-500 text-sm font-medium text-gray-800",placeholder:"如:头条号创作者后台"})]}),(0,K.jsxs)("div",{className:"flex-1",children:[(0,K.jsxs)("label",{className:"block text-xs text-gray-500 mb-1",children:["底层跳转链接 (隐藏 URL) ",(0,K.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,K.jsxs)("div",{className:"relative",children:[(0,K.jsx)(g,{size:14,className:"absolute left-3 top-3 text-gray-400"}),(0,K.jsx)("input",{type:"url",value:e.url,onChange:s=>Qe(e.id,"url",s.target.value),className:"w-full border border-gray-300 rounded px-3 pl-8 py-2 outline-none focus:border-blue-500 text-sm text-gray-600 font-mono",placeholder:"https://..."})]})]}),(0,K.jsx)("div",{className:"flex items-center pt-5 px-2",children:(0,K.jsx)("button",{onClick:()=>{return s=e.id,Y(X.filter(e=>e.id!==s));var s},className:"text-gray-400 hover:text-red-500",title:"删除平台",children:(0,K.jsx)(S,{size:18})})})]},e.id))}),(0,K.jsx)("div",{className:"pt-4 border-t border-gray-100 text-right",children:(0,K.jsx)("button",{onClick:()=>{s(e=>({...e,publishPlatforms:X})),k("分发平台配置已保存,已同步云端及下发至子账号!")},className:"bg-gradient-to-r from-[#1a3a6b] to-[#2563eb] hover:from-[#0f2847] hover:to-[#1a3a6b] text-white px-8 py-2.5 rounded-lg shadow font-medium",children:"全量保存并同步云端下发"})})]}),"newsSources"===G&&(0,K.jsxs)("div",{className:"bg-white p-8 rounded-xl shadow-sm border border-gray-200",children:[(0,K.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,K.jsxs)("div",{children:[(0,K.jsx)("h3",{className:"text-lg font-medium text-gray-800 border-l-4 border-blue-600 pl-3",children:"新闻源发布媒体管理"}),(0,K.jsx)("p",{className:"text-sm text-gray-500 mt-2 pl-4",children:"配置新闻源媒体,子账号可在发布系统中检索并消耗余额进行发稿下单。修改即时生效,无需手动保存。"})]}),(0,K.jsxs)("button",{onClick:async()=>{le(!0);try{const e=await E("/media-platforms",{method:"POST",body:{name:"",category:"新闻资讯",region:"全国",price:0,url:"",index_type:"网页收录",description:""}});e?.success?await Re():k(e?.error||"添加失败")}catch(e){k("添加媒体失败")}finally{le(!1)}},disabled:ae,className:"text-sm bg-gradient-to-r from-[#1a3a6b] to-[#2563eb] text-white px-4 py-2 rounded-lg hover:from-[#0f2847] hover:to-[#1a3a6b] flex items-center gap-1 shadow-sm disabled:opacity-50",children:[(0,K.jsx)(j,{size:16})," 添加新闻源媒体"]})]}),te?(0,K.jsx)("div",{className:"text-center py-12 text-gray-400",children:"加载中..."}):(0,K.jsx)("div",{className:"overflow-x-auto border border-gray-200 rounded-lg mb-8",children:(0,K.jsxs)("table",{className:"w-full text-left text-sm whitespace-nowrap min-w-[1100px]",children:[(0,K.jsx)("thead",{className:"bg-gray-50 text-gray-700 border-b border-gray-200",children:(0,K.jsxs)("tr",{children:[(0,K.jsx)("th",{className:"p-3 w-28",children:"媒体类型"}),(0,K.jsx)("th",{className:"p-3 w-24",children:"区域"}),(0,K.jsx)("th",{className:"p-3 w-32",children:"媒体名称"}),(0,K.jsx)("th",{className:"p-3 w-24",children:"扣费价格(元)"}),(0,K.jsx)("th",{className:"p-3 w-40",children:"网站案例(URL)"}),(0,K.jsx)("th",{className:"p-3 w-32",children:"收录类型"}),(0,K.jsx)("th",{className:"p-3 w-48",children:"备注"}),(0,K.jsx)("th",{className:"p-3 w-20 text-center",children:"状态"}),(0,K.jsx)("th",{className:"p-3 w-16 text-center",children:"操作"})]})}),(0,K.jsx)("tbody",{children:0===ee.length?(0,K.jsx)("tr",{children:(0,K.jsx)("td",{colSpan:"9",className:"p-12 text-center text-gray-400",children:"暂无新闻源媒体,请添加"})}):ee.map(e=>(0,K.jsxs)("tr",{className:"border-b border-gray-100 hover:bg-gray-50 "+("已停用"===e.status?"opacity-50":""),children:[(0,K.jsx)("td",{className:"p-2",children:(0,K.jsx)("input",{type:"text",value:e.category||"",onChange:s=>Ge(e.id,"category",s.target.value),className:"w-full border border-gray-300 rounded px-2 py-1 outline-none focus:border-blue-500 text-sm",placeholder:"新闻资讯"})}),(0,K.jsx)("td",{className:"p-2",children:(0,K.jsx)("input",{type:"text",value:e.region||"",onChange:s=>Ge(e.id,"region",s.target.value),className:"w-full border border-gray-300 rounded px-2 py-1 outline-none focus:border-blue-500 text-sm",placeholder:"全国"})}),(0,K.jsx)("td",{className:"p-2",children:(0,K.jsx)("input",{type:"text",value:e.name||"",onChange:s=>Ge(e.id,"name",s.target.value),className:"w-full border border-gray-300 rounded px-2 py-1 outline-none focus:border-blue-500 text-sm font-medium",placeholder:"媒体名称"})}),(0,K.jsx)("td",{className:"p-2",children:(0,K.jsx)("input",{type:"number",value:e.price??0,onChange:s=>Ge(e.id,"price",parseFloat(s.target.value)||0),className:"w-full border border-gray-300 rounded px-2 py-1 outline-none focus:border-blue-500 text-sm text-orange-600 font-bold"})}),(0,K.jsx)("td",{className:"p-2",children:(0,K.jsx)("input",{type:"url",value:e.url||"",onChange:s=>Ge(e.id,"url",s.target.value),className:"w-full border border-gray-300 rounded px-2 py-1 outline-none focus:border-blue-500 text-sm font-mono text-gray-500",placeholder:"http://..."})}),(0,K.jsx)("td",{className:"p-2",children:(0,K.jsx)("input",{type:"text",value:e.index_type||"",onChange:s=>Ge(e.id,"index_type",s.target.value),className:"w-full border border-gray-300 rounded px-2 py-1 outline-none focus:border-blue-500 text-sm",placeholder:"网页收录"})}),(0,K.jsx)("td",{className:"p-2",children:(0,K.jsx)("input",{type:"text",value:e.description||"",onChange:s=>Ge(e.id,"description",s.target.value),className:"w-full border border-gray-300 rounded px-2 py-1 outline-none focus:border-blue-500 text-sm text-gray-500",placeholder:"备注信息"})}),(0,K.jsx)("td",{className:"p-2 text-center",children:(0,K.jsx)("button",{onClick:()=>Ge(e.id,"status","启用"===e.status?"已停用":"启用"),className:"px-2 py-1 rounded text-xs font-medium "+("启用"===e.status?"bg-green-100 text-green-700":"bg-gray-100 text-gray-500"),children:"启用"===e.status?"启用":"已停用"})}),(0,K.jsx)("td",{className:"p-2 text-center",children:(0,K.jsx)("button",{onClick:()=>(async e=>{le(!0);try{const s=await E(`/media-platforms/${e}`,{method:"DELETE"});s?.success?await Re():k(s?.error||"删除失败")}catch(s){k("删除媒体失败")}finally{le(!1)}})(e.id),className:"text-gray-400 hover:text-red-500 p-1",disabled:ae,children:(0,K.jsx)(S,{size:16,className:"mx-auto"})})})]},e.id))})]})})]}),"template"===G&&(0,K.jsxs)("div",{className:"flex gap-6 h-[calc(100vh-180px)]",children:[(0,K.jsxs)("div",{className:"w-1/3 bg-white rounded-xl shadow-sm border border-gray-200 flex flex-col overflow-hidden shrink-0",children:[(0,K.jsxs)("div",{className:"p-4 border-b border-gray-100 flex justify-between items-center bg-gray-50",children:[(0,K.jsx)("span",{className:"font-bold text-gray-700",children:"模板类目分组"}),(0,K.jsxs)("button",{onClick:()=>{const e={id:"cat_"+Date.now(),mainCategory:"新建大类",subCategory:"新建小类",templates:[{id:"t_"+Date.now(),name:"新建文章模板",content:"请输入模板系统指令...\n本次核心撰写长尾词: {当前撰写主词}"}]};s(s=>({...s,templates:[...s.templates,e]})),Ne(e)},className:"text-sm bg-white border border-blue-600 text-blue-600 px-3 py-1 rounded hover:bg-blue-50 flex items-center gap-1",children:[(0,K.jsx)(j,{size:14})," 新增类目"]})]}),(0,K.jsxs)("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:[e.templates.map(e=>(0,K.jsxs)("div",{onClick:()=>Ne(e),className:"p-3 rounded-lg border cursor-pointer transition-all flex flex-col gap-1 group "+(je?.id===e.id?"bg-blue-50 border-blue-500":"border-gray-200 hover:border-blue-300"),children:[(0,K.jsxs)("div",{className:"flex justify-between items-center",children:[(0,K.jsx)("span",{className:"font-bold "+(je?.id===e.id?"text-blue-800":"text-gray-700"),children:e.subCategory}),(0,K.jsx)("button",{onClick:t=>{var r;t.stopPropagation(),r=e.id,s(e=>{const s=e.templates.filter(e=>e.id!==r);return je?.id===r&&Ne(s[0]||null),{...e,templates:s}}),k("整个类目及内部模板已删除")},className:"text-red-300 hover:text-red-600 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,K.jsx)(S,{size:16})})]}),(0,K.jsxs)("div",{className:"flex justify-between items-center mt-1",children:[(0,K.jsx)("span",{className:"text-xs bg-gray-100 px-1.5 py-0.5 rounded text-gray-500",children:e.mainCategory}),(0,K.jsxs)("span",{className:"text-xs text-blue-600 font-medium",children:["包含 ",e.templates.length," 个模板"]})]})]},e.id)),0===e.templates.length&&(0,K.jsx)("div",{className:"text-center text-gray-400 text-sm mt-10",children:"暂无类目,请新增"})]})]}),(0,K.jsx)("div",{className:"flex-1 bg-white rounded-xl shadow-sm border border-gray-200 flex flex-col overflow-hidden",children:je?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("div",{className:"p-6 border-b border-gray-100 bg-gray-50",children:(0,K.jsxs)("div",{className:"flex gap-4",children:[(0,K.jsxs)("div",{className:"flex-1",children:[(0,K.jsxs)("label
1",{className:"block text-sm font-medium text-gray-700 mb-1",children:["大类目名称 ",(0,K.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,K.jsx)("input",{type:"text",value:je.mainCategory,onChange:e=>Ne({...je,mainCategory:e.target.value}),className:"w-full border border-gray-300 rounded-lg p-2 focus:ring-2 focus:ring-blue-500 outline-none text-sm",placeholder:"例如:通用营销"})]}),(0,K.jsxs)("div",{className:"flex-1",children:[(0,K.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["小类目名称 ",(0,K.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,K.jsx)("input",{type:"text",value:je.subCategory,onChange:e=>Ne({...je,subCategory:e.target.value}),className:"w-full border border-gray-300 rounded-lg p-2 focus:ring-2 focus:ring-blue-500 outline-none text-sm",placeholder:"例如:品牌宣传"})]})]})}),(0,K.jsxs)("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[(0,K.jsxs)("div",{className:"flex justify-between items-center",children:[(0,K.jsx)("h4",{className:"font-bold text-gray-800 border-l-4 border-blue-600 pl-2",children:"该类目下的具体文章模板配置"}),(0,K.jsxs)("button",{onClick:()=>Ne(e=>({...e,templates:[...e.templates,{id:"t_"+Date.now(),name:"新增模板选项",content:""}]})),className:"text-sm text-blue-600 hover:text-blue-800 flex items-center gap-1 font-medium bg-blue-50 px-3 py-1 rounded-md",children:[(0,K.jsx)(j,{size:14})," 添加一个新模板选项"]})]}),je.templates.map(e=>(0,K.jsxs)("div",{className:"p-5 border border-gray-200 rounded-xl bg-white shadow-sm relative",children:[(0,K.jsx)("div",{className:"absolute top-4 right-4",children:(0,K.jsx)("button",{onClick:()=>{return s=e.id,Ne(e=>({...e,templates:e.templates.filter(e=>e.id!==s)}));var s},className:"text-gray-400 hover:text-red-500",title:"删除该模板",children:(0,K.jsx)(S,{size:18})})}),(0,K.jsxs)("div",{className:"mb-4 pr-8",children:[(0,K.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["模板对外名称 (供子账号选择时显示) ",(0,K.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,K.jsx)("input",{type:"text",value:e.name,onChange:s=>He(e.id,"name",s.target.value),className:"w-full border border-gray-300 rounded-lg p-2 focus:ring-2 focus:ring-blue-500 outline-none font-bold text-blue-800 bg-blue-50/30",placeholder:"例如:默认营销标准版"})]}),(0,K.jsxs)("div",{children:[(0,K.jsxs)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:["文章底层提示词指令 / Prompt (对子账号",(0,K.jsx)("span",{className:"text-red-500 font-bold",children:"完全隐藏"}),")"]}),(0,K.jsx)("textarea",{rows:5,value:e.content,onChange:s=>He(e.id,"content",s.target.value),className:"w-full border border-gray-300 rounded-lg p-3 focus:ring-2 focus:ring-blue-500 outline-none font-mono text-sm leading-relaxed resize-none bg-slate-50",placeholder:"请输入告诉AI应该如何利用下面这些企业变量去写文章的指令..."})]})]},e.id)),0===je.templates.length&&(0,K.jsx)("div",{className:"text-center p-8 text-gray-400 border border-dashed border-gray-300 rounded-lg",children:"请点击右上方按钮添加模板选项"})]}),(0,K.jsxs)("div",{className:"p-4 border-t border-gray-100 bg-white flex justify-between items-center shrink-0",children:[(0,K.jsxs)("div",{className:"text-xs text-blue-600 flex gap-2 items-center flex-wrap max-w-2xl",children:[(0,K.jsx)("span",{className:"text-gray-500 font-bold",children:"注入变量大全:"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{公司名称}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{所处行业}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{竞争对手}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{联系电话}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{官网地址}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{企业定位}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{企业介绍}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{信任背书}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{客户画像}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{客户痛点}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{产品介绍}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{产品服务}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{售后服务}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{客户案例}"}),(0,K.jsx)("span",{className:"bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded",children:"{其他信息}"}),(0,K.jsx)("span",{className:"bg-orange-50 border border-orange-200 text-orange-700 px-1.5 py-0.5 rounded font-bold",children:"{当前撰写主词}"})]}),(0,K.jsx)("button",{onClick:()=>je.mainCategory.trim()&&je.subCategory.trim()?0===je.templates.length?k("请至少为该类目添加一个具体文章模板"):(s(e=>{const s=e.templates.map(e=>e.id===je.id?je:e);return{...e,templates:s}}),void k("类目及模板配置已保存并同步至云端!")):k("大类目和小类目不能为空"),className:"bg-gradient-to-r from-[#1a3a6b] to-[#2563eb] hover:from-[#0f2847] hover:to-[#1a3a6b] text-white px-8 py-3 rounded-lg shadow font-medium shrink-0 ml-4",children:"同步保存至云端数据库"})]})]}):(0,K.jsx)("div",{className:"flex-1 flex items-center justify-center text-gray-400",children:"请在左侧选择或新增一个类目分组"})})]}),"tenants"===G&&(0,K.jsx)("div",{children:"brandConfig"===L?(0,K.jsx)(B,{showToast:k}):"quotaStats"===L?(0,K.jsx)(U,{showToast:k}):"subAccountSummary"===L?(0,K.jsx)(U,{showSubAccountSummary:!0,showToast:k}):(0,K.jsxs)("div",{className:"space-y-6",children:[(0,K.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,K.jsxs)("button",{onClick:()=>Q(T.dashboard()),className:"flex items-center gap-2 px-4 py-2 rounded-lg text-sm transition-colors "+(L?"bg-gray-100 text-gray-600 hover:bg-gray-200":"bg-gradient-to-r from-[#1a3a6b] to-[#2563eb] text-white"),children:[(0,K.jsx)(D,{size:16})," 租户列表"]}),(0,K.jsxs)("button",{onClick:()=>Q("/admin/tenants.html?detail=subAccountSummary"),className:"flex items-center gap-2 px-4 py-2 rounded-lg text-sm transition-colors "+("subAccountSummary"===L?"bg-gradient-to-r from-[#1a3a6b] to-[#2563eb] text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"),children:[(0,K.jsx)(d,{size:16})," 子账号消耗明细"]})]}),(0,K.jsx)($,{showToast:k}),(0,K.jsx)(U,{showAllTenants:!0,showToast:k})]})})]}),(0,K.jsx)("div",{className:"mt-8 pt-4 border-t border-gray-200 text-xs text-gray-400 shrink-0",children:"版权所有©东莞森辰电子商务有限公司"})]})]})]})};export{O as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.