k5web/assets/index.28e8d011.js
2024-02-01 00:00:21 +08:00

2 lines
3.3 KiB
JavaScript

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