import{_ as e,i as s,h as a,r as l,o,b as t,g as i,a as n,w as d,e as c,p as r,f as u}from"./index-ea5b20ee.js";import{s as p}from"./store2-204267a2.js";const f=[{content:"【下载】目录",id:"downloads"},{content:"【图片】目录",id:"pictures"},{content:"【文档】目录",id:"documents"},{content:"【音乐】目录",id:"music"}],h={data:()=>({file_list:f,action_url:"",image_info:[],num:0,servicAddress:"",dir_path:"D:\\www\\ee"}),mounted(){this.getHost()},methods:{getHost(){s.invoke(a.checkHttpServer,{}).then((e=>{if(e.enable){this.servicAddress=e.server,p.set("httpServiceConfig",e);const s=e.server||"http://localhost:7071";let l=a.uploadFile.split(".").join("/");this.action_url=s+"/"+l}}))},openDirectry(e){s.invoke(a.openDirectory,{id:e}).then((e=>{}))},selectDir(){s.invoke(a.selectFolder,"").then((e=>{this.dir_path=e,this.$message.info(e)}))},messageShow(){s.invoke(a.messageShow,"").then((e=>{this.$message.info(e)}))},messageShowConfirm(){s.invoke(a.messageShowConfirm,"").then((e=>{this.$message.info(e)}))},handleFileChange(e){if(console.log("handleFileChange-----"),""==this.action_url)return void this.$message.error("http服务未开启");const s=e.file.status;if("uploading"!==s&&console.log(e.file),"done"===s){const s=e.file.response;if(console.log("uploadRes:",s),"success"!==s.code)return this.$message.error(`file upload failed ${s.code} .`),!1;this.num++;const a=s.data;a.id=this.num,a.imageUrlText="image url",this.image_info.push(a),this.$message.success(`${e.file.name} file uploaded successfully.`)}else"error"===s&&this.$message.error(`${e.file.name} file upload failed.`)}}},m=e=>(r("data-v-d30dccef"),e=e(),u(),e),g={id:"app-base-file"},_=m((()=>i("div",{class:"one-block-1"},[i("span",null," 1. 系统原生对话框 ")],-1))),v={class:"one-block-2"},k=m((()=>i("div",{class:"one-block-1"},[i("span",null," 2. 选择保存目录 ")],-1))),C={class:"one-block-2"},b=m((()=>i("div",{class:"one-block-1"},[i("span",null," 3. 打开文件夹 ")],-1))),w={class:"one-block-2"},$=m((()=>i("div",{class:"one-block-1"},[i("span",null," 4. 上传文件到图床 ")],-1))),S={class:"one-block-2"},D=m((()=>i("p",{class:"ant-upload-drag-icon"},null,-1))),y=m((()=>i("p",{class:"ant-upload-text"}," 点击 或 拖拽文件到这里 ",-1))),F=m((()=>i("p",{class:"ant-upload-hint"}," 注意：请使用您自己的图床token ",-1))),x=m((()=>i("div",{class:"footer"},null,-1)));const j=e(h,[["render",function(e,s,a,r,u,p){const f=l("a-button"),h=l("a-space"),m=l("a-input"),j=l("a-col"),H=l("a-row"),V=l("a-card"),A=l("a-list-item"),I=l("a-list"),U=l("a-upload-dragger");return o(),t("div",g,[_,i("div",v,[n(h,null,{default:d((()=>[n(f,{onClick:s[0]||(s[0]=e=>p.messageShow())},{default:d((()=>[c("消息提示(ipc)")])),_:1}),n(f,{onClick:s[1]||(s[1]=e=>p.messageShowConfirm())},{default:d((()=>[c("消息提示与确认(ipc)")])),_:1})])),_:1})]),k,i("div",C,[n(H,null,{default:d((()=>[n(j,{span:12},{default:d((()=>[n(m,{modelValue:u.dir_path,"onUpdate:modelValue":s[2]||(s[2]=e=>u.dir_path=e),value:u.dir_path,"addon-before":"保存目录"},null,8,["modelValue","value"])])),_:1}),n(j,{span:12},{default:d((()=>[n(f,{onClick:p.selectDir},{default:d((()=>[c(" 修改目录 ")])),_:1},8,["onClick"])])),_:1})])),_:1})]),b,i("div",w,[n(I,{grid:{gutter:16,column:4},"data-source":u.file_list},{renderItem:d((({item:e})=>[n(A,{onClick:s=>p.openDirectry(e.id)},{default:d((()=>[n(V,{title:e.content},{default:d((()=>[n(f,{type:"link"},{default:d((()=>[c(" 打开 ")])),_:1})])),_:2},1032,["title"])])),_:2},1032,["onClick"])])),_:1},8,["data-source"])]),$,i("div",S,[n(U,{name:"file",multiple:!0,action:u.action_url,onChange:p.handleFileChange},{default:d((()=>[D,y,F])),_:1},8,["action","onChange"])]),x])}],["__scopeId","data-v-d30dccef"]]);export{j as default};
