diff --git a/cms/admin/src/App.tsx b/cms/admin/src/App.tsx index 955a7e8..34b7716 100644 --- a/cms/admin/src/App.tsx +++ b/cms/admin/src/App.tsx @@ -3,19 +3,20 @@ import { useState, useEffect } from 'react' const API_BASE = '' // 同域,相对路径 const SIDEBAR = [ { key: 'config', label: '1 全局配置' }, - { key: 'home', label: '2 首页模块' }, - { key: 'ameba', label: '3 阿美巴页面' }, - { key: 'evolution', label: '4 企业进化' }, - { key: 'methods', label: '5 方法与能力' }, - { key: 'services', label: '6 产品服务' }, - { key: 'cases', label: '7 案例管理' }, - { key: 'articles', label: '8 认知观察' }, - { key: 'selfcheck', label: '9 自我对照' }, - { key: 'diag_q', label: '10 诊断问卷' }, - { key: 'diag_config', label: '11 诊断配置' }, - { key: 'diag_reports', label: '12 诊断记录' }, - { key: 'diag_leads', label: '13 留资统计' }, - { key: 'contact_leads', label: '14 咨询线索' }, + { key: 'texts', label: '2 全站文案' }, + { key: 'home', label: '3 首页模块' }, + { key: 'ameba', label: '4 阿美巴页面' }, + { key: 'evolution', label: '5 企业进化' }, + { key: 'methods', label: '6 方法与能力' }, + { key: 'services', label: '7 产品服务' }, + { key: 'cases', label: '8 案例管理' }, + { key: 'articles', label: '9 认知观察' }, + { key: 'selfcheck', label: '10 自我对照' }, + { key: 'diag_q', label: '11 诊断问卷' }, + { key: 'diag_config', label: '12 诊断配置' }, + { key: 'diag_reports', label: '13 诊断记录' }, + { key: 'diag_leads', label: '14 留资统计' }, + { key: 'contact_leads', label: '15 咨询线索' }, { key: 'password', label: '⚙ 修改密码' }, ] @@ -66,6 +67,7 @@ export default function App(){

{SIDEBAR.find(s=>s.key===cur)?.label}

内容与布局解耦 · 只改内容不改架构
{cur==='config' && } + {cur==='texts' && } {cur==='home' && } {cur==='ameba' && } {cur==='evolution' && } @@ -85,6 +87,17 @@ export default function App(){ ) } +function Texts({token}:{token:string}){ + const [list,setList]=useState([]) + useEffect(()=>{api('/api/cms/texts',token).then(j=>setList(j.data||[]))},[]) + const update=(i:number,key:string,value:any)=>{const n=[...list]; n[i]={...n[i],[key]:value}; setList(n)} + const save=()=>api('/api/cms/texts',token,{method:'PUT',body:JSON.stringify(list)}).then(j=>alert(j.msg||'保存成功')) + return

全站文案

这里的内容会覆盖首页、阿美巴页和全站行动区的默认文字。保存后刷新前台即可看到。

+ {list.map((it,i)=>