2024-10-27 08:08:20 +00:00
|
|
|
import{t as ee,u as te,N as h,ad as ae,O as oe,_ as ne}from"./index.b5a2f1c9.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as se,r as E,o as le,bT as ie,bI as re,C as c,D as y,aI as a,aH as t,G as m,aM as i,aN as r,u as p,aK as F,aJ as U,aE as k,b7 as B,bh as ue,bU as de,bV as ce,bK as pe,bO as me,bm as _e,bn as fe}from"./arco.9755215d.js";import{g as he}from"./vue.e23f7fca.js";import{S as we,R as ge,L as ye,a as ke,D as be,T as ve,U as xe}from"./index.ba763ad8.js";import{I as Fe}from"./index.44f805f6.js";import{T as Ae,P as Ce}from"./dep-71c4f289.cf29a73c.js";import{L as Le}from"./index.aabf007e.js";import{F as $e,a as Ie}from"./index.ee068902.js";import"./chart.e5f26fc3.js";import"./slot.d8136cff.js";import"./index.c616a1f5.js";import"./index.d5c8997c.js";import"./form-model.0762a291.js";import"./index.bd936d35.js";const Ee=b=>(_e("data-v-af982f8c"),b=b(),fe(),b),Ue={class:"container"},Be={style:{display:"flex",gap:"1rem","align-items":"flex-end"}},De={style:{"margin-right":"20px"}},Ve={style:{color:"#373737",margin:"10px"}},Se={style:{display:"flex","align-items":"center","justify-content":"space-between"}},Pe={style:{display:"flex",width:"100%"}},Re={style:{width:"90%"}},Te=Ee(()=>m("br",null,null,-1)),ze={style:{width:"50%",margin:"auto","text-align":"center"}},Ne={name:"Backup"},Me=se({...Ne,setup(b){ee();const d=te(),D=he(),s=E({binaryFile:void 0,loading:!1,showPanel:!1,showUpload:!1,refLoading:!1,myList:[],total:0,page:1,nowpage:[],title:""}),l=E({id:0,title:"",desc:"",firmware:[]});le(async()=>{A({current:1})});const A=async n=>{s.page=n.current;const o=await h.get("https://k5ws.vicicode.cn/api/channel/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/channel/my?server=1",{},{headers:{"ba-user-token":d.accountId}});s.myList=n.data,s.refLoading=!1},V=()=>{l.id=0,l.title="",l.desc="",l.firmware=[],s.showUpload=!0},S=async()=>{var n;if(l.title==""||l.firmware.code==0){B.error({content:"\u672A\u586B\u5199\u540D\u79F0\u53CA\u4E0A\u4F20\u6587\u4EF6",duration:5*1e3});return}l.id===0?await h.post("https://k5ws.vicicode.cn/api/channel/add?server=1",{title:l.title,desc:l.desc,data:l.firmware[0].response.data.file.url},{headers:{"ba-user-token":d.accountId}}):await h.post("https://k5ws.vicicode.cn/api/channel/edit?server=1",{id:l.id,title:l.title,desc:l.desc,data:(n=l.firmware[0].url)!=null?n:l.firmware[0].response.data.file.url},{headers:{"ba-user-token":d.accountId}}),s.showUpload=!1,w()},P=async n=>{l.id=n,l.title=s.myList.filter(o=>o.id==n)[0].title,l.desc=s.myList.filter(o=>o.id==n)[0].desc,l.firmware=[{name:s.myList.filter(o=>o.id==n)[0].title,status:"success",url:s.myList.filter(o=>o.id==n)[0].file}],s.showUpload=!0},R=async n=>{await h.post("https://k5ws.vicicode.cn/api/channel/del?server=1",{id:n},{headers:{"ba-user-token":d.accountId}}),w()},T=async n=>{s.nowpage.filter(o=>{o.id==n&&(o.star+=1)}),await h.post("https://k5ws.vicicode.cn/api/channel/star?server=1",{id:n}),B.success({content:"\u70B9\u8D5E\u6210\u529F",duration:5*1e3})},z=()=>{w()},N=n=>{D.push({path:"/chirp/channel",query:{url:n}})},M=(n,o)=>{fetch(n).then(g=>g.blob()).then(g=>{const v=URL.createObjectURL(g),u=document.createElement("a");u.href=v,u.download=o+".xlsx",document.body.appendChild(u),u.click(),document.body.removeChild(u)})},L=()=>{A({current:1})};return(n,o)=>{const g=ae,v=Fe,u=ue,f=Ae,j=de,O=ce,K=ie,q=Ce,G=re,H=pe,J=me,C=oe,$=Le,Q=ye,W=ke,I=be,x=$e,X=ve,Y=xe,Z=Ie;return c(),y("div",Ue,[a(g,{items:[n.$t("menu.workshop"),n.$t("menu.channel")]},null,8,["items"]),a(J,{gutter:20,align:"stretch"},{default:t(()=>[a(H,{span:24},{default:t(()=>[a(G,{class:"general-card"},{title:t(()=>[m("div",Be,[i(r(n.$t("menu.channel"))+" ",1),a(v,{size:"small",style:{width:"200px"},modelValue:s.title,"on
|