k5web/assets/index.e35f6a99.js

2 lines
3 KiB
JavaScript
Raw Normal View History

2024-01-31 14:43:45 +00:00
import{e as D,_ as v}from"./index.d9a8a349.js";/* empty css *//* empty css *//* empty css *//* empty css */import{d as C,r as h,b0 as w,C as A,D as k,aI as n,aH as s,aM as F,G as x,aX as T,bb as H,bD as K,bE as P,bC as S,bF as I,n as M}from"./arco.cd87ac27.js";import{e as N,f as R,g as V}from"./serial.3518333f.js";import"./chart.19f3a5b6.js";import"./vue.a1682e6c.js";const $={class:"container"},y=["innerHTML"],L={name:"Chi"},O=C({...L,setup(z){const o=D(),r=h({status:"\u70B9\u51FB\u5199\u5165\u6309\u94AE\u5199\u5165\u5B57\u5E93\u5230\u8BBE\u5907<br/><br/>",eepromType:""}),b=async(t=0,u)=>{var c;await N(o.connectPort);for(let e=t;e<u.length+t;e+=128)await R(o.connectPort,e,u.slice(e-t,e-t+128),128,(c=o.configuration)==null?void 0:c.uart),r.status=r.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A"+((e-t)/u.length*100).toFixed(1)+"%<br/>",M(()=>{const a=document==null?void 0:document.getElementById("statusArea");a&&(a.scrollTop=a==null?void 0:a.scrollHeight)});r.status=r.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A100.0%<br/>",await V(o.connectPort)},p=async(t=1)=>{var l,_,d,f,i,m,E;if(o.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}if(((l=o.configuration)==null?void 0:l.uart)=="official"){alert("\u56FA\u4EF6\u7248\u672C\u4E0D\u5339\u914D");return}if(t==1&&((_=o.configuration)==null?void 0:_.charset)!="losehu"||t==1&&((d=o.configuration)==null?void 0:d.K)!=!0){alert("\u56FA\u4EF6\u7248\u672C\u4E0D\u5339\u914D");return}if(t==2&&((f=o.configuration)==null?void 0:f.charset)!="gb2312"||t==2&&((i=o.configuration)==null?void 0:i.K)!=!0){alert("\u56FA\u4EF6\u7248\u672C\u4E0D\u5339\u914D");return}if(t==3&&((m=o.configuration)==null?void 0:m.charset)!="gb2312"||t==3&&((E=o.configuration)==null?void 0:E.H)!=!0){alert("\u56FA\u4EF6\u7248\u672C\u4E0D\u5339\u914D");return}r.status=r.status+"\u6B63\u5728\u4E0B\u8F7D\u5B57\u5E93...<br />";let u;switch(t){case 1:u=await fetch("/old_font.bin");break;default:alert("TODO");return}const c=u.body.getReader(),e=[];for(;;){const{done:g,value:B}=await c.read();if(g)break;e.push(...B)}const a=new Uint8Array(e);await b(8192,a)};return(t,u)=>{const c=w("Breadcrumb"),e=T,a=H,l=K,_=P,d=S,f=I;return A(),k("div",$,[n(c,{items:["\u5C0F\u5DE5\u5177","\u5B57\u5E93\u5199\u5165"]}),n(f,{gutter:20,align:"stretch"},{default:s(()=>[n(d,{span:24},{default:s(()=>[n(_,{class:"general-card",title:"\u5B57\u5E93\u5199\u5165"},{default:s(()=>[n(a,null,{default:s(()=>[n(e,{onClick:u[0]||(u[0]=i=>p(1))},{default:s(()=>[F("\u5199\u5165 117 \u5B57\u5E93\uFF08K\uFF09")]),_:1}),n(e,{onClick:u[1]||(u[1]=i=>p(2))},{default:s(()=>[F("\u5199\u5165 118 \u5B57\u5E93\uFF08K\uFF09")]),_:1}),n(e,{onClick:u[2]||(u[2]=i=>p(3))},{default:s(()=>[F("\u5199\u5165 118 \u5B57\u5E93\uFF08H\uFF09")]),_:1})]),_:1}),n(l),x("div",{id:"statusArea",style:{height:"20em","background-color":"azure",color:"silver",overflow:"auto",padding:"20px"},innerHTML:r.status},null,8,y)]),_:1})]),_:1})]),_:1})])}}});const Z=v(O,[["__scopeId","data-v-df9107ac"]]);export{Z as default};