import{u as e,a,r as l,b as t,s as o,o as d,d as s,e as r,f as i,h as u,w as n,g as m,j as p,k as c,i as f,n as b,E as v,q as g}from"./index.286e9b79.js";import{v as h}from"./loading.c49775a6.js";import{E as j,a as x}from"./form.ad10dcd5.js";import{E as y,a as _}from"./tab-pane.1cc0f769.js";import"./form-item.9355e6dc.js";import{E as V}from"./input.31de1b37.js";import{_ as w}from"./page-header.29890ed0.js";/* empty css              */import{T as C,E as k}from"./index.esm.68db7469.js";import{g as E,p as q}from"./http.f588794f.js";import"./_initCloneObject.fb8fbaea.js";import"./strings.8c60bfae.js";import"./event.776e7e11.js";import"./index.ed3ed02e.js";import"./divider.948c4b18.js";const U={class:"card goods-wrap"},F={class:"editor-card"},O={class:"editor-card-box"},T={style:{border:"1px solid #ccc"}},K={class:"tool"},L={class:"tool-box"},M={__name:"editor",setup(M){const N=e(),R=a().query.id;let z=l(!1),A=l(!1),B=l(0),D=l();const G=(e,a)=>{B.value=e.paneName};let H=t({data:{title:"",content:"",sort:0,id:0}});z.value=!1,null!=R&&R>0&&(z.value=!0,E("addons.help/editor",{id:R}).then((e=>{z.value=!1,e.code&&(H.data=e.data)})));const I=t({title:[{required:!0,message:"请输入名称",trigger:"blur"},{min:2,max:60,message:"名称长度请控制在2-60个字符内",trigger:"blur"}],sort:[{required:!0,message:"请输入排序",trigger:"blur"}]}),J=async()=>{D.value&&await D.value.validate(((e,a)=>{A.value=!1,e?(A.value=!0,q("addons.help/editor",H.data).then((e=>{A.value=!1,e.code?(D.value.resetFields(),N.replace("/addons/help/index"),v.success("编辑成功")):v.error(e.msg)})).catch((e=>{v.error(e)}))):v.error("请完善内容")}))},P=()=>{N.go(-1)},Q=o(),S=l("default"),W={excludeKeys:["group-image","group-video","insertLink"]},X={placeholder:"请输入内容..."},Y=e=>{Q.value=e};return d((()=>{const e=Q.value;null!=e&&e.destroy()})),(e,a)=>{const l=w,t=V,o=j,d=y,v=_,E=x,q=g,M=h;return s(),r("div",U,[i(l,{title:"编辑内容"}),u("div",F,[n((s(),p(E,{model:m(H).data,rules:m(I),ref_key:"ruleFormRef",ref:D},{default:c((()=>[u("div",O,[i(v,{modelValue:m(B),"onUpdate:modelValue":a[3]||(a[3]=e=>f(B)?B.value=e:B=e),onTabClick:G},{default:c((()=>[i(d,{label:"基本信息",name:0},{default:c((()=>[i(o,{label:"名称",prop:"title","label-width":"100px"},{default:c((()=>[i(t,{modelValue:m(H).data.title,"onUpdate:modelValue":a[0]||(a[0]=e=>m(H).data.title=e),"show-word-limit":"",maxlength:"60"},null,8,["modelValue"])])),_:1}),i(o,{label:"内容","label-width":"100px"},{default:c((()=>[u("div",T,[i(m(C),{style:{"border-bottom":"1px solid #ccc"},editor:m(Q),defaultConfig:W,mode:m(S)},null,8,["editor","mode"]),i(m(k),{style:{height:"500px","overflow-y":"hidden"},modelValue:m(H).data.content,"onUpdate:modelValue":a[1]||(a[1]=e=>m(H).data.content=e),defaultConfig:X,mode:m(S),onOnCreated:Y},null,8,["modelValue","mode"])])])),_:1}),i(o,{label:"排序",prop:"sort","label-width":"100px"},{default:c((()=>[i(t,{type:"number",modelValue:m(H).data.sort,"onUpdate:modelValue":a[2]||(a[2]=e=>m(H).data.sort=e),modelModifiers:{number:!0},oninput:"if(value.length > 3) value=value.slice(0, 3)"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1},8,["modelValue"])])])),_:1},8,["model","rules"])),[[M,m(z)]])]),u("div",K,[u("div",L,[i(q,{onClick:P},{default:c((()=>[b("取消")])),_:1}),i(q,{type:"primary",loading:m(A),onClick:J},{default:c((()=>[b("保存")])),_:1},8,["loading"])])])])}}};export{M as default};
