← Back
Editing: edit-pass-limit.js
import{c as e,k as a,r as s,q as t,v as l,e as r,A as d,y as m,x as o,B as i,a9 as u,a$ as p,D as n,a7 as c}from"./base-lib.js?v=VERSION_NUMBER";import{a6 as _,p as b,K as f,k as g,e as w}from"./utils-lib.js?v=VERSION_NUMBER";import{u as h}from"./column.js?v=VERSION_NUMBER";import{setPassUserApi as V}from"./site.js?v=VERSION_NUMBER";import"./__commonjsHelpers__.js?v=VERSION_NUMBER";import"./index104.js?v=VERSION_NUMBER";const D={class:"p-[20px]"},x={class:"flex items-center"},y=w(e({__name:"edit-pass-limit",props:{compData:{default:()=>({})}},emits:["close"],setup(e,{emit:w}){const y=e,j=w,v=a({site_dir:y.compData.site_dir||"",name:y.compData.name||"",username:y.compData.username||"",password:y.compData.password||""}),k=s(!1),q=s(),U=a({username:[{required:!0,message:"请输入用户名",trigger:"blur"},{min:3,message:"用户名必须大于三位",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"},{min:3,message:"密码必须大于三位",trigger:"blur"}]}),{BtTable:B,config:C}=_({request:()=>{const e=y.compData.user_list.map((e=>({user:e})))||[];return{data:e,total:e.length}},columns:[{prop:"user",label:"用户"},h([{title:"删除",onClick:e=>A("remove",e)}])]}),A=async(e,a)=>{const s=C.data.some((e=>e.user===v.username));s&&"add"===e&&await b({title:"提示",content:"用户已存在,继续添加会覆盖同名用户配置,是否继续?"}),1===C.data.length&&"remove"===e&&await b({title:"提示",content:"确认删除用户【".concat(C.data[0].user,"】?此为当前唯一用户,删除后该加密规则将一起被删除,是否继续?")});let t={id:y.compData.id,...v,username:a?a.user:v.username,option:e};delete t.site_dir,f({loading:"正在".concat({add:"添加",remove:"删除"}[e],",请稍后..."),request:V(t),message:!0,success:t=>{t.status&&("add"===e?(!s&&C.data.push({user:v.username}),v.username="",v.password=""):(C.data=C.data.filter((e=>e.user!==a.user)),0===C.data.length&&j("close")),y.compData.refresh())}})};return(e,a)=>{const s=g,_=u,b=p,f=n,w=c;return t(),l("div",D,[r(w,{ref_key:"passwordSiteForm",ref:q,rules:o(U),model:o(v),disabled:o(k)},{default:d((()=>[m("div",x,[r(_,{label:"加密路径",prop:"site_dir"},{default:d((()=>[r(s,{disabled:!!e.compData.name,modelValue:o(v).site_dir,"onUpdate:modelValue":a[0]||(a[0]=e=>o(v).site_dir=e),placeholder:"输入需要加密访问的目录,如:/text/",width:"13rem"},null,8,["disabled","modelValue"])])),_:1}),r(_,{label:"名称",prop:"name"},{default:d((()=>[r(s,{modelValue:o(v).name,"onUpdate:modelValue":a[1]||(a[1]=e=>o(v).name=e),disabled:!!e.compData.name,width:"13rem"},null,8,["modelValue","disabled"])])),_:1})]),r(b,{"border-style":"dashed",class:"!mt-0"}),r(_,{label:"新用户",prop:"username"},{default:d((()=>[r(s,{modelValue:o(v).username,"onUpdate:modelValue":a[2]||(a[2]=e=>o(v).username=e),placeholder:"请输入大于三位的用户名",width:"26rem"},null,8,["modelValue"]),r(f,{type:"primary",onClick:a[3]||(a[3]=e=>A("add")),class:"ml-[8px]"},{default:d((()=>a[5]||(a[5]=[i(" 添加 ")]))),_:1})])),_:1}),r(_,{label:"密码",prop:"password"},{default:d((()=>[r(s,{modelValue:o(v).password,"onUpdate:modelValue":a[4]||(a[4]=e=>o(v).password=e),type:"password",placeholder:"请输入大于三位的密码",width:"26rem"},null,8,["modelValue"])])),_:1}),r(b,{"border-style":"dashed"}),r(_,{label:"已有用户",prop:"password"},{default:d((()=>[r(o(B),{class:"!w-[85%]"})])),_:1}),a[6]||(a[6]=m("ul",{class:"ml-6 mt-8 list-disc leading-10"},[m("li",{class:"text-medium"},"目录设置加密访问后,会导致目录及子目录下的“反向代理”失效"),m("li",{class:"text-medium"},"目录设置加密访问后,访问时需要输入账号密码才能访问"),m("li",{class:"text-medium"},"例如我设置了加密访问 /test/ ,那我访问 http://aaa.com/test/ 时就要输入账号密码才能访问")],-1))])),_:1},8,["rules","model","disabled"])])}}}),[["__scopeId","data-v-2f2a44aa"]]);export{y as default};
Save File
Cancel