← Back
Editing: add-redirect2.js
import{G as e,bm as a,bg as l,ag as t,bV as r,k as o,W as d}from"./utils-lib.js?v=VERSION_NUMBER";import{c as s,g as i,e as u,p as m,q as n,M as p,A as c,y as h,x as b,B as v,v as y,a_ as f,F as g,D as V,aj as _,a9 as j,ai as U}from"./base-lib.js?v=VERSION_NUMBER";import{r as w,l as k,m as x,n as L,o as R}from"./useController17.js?v=VERSION_NUMBER";import"./__commonjsHelpers__.js?v=VERSION_NUMBER";import"./site.js?v=VERSION_NUMBER";import"./column.js?v=VERSION_NUMBER";import"./index104.js?v=VERSION_NUMBER";import"./useStore4.js?v=VERSION_NUMBER";const C={class:"flex items-center"},q={class:"flex items-center justify-center checked-button"},B=s({__name:"add-redirect",setup(s,{expose:B}){const E=e=>{D.value.redirectdomain=L.value.map((e=>e.name))},F=e=>{D.value.redirectdomain=[]},{BtForm:A,param:D,submit:G}=e({data:()=>{let e={type:!0,holdpath:!0,domainorpath:"domain",redirecttype:"301",redirectpath:"",tourl:"http://",redirectdomain:[],redirectname:""};if(w.value){const{type:a,holdpath:l,...t}=w.value;Object.assign(e,{type:1===a,holdpath:1===l,...t})}return e},options:e=>i((()=>[{type:"custom",render:()=>u(l,{label:"开启重定向"},{default:()=>[u("div",{class:"flex items-center"},[u(a,{modelValue:e.value.type,"onUpdate:modelValue":a=>e.value.type=a},null),u(l,{label:"保留URL参数",style:"margin-left: 4rem;"},{default:()=>[u(a,{modelValue:e.value.holdpath,"onUpdate:modelValue":a=>e.value.holdpath=a},null)]})])]})},{type:"custom",render:()=>u(l,{label:"重定向类型"},{default:()=>[u("div",{class:"flex items-center"},[u(t,{modelValue:e.value.domainorpath,"onUpdate:modelValue":a=>e.value.domainorpath=a,options:[{label:"域名",value:"domain"},{label:"路径",value:"path"}],style:"width: 15rem;"},null),u(l,{label:"重定向方式"},{default:()=>[u(t,{modelValue:e.value.redirecttype,"onUpdate:modelValue":a=>e.value.redirecttype=a,options:[{label:"301(永久重定向)",value:"301"},{label:"302(临时重定向)",value:"302"}],style:"width: 15rem;"},null)]})])]})},{type:"slots",key:"domain",rules:{tourl:[r({message:"请输入目标URL",trigger:"blur"}),{validator:(e,a,l)=>{if("http://"===a||"https://"===a)l(new Error("请输入目标URL"));else try{new URL(a),l()}catch(t){l(new Error("请输入正确的URL"))}},trigger:["change","input"]}],redirectdomain:[{required:!0,message:"请选择重定向域名",trigger:"change"}],redirectpath:[{required:!0,message:"请输入重定向路径",trigger:"blur"}]}}])),submit:async(e,a)=>(await a(),await k(e.value))});return m(x),B({onConfirm:G}),(e,a)=>{const l=V,t=U,r=_,s=o,i=j,m=d;return n(),p(b(A),{class:"p-[2rem]"},{domain:c((()=>[u(i,{prop:"domain"===b(D).domainorpath?"redirectdomain":"redirectpath",label:"重定向".concat("domain"===b(D).domainorpath?"域名":"路径")},{default:c((()=>[h("div",C,["domain"===b(D).domainorpath?(n(),p(r,{key:0,"collapse-tags":"",multiple:"",style:{width:"15rem"},modelValue:b(D).redirectdomain,"onUpdate:modelValue":a[0]||(a[0]=e=>b(D).redirectdomain=e)},{header:c((()=>[h("div",q,[u(l,{onClick:E,type:"default"},{default:c((()=>a[3]||(a[3]=[v("全选")]))),_:1}),u(l,{onClick:F,type:"default"},{default:c((()=>a[4]||(a[4]=[v("取消全选")]))),_:1})])])),default:c((()=>[(n(!0),y(g,null,f(b(L),((e,a)=>(n(),p(t,{key:a,value:e.name,label:e.name},null,8,["value","label"])))),128))])),_:1},8,["modelValue"])):(n(),p(s,{key:1,width:"15rem",modelValue:b(D).redirectpath,"onUpdate:modelValue":a[1]||(a[1]=e=>b(D).redirectpath=e),placeholder:"如:/b.com"},null,8,["modelValue"])),u(i,{label:"目标url",prop:"tourl"},{default:c((()=>[u(s,{modelValue:b(D).tourl,"onUpdate:modelValue":a[2]||(a[2]=e=>b(D).tourl=e),width:"24rem"},null,8,["modelValue"])])),_:1})])])),_:1},8,["prop","label"]),u(i,null,{default:c((()=>[u(m,{options:b(R),"list-style":"disc"},null,8,["options"])])),_:1})])),_:1})}}});export{B as default};
Save File
Cancel