mirror of
https://github.com/silenty4ng/k5web
synced 2025-01-15 16:22:44 +00:00
1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
import{S as _t}from"./index.c93dfeeb.js";import{e as ft,q as gt,_ as wt}from"./index.312b6b9c.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{d as Ft,r as bt,o as yt,bp as ht,bY as xt,bU as St,aU as Ct,bB as Dt,bN as At,bC as Et,C as g,D as h,aI as n,aH as r,u as Bt,aM as m,aN as x,bw as et,G as ot,bx as st,aK as C,aJ as D,aE as A,n as nt,ba as Vt,bX as vt,aZ as Tt,b8 as Pt,bZ as It,bD as Ut,bM as kt}from"./arco.beabb834.js";import{e as U,g as ut,h as i,f as c,s as Ot}from"./serial.b70f48dc.js";import{u as Nt}from"./loading.04079284.js";import"./chart.83b8c11b.js";import"./vue.30c84055.js";const Ht={class:"container"},Mt=["innerHTML"],Yt={name:"Sat"},Lt=Ft({...Yt,setup(jt){const{loading:rt,setLoading:f}=Nt(!0),e=ft(),t=bt({showh:0,status:"\u70B9\u51FB\u5199\u5165\u6309\u94AE\u5199\u5165\u536B\u661F\u6570\u636E\u5230\u8BBE\u5907<br/><br/>",sat:"",satData:[],lng:0,lat:0,alt:0,tx:0,rx:0,txTone:0,rxTone:0,CTCSSOption:[67,69.3,71.9,74.4,77,79.7,82.5,85.4,88.5,91.5,94.8,97.4,100,103.5,107.2,110.9,114.8,118.8,123,127.3,131.8,136.5,141.3,146.2,151.4,156.7,159.8,162.2,165.5,167.9,171.3,173.8,177.3,179.9,183.5,186.2,189.9,192.8,196.6,199.5,203.5,206.5,210.7,218.1,225.7,229.1,233.6,241.8,250.3,254.1],pass:void 0,passOption:[],dt:"",timer:void 0,passCustom:void 0,dtCustom:void 0});yt(()=>{t.timer=setInterval(()=>{t.dt=new Date().toLocaleString("zh-CN",{timeZone:"Asia/Shanghai"})},1e3)}),ht(()=>{try{clearInterval(t.timer)}catch{}});const lt=()=>{t.showh+=1},it=async()=>{if(e.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}f(!0),await U(e.connectPort),await k(),await ut(e.connectPort),f(!1)},k=async()=>{var s;const l=t.dtCustom?new Date(t.dtCustom):new Date,a=[...i(parseInt(l.getFullYear().toString().substring(2,4)).toString(16)),...i((l.getMonth()+1).toString(16)),...i(l.getDate().toString(16)),...i(l.getHours().toString(16)),...i(l.getMinutes().toString(16)),...i(l.getSeconds().toString(16))];await c(e.connectPort,11200,new Uint8Array(a),6,(s=e.configuration)==null?void 0:s.uart)},pt=async l=>{const a=t.satData.find(s=>s.name==l);a&&a.path&&(t.status+="<br/>\u536B\u661F\u53C2\u6570\uFF1A<br/>",a.path.map(s=>{t.status+=s+"<br/>"})),a.path.length>2?(t.tx=parseFloat(a.path[2].split(" ")[1]),t.txTone=parseFloat(a.path[2].split(" ")[2]),t.rx=parseFloat(a.path[2].split(" ")[3]),t.rxTone=parseFloat(a.path[2].split(" ")[4])):(t.tx=0,t.txTone=0,t.rx=0,t.rxTone=0),nt(()=>{const s=document==null?void 0:document.getElementById("statusArea");s&&(s.scrollTop=s==null?void 0:s.scrollHeight)})};(async()=>{f(!0);const a=(await(await fetch("https://k5.vicicode.com/api/amateur.txt")).text()).split(/\r?\n/),s=[];let u={};for(let d=0;d<a.length;d++)Number.isNaN(parseInt(a[d].substring(0,1)))?(u.name&&u.name!=""&&(s.push(u),u={}),u.name=a[d]):(u.path||(u.path=[]),u.path.push(a[d]));t.satData=s,f(!1)})();const O=async()=>{f(!0),navigator.geolocation.getCurrentPosition(l=>{l.coords&&(t.lat=l.coords.latitude,t.lng=l.coords.longitude,l.coords.altitude&&(t.alt=l.coords.altitude))}),f(!1)};O();const ct=async(l=0,a)=>{var s;await U(e.connectPort);for(let u=l;u<a.length+l;u+=128)await c(e.connectPort,u,a.slice(u-l,u-l+128),128,(s=e.configuration)==null?void 0:s.uart),t.status=t.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A"+((u-l)/a.length*100).toFixed(1)+"%<br/>",nt(()=>{const d=document==null?void 0:document.getElementById("statusArea");d&&(d.scrollTop=d==null?void 0:d.scrollHeight)});t.status=t.status+"\u5199\u5165\u8FDB\u5EA6\uFF1A100.0%<br/>"},dt=async()=>{if(!t.sat){alert("\u8BF7\u9009\u62E9\u536B\u661F\uFF01");return}f(!0);const l=await(await fetch("https://k5.vicicode.com/api/pass",{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({sat:t.sat,sat_line_1:t.satData.find(s=>s.name==t.sat).path[0],sat_line_2:t.satData.find(s=>s.name==t.sat).path[1],lat:t.lat,lng:t.lng,alt:t.alt})})).json(),a=[];for(let s=0;s<l.pass_times.length;s++)try{let u;Date.parse(l.departure_times[s])-Date.parse(l.pass_times[s])>0?u=[l.pass_times[s],l.departure_times[s]]:u=[l.pass_times[s],l.departure_times[s+1]],a.push(u)}catch{}a.length>0?t.pass=a[0][0]+"|"+a[0][1]:t.pass=void 0,t.passOption=a,f(!1)},mt=async()=>{var N,H,M,Y,L,j,R,$,z,J,Z,q,G,K,X,Q,W,tt;if(e.connectState!=!0){alert("\u8BF7\u5148\u8FDE\u63A5\u624B\u53F0\uFF01");return}if(((N=e.configuration)==null?void 0:N.sat)!=!0){alert("\u56FA\u4EF6\u7248\u672C\u4E0D\u5339\u914D");return}if(!t.sat){alert("\u8BF7\u9009\u62E9\u536B\u661F\uFF01");return}if(t.passCustom&&(t.pass=t.passCustom[0]+"|"+t.passCustom[1]),!t.pass){alert("\u8BF7\u9009\u62E9\u8FC7\u5883\u65F6\u95F4\uFF01");return}f(!0);const l=await(await fetch("https://k5.vicicode.com/api/doppler",{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({sat:t.sat,sat_line_1:t.satData.find(b=>b.name==t.sat).path[0],sat_line_2:t.satData.find(b=>b.name==t.sat).path[1],lat:t.lat,lng:t.lng,alt:t.alt,tx:t.tx,rx:t.rx,pass_time:t.pass.split("|")[0],departure_time:t.pass.split("|")[1]})})).json(),a=t.sat,s=t.pass.split("|")[0],u=s.split("-")[0].substring(2,4),d=s.split("-")[1],E=s.split("-")[2].split(" ")[0],w=s.split(" ")[1].split(":")[0],y=s.split(" ")[1].split(":")[1],F=s.split(" ")[1].split(":")[2],_=t.pass.split("|")[1],B=_.split("-")[0].substring(2,4),V=_.split("-")[1],v=_.split("-")[2].split(" ")[0],T=_.split(" ")[1].split(":")[0],P=_.split(" ")[1].split(":")[1],I=_.split(" ")[1].split(":")[2];await U(e.connectPort);let p=new Uint8Array(10);p.set(Ot(a.trim()).subarray(0,9)),await c(e.connectPort,11168,p,10,(H=e.configuration)==null?void 0:H.uart),await c(e.connectPort,11178,i(parseInt(u).toString(16)).subarray(0,1),1,(M=e.configuration)==null?void 0:M.uart),await c(e.connectPort,11179,i(parseInt(d).toString(16)).subarray(0,1),1,(Y=e.configuration)==null?void 0:Y.uart),await c(e.connectPort,11180,i(parseInt(E).toString(16)).subarray(0,1),1,(L=e.configuration)==null?void 0:L.uart),await c(e.connectPort,11181,i(parseInt(w).toString(16)).subarray(0,1),1,(j=e.configuration)==null?void 0:j.uart),await c(e.connectPort,11182,i(parseInt(y).toString(16)).subarray(0,1),1,(R=e.configuration)==null?void 0:R.uart),await c(e.connectPort,11183,i(parseInt(F).toString(16)).subarray(0,1),1,($=e.configuration)==null?void 0:$.uart),await c(e.connectPort,11184,i(parseInt(B).toString(16)).subarray(0,1),1,(z=e.configuration)==null?void 0:z.uart),await c(e.connectPort,11185,i(parseInt(V).toString(16)).subarray(0,1),1,(J=e.configuration)==null?void 0:J.uart),await c(e.connectPort,11186,i(parseInt(v).toString(16)).subarray(0,1),1,(Z=e.configuration)==null?void 0:Z.uart),await c(e.connectPort,11187,i(parseInt(T).toString(16)).subarray(0,1),1,(q=e.configuration)==null?void 0:q.uart),await c(e.connectPort,11188,i(parseInt(P).toString(16)).subarray(0,1),1,(G=e.configuration)==null?void 0:G.uart),await c(e.connectPort,11189,i(parseInt(I).toString(16)).subarray(0,1),1,(K=e.configuration)==null?void 0:K.uart),p=new Uint8Array(2),p.set(i(((Date.parse(_)-Date.parse(s))/1e3).toString(16)).subarray(0,2)),await c(e.connectPort,11190,p,2,(X=e.configuration)==null?void 0:X.uart),p=new Uint8Array(2),t.txTone&&t.txTone>0&&p.set(i(parseInt((t.txTone*10).toFixed(0)).toString(16)).subarray(0,2)),await c(e.connectPort,11192,p,2,(Q=e.configuration)==null?void 0:Q.uart),p=new Uint8Array(2),t.rxTone&&t.rxTone>0&&p.set(i(parseInt((t.rxTone*10).toFixed(0)).toString(16)).subarray(0,2)),await c(e.connectPort,11194,p,2,(W=e.configuration)==null?void 0:W.uart),p=new Uint8Array(4),p.set(i(((Date.parse(s)-Date.parse("2000-01-01 00:00:00"))/1e3).toString(16)).subarray(0,4)),await c(e.connectPort,11196,p,4,(tt=e.configuration)==null?void 0:tt.uart);const o=[];l.shift_array.filter((b,S)=>S%2===0).map(b=>{const S=new Uint8Array(4),at=new Uint8Array(4);S.set(i(parseInt(((t.tx*1e6+b[0])/10).toFixed(0)).toString(16))),at.set(i(parseInt(((t.rx*1e6+b[1])/10).toFixed(0)).toString(16))),o.push(...S,...at)}),p=new Uint8Array(7680),p.set(new Uint8Array(o).subarray(0,7680)),await ct(123392,p),await k(),await ut(e.connectPort),f(!1)};return(l,a)=>{const s=gt,u=Vt,d=xt,E=_t,w=vt,y=St,F=Ct,_=Tt,B=Pt,V=It,v=Dt,T=At,P=Et,I=Ut,p=kt;return g(),h("div",Ht,[n(s,{items:["\u5C0F\u5DE5\u5177","\u536B\u661F\u5199\u5165"]}),n(p,{gutter:20,align:"stretch"},{default:r(()=>[n(I,{span:24},{default:r(()=>[n(P,{class:"general-card",title:"\u536B\u661F\u5199\u5165"},{default:r(()=>[n(T,{loading:Bt(rt),style:{width:"100%"},tip:"\u6B63\u5728\u5904\u7406 ..."},{default:r(()=>[n(u,{"label-col-style":{width:"25%"},field:"dt",label:"\u6D4F\u89C8\u5668\u65F6\u95F4",onClick:lt},{default:r(()=>[m(x(t.dt),1)]),_:1}),et(n(u,{"label-col-style":{width:"25%"},field:"dtCustom",label:"\u81EA\u5B9A\u4E49\u65F6\u95F4"},{default:r(()=>[ot("div",null,[n(d,{style:{width:"220px",margin:"0 24px 24px 0"},"show-time":"","time-picker-props":{defaultValue:"00:00:00"},format:"YYYY-MM-DD HH:mm:ss",modelValue:t.dtCustom,"onUpdate:modelValue":a[0]||(a[0]=o=>t.dtCustom=o)},null,8,["modelValue"]),m(" \xA0\xA0"),n(E,{size:"small",theme:"success",onClick:it},{default:r(()=>[m("\u5199\u5165\u65F6\u95F4\u5230\u53F0\u7AD9")]),_:1})])]),_:1},512),[[st,t.showh>=5]]),n(u,{"label-col-style":{width:"25%"},field:"sat",label:"\u9009\u62E9\u536B\u661F"},{default:r(()=>[n(y,{modelValue:t.sat,"onUpdate:modelValue":a[1]||(a[1]=o=>t.sat=o),onChange:pt,placeholder:"\u9009\u62E9\u536B\u661F ...","allow-search":"","allow-clear":""},{default:r(()=>[(g(!0),h(C,null,D(t.satData,o=>(g(),A(w,{key:o.name,value:o.name},{default:r(()=>[m(x(o.name),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(u,{"label-col-style":{width:"25%"},field:"lng",label:"\u53F0\u7AD9\u7ECF\u5EA6"},{default:r(()=>[n(F,{precision:6,modelValue:t.lng,"onUpdate:modelValue":a[2]||(a[2]=o=>t.lng=o)},null,8,["modelValue"])]),_:1}),n(u,{"label-col-style":{width:"25%"},field:"lat",label:"\u53F0\u7AD9\u7EAC\u5EA6"},{default:r(()=>[n(F,{precision:6,modelValue:t.lat,"onUpdate:modelValue":a[3]||(a[3]=o=>t.lat=o)},null,8,["modelValue"])]),_:1}),n(u,{"label-col-style":{width:"25%"},field:"alt",label:"\u53F0\u7AD9\u6D77\u62D4"},{default:r(()=>[n(F,{precision:0,modelValue:t.alt,"onUpdate:modelValue":a[4]||(a[4]=o=>t.alt=o)},null,8,["modelValue"])]),_:1}),n(u,{"label-col-style":{width:"25%"},label:""},{default:r(()=>[n(B,null,{default:r(()=>[n(_,{onClick:O},{default:r(()=>[m("\u6D4F\u89C8\u5668\u83B7\u53D6\u7ECF\u7EAC\u5EA6")]),_:1}),n(_,{onClick:dt},{default:r(()=>[m("\u83B7\u53D6\u536B\u661F\u8FC7\u5883\u65F6\u95F4")]),_:1})]),_:1})]),_:1}),n(u,{"label-col-style":{width:"25%"},field:"pass",label:"\u9009\u62E9\u8FC7\u5883\u65F6\u95F4"},{default:r(()=>[n(y,{modelValue:t.pass,"onUpdate:modelValue":a[5]||(a[5]=o=>t.pass=o),"allow-search":"","allow-clear":""},{default:r(()=>[(g(!0),h(C,null,D(t.passOption,o=>(g(),A(w,{key:o[0]+"|"+o[1],value:o[0]+"|"+o[1]},{default:r(()=>[m(x(o[0]+" - "+o[1]),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),et(n(u,{"label-col-style":{width:"25%"},field:"passCustom",label:"\u81EA\u5B9A\u4E49\u8FC7\u5883\u65F6\u95F4"},{default:r(()=>[n(V,{style:{width:"360px",margin:"0 24px 24px 0"},"show-time":"","time-picker-props":{defaultValue:["00:00:00","00:00:00"]},format:"YYYY-MM-DD HH:mm:ss",modelValue:t.passCustom,"onUpdate:modelValue":a[6]||(a[6]=o=>t.passCustom=o)},null,8,["modelValue"])]),_:1},512),[[st,t.showh>=5]]),n(u,{"label-col-style":{width:"25%"},field:"tx",label:"\u4E0A\u884C\u9891\u7387"},{default:r(()=>[n(F,{precision:5,modelValue:t.tx,"onUpdate:modelValue":a[7]||(a[7]=o=>t.tx=o)},null,8,["modelValue"])]),_:1}),n(u,{"label-col-style":{width:"25%"},field:"txTone",label:"\u4E0A\u884C\u4E9A\u97F3"},{default:r(()=>[n(y,{modelValue:t.txTone,"onUpdate:modelValue":a[8]||(a[8]=o=>t.txTone=o),"allow-search":"","allow-clear":""},{default:r(()=>[n(w,{value:0},{default:r(()=>[m("\u5173\u95ED")]),_:1}),(g(!0),h(C,null,D(t.CTCSSOption,o=>(g(),A(w,{key:o,value:o},{default:r(()=>[m(x(o.toFixed(1)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(u,{"label-col-style":{width:"25%"},field:"rx",label:"\u4E0B\u884C\u9891\u7387"},{default:r(()=>[n(F,{precision:5,modelValue:t.rx,"onUpdate:modelValue":a[9]||(a[9]=o=>t.rx=o)},null,8,["modelValue"])]),_:1}),n(u,{"label-col-style":{width:"25%"},field:"rxTone",label:"\u4E0B\u884C\u4E9A\u97F3"},{default:r(()=>[n(y,{modelValue:t.rxTone,"onUpdate:modelValue":a[10]||(a[10]=o=>t.rxTone=o),"allow-search":"","allow-clear":""},{default:r(()=>[n(w,{value:0},{default:r(()=>[m("\u5173\u95ED")]),_:1}),(g(!0),h(C,null,D(t.CTCSSOption,o=>(g(),A(w,{key:o,value:o},{default:r(()=>[m(x(o.toFixed(1)),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(u,{"label-col-style":{width:"25%"},label:""},{default:r(()=>[n(_,{onClick:mt},{default:r(()=>[m("\u5199\u5165\u6570\u636E")]),_:1})]),_:1}),n(v),ot("div",{id:"statusArea",style:{height:"20em","background-color":"azure",color:"silver",overflow:"auto",padding:"20px"},innerHTML:t.status},null,8,Mt)]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1})])}}});const ra=wt(Lt,[["__scopeId","data-v-a52d8196"]]);export{ra as default};
|