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