mirror of
https://github.com/silenty4ng/k5web
synced 2025-01-15 16:22:44 +00:00
1 line
3.4 KiB
JavaScript
1 line
3.4 KiB
JavaScript
import{e as B,s as h,_ as E}from"./index.e6020230.js";/* empty css *//* empty css *//* empty css *//* empty css */import{d as g,r as v,bD as y,C as A,D as C,aI as n,aH as u,G as w,aM as m,a_ as k,b9 as D,bB as x,bE as H,bJ as S,n as T}from"./arco.02de294f.js";import{e as R,b as U,g as L}from"./serial.c741fbda.js";import{C as P}from"./index.ad4d82c6.js";import"./chart.61cd37ef.js";import"./vue.4e4c1473.js";import"./tnode.17829577.js";import"./index.37837b88.js";const I={class:"container"},M=["innerHTML"],N={name:"Chi"},V=g({...N,setup($){const r=B(),i=v({status:"\u70B9\u51FB\u5199\u5165\u6309\u94AE\u5199\u5165\u5B57\u5E93\u5230\u8BBE\u5907<br/><br/>",eepromType:"",showHide:0}),F=async(s=0,t)=>{var c;await R(r.connectPort);for(let e=s;e<t.length+s;e+=128)await U(r.connectPort,e,t.slice(e-s,e-s+128),128,(c=r.configuration)==null?void 0:c.uart),i.status=i.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A"+((e-s)/t.length*100).toFixed(1)+"%<br/>",T(()=>{const o=document==null?void 0:document.getElementById("statusArea");o&&(o.scrollTop=o==null?void 0:o.scrollHeight)});i.status=i.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A100.0%<br/>",await L(r.connectPort)},b=async(s=1)=>{var c,e,o,f;if(r.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}if(((c=r.configuration)==null?void 0:c.uart)=="official"){alert("\u56FA\u4EF6\u7248\u672C\u4E0D\u5339\u914D");return}i.status=i.status+"\u6B63\u5728\u4E0B\u8F7D\u5B57\u5E93...<br />";let t;if(s==4){(e=r.configuration)!=null&&e.newpinyin?t=await fetch("/pinyin_plus.bin"):t=await fetch("/pinyin.bin");const d=t.body.getReader(),a=[];for(;;){const{done:l,value:p}=await d.read();if(l)break;a.push(...p)}const _=new Uint8Array(a);await F(131072,_);return}if(s==1){if(((o=r.configuration)==null?void 0:o.charset)=="losehu"){t=await fetch("/old_font.bin");const d=t.body.getReader(),a=[];for(;;){const{done:l,value:p}=await d.read();if(l)break;a.push(...p)}const _=new Uint8Array(a);await F(8192,_);return}if(((f=r.configuration)==null?void 0:f.charset)=="gb2312"){t=await fetch("/new_font_k.bin");const d=t.body.getReader(),a=[];for(;;){const{done:l,value:p}=await d.read();if(l)break;a.push(...p)}const _=new Uint8Array(a);await F(9344,_);return}}};return(s,t)=>{const c=h,e=k,o=P,f=D,d=x,a=y,_=H,l=S;return A(),C("div",I,[n(c,{items:["\u5C0F\u5DE5\u5177","\u5B57\u5E93\u5199\u5165"]}),n(l,{gutter:20,align:"stretch"},{default:u(()=>[n(_,{span:24},{default:u(()=>[n(a,{class:"general-card"},{title:u(()=>[w("span",{onClick:t[0]||(t[0]=()=>{i.showHide+=1})},"\u5B57\u5E93\u5199\u5165\uFF08\u624B\u53F0\u5E94\u5728\u5F00\u673A\u72B6\u6001\u4E0B\uFF09")]),default:u(()=>[n(f,null,{default:u(()=>[n(o,{bordered:""},{header:u(()=>[m(" LOSEHU \u56FA\u4EF6\u5B57\u5E93\u5199\u5165 ")]),default:u(()=>[n(e,{onClick:t[1]||(t[1]=p=>b(1))},{default:u(()=>[m("\u81EA\u52A8\u5199\u5165\u5B57\u5E93")]),_:1})]),_:1}),n(o,{bordered:""},{header:u(()=>[m(" LOSEHU H \u7248\u56FA\u4EF6\u62FC\u97F3\u7D22\u5F15\u8868 ")]),default:u(()=>[n(f,null,{default:u(()=>[n(e,{onClick:t[2]||(t[2]=p=>b(4))},{default:u(()=>[m("\u5199\u5165\u62FC\u97F3\u68C0\u7D22\u8868")]),_:1})]),_:1})]),_:1})]),_:1}),n(d),w("div",{id:"statusArea",style:{height:"20em","background-color":"azure",color:"silver",overflow:"auto",padding:"20px"},innerHTML:i.status},null,8,M)]),_:1})]),_:1})]),_:1})])}}});const tt=E(V,[["__scopeId","data-v-c90f8efa"]]);export{tt as default};
|