k5web/assets/index.14920f7a.js
2024-02-25 16:43:43 +08:00

2 lines
3.4 KiB
JavaScript

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