import{s as Y,u as Z,M as g,ac as tt,N as et,_ as ot}from"./index.413febc1.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as at,r as C,o as nt,bT as st,bI as lt,C as p,D as b,aI as t,aH as e,G as m,u as _,aK as k,aM as l,aN as r,aJ as L,aE as $,b7 as E,bh as it,bU as rt,bV as ut,bK as dt,bO as ct,bm as pt,bn as mt}from"./arco.76adc92f.js";import{g as _t}from"./vue.107cc2d0.js";import{R as ft,L as wt,a as gt,D as bt,T as ht,U as yt}from"./index.350c144b.js";import{s as kt,P as vt}from"./dep-6deb4e3a.3da13c94.js";import{L as At}from"./index.f132f61a.js";import{I as Ft}from"./index.d49b744e.js";import{F as xt,a as Ct}from"./index.6d7e872a.js";import"./chart.d41e8c5b.js";import"./slot.c1690aae.js";import"./index.df9fea37.js";import"./index.43e2a6eb.js";import"./form-model.553a3655.js";const Lt=h=>(pt("data-v-b7fd0e1a"),h=h(),mt(),h),$t={class:"container"},Et={style:{"margin-right":"20px"}},Ut={style:{color:"#373737",margin:"10px"}},It={style:{display:"flex","align-items":"center","justify-content":"space-between"}},Dt={style:{display:"flex",width:"100%"}},Bt={style:{width:"90%"}},Vt=Lt(()=>m("br",null,null,-1)),St={style:{width:"10%",margin:"auto","text-align":"center"}},Pt={name:"Backup"},Rt=at({...Pt,setup(h){Y();const d=Z(),U=_t(),s=C({binaryFile:void 0,loading:!1,showPanel:!1,showUpload:!1,refLoading:!1,myList:[],total:0,page:1,nowpage:[]}),i=C({title:"",desc:"",firmware:[]});nt(async()=>{F({current:1})});const F=async a=>{s.page=a.current;const n=await g.get("https://k6.vicicode.cn/wsapi/list?type=0&limit=12&page="+a.current+"&t="+Date.now());s.total=n.total,s.nowpage=n.data},f=async()=>{s.refLoading=!0,s.showPanel=!0;const a=await g.post("https://k6.vicicode.cn/wsapi/my_list",{type:0,token:d.accountId});s.myList=a.data,s.refLoading=!1},I=()=>{i.title="",i.desc="",i.firmware=[],s.showUpload=!0},D=async()=>{if(i.title==""||i.firmware.length==0){E.error({content:"\u672A\u586B\u5199\u540D\u79F0\u53CA\u4E0A\u4F20\u6587\u4EF6",duration:5*1e3});return}await g.post("https://k6.vicicode.cn/wsapi/upload",{type:0,token:d.accountId,title:i.title,desc:i.desc,data:i.firmware[0].url}),s.showUpload=!1,f()},B=async a=>{await g.post("https://k6.vicicode.cn/wsapi/delete",{id:a,token:d.accountId}),f()},V=async a=>{await g.post("https://k6.vicicode.cn/wsapi/star",{id:a}),E.success({content:"\u70B9\u8D5E\u6210\u529F",duration:5*1e3})},S=()=>{f()},P=a=>{U.push({path:"/tool/flash",query:{url:a}})},R=(a,n)=>{fetch(a).then(w=>w.blob()).then(w=>{const u=URL.createObjectURL(w),c=document.createElement("a");c.href=u,c.download=n,document.body.appendChild(c),c.click(),document.body.removeChild(c)})};return(a,n)=>{const w=tt,u=it,c=kt,N=rt,T=ut,z=st,M=vt,j=lt,K=dt,O=ct,v=et,q=At,G=wt,H=gt,x=bt,J=Ft,y=xt,Q=ht,W=yt,X=Ct;return p(),b("div",$t,[t(w,{items:[a.$t("menu.workshop"),a.$t("menu.firmware")]},null,8,["items"]),t(O,{gutter:20,align:"stretch"},{default:e(()=>[t(K,{span:24},{default:e(()=>[t(j,{class:"general-card",title:a.$t("menu.firmware")},{extra:e(()=>[m("div",Et,[_(d).name?(p(),b(k,{key:0},[t(u,{onClick:f},{default:e(()=>[l("\xA0\xA0"+r(_(d).name)+"\xA0\xA0",1)]),_:1}),t(u,{onClick:f},{default:e(()=>[l("\xA0\xA0"+r(a.$t("global.upload"))+"\xA0\xA0",1)]),_:1}),t(u,{onClick:n[0]||(n[0]=o=>_(d).logout())},{default:e(()=>[l("\xA0\xA0"+r(a.$t("global.logout"))+"\xA0\xA0",1)]),_:1})],64)):(p(),b(k,{key:1},[t(u,{onClick:n[1]||(n[1]=o=>_(d).setInfo({showLogin:!0}))},{default:e(()=>[l("\xA0\xA0"+r(a.$t("global.login"))+"\xA0\xA0",1)]),_:1}),t(u,{onClick:n[2]||(n[2]=o=>_(d).setInfo({showRegister:!0}))},{default:e(()=>[l("\xA0\xA0"+r(a.$t("global.register"))+"\xA0\xA0",1)]),_:1}),m("span",Ut,r(a.$t("global.loginUpload")),1)],64))])]),default:e(()=>[t(z,null,{default:e(()=>[(p(!0),b(k,null,L(s.nowpage,o=>(p(),$(T,{style:{width:"100%"}},{actions:e(()=>[t(u,{onClick:A=>V(o.id)},{default:e(()=>[l("\u{1F44D}")]),_:2},1032,["onClick"]),t(u,{onClick:A=>R("https://k6.vicicode.cn/wsapi/download?id="+o.id,o.title)},{default:e(()=>[l(r(a.$t("global.download")),1)]),_:2},1032,["onClick"]),t(u,{onClick:A=>P("https://k6.vicicode.cn/wsapi/download?id="+o.id+"&n=/"+o.title)},{default:e(()=>[l(r(a.$t("global.use")),1)]),_:2},1032,["onClick"])]),default:e(()=>[t(N,{description:o.desc},{title:e(()=>[t(c,{theme:"primary",variant:"outline"},{default:e(()=>[l(r(o.upload),1)]),_:2},1024),l(" "+r(o.title),1)]),_:2},1032,["description"])]),_:2},1024))),256))]),_:1}),t(M,{onChange:F,style:{margin:"10px"},total:s.total,current:s.page,pageSize:12,showPageNumber:"",showPageSize:!1},null,8,["total","current"])]),_:1},8,["title"])]),_:1})]),_:1}),t(x,{visible:s.showPanel,"onUpdate:visible":n[3]||(n[3]=o=>s.showPanel=o),size:"50%",header:"\u6211\u7684\u56FA\u4EF6",footer:!1},{default:e(()=>[m("div",It,[t(v,{style:{margin:"10px"},onClick:I},{default:e(()=>[l("\u4E0A\u4F20\u65B0\u56FA\u4EF6")]),_:1}),t(v,{loading:s.refLoading,shape:"circle",theme:"outline",onClick:S},{icon:e(()=>[t(_(ft))]),_:1},8,["loading"])]),t(H,{split:!0},{default:e(()=>[(p(!0),b(k,null,L(s.myList,o=>(p(),$(G,null,{default:e(()=>[m("div",Dt,[m("div",Bt,[t(c,{theme:"primary",variant:"outline"},{default:e(()=>[l(r(o.audit?"\u5DF2\u5BA1\u6838":"\u5BA1\u6838\u4E2D"),1)]),_:2},1024),l(" "+r(o.title)+" ",1),Vt,l(" "+r(o.desc),1)]),m("div",St,[t(q,{theme:"primary",hover:"color",onClick:A=>B(o.id)},{default:e(()=>[l("\u5220\u9664")]),_:2},1032,["onClick"])])])]),_:2},1024))),256))]),_:1})]),_:1},8,["visible"]),t(x,{visible:s.showUpload,"onUpdate:visible":n[7]||(n[7]=o=>s.showUpload=o),size:"25%",header:"\u4E0A\u4F20\u65B0\u56FA\u4EF6",footer:!1},{default:e(()=>[t(X,{data:i,"reset-type":"initial",colon:"",onSubmit:D},{default:e(()=>[t(y,{label:"\u56FA\u4EF6\u540D\u79F0",name:"title","label-align":"top"},{default:e(()=>[t(J,{modelValue:i.title,"onUpdate:modelValue":n[4]||(n[4]=o=>i.title=o)},null,8,["modelValue"])]),_:1}),t(y,{label:"\u56FA\u4EF6\u63CF\u8FF0",name:"desc","label-align":"top"},{default:e(()=>[t(Q,{autosize:{minRows:5,maxRows:10},modelValue:i.desc,"onUpdate:modelValue":n[5]||(n[5]=o=>i.desc=o),clearable:""},null,8,["modelValue"])]),_:1}),t(y,{label:"\u56FA\u4EF6\u6587\u4EF6",name:"firmware","label-align":"top"},{default:e(()=>[t(W,{modelValue:i.firmware,"onUpdate:modelValue":n[6]||(n[6]=o=>i.firmware=o),action:"https://k6.vicicode.cn/wsapi/base64","abridge-name":[8,6],theme:"file-input",placeholder:"\u672A\u9009\u62E9\u6587\u4EF6"},null,8,["modelValue"])]),_:1}),t(y,{"label-align":"top"},{default:e(()=>[t(v,{theme:"primary",type:"submit",block:""},{default:e(()=>[l("\u63D0\u4EA4\u5BA1\u6838")]),_:1})]),_:1})]),_:1},8,["data"])]),_:1},8,["visible"])])}}});const se=ot(Rt,[["__scopeId","data-v-b7fd0e1a"]]);export{se as default};