2024-10-31 06:41:07 +00:00
|
|
|
import{t as Z,u as ee,N as h,ad as te,O as ae,_ as oe}from"./index.7d6e688d.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as ne,r as E,o as se,bT as le,bI as ie,C as d,D as b,aI as a,aH as t,G as m,aM as l,aN as i,u as p,aK as x,aJ as L,aE as k,b7 as U,bh as re,bU as ue,bV as de,bK as ce,bO as pe,bm as me,bn as _e}from"./arco.9755215d.js";import{g as fe}from"./vue.e23f7fca.js";import{S as we,R as ge,L as he,a as be,D as ke,T as ye,U as Fe}from"./index.72c9a5c8.js";import{I as ve}from"./index.58db8cb9.js";import{T as xe,P as Ae}from"./dep-71c4f289.2aedd622.js";import{L as Ce}from"./index.49f61187.js";import{F as $e,a as Ie}from"./index.5e647823.js";import"./chart.e5f26fc3.js";import"./slot.5fc76175.js";import"./index.ba0d5add.js";import"./index.10e63d65.js";import"./form-model.38e68b7e.js";import"./index.1a73e5bc.js";const Ee=y=>(me("data-v-e97fa37a"),y=y(),_e(),y),Le={class:"container"},Ue={style:{display:"flex",gap:"1rem","align-items":"flex-end"}},De={style:{"margin-right":"20px"}},Ve={style:{color:"#373737",margin:"10px"}},Be={style:{display:"flex","align-items":"center","justify-content":"space-between"}},Se={style:{display:"flex",width:"100%"}},Pe={style:{width:"90%"}},Re=Ee(()=>m("br",null,null,-1)),Te={style:{width:"40%",margin:"auto","text-align":"center"}},ze={name:"Backup"},Ne=ne({...ze,setup(y){Z();const c=ee(),D=fe(),s=E({binaryFile:void 0,loading:!1,showPanel:!1,showUpload:!1,refLoading:!1,myList:[],total:0,page:1,nowpage:[],title:""}),r=E({title:"",desc:"",firmware:[]});se(async()=>{A({current:1})});const A=async n=>{s.page=n.current;const o=await h.get("https://k5ws.vicicode.cn/api/firmware/index?server=1&limit=12&page="+n.current+"&title="+s.title+"&t="+Date.now());s.total=o.data.total,s.nowpage=o.data.list},w=async()=>{s.refLoading=!0,s.showPanel=!0;const n=await h.post("https://k5ws.vicicode.cn/api/firmware/my?server=1",{},{headers:{"ba-user-token":c.accountId}});s.myList=n.data,s.refLoading=!1},V=()=>{r.title="",r.desc="",r.firmware=[],s.showUpload=!0},B=async()=>{if(r.title==""||r.firmware.code==0){U.error({content:"\u672A\u586B\u5199\u540D\u79F0\u53CA\u4E0A\u4F20\u6587\u4EF6",duration:5*1e3});return}await h.post("https://k5ws.vicicode.cn/api/firmware/add?server=1",{title:r.title,desc:r.desc,data:r.firmware[0].response.data.file.url},{headers:{"ba-user-token":c.accountId}}),s.showUpload=!1,w()},S=async n=>{await h.post("https://k5ws.vicicode.cn/api/firmware/del?server=1",{id:n},{headers:{"ba-user-token":c.accountId}}),w()},P=async n=>{s.nowpage.filter(o=>{o.id==n&&(o.star+=1)}),await h.post("https://k5ws.vicicode.cn/api/firmware/star?server=1",{id:n}),U.success({content:"\u70B9\u8D5E\u6210\u529F",duration:5*1e3})},R=()=>{w()},T=n=>{D.push({path:"/tool/flash",query:{url:n}})},z=(n,o)=>{o.split(".").reverse()[0]!=="bin"&&(o+=".bin"),fetch(n).then(g=>g.blob()).then(g=>{const F=URL.createObjectURL(g),u=document.createElement("a");u.href=F,u.download=o,document.body.appendChild(u),u.click(),document.body.removeChild(u)})},$=()=>{A({current:1})};return(n,o)=>{const g=te,F=ve,u=re,_=xe,N=ue,M=de,j=le,O=Ae,K=ie,q=ce,G=pe,C=ae,H=Ce,J=he,Q=be,I=ke,v=$e,W=ye,X=Fe,Y=Ie;return d(),b("div",Le,[a(g,{items:[n.$t("menu.workshop"),n.$t("menu.firmware")]},null,8,["items"]),a(G,{gutter:20,align:"stretch"},{default:t(()=>[a(q,{span:24},{default:t(()=>[a(K,{class:"general-card"},{title:t(()=>[m("div",Ue,[l(i(n.$t("menu.firmware"))+" ",1),a(F,{size:"small",style:{width:"200px"},modelValue:s.title,"onUpdate:modelValue":o[0]||(o[0]=e=>s.title=e),onEnter:$},{suffixIcon:t(()=>[a(p(we),{style:{cursor:"pointer"},onClick:$})]),_:1},8,["modelValue"])])]),extra:t(()=>[m("div",De,[p(c).name?(d(),b(x,{key:0},[a(u,{onClick:w},{default:t(()=>[l("\xA0\xA0"+i(p(c).name)+"\xA0\xA0",1)]),_:1}),a(u,{onClick:w},{default:t(()=>[l("\xA0\xA0"+i(n.$t("global.upload"))+"\xA0\xA0",1)]),_:1}),a(u,{onClick:o[1]||(o[1]=e=>p(c).logout())},{default:t(()=>[l("\
|