← Back
Editing: default-page.js
import{c as e,r as a,p as l,G as t,q as s,v as o,e as u,A as n,x as r,P as i,y as d,B as m,C as p,F as c,a$ as v,M as f,H as _,aB as y,ay as x,T as j,aj as b,ak as g,D as h}from"./base-lib.js?v=1765440387";import{_ as V}from"./index130.js?v=1765440387";import{iO as C,K as w,iP as B,iQ as k,al as q,b as G}from"./utils-lib.js?v=1765440387";import{p as U}from"./useController4.js?v=1765440387";import"./__commonjsHelpers__.js?v=1765440387";import"./ace.js?v=1765440387";import"./validator.js?v=1765440387";import"./index94.js?v=1765440387";import"./column.js?v=1765440387";import"./useController5.js?v=1765440387";import"./site.js?v=1765440387";import"./useStore3.js?v=1765440387";import"./useController6.js?v=1765440387";const z={class:"flex flex-col"},H={class:"flex items-center justify-between mb-[8px]"},O={key:0},E={class:"h-[44rem] w-full"},F=e({__name:"default-page",setup(e,{expose:F}){const K=G(),P=a("index"),S=a(""),A=a(),D=a("utf-8"),I=a(["utf-8","GBK","GB2312","BIG5"]),M=a(!1),Q=a(!1),R=async()=>{try{Q.value=!0;const{data:e}=await C({default_type:P.value});S.value=e.data[P.value].data,D.value=e.data[P.value].encoding||"utf-8","404"===P.value&&(M.value=Boolean(e.data.auto_create_404)),Q.value=!1}catch(e){}},T=async e=>{Q.value=!0,P.value=e,await R(),Q.value=!1},$=e=>{w({loading:"正在设置,请稍后...",request:B({auto_create:e?"1":"0"}),message:!0})},J=async()=>{const e=await k({default_type:P.value,default_body:S.value,encoding:D.value});K.request(e)};return l(()=>{R()}),F({onRefresh:()=>{P.value="index",R()}}),(e,a)=>{const l=y,C=q,w=x,B=j,k=b,G=g,F=V,K=h,R=t("bt-loading");return s(),o("div",z,[u(C,{type:"card",modelValue:r(P),"onUpdate:modelValue":a[0]||(a[0]=e=>i(P)?P.value=e:null),onChange:T},{default:n(()=>[u(l,{label:"新建网站默认页面",name:"index"}),u(l,{label:"404错误页",name:"404",lazy:!0}),u(l,{label:"网站不存在页",name:"not_found",lazy:!0}),u(l,{label:"网站停用后的提示页",name:"stop",lazy:!0})]),_:1},8,["modelValue"]),u(w,{placement:"top",width:"320","popper-class":"white-popover",trigger:"hover",content:"创建网站时会使用页面模板,不会影响已经存在的网站"},{reference:n(()=>[...a[4]||(a[4]=[d("i",{class:"absolute right-[2rem] top-[2.4rem] svgtofont-el-question-filled text-warning !text-[16px]"},null,-1)])]),_:1}),d("div",H,["404"===r(P)?(s(),o("div",O,[u(B,{modelValue:r(M),"onUpdate:modelValue":a[1]||(a[1]=e=>i(M)?M.value=e:null),onChange:$},{default:n(()=>[...a[5]||(a[5]=[m("创建网站时自动创建404.html页面",-1)])]),_:1},8,["modelValue"])])):p("",!0),a[6]||(a[6]=m(" 提示:Ctrl+F 搜索关键字,Ctrl+S 保存,Ctrl+H 查找替换 ",-1)),u(G,{class:"!w-[16rem]",modelValue:r(D),"onUpdate:modelValue":a[2]||(a[2]=e=>i(D)?D.value=e:null),onChange:J},{default:n(()=>[(s(!0),o(c,null,v(r(I),e=>(s(),f(k,{key:e,value:e,label:e},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_((s(),o("div",E,[u(F,{ref_key:"aceEditor",ref:A,"is-request":!1,modelValue:r(S),"onUpdate:modelValue":a[3]||(a[3]=e=>i(S)?S.value=e:null),editorOption:r(U)(),saveEvent:J,class:"h-[40rem] w-full"},null,8,["modelValue","editorOption"]),u(K,{class:"flex !mt-[12px]",type:"primary",onClick:J},{default:n(()=>[...a[7]||(a[7]=[m("保存",-1)])]),_:1})])),[[R,r(Q)]])])}}});export{F as default};
Save File
Cancel