| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085 |
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <meta name="description" content="">
- <meta name="author" content="">
-
- <script src="js/mqttws31.min.js" type="text/javascript"></script>
- <script src="js/jquery-3.5.1.min.js"></script>
-
-
-
- <script type="text/javascript">
- var message999;
- var message0 ;
- var message4 ;
- var message9 ;
- var message6;
- var message7 ;
- var message2 ;
- var issame=false;
- var vvqrcd= '';
- var orgcycle='';
- var fincycle='';
- var orgtimestamp='';
- var CID = '';
- var ID = '';
- var PW = '';
- var TYPE = '';
- var client;
- var kname='';
- var myclientid='';
- var tt = '';
- var st = '';
- var et = '';
- var idx = '';
- var cy='';
- var vtype='';
- var vtttt='';
- var isget = false;
- var isget2 = false;
- var isget3 = false;
- var vtstpqr='';
- var vcyd='';
- var vmqtt='';
- var SN='';
- var SubID='';
- var vsn='';
- var vobj;
- var ooodata='';
-
- function init()
- {
- try
- {
- CID = getUrlParameter('CID');
- ID = getUrlParameter('ID');
- PW= getUrlParameter('PW');
- TYPE= getUrlParameter('TYPE');
- SN = getUrlParameter('SN');
- vmqtt = getUrlParameter('MQTT');
- SubID = getUrlParameter('SubID');
-
- // vvqrcd= vobj.data.data.CardID;
- vvqrcd= getUrlParameter('qrcd');
- vvqrcd=vvqrcd.replaceAll('-','=');
- //updateOutput('init');
- /*
- CID = getUrlParameter('CID');
- ID = getUrlParameter('ID');
- PW= getUrlParameter('PW');
- TYPE= getUrlParameter('TYPE');
- */
- //myclientid="Giga"+CID+"1-"+ parseInt(Math.random() * 100000000, 10);
- myclientid="Giga"+CID+"1-"+SubID;
- client = new Paho.MQTT.Client(vmqtt, Number(8083), myclientid);
- client.onMessageArrived = onMessageArrived;
- client.onConnectionLost = onConnectionLost;
- // client.connect( {onSuccess: onConnect});
- // client.connect( {onSuccess: onConnect, onFailure : onFailedConnect,timeout: 3,keepAliveInterval: 35,cleanSession : false});
- client.connect( {onSuccess: onConnect, onFailure : onFailedConnect});
-
-
- tt = getUrlParameter("tt");
- orgcycle=tt+';';
- orgtimestamp=getUrlParameter("st")+','+getUrlParameter("et");
- // alert(orgtimestamp);
- orgcycle=orgcycle+orgtimestamp+';';
-
- st ='20'+ getUrlParameter("st").replace('_','T');
- st=st.replace('/','-');
- st=st.replace('/','-');
-
-
- et = '20'+ getUrlParameter("et").replace('_','T');
- et=et.replace('/','-');
- et=et.replace('/','-');
-
- document.getElementById("ItemNOSer").value=tt;
- //document.getElementById("sd").value= '2017-06-01T08:30';
- //alert(st);
- document.getElementById("sd").value= st.split('T')[0];//'2022-09-01';//st;
- document.getElementById("sdt1").value= st.split('T')[1];
- //let theDay = new Date();
- //alert(theDay.toLocaleString('en-US', { hour12: false }));
- // alert(et);
- document.getElementById("ed").value=et.split('T')[0];
- document.getElementById("sdt2").value= et.split('T')[1];
- //document.getElementById("ed").value=theDay.toLocaleString('en-US', { hour12: false });
- idx= getUrlParameter("idx");
-
- vtype= getUrlParameter("tp");
-
- // ID= getUrlParameter("cid");
- //alert(ID);
- kname= getUrlParameter("name");
- //CID = '886999000230';
- //ID = '00000000';
- //PW= 'CMM87krWqj8Ltt00';
- // TYPE='IOS';
- document.getElementById("btn100").innerHTML =kname;
-
- cy= getUrlParameter("cy");
- orgcycle=orgcycle+cy+';';
-
- if (vtype=='1')
- {
-
- }
- if (vtype=='2')
- {
-
-
- //alert(cy);
- var vcy = cy.split(',');
- //alert(vcy[0]);
- if ( vcy[0]=='0000000')
- {
-
- }else
- {
- if (vcy[0].substring(0,1)=='1'){document.getElementById("d11").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('日');
- if (vcy[0].substring(1,2)=='1'){document.getElementById("d12").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('一');
- if (vcy[0].substring(2,3)=='1'){document.getElementById("d13").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('二');
- if (vcy[0].substring(3,4)=='1'){document.getElementById("d14").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('三');
- if (vcy[0].substring(4,5)=='1'){document.getElementById("d15").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('四');
- if (vcy[0].substring(5,6)=='1'){document.getElementById("d16").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('五');
- if (vcy[0].substring(6,7)=='1'){document.getElementById("d17").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('六');
-
- document.getElementById("st1").value= vcy[1].substring(0,2)+':'+vcy[1].substring(2,4);
-
- document.getElementById("et1").value=vcy[2].substring(0,2)+':'+vcy[2].substring(2,4);
- }
- if ( vcy[3]=='0000000')
- {
-
- }else
- {
- if (vcy[3].substring(0,1)=='1')
- {document.getElementById("d21").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
-
-
- //days.push('日');
- if (vcy[3].substring(1,2)=='1'){document.getElementById("d22").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('一');
- if (vcy[3].substring(2,3)=='1'){document.getElementById("d23").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('二');
- if (vcy[3].substring(3,4)=='1'){document.getElementById("d24").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('三');
- if (vcy[3].substring(4,5)=='1'){document.getElementById("d25").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('四');
- if (vcy[3].substring(5,6)=='1'){document.getElementById("d26").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('五');
- if (vcy[3].substring(6,7)=='1'){document.getElementById("d27").style.background="url('image/bgreen.png') no-repeat center/100%";}
-
- //days.push('六');
- document.getElementById("st2").value= vcy[4].substring(0,2)+':'+vcy[4].substring(2,4);
- document.getElementById("et2").value=vcy[5].substring(0,2)+':'+vcy[5].substring(2,4);
- }
- if ( vcy[6]=='0000000')
- {
-
- }else
- {
- if (vcy[6].substring(0,1)=='1')
- {document.getElementById("d31").style.background="url('image/bgreen.png') no-repeat center/100%";}
- //days.push('日');
- if (vcy[6].substring(1,2)=='1')
- {document.getElementById("d32").style.background="url('image/bgreen.png') no-repeat center/100%";}
- //days.push('一');
- if (vcy[6].substring(2,3)=='1')
- {document.getElementById("d33").style.background="url('image/bgreen.png') no-repeat center/100%";}
- //days.push('二');
- if (vcy[6].substring(3,4)=='1')
- {document.getElementById("d34").style.background="url('image/bgreen.png') no-repeat center/100%";}
- //days.push('三');
- if (vcy[6].substring(4,5)=='1')
- {document.getElementById("d35").style.background="url('image/bgreen.png') no-repeat center/100%";}
- //days.push('四');
- if (vcy[6].substring(5,6)=='1')
- {document.getElementById("d36").style.background="url('image/bgreen.png') no-repeat center/100%";}
- //days.push('五');
- if (vcy[6].substring(6,7)=='1')
- {document.getElementById("d37").style.background="url('image/bgreen.png') no-repeat center/100%";}
- //days.push('六');
-
- document.getElementById("st3").value= vcy[7].substring(0,2)+':'+vcy[7].substring(2,4);
- document.getElementById("et3").value=vcy[8].substring(0,2)+':'+vcy[8].substring(2,4);
- }
- }
-
-
- //alert(orgcycle);
- //updateOutput('CID='+CID);
- //updateOutput('ID='+ID);
- //updateOutput('PW='+PW);
- //updateOutput('TYPE='+TYPE);
- if (TYPE=='ANDROID')
- {
- connect();
- }
- vsn='';
-
-
- }catch(e)
- {
- alert(e);
- }
- }
- function onConnectionLost(message)
- {
- client.connect( {onSuccess: onConnect, onFailure : onFailedConnect});
- }
- function onMessageArrived(message)
- {
-
- //alert(message.payloadString);
- var errda = message.payloadString;
-
- if (errda.startsWith('modify'))
- {
- try
- {
- var kkdd = errda.split(',');
-
-
- if (kkdd[3]==kname)
- {
-
- if (kkdd[1]==idx)
- {
- if (kkdd[2]!=SubID)
- {
- alert('此筆資料已修改');
- window.history.go(-1);
- }
- }
- }
- else
- {
-
- }
- }catch
- {}
-
- }else
- {
-
- vobj = JSON.parse( errda);
- var jsonString = "{\"action\":\"decode\", \"serial\":\"002\",\"data\":\""+vobj.data+"\"}";
- //updateOutput('----------------------------------------------');
- //updateOutput(jsonString);
- if (vsn=='001')
- {
- vsn='002';
- }
- else if (vsn=='003')
- {
- vsn='004';
- }
- else if (vsn=='102')
- {
- jsonString = "{\"action\":\"decode\", \"serial\":\"103\",\"data\":\""+vobj.data+"\"}"
- vsn='103';
- //alert('103');
- //alert(errda);
- }
- //alert(vsn);
- /// "WebToApp". 為我們和前端開發人員的約定
- if (TYPE=='IOS')
- {
- window.webkit.messageHandlers.WebToApp.postMessage(jsonString);
- }
- if (TYPE=='ANDROID')
- {
- webSocket.send(jsonString);
- }
-
- }
-
- }
- function onFailedConnect()
- {
- //alert('連線異常');
- }
- function onConnect()
- {
- client.subscribe('Reserve'+CID+'1-'+SubID);
- try
- {
-
-
-
- }
- catch(e)
- {
- alert(e);
- }
- //alert('c');
- }
-
- </script>
- <title>預約 QR Code</title>
- <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
- </head>
-
- <body class="text-center" onload="init()">
-
-
- <div>
- <div class="card" style="box-shadow: 0px 0px 1px 1px rgba(0,0,0,0.1);margin: 21px 20px 0;background-color:#FFFFFF;">
-
- <div style="margin: 16px 0 0px 4px;background-color:#FFFFFF;" >
- <button id="btn100" style="margin: 2px 0px 0px 0px;outline:none;line-height:40px;vertical-align: middle; text-align: left;width:100%;border:0px white none;background-color:#FFFFFF;font-family:Roboto_Light;font-size:24px;color:#646464;height:42px;"></button>
-
- </div>
- <div style="text-align:center">
- <!-- <h1 class="h3 mb-3 font-weight-normal">預收貨款</h1> -->
- <!-- <form class="form-signin" id="senddocument"> -->
- <div style="margin: 3px 9px 3px 9px;text-align:left;">
- <label style="margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:24px;color:#646464;border:none;width: 100px;">預約人 :  </label><input type="text" id="ItemNOSer" style="height:40px;box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:20px;color:#646464;border:none;width:calc(99% - 100px);" placeholder="" required></div>
- <div style="margin: 3px 9px 3px 9px;text-align:left;">
- <label style="margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:24px;color:#646464;border:none;width: 100px;">開始日 :  </label><input type="date" id="sd" style="height:40px;box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);width: calc(99% - 100px);margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:20px;color:#646464;border:none;"></div>
- <div style="margin: 3px 9px 3px 9px;text-align:left;">
- <label style="margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:24px;color:#646464;border:none;width: 100px;">開始時 :  </label><input type="time" id="sdt1" style="height:40px;box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);width: calc(99% - 100px);margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:20px;color:#646464;border:none;"></div>
-
- <div style="margin: 3px 9px 3px 9px;text-align:left;">
- <label style="margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:24px;color:#646464;border:none;width: 100px;">結束日 :  </label><input type="date" id="ed" style="height:40px;box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);width: calc(99% - 100px);margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:20px;color:#646464;border:none;"></div>
- <div style="margin: 3px 9px 3px 9px;text-align:left;">
- <label style="margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:24px;color:#646464;border:none;width: 100px;">結束時 :  </label><input type="time" id="sdt2" style="height:40px;box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);width: calc(99% - 100px);margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:20px;color:#646464;border:none;"></div>
-
-
-
-
- <hr style="margin: 23px 9px 15px 9px;border: solid 1px #979797;">
-
- <table style="width: 100%">
- <tbody>
- <tr>
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d11' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">日</button>
- </td>
-
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d12' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png) ; background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">一</button>
- </td>
-
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d13' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">二</button>
- </td>
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d14' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">三</button>
- </td>
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d15' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">四</button>
- </td>
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d16' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">五</button>
- </td>
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d17' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)" >六</button>
- </td>
-
- </tbody>
- </table>
- </div>
-
- <div style="margin: 3px 9px 3px 9px;text-align:left;">
- <label style="margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:24px;color:#646464;border:none;width: 100px;">開始時 :  </label><input type="time" id="st1" style="height:40px;box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);width: calc(99% - 100px);margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:20px;color:#646464;border:none;"></div>
- <div style="margin: 3px 9px 3px 9px;text-align:left;">
- <label style="margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:24px;color:#646464;border:none;width: 100px;">結束時 :  </label><input type="time" id="et1" style="height:40px;box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);width: calc(99% - 100px);margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:20px;color:#646464;border:none;"></div>
-
-
- <hr style="margin: 23px 9px 15px 9px;border: solid 1px #979797;">
-
- <table style="width: 100%">
- <tbody>
- <tr>
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d21' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">日</button>
- </td>
-
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d22' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">一</button>
- </td>
-
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d23' type="button" style="padding:0px 0px 0px 0px;padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">二</button>
- </td>
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d24' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">三</button>
- </td>
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d25' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">四</button>
- </td>
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d26' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">五</button>
- </td>
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d27' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)" >六</button>
- </td>
-
- </tbody>
- </table>
-
- <div style="margin: 3px 9px 3px 9px;text-align:left;">
- <label style="margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:24px;color:#646464;border:none;width: 100px;">開始時 :  </label><input type="time" id="st2" style="height:40px;box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);width: calc(99% - 100px);margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:20px;color:#646464;border:none;"></div>
- <div style="margin: 3px 9px 3px 9px;text-align:left;">
- <label style="margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:24px;color:#646464;border:none;width: 100px;">結束時 :  </label><input type="time" id="et2" style="height:40px;box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);width: calc(99% - 100px);margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:20px;color:#646464;border:none;"></div>
-
-
- <hr style="margin: 23px 9px 15px 9px;border: solid 1px #979797;">
-
-
- <table style="width: 100%">
- <tbody>
- <tr>
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d31' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">日</button>
- </td>
-
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d32' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">一</button>
- </td>
-
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d33' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">二</button>
- </td>
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d34' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">三</button>
- </td>
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d35' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">四</button>
- </td>
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d36' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)">五</button>
- </td>
-
- <td style="width: 13%;text-align: center; vertical-align: middle;">
- <button id ='d37' type="button" style="padding:0px 0px 0px 0px;border-width: 0px;margin: 0px 0px 5px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px; height: 40px;background-color:#FFFFFF;width:40px;background-image: url(image/bgrey.png); background-repeat: no-repeat;background-size: 40px 40px;" onclick="btnitemback(this.id)" >六</button>
- </td>
-
- </tbody>
- </table>
-
- <div style="margin: 3px 9px 3px 9px;text-align:left;">
- <label style="margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:24px;color:#646464;border:none;width: 100px;">開始時 :  </label><input type="time" id="st3" style="height:40px;box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);width: calc(99% - 100px);margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:20px;color:#646464;border:none;"></div>
- <div style="margin: 3px 9px 3px 9px;text-align:left;">
- <label style="margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:24px;color:#646464;border:none;width: 100px;">結束時 :  </label><input type="time" id="et3" style="height:40px;box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.5);width: calc(99% - 100px);margin: 5px 0px 5px 0px;font-family:Roboto_Light;font-size:20px;color:#646464;border:none;"></div>
-
- </br>
- <table style="width: 100%">
- <tbody>
- <tr>
- <td style="width: 33.3%"><button type="button" style="border-color: #dcdcdc;border-width: 1px;border-color: #dcdcdc;border-width: 1px;margin: 0px 0px 20px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px;width: 110px; height: 60px; background-color: rgba(255, 0, 20, 0.2);width:100%;" onclick="btndddel()">刪除</button></td><td style="width: 33.3%"><button type="button" style="border-color: #dcdcdc;border-width: 1px;border-color: #dcdcdc;border-width: 1px;margin: 0px 0px 20px 0px;color:#787878;font-family: Roboto_Light; font-size: 24px;width: 110px; height: 60px; background-color: #cce8fc;width:100%;" onclick="btnSaveTmp()"'+
- '>儲存</button> </td><td style="width: 33.3%"><button type="button" style="border-color: #dcdcdc;border-width: 1px;border-color: #dcdcdc;border-width: 1px;margin: 0px 0px 20px 0px;color:#FFFFFF;font-family: Roboto_Light; font-size: 24px;width: 110px; height: 60px; background-color: #64c800;width:100%;" onclick="btnSaveqr()">預約</button></td>
-
- </tbody>
- </table>
- </div>
-
- </div>
- <div id="output" style="display:none">
- <h2>Output</h2>
- </div>
-
- <script type="text/javascript">
-
- function btnSaveTmp()
- {
- try
- {
- issame=false;
- //alert(idx);
- var vvee1='';
- var vvee2='';
- var vvee3='';
- var cycy='';
-
- var st1 = '0000' ;
- var et1= '0000' ;
-
- var st2 = '0000' ;
- var et2= '0000' ;
-
- var st3 = '0000' ;
- var et3= '0000' ;
- //12345
- var vItemNOSer=document.getElementById("ItemNOSer").value;
- if (vItemNOSer.length<1)
- {
- alert('請輸入預約人');
- return;
- }
-
- if((document.getElementById("sd").value<1) || (document.getElementById("ed").value<1) ||(document.getElementById("sdt1").value<1) || (document.getElementById("sdt2").value<1))
- {
- alert('請輸入開始與結束日期時間');
- return;
- }
-
- var vsdsd=document.getElementById("sd").value+'T'+document.getElementById("sdt1").value;
- //alert(vsdsd);
- //return;
- var veded =document.getElementById("ed").value+'T'+document.getElementById("sdt2").value;
- //alert(veded);
- if ((vsdsd.length<2)|| (veded.length<2))
- {
- alert('請輸入開始與結束日期時間');
- return;
- }
- //alert('pass');
- if (vsdsd.length>16)
- {
- vsdsd=vsdsd.substring(0,16);
- }
- if (veded.length>16)
- {
- veded=veded.substring(0,16);
- }
- vsdsd=vsdsd.replace('T','_');
- vsdsd=vsdsd.replace('-','/');
- vsdsd=vsdsd.replace('-','/');
-
- veded=veded.replace('T','_');
- veded=veded.replace('-','/');
- veded=veded.replace('-','/');
- vsdsd=vsdsd.substring(2,vsdsd.length);
- veded=veded.substring(2,veded.length);
- //alert(vsdsd);
- //alert(veded);
- var vtstp=vsdsd+','+veded;
-
- //alert(vtstp);
- //return;
- //if (document.getElementById("d11").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png')
- if (document.getElementById("d11").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1='1';
- //alert('bgreen');
- }else
- {
- vvee1='0';
- //alert('bgrey');
- }
- if (document.getElementById("d12").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1=vvee1+'1';
- }else
- {
- vvee1=vvee1+'0';
- }
- if (document.getElementById("d13").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1=vvee1+'1';
- }else
- {
- vvee1=vvee1+'0';
- }
- if (document.getElementById("d14").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1=vvee1+'1';
- }else
- {
- vvee1=vvee1+'0';
- }
- if (document.getElementById("d15").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1=vvee1+'1';
- }else
- {
- vvee1=vvee1+'0';
- }
- if (document.getElementById("d16").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1=vvee1+'1';
- }else
- {
- vvee1=vvee1+'0';
- }
- if (document.getElementById("d17").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1=vvee1+'1';
- }else
- {
- vvee1=vvee1+'0';
- }
- //alert(vvee1);
-
-
-
- if (document.getElementById("d21").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2='1';
- //alert('bgreen');
- }else
- {
- vvee2='0';
- //alert('bgrey');
- }
- if (document.getElementById("d22").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2=vvee2+'1';
- }else
- {
- vvee2=vvee2+'0';
- }
- if (document.getElementById("d23").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2=vvee2+'1';
- }else
- {
- vvee2=vvee2+'0';
- }
- if (document.getElementById("d24").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2=vvee2+'1';
- }else
- {
- vvee2=vvee2+'0';
- }
- if (document.getElementById("d25").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2=vvee2+'1';
- }else
- {
- vvee2=vvee2+'0';
- }
- if (document.getElementById("d26").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2=vvee2+'1';
- }else
- {
- vvee2=vvee2+'0';
- }
- if (document.getElementById("d27").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2=vvee2+'1';
- }else
- {
- vvee2=vvee2+'0';
- }
- // alert(vvee2);
-
-
- if (document.getElementById("d31").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3='1';
- //alert('bgreen');
- }else
- {
- vvee3='0';
- //alert('bgrey');
- }
- if (document.getElementById("d32").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3=vvee3+'1';
- }else
- {
- vvee3=vvee3+'0';
- }
- if (document.getElementById("d33").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3=vvee3+'1';
- }else
- {
- vvee3=vvee3+'0';
- }
- if (document.getElementById("d34").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3=vvee3+'1';
- }else
- {
- vvee3=vvee3+'0';
- }
- if (document.getElementById("d35").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3=vvee3+'1';
- }else
- {
- vvee3=vvee3+'0';
- }
- if (document.getElementById("d36").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3=vvee3+'1';
- }else
- {
- vvee3=vvee3+'0';
- }
- if (document.getElementById("d37").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3=vvee3+'1';
- }else
- {
- vvee3=vvee3+'0';
- }
- //alert(vvee3);
- var ktype = '1';
- if (vvee1=='0000000')
- {
-
- }else
- {
- ktype='2';
- st1 = document.getElementById("st1").value.replace(':','') ;
- et1= document.getElementById("et1").value.replace(':','') ;
- if (st1.length==0 || et1.length==0)
- {
- alert('請選擇時段1的起始與結束時間');
- return;
- }
- }
- if (vvee2=='0000000')
- {
-
- }else
- {
- ktype='2';
- st2 = document.getElementById("st2").value.replace(':','') ;
- et2= document.getElementById("et2").value.replace(':','') ;
- if (st2.length==0 || et2.length==0)
- {
- alert('請選擇時段2的起始與結束時間');
- return;
- }
- }
- if (vvee3=='0000000')
- {
-
- }else
- {
- ktype='2';
- st3 = document.getElementById("st3").value.replace(':','') ;
- et3= document.getElementById("et3").value.replace(':','') ;
-
- //alert(st3.length)
- if (st3.length==0 || et3.length==0)
- {
- alert('請選擇時段3的起始與結束時間');
- return;
- }
- }
-
- //alert(ktype);
-
-
- if (ktype=='2')
- {
- cycy=vvee1+','+st1 +','+ et1+','+ vvee2+','+st2+','+et2+','+vvee3+','+st3+','+et3;
- }
- else
- {
- //cycy='';
- }
- // alert(ktype);
- //updateOutput('cycy='+cycy);
- //alert(cycy);
-
-
- fincycle='';
- fincycle= document.getElementById("ItemNOSer").value+';';
- fincycle=fincycle+ vtstp+';';
-
- fincycle=fincycle+cycy+';';
-
- //alert(cycy);
- // alert(fincycle);
- if (orgcycle==fincycle)
- {
- issame=true;
- // alert('相同');
- }
-
- if (issame)
- {
- alert('OK');
- window.history.go(-1);
- }
- else
- {
-
- var vt=new Date().format("yyyy/MM/dd_HH:mm:ss");
- //alert(document.getElementById("ItemNOSer").value);
- vtttt = document.getElementById("ItemNOSer").value;
-
- // alert(ktype);
- // return;
-
- var edata ="{\"action\":\"mqttupdateRemoteKey\",\"data\":{\"Command\":\"PassWord="+PW+"&ReGenerate=1&Stat=0&Type="+ktype+"&IndexID="+idx+"&TimeStamp="+vtstp+"&Cycle="+cycy+"&UserID="+ID+"&Title="+vtttt+"\",\"SerialNo\":\"Reserve"+CID+"1-"+SubID+"\",\"TimeStamp\":\""+vt+"\",\"Token\":\"Gigatech23634857\"}}";
-
- var jsonString = "{\"action\":\"encode\", \"serial\":\"001\",\"data\":"+edata+"}";
- vsn='001';
- isget2=false;
- // updateOutput(jsonString);
- //alert(jsonString
-
- if (TYPE=='IOS')
- {
- window.webkit.messageHandlers.WebToApp.postMessage(jsonString);
- }
-
- if (TYPE=='ANDROID')
- {
- webSocket.send(jsonString);
- }
-
- }
-
- }catch(e)
- {
- alert(e);
- }
-
- }
-
- function senttoother()
- {
- try
- {
- message999 = new Paho.MQTT.Message( "modify,"+idx+","+SubID+","+kname );
- // alert('send to other = '+ "modify,"+idx+","+SubID+","+kname );
- message999.qos = 0;
- message999.retained = false;
-
- for (var iii = 1; iii < 9; iii++)
- {
- if ( iii.toString() !=SubID.toString())
- {
- message999.destinationName = 'Reserve'+CID+'1-'+iii.toString() ;
- client.send(message999);
- }
- }
-
- }
- catch(e)
- {
- alert(e);
- }
- }
-
- function btnSaveqr()
- {
-
- issame=false;
- //alert(idx);
- var vvee1='';
- var vvee2='';
- var vvee3='';
- var cycy='';
-
- var st1 = '0000' ;
- var et1= '0000' ;
-
- var st2 = '0000' ;
- var et2= '0000' ;
-
- var st3 = '0000' ;
- var et3= '0000' ;
-
-
- //var vsdsd=document.getElementById("sd").value;
- //var veded =document.getElementById("ed").value;
- var vsdsd=document.getElementById("sd").value+'T'+document.getElementById("sdt1").value;
- //alert(vsdsd);
- //return;
- var veded =document.getElementById("ed").value+'T'+document.getElementById("sdt2").value;
-
- if (vsdsd.length>16)
- {
- vsdsd=vsdsd.substring(0,16);
- }
- if (veded.length>16)
- {
- veded=veded.substring(0,16);
- }
- //var vsdsd=document.getElementById("sd").value.format("yyyy/MM/dd_HH:mm");
- //vsdsd=vsdsd.substring(0,16);
- //alert(vsdsd);
- //return;
-
- //12345
- var vItemNOSer=document.getElementById("ItemNOSer").value;
- if (vItemNOSer.length<1)
- {
- alert('請輸入預約人');
- return;
- }
-
- if((document.getElementById("sd").value<1) || (document.getElementById("ed").value<1) ||(document.getElementById("sdt1").value<1) || (document.getElementById("sdt2").value<1))
- {
- alert('請輸入開始與結束日期時間');
- return;
- }
-
- var vsdsd=document.getElementById("sd").value+'T'+document.getElementById("sdt1").value;
- //alert(vsdsd);
- //return;
- var veded =document.getElementById("ed").value+'T'+document.getElementById("sdt2").value;
- //alert(veded);
- if ((vsdsd.length<2)|| (veded.length<2))
- {
- alert('請輸入開始與結束日期時間');
- return;
- }
- vsdsd=vsdsd.replace('T','_');
- vsdsd=vsdsd.replace('-','/');
- vsdsd=vsdsd.replace('-','/');
-
- veded=veded.replace('T','_');
- veded=veded.replace('-','/');
- veded=veded.replace('-','/');
- vsdsd=vsdsd.substring(2,vsdsd.length);
- veded=veded.substring(2,veded.length);
- //alert(vsdsd);
- //alert(veded);
- var vtstp=vsdsd+','+veded;
- vtstpqr=vtstp;
- vtstpqr=vtstpqr.replace('_',' ');
- vtstpqr=vtstpqr.replace('_',' ');
- vtstpqr=vtstpqr.replace(',','~');
-
- //alert(vtstp);
- //return;
-
- if (document.getElementById("d11").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1='1';
- //alert('bgreen');
- }else
- {
- vvee1='0';
- //alert('bgrey');
- }
- if (document.getElementById("d12").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1=vvee1+'1';
- }else
- {
- vvee1=vvee1+'0';
- }
- if (document.getElementById("d13").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1=vvee1+'1';
- }else
- {
- vvee1=vvee1+'0';
- }
- if (document.getElementById("d14").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1=vvee1+'1';
- }else
- {
- vvee1=vvee1+'0';
- }
- if (document.getElementById("d15").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1=vvee1+'1';
- }else
- {
- vvee1=vvee1+'0';
- }
- if (document.getElementById("d16").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1=vvee1+'1';
- }else
- {
- vvee1=vvee1+'0';
- }
- if (document.getElementById("d17").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee1=vvee1+'1';
- }else
- {
- vvee1=vvee1+'0';
- }
- //alert(vvee1);
-
-
-
- if (document.getElementById("d21").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2='1';
- //alert('bgreen');
- }else
- {
- vvee2='0';
- //alert('bgrey');
- }
- if (document.getElementById("d22").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2=vvee2+'1';
- }else
- {
- vvee2=vvee2+'0';
- }
- if (document.getElementById("d23").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2=vvee2+'1';
- }else
- {
- vvee2=vvee2+'0';
- }
- if (document.getElementById("d24").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2=vvee2+'1';
- }else
- {
- vvee2=vvee2+'0';
- }
- if (document.getElementById("d25").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2=vvee2+'1';
- }else
- {
- vvee2=vvee2+'0';
- }
- if (document.getElementById("d26").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2=vvee2+'1';
- }else
- {
- vvee2=vvee2+'0';
- }
- if (document.getElementById("d27").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee2=vvee2+'1';
- }else
- {
- vvee2=vvee2+'0';
- }
- // alert(vvee2);
-
-
- if (document.getElementById("d31").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3='1';
- //alert('bgreen');
- }else
- {
- vvee3='0';
- //alert('bgrey');
- }
- if (document.getElementById("d32").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3=vvee3+'1';
- }else
- {
- vvee3=vvee3+'0';
- }
- if (document.getElementById("d33").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3=vvee3+'1';
- }else
- {
- vvee3=vvee3+'0';
- }
- if (document.getElementById("d34").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3=vvee3+'1';
- }else
- {
- vvee3=vvee3+'0';
- }
- if (document.getElementById("d35").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3=vvee3+'1';
- }else
- {
- vvee3=vvee3+'0';
- }
- if (document.getElementById("d36").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3=vvee3+'1';
- }else
- {
- vvee3=vvee3+'0';
- }
- if (document.getElementById("d37").style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- vvee3=vvee3+'1';
- }else
- {
- vvee3=vvee3+'0';
- }
- //alert(vvee3);
- var ktype = '1';
- if (vvee1=='0000000')
- {
-
- }else
- {
- ktype='2';
- st1 = document.getElementById("st1").value.replace(':','') ;
- et1= document.getElementById("et1").value.replace(':','') ;
- if (st1.length==0 || et1.length==0)
- {
- alert('請選擇時段1的起始與結束時間');
- return;
- }
- }
- if (vvee2=='0000000')
- {
-
- }else
- {
- ktype='2';
- st2 = document.getElementById("st2").value.replace(':','') ;
- et2= document.getElementById("et2").value.replace(':','') ;
- if (st2.length==0 || et2.length==0)
- {
- alert('請選擇時段2的起始與結束時間');
- return;
- }
- }
- if (vvee3=='0000000')
- {
-
- }else
- {
- ktype='2';
- st3 = document.getElementById("st3").value.replace(':','') ;
- et3= document.getElementById("et3").value.replace(':','') ;
-
- //alert(st3.length)
- if (st3.length==0 || et3.length==0)
- {
- alert('請選擇時段3的起始與結束時間');
- return;
- }
- }
-
-
-
-
- if (ktype=='2')
- {
- cycy=vvee1+','+st1 +','+ et1+','+ vvee2+','+st2+','+et2+','+vvee3+','+st3+','+et3;
-
- vcyd='';
- var vcy = cycy.split(',');
- let days=[];
-
- if (vcy[0]=='0000000')
- {
- }else
- {
-
-
- if (vcy[0].substring(0,1)=='1')
- days.push('日');
- if (vcy[0].substring(1,2)=='1')
- days.push('一');
- if (vcy[0].substring(2,3)=='1')
- days.push('二');
- if (vcy[0].substring(3,4)=='1')
- days.push('三');
- if (vcy[0].substring(4,5)=='1')
- days.push('四');
- if (vcy[0].substring(5,6)=='1')
- days.push('五');
- if (vcy[0].substring(6,7)=='1')
- days.push('六');
- vcy[1]=vcy[1].substring(0,2)+':'+vcy[1].substring(2,4);
- vcy[2]=vcy[2].substring(0,2)+':'+vcy[2].substring(2,4);
- vcyd=vcyd+'#1.'+vcy[1]+'~'+vcy[2]+' '+' '+days.join(',');
- }
-
- days=[];
- if (vcy[3]=='0000000')
- {
- }else
- {
-
-
- if (vcy[3].substring(0,1)=='1')
- days.push('日');
- if (vcy[3].substring(1,2)=='1')
- days.push('一');
- if (vcy[3].substring(2,3)=='1')
- days.push('二');
- if (vcy[3].substring(3,4)=='1')
- days.push('三');
- if (vcy[3].substring(4,5)=='1')
- days.push('四');
- if (vcy[3].substring(5,6)=='1')
- days.push('五');
- if (vcy[3].substring(6,7)=='1')
- days.push('六');
- vcy[4]=vcy[4].substring(0,2)+':'+vcy[4].substring(2,4);
- vcy[5]=vcy[5].substring(0,2)+':'+vcy[5].substring(2,4);
- vcyd=vcyd+'#2.'+vcy[4]+'~'+vcy[5]+' '+' '+days.join(',');
- }
-
- days=[];
- if (vcy[6]=='0000000')
- {
- }else
- {
-
-
- if (vcy[6].substring(0,1)=='1')
- days.push('日');
- if (vcy[6].substring(1,2)=='1')
- days.push('一');
- if (vcy[6].substring(2,3)=='1')
- days.push('二');
- if (vcy[6].substring(3,4)=='1')
- days.push('三');
- if (vcy[6].substring(4,5)=='1')
- days.push('四');
- if (vcy[6].substring(5,6)=='1')
- days.push('五');
- if (vcy[6].substring(6,7)=='1')
- days.push('六');
- vcy[7]=vcy[7].substring(0,2)+':'+vcy[7].substring(2,4);
- vcy[8]=vcy[8].substring(0,2)+':'+vcy[8].substring(2,4);
- vcyd=vcyd+'#3.'+vcy[7]+'~'+vcy[8]+' '+' '+days.join(',');
- }
-
-
- }
- else
- {
- //cycy='';
- }
-
- fincycle='';
- fincycle= document.getElementById("ItemNOSer").value+';';
- fincycle=fincycle+ vtstp+';';
-
- fincycle=fincycle+cycy+';';
-
- //alert(cycy);
- // alert(fincycle);
- if (orgcycle==fincycle)
- {
- issame=true;
- // alert('相同');
- }
- vtttt = document.getElementById("ItemNOSer").value;
- if (issame)
- {
-
- vsn='';
- try
- {
-
- vtttt = document.getElementById("ItemNOSer").value;
-
-
- var jsonString = "{\"action\":\"shareQr\", \"serial\":\"001\",\"data\":{\"name\":\""+kname+"\",\"note\":\""+vtttt+"\",\"QRCode\":\""+vvqrcd+"\",\"time\":\""+vtstpqr+"\",\"cycle\":\""+vcyd+"\"}}";
-
- if (TYPE=='IOS')
- {
- window.webkit.messageHandlers.WebToApp.postMessage(jsonString);
- }
- if (TYPE=='ANDROID')
- {
- webSocket.send(jsonString);
- }
-
- }catch(e)
- {
- alert('連線異常');
- }
-
-
- }
- else
- {
-
-
-
- var vt=new Date().format("yyyy/MM/dd_HH:mm:ss")
- // alert(document.getElementById("ItemNOSer").value);
- vtttt = document.getElementById("ItemNOSer").value;
- // alert(ktype);
- // return;
- var edata456 ="{\"action\":\"mqttupdateRemoteKey\",\"data\":{\"Command\":\"PassWord="+PW+"&ReGenerate=1&Stat=1&Type="+ktype+"&IndexID="+idx+"&TimeStamp="+vtstp+"&Cycle="+cycy+"&UserID="+ID+"&Title="+vtttt+"\",\"SerialNo\":\"Reserve"+CID+"1-"+SubID+"\",\"TimeStamp\":\""+vt+"\",\"Token\":\"Gigatech23634857\"}}";
-
- var jsonString333 = "{\"action\":\"encode\", \"serial\":\"003\",\"data\":"+edata456+"}";
- vsn='003';
- //updateOutput(jsonString);
- //alert(jsonString);
- //return;
- if (TYPE=='IOS')
- {
- window.webkit.messageHandlers.WebToApp.postMessage(jsonString333);
- }
-
- if (TYPE=='ANDROID')
- {
- webSocket.send(jsonString333);
- }
- }
-
-
-
-
- }
-
- function btnitemback(vid)
- {
- try
- {
- //alert(vid);
- // alert(document.getElementById(vid).style.backgroundImage.slice(4, -1).replace(/"/g, ""));
-
- if (document.getElementById(vid).style.backgroundImage.slice(4, -1).replace(/"/g, "").includes('bgreen.png'))
- {
- document.getElementById(vid).style.background="url('image/bgrey.png') no-repeat center/100%";
- }else
- {
- document.getElementById(vid).style.background="url('image/bgreen.png') no-repeat center/100%";
- }
-
-
- }catch(e)
- {
- alert(e);
- }
-
- }
-
- function btndddel()
- {
-
- var yes = confirm('確定刪除?');
- if (yes) {
-
- try
- {
-
- //alert('ue');
- //return;
- var vt=new Date().format("yyyy/MM/dd_HH:mm:ss")
- // alert(document.getElementById("ItemNOSer").value);
- vtttt = document.getElementById("ItemNOSer").value;
- // alert(ktype);
-
- // return;
- var edata3 ="";
- edata3 ="{\"action\":\"mqttdeleteRemoteKey\",\"data\":{\"Command\":\"PassWord="+PW+"&IndexID="+idx+"&UserID="+ID+"\",\"SerialNo\":\"Reserve"+CID+"1-"+SubID+"\",\"TimeStamp\":\""+vt+"\",\"Token\":\"Gigatech23634857\"}}";
- // alert(edata);
- var jsonString4 ="";
- jsonString4 = "{\"action\":\"encode\", \"serial\":\"101\",\"data\":"+edata3+"}";
-
- vsn='101';
- // updateOutput(jsonString);
- //alert(jsonString);
- //return;
- if (TYPE=='IOS')
- {
- window.webkit.messageHandlers.WebToApp.postMessage(jsonString4);
- }
-
- if (TYPE=='ANDROID')
- {
- webSocket.send(jsonString4);
- }
-
- }
- catch(e)
- {
- alert('連線異常');
- }
- } else {
- }
-
- }
-
-
- function getdoorlist()
- {
-
- var vt=new Date().format("yyyy/MM/dd_HH:mm:ss")
-
-
-
- var edata ="{\"action\":\"mqttqueryCallList\",\"data\":{\"Command\":\"PassWord="+PW+"\",\"SerialNo\":\"Reserve"+CID+"1\",\"TimeStamp\":\""+vt+"\",\"Token\":\"Gigatech23634857\"}}";
-
- var jsonString = "{\"action\":\"encode\", \"serial\":\"001\",\"data\":"+edata+"}";
- vsn='001';
- // updateOutput(jsonString);
- isget2=false;
- if (TYPE=='IOS')
- {
- window.webkit.messageHandlers.WebToApp.postMessage(jsonString);
- }
-
- if (TYPE=='ANDROID')
- {
- webSocket.send(jsonString);
- }
-
-
-
- }
-
-
-
- </script>
- <script type="text/javascript">
- var webSocket;
- var input = document.getElementById("input")
- var output = document.getElementById("output");
- var vdata="";
- var isok=true;
- var webSocket;
- //var connectBtn = document.getElementById("connectBtn");
- //var wsUrl = "ws://localhost:2980/";
- // var wsUrl = "ws://192.168.0.27:2980/";
- // var wsUrl = "ws://192.168.0.30:2980/";
- var wsUrl = "ws://127.0.0.1:2980/";
- //var wsUrl = "ws://192.168.0.25:2980/";
- function connect() {
- // open the connection if one does not exist
- if (webSocket !== undefined
- && webSocket.readyState !== WebSocket.CLOSED) {
- return;
- }
-
- // updateOutput("Trying to establish a WebSocket connection to <code>" + wsUrl + "</code>");
-
- // Create a websocket
- webSocket = new WebSocket(wsUrl);
-
- webSocket.onopen = function(event) {
-
- // updateOutput("Connected!");
- // connectBtn.disabled = true;
- try
- {
-
-
- /*
- setTimeout(() => {
- if (isget)
- {
- }else
- {
-
- getdoorlist() ;
- }
- }, 1000);
- */
-
- }catch(e)
- {
- alert(e);
- }
-
- };
-
- webSocket.onmessage = function(event)
- {
-
- if (vsn=='002'||vsn=='103')
- {
- // alert(vsn);
- isget=true;
- var ress = event.data;
- vsn='104';
- try
- {
- // var vobj = JSON.parse( ress);
- //alert( vobj.data);
- //var sevobj = JSON.parse( vobj);
- //alert('de'+ ress);
- senttoother();
- alert('OK');
- //23456
- window.history.go(-1);
- //document.location = "index2.html?KID="+ID +"&name="+ kname;
- }
- catch(e)
- {
- alert(e);
- }
- }
-
- if (vsn=='004')
- {
- isget3 = true;
- //alert('004');
- vsn='';
- var ress = event.data;
- try
- {
- // alert('de'+ ress);
- vobj = JSON.parse( ress);
- var qrcd= vobj.data.data.CardID;
- // alert( qrcd);
- //var sevobj = JSON.parse( vobj);
- // alert('de'+ ress);
- //alert('OK');
- //window.history.go(-1);
- //document.location = "index2.html?KID="+ID +"&name="+ kname;
- //"name":"健身房","note":"王大明09123456789","QRCode":"KaiZvhWz5dcUqkkuvAK0q6T/iw4dbE7CpGKDozTFL2LkH6g1YRdayW=="
- // alert(vtttt);
- //vcyd
- var jsonString = "{\"action\":\"shareQr\", \"serial\":\"001\",\"data\":{\"name\":\""+kname+"\",\"note\":\""+vtttt+"\",\"QRCode\":\""+qrcd+"\",\"time\":\""+vtstpqr+"\",\"cycle\":\""+vcyd+"\"}}";
- // updateOutput(jsonString);
- /// "WebToApp". 為我們和前端開發人員的約定
- orgcycle=fincycle;
- vvqrcd=qrcd;
- senttoother();
- if (TYPE=='IOS')
- {
- window.webkit.messageHandlers.WebToApp.postMessage(jsonString);
- }
- if (TYPE=='ANDROID')
- {
- webSocket.send(jsonString);
- }
-
- }catch(e)
- {
- alert('連線異常');
- }
- }
-
- if (vsn=='001')
- {
- try
- {
- isget2=true;
- // alert( '001');
- var ress = event.data;
- // alert( ress);
-
- vobj = JSON.parse( ress);
- isget=false;
- // vdata = "{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}";
- }catch(e)
- {
- alert(e);
- }
- //updateOutput('---------------------------');
- // updateOutput(vdata);
- // updateOutput('get en='+vobj.data);
- //var payload =vdata;
- var payload = "{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}";
- //alert(payload);
- //23456
-
- message2 = new Paho.MQTT.Message( "{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}");
- message2.destinationName = SN ;
- message2.qos = 0;
- message2.retained = false;
-
-
- // client.send(message);
- //setTimeout(() => {
- var vivi = 0;
- var intervalID = setInterval(() => {
- if (isget)
- {
-
- }
- else
- {
- if (vivi>3)
- {
- clearInterval(intervalID);
- alert('連線異常');
-
- }else
- {
- vivi++;
- updateOutput('message2 send ='+ message2.payloadString);
- client.send(message2);
- }
-
- }
- }, 500);
-
-
-
-
- }
-
- if (vsn=='101')
- {
- try
- {
- vsn='102';
- // alert( '102');
- var ress = event.data;
- // alert( ress);
- vobj = JSON.parse( ress);
- isget=false;
- // vdata = "{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}";
-
- //updateOutput('---------------------------');
- // updateOutput(vdata);
-
- // var payload =vdata;
-
- message0 = new Paho.MQTT.Message("{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}");
- message0.qos = 0;
- message0.retained = false;
- message0.destinationName = SN ;
- //setTimeout(() => {
- // client.send(message);
- var vivi = 0;
-
- var intervalID = setInterval(() => {
- if (isget)
- {
-
- }
- else
- {
- if (vivi>3)
- {
- clearInterval(intervalID);
- alert('連線異常');
-
- }else
- {
- vivi++;
- client.send(message0);
- }
-
- }
- }, 500);
-
-
-
-
- }catch(e)
- {
- alert(e);
- }
- }
-
- if (vsn=='003')
- {
-
- // alert( '003');
- var ress = event.data;
- // alert( ress);
- vobj = JSON.parse( ress);
- isget3=false;
- vdata = "{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}";
-
- //updateOutput('---------------------------');
- // updateOutput(vdata);
-
- updateOutput('rece ='+vobj.data);
- message7 = new Paho.MQTT.Message("{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}");
- message7.destinationName = SN ;
- message7.retained = false;
- message7.qos = 0;
- var vivi = 0;
- // client.send(message);
- var intervalID = setInterval(() => {
- if (isget3)
- {
-
- }
- else
- {
- if (vivi>3)
- {
- clearInterval(intervalID);
- alert('連線異常');
-
- }else
- {
- vivi++;
- updateOutput('message7 send ='+ message7.payloadString);
- client.send(message7);
- }
-
- }
- }, 500);
-
-
-
-
- }
- //updateOutput('---------------------------');
- // updateOutput(event.data);
-
- };
-
- webSocket.onclose = function(event) {
- // updateOutput("Connection Closed");
- //connectBtn.disabled = false;
- //sendBtn.disabled = true;
- };
- }
-
-
- function shareQr() {
- var text = input.value;
- var jsonString = "{\"action\":\"shareQr\", \"serial\":\"001\",\"data\":\""+text+"\"}";
- //updateOutput(jsonString);
- /// "WebToApp". 為我們和前端開發人員的約定
-
- if (TYPE=='IOS')
- {
- window.webkit.messageHandlers.WebToApp.postMessage(jsonString);
- }
- if (TYPE=='ANDROID')
- {
- webSocket.send(jsonString);
- }
- }
-
- function AppToWeb(message) {
-
- if (vsn=='002'||vsn=='103')
- {
- isget=true;
- // alert(vsn);
- var ress = message;
- vsn='104';
- try
- {
- // var vobj = JSON.parse( ress);
- //alert( vobj.data);
- //var sevobj = JSON.parse( vobj);
- // alert('de'+ ress);
- senttoother();
- alert('OK');
- //23456
- window.history.go(-1);
- //document.location = "index2.html?KID="+ID +"&name="+ kname;
- }catch(e)
- {
- alert(e);
- }
- }
-
- if (vsn=='004')
- {
- //alert('004');
- vsn='';
- isget3 = true;
- var ress = message;
- try
- {
- // alert('de'+ ress);
- vobj = JSON.parse( ress);
- var qrcd= vobj.data.data.CardID;
- // alert( qrcd);
- //var sevobj = JSON.parse( vobj);
- // alert('de'+ ress);
- //alert('OK');
- //window.history.go(-1);
- //document.location = "index2.html?KID="+ID +"&name="+ kname;
- //"name":"健身房","note":"王大明09123456789","QRCode":"KaiZvhWz5dcUqkkuvAK0q6T/iw4dbE7CpGKDozTFL2LkH6g1YRdayW=="
- // alert(vtttt);
- //vcyd
- var jsonString = "{\"action\":\"shareQr\", \"serial\":\"001\",\"data\":{\"name\":\""+kname+"\",\"note\":\""+vtttt+"\",\"QRCode\":\""+qrcd+"\",\"time\":\""+vtstpqr+"\",\"cycle\":\""+vcyd+"\"}}";
- // alert(jsonString);
- // updateOutput(jsonString);
- /// "WebToApp". 為我們和前端開發人員的約定
- orgcycle=fincycle;
- vvqrcd=qrcd;
- senttoother();
- if (TYPE=='IOS')
- {
- window.webkit.messageHandlers.WebToApp.postMessage(jsonString);
- }
- if (TYPE=='ANDROID')
- {
- webSocket.send(jsonString);
- }
-
- }catch(e)
- {
- alert(e);
- }
- }
-
- if (vsn=='001')
- {
- try
- {
- // alert( '001');
- var ress = message;
- // alert( ress);
- isget2=true;
- vobj = JSON.parse( ress);
- isget=false;
- vdata = "{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}";
- }catch(e)
- {
- alert(e);
- }
- //updateOutput('---------------------------');
- // updateOutput(vdata);
-
-
- message4 = new Paho.MQTT.Message("{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}");
- message4.destinationName = SN ;
- message4.retained = false;
- message4.qos = 0;
- var vivi = 0;
- // client.send(message);
- var intervalID = setInterval(() => {
- if (isget)
- {
-
- }
- else
- {
- if (vivi>3)
- {
- clearInterval(intervalID);
- alert('連線異常');
-
- }else
- {
- vivi++;
- client.send(message4);
- }
-
- }
- }, 500);
-
- }
-
- if (vsn=='101')
- {
- try
- {
- vsn='102';
- // alert( '102');
- var ress = message;
- // alert( ress);
- vobj = JSON.parse( ress);
- isget=false;
- vdata = "{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}";
-
- //updateOutput('---------------------------');
- // updateOutput(vdata);
-
-
- message9 = new Paho.MQTT.Message("{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}");
- message9.destinationName = SN ;
- message9.retained = false;
- message9.qos = 0;
- var vivi = 0;
-
- // client.send(message);
- var intervalID = setInterval(() => {
- if (isget)
- {
-
- }
- else
- {
- if (vivi>3)
- {
-
- clearInterval(intervalID);
- alert('連線異常');
- }else
- {
-
- client.send(message9);
- vivi++;
- }
-
- }
- }, 500);
-
- }catch(e)
- {
- alert(e);
- }
- }
-
- if (vsn=='003')
- {
- try
- {
- // alert( '003');
- var ress = message;
- // alert( ress);
- vobj = JSON.parse( ress);
- isget3=false;
- vdata = "{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}";
- }catch(e)
- {
- alert(e);
- }
- //updateOutput('---------------------------');
- // updateOutput(vdata);
-
-
- message6= new Paho.MQTT.Message("{\"encrypt\":\"1\",\"data\":\""+vobj.data+"\"}");
- message6.destinationName = SN ;
- message6.retained = false;
- message6.qos = 0;
-
- //setTimeout(() => {
- var vivi = 0;
-
-
- var intervalID = setInterval(() => {
- if (isget3)
- {
-
- }
- else
- {
- if (vivi>3)
- {
- alert('連線異常');
- clearInterval(intervalID);
- }else
- {
- vivi++;
- client.send(message6);
- }
-
- }
- }, 500);
-
-
-
- }
-
- // updateOutput(message);
- return "Got it"
- }
-
- function endode() {
- var text = input.value;
- var jsonString = "{\"action\":\"encode\", \"serial\":\"001\",\"data\":"+text+"}";
-
- // updateOutput(jsonString);
- /// "WebToApp". 為我們和前端開發人員的約定
- if (TYPE=='IOS')
- {
- window.webkit.messageHandlers.WebToApp.postMessage(jsonString);
- }
- if (TYPE=='ANDROID')
- {
- webSocket.send(jsonString);
- }
-
- }
-
- function decode() {
- var text = input.value;
- var jsonString = "{\"action\":\"decode\", \"serial\":\"001\",\"data\":\""+text+"\"}";
- //updateOutput(jsonString);
- /// "WebToApp". 為我們和前端開發人員的約定
- if (TYPE=='IOS')
- {
- window.webkit.messageHandlers.WebToApp.postMessage(jsonString);
- }
- if (TYPE=='ANDROID')
- {
- webSocket.send(jsonString);
- }
- }
-
-
-
- function updateOutput(text) {
- output.innerHTML += "<br/>" + text;
- }
-
-
- </script>
- <script>
- var getUrlParameter = function getUrlParameter(sParam) {
- var sPageURL = decodeURIComponent(window.location.search.substring(1)),
- sURLVariables = sPageURL.split('&'),
- sParameterName,
- i;
-
- for (i = 0; i < sURLVariables.length; i++) {
- sParameterName = sURLVariables[i].split('=');
-
- if (sParameterName[0] === sParam) {
- return sParameterName[1] === undefined ? true : sParameterName[1];
- }
- }
- };
-
- Date.prototype.format = function (format) {
- //eg:format="yyyy-MM-dd hh:mm:ss";
-
- if (!format) {
- format = "yyyy-MM-dd hh:mm:ss";
- }
-
- var o = {
- "M+": this.getMonth() + 1, // month
- "d+": this.getDate(), // day
- "H+": this.getHours(), // hour
- "h+": this.getHours(), // hour
- "m+": this.getMinutes(), // minute
- "s+": this.getSeconds(), // second
- "q+": Math.floor((this.getMonth() + 3) / 3), // quarter
- "S": this.getMilliseconds()
- };
-
- if (/(y+)/.test(format)) {
- format = format.replace(RegExp.$1, (this.getFullYear() + "")
- .substr(4 - RegExp.$1.length));
- }
-
- for (var k in o) {
- if (new RegExp("(" + k + ")").test(format)) {
- format = format.replace(RegExp.$1, RegExp.$1.length == 1
- ? o[k]
- : ("00" + o[k]).substr(("" + o[k]).length));
- }
- }
-
- return format;
- };
- </script>
- <br>
- </body>
-
- </html>
|