← Back
Editing: cosfs-mount.js
import{L as e}from"./utils-lib.js?v=VERSION_NUMBER";import{m as a,n as t,g as s,s as l,o}from"./api.js?v=VERSION_NUMBER";import{c as n,x as i,r as c,k as r,p as m,G as d,q as u,v as p,e as f,A as h,H as v,M as _,F as g,a_ as y,y as w,z as k,C as x,B as b,P as j}from"./base-lib.js?v=VERSION_NUMBER";import"./__commonjsHelpers__.js?v=VERSION_NUMBER";const D={key:0,class:"mr-1rem"},E={class:"inline-block w-full flex items-center justify-between"},I=["title"],V={class:"truncate max-w-[12rem]"},C={key:0,class:"h-4rem flex items-center justify-center text-lighter"},A={key:1,class:"h-4rem flex items-center justify-center text-lighter text-12px"},B=n({__name:"cosfs-mount",props:{dependencies:{default:()=>({})}},setup(n){const B=n,{BtDialog:F,BtInputIcon:L,BtSvgIcon:N,ElDropdown:S,ElDropdownItem:q,ElDropdownMenu:M,ElForm:P,ElButton:z,ElFormItem:H}=i(B.dependencies.components),{useAxios:O,useMessage:R,useDialog:U}=i(B.dependencies.hooks),{fileSelectionDialog:G}=i(B.dependencies.dialog),{getDiskList:T}=i(B.dependencies.custom),$=R(),J=c(!1),K=c(!1),Q=c([]),W=c(!1),X=c(!1),Y=c(),Z=r({region:"",bucket_name:"",path:""}),ee=r({path:[{required:!0,message:"请选择文件目录",trigger:"blur"}]}),ae=()=>{G({type:"dir",change:e=>{Z.path=e}})},te=()=>{U({isAsync:!0,component:()=>e((()=>import("./config5.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url),title:!1,area:[48],compData:{dependencies:B.dependencies}})},se=e=>{const{Name:a,Location:t}=Q.value[e];Z.region=t,Z.bucket_name=a,Z.path="/www/cosfs/".concat(a.replace(/([-][^-]+)$/,"")),X.value=!0},le=async()=>{try{await Y.value.validate();const e=$.load("正在挂载,请稍后..."),t=await a(Z);$.request(t),t.status&&(X.value=!1,oe(),T()),e.close()}catch(e){}},oe=async()=>{try{K.value=!0;const e=await t();e.status&&(Q.value=e.data.list)}catch(e){}finally{K.value=!1}},ne=async()=>{try{const{data:e}=await s();!1===(null==e?void 0:e.status)&&(null==e?void 0:e.msg)&&(W.value=!0),e&&(async()=>{try{const e=await o({sName:"cosfs"});e.data.setup&&oe(),J.value=e.data.setup}catch(e){}})(),J.value=!!e}catch(e){}};return m((()=>{l(O),ne()})),(e,a)=>{const t=d("bt-loading"),s=d("trim");return i(J)?(u(),p("div",D,[f(i(S),{placement:"bottom-start",onCommand:se},{dropdown:h((()=>[v((u(),_(i(M),{class:"w-20rem"},{default:h((()=>[i(W)?(u(),p("div",A,[a[4]||(a[4]=b("未关联腾讯云API密钥")),w("a",{class:"bt-link cursor-pointer ml-4px",onClick:te},">>关联密钥")])):(u(),p(g,{key:0},[(u(!0),p(g,null,y(i(Q),((e,t)=>(u(),_(i(q),{key:t,command:t},{default:h((()=>[w("div",E,[w("div",{class:"flex items-center",title:e.Name.split("-")[0]},[f(i(N),{name:"file-hdd",size:"1.4",class:"mr-4px"}),w("div",V,k(e.Name.split("-")[0]),1)],8,I),a[3]||(a[3]=w("div",{class:"text-primary"},"挂载",-1))])])),_:2},1032,["command"])))),128)),i(Q).length?x("",!0):(u(),p("div",C,"暂无未挂载存储桶"))],64))])),_:1})),[[t,i(K)]])])),default:h((()=>[f(i(z),null,{default:h((()=>a[2]||(a[2]=[b("腾讯云COSFS挂载工具"),w("i",{class:"svgtofont-el-arrow-down el-icon--right"},null,-1)]))),_:1})])),_:1}),f(i(F),{title:"【".concat(i(Z).bucket_name,"】本地挂载"),modelValue:i(X),"onUpdate:modelValue":a[1]||(a[1]=e=>j(X)?X.value=e:null),"show-footer":!0,area:[50],"confirm-text":"挂载",onConfirm:le},{default:h((()=>[f(i(P),{ref_key:"mountFromRef",ref:Y,class:"p-2rem",model:i(Z),rules:i(ee)},{default:h((()=>[f(i(H),{label:"挂载地址",prop:"path"},{default:h((()=>[v(f(i(L),{modelValue:i(Z).path,"onUpdate:modelValue":a[0]||(a[0]=e=>i(Z).path=e),name:"path",icon:"el-folder-opened",width:"32rem",placeholder:"请选择文件目录",onIconClick:ae},null,8,["modelValue"]),[[s]])])),_:1})])),_:1},8,["model","rules"])])),_:1},8,["title","modelValue"])])):x("",!0)}}});export{B as default}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel