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