k5web/assets/index.c8c375b2.js
2024-10-23 01:54:31 +08:00

1 line
8.5 KiB
JavaScript

import{t as ee,u as te,N as h,ad as ae,O as oe,_ as ne}from"./index.f34f4521.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.5f227ea0.js";import{I as Fe}from"./index.aaa29523.js";import{T as Ae,P as Ce}from"./dep-71c4f289.27ec98ef.js";import{L as Le}from"./index.5bbe4121.js";import{F as $e,a as Ie}from"./index.95ffe82e.js";import"./chart.e5f26fc3.js";import"./slot.fafdf46b.js";import"./index.8f35e75c.js";import"./index.1a947c92.js";import"./form-model.91aa1943.js";import"./index.ca4f8488.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,"onUpdate:modelValue":o[0]||(o[0]=e=>s.title=e),onEnter:L},{suffixIcon:t(()=>[a(p(we),{style:{cursor:"pointer"},onClick:L})]),_:1},8,["modelValue"])])]),extra:t(()=>[m("div",De,[p(d).name?(c(),y(F,{key:0},[a(u,{onClick:w},{default:t(()=>[i("\xA0\xA0"+r(p(d).name)+"\xA0\xA0",1)]),_:1}),a(u,{onClick:w},{default:t(()=>[i("\xA0\xA0"+r(n.$t("global.upload"))+"\xA0\xA0",1)]),_:1}),a(u,{onClick:o[1]||(o[1]=e=>p(d).logout())},{default:t(()=>[i("\xA0\xA0"+r(n.$t("global.logout"))+"\xA0\xA0",1)]),_:1})],64)):(c(),y(F,{key:1},[a(u,{onClick:o[2]||(o[2]=e=>p(d).setInfo({showLogin:!0}))},{default:t(()=>[i("\xA0\xA0"+r(n.$t("global.login"))+"\xA0\xA0",1)]),_:1}),a(u,{onClick:o[3]||(o[3]=e=>p(d).setInfo({showRegister:!0}))},{default:t(()=>[i("\xA0\xA0"+r(n.$t("global.register"))+"\xA0\xA0",1)]),_:1}),m("span",Ve,r(n.$t("global.loginUpload")),1)],64))])]),default:t(()=>[a(K,null,{default:t(()=>[(c(!0),y(F,null,U(s.nowpage,e=>(c(),k(O,{style:{width:"100%"}},{actions:t(()=>[a(f,{style:{"margin-left":"1rem"}},{default:t(()=>[i(r(e.create_time_text),1)]),_:2},1024),a(u,{style:{"min-width":"100px"},onClick:_=>T(e.id)},{default:t(()=>[i("\u{1F44D}\uFF08"+r(e.star)+"\uFF09",1)]),_:2},1032,["onClick"]),a(u,{style:{"min-width":"70px"},onClick:_=>M("https://k5ws.vicicode.cn"+e.file,e.title)},{default:t(()=>[i(r(n.$t("global.download")),1)]),_:2},1032,["onClick"]),a(u,{style:{"min-width":"70px"},onClick:_=>N("https://k5ws.vicicode.cn"+e.file)},{default:t(()=>[i(r(n.$t("global.use")),1)]),_:2},1032,["onClick"])]),default:t(()=>[a(j,{description:e.desc},{title:t(()=>[a(f,{theme:"primary",variant:"outline"},{default:t(()=>{var _;return[i(r((_=e.user)==null?void 0:_.nickname),1)]}),_:2},1024),i(" "+r(e.title),1)]),_:2},1032,["description"])]),_:2},1024))),256))]),_:1}),a(q,{onChange:A,style:{margin:"10px"},total:s.total,current:s.page,pageSize:12,showPageNumber:"",showPageSize:!1},null,8,["total","current"])]),_:1})]),_:1})]),_:1}),a(I,{visible:s.showPanel,"onUpdate:visible":o[4]||(o[4]=e=>s.showPanel=e),size:"50%",header:"\u6211\u7684\u5206\u4EAB",footer:!1},{default:t(()=>[m("div",Se,[a(C,{style:{margin:"10px"},onClick:V},{default:t(()=>[i("\u4E0A\u4F20\u65B0\u5206\u4EAB")]),_:1}),a(C,{loading:s.refLoading,shape:"circle",theme:"outline",onClick:z},{icon:t(()=>[a(p(ge))]),_:1},8,["loading"])]),a(W,{split:!0},{default:t(()=>[(c(!0),y(F,null,U(s.myList,e=>(c(),k(Q,null,{default:t(()=>[m("div",Pe,[m("div",Re,[e.status==0?(c(),k(f,{key:0,theme:"primary",variant:"outline"},{default:t(()=>[i("\u5BA1\u6838\u4E2D"+r(e.remark&&`\uFF08${e.remark}\uFF09`),1)]),_:2},1024)):e.status==1?(c(),k(f,{key:1,theme:"primary",variant:"outline"},{default:t(()=>[i("\u5DF2\u5BA1\u6838"+r(e.remark&&`\uFF08${e.remark}\uFF09`),1)]),_:2},1024)):(c(),k(f,{key:2,theme:"primary",variant:"outline"},{default:t(()=>[i("\u5DF2\u9A73\u56DE"+r(e.remark&&`\uFF08${e.remark}\uFF09`),1)]),_:2},1024)),i(" "+r(e.title)+" ",1),Te,i(" "+r(e.desc),1)]),m("div",ze,[a(f,null,{default:t(()=>[i(r(e.create_time_text),1)]),_:2},1024),i("\xA0 "),a($,{theme:"primary",hover:"color",onClick:_=>P(e.id)},{default:t(()=>[i("\u7F16\u8F91")]),_:2},1032,["onClick"]),i("\xA0 "),a($,{theme:"primary",hover:"color",onClick:_=>R(e.id)},{default:t(()=>[i("\u5220\u9664")]),_:2},1032,["onClick"])])])]),_:2},1024))),256))]),_:1})]),_:1},8,["visible"]),a(I,{visible:s.showUpload,"onUpdate:visible":o[8]||(o[8]=e=>s.showUpload=e),size:"25%",header:"\u4E0A\u4F20\u65B0\u56FA\u4EF6",footer:!1},{default:t(()=>[a(Z,{data:l,"reset-type":"initial",colon:"",onSubmit:S},{default:t(()=>[a(x,{label:"\u5206\u4EAB\u540D\u79F0",name:"title","label-align":"top"},{default:t(()=>[a(v,{modelValue:l.title,"onUpdate:modelValue":o[5]||(o[5]=e=>l.title=e)},null,8,["modelValue"])]),_:1}),a(x,{label:"\u5206\u4EAB\u63CF\u8FF0",name:"desc","label-align":"top"},{default:t(()=>[a(X,{maxlength:200,autosize:{minRows:5,maxRows:10},modelValue:l.desc,"onUpdate:modelValue":o[6]||(o[6]=e=>l.desc=e),clearable:""},null,8,["modelValue"])]),_:1}),a(x,{label:"\u4FE1\u9053\u6587\u4EF6",name:"firmware","label-align":"top"},{default:t(()=>[a(Y,{modelValue:l.firmware,"onUpdate:modelValue":o[7]||(o[7]=e=>l.firmware=e),action:"https://k5ws.vicicode.cn/api/ajax/upload?server=1","abridge-name":[8,6],headers:{"ba-user-token":p(d).accountId},theme:"file-input",placeholder:"\u672A\u9009\u62E9\u6587\u4EF6"},null,8,["modelValue","headers"])]),_:1}),a(x,{"label-align":"top"},{default:t(()=>[a(C,{theme:"primary",type:"submit",block:""},{default:t(()=>[i("\u63D0\u4EA4\u5BA1\u6838")]),_:1})]),_:1})]),_:1},8,["data"])]),_:1},8,["visible"])])}}});const dt=ne(Me,[["__scopeId","data-v-af982f8c"]]);export{dt as default};