提交 6a152fbe authored 作者: blu's avatar blu

new feature: evwifi

上级 cf092e99
...@@ -94,7 +94,6 @@ typings/ ...@@ -94,7 +94,6 @@ typings/
# Nuxt.js build / generate output # Nuxt.js build / generate output
.nuxt .nuxt
dist
# Gatsby files # Gatsby files
.cache/ .cache/
......
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
/logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
# Nuxt generate
dist
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# IDE / Editor
.idea
# Service worker
sw.*
# Mac OSX
.DS_Store
# Vim swap files
*.swp
<!doctype html>
<html lang="en" data-n-head="%7B%22lang%22:%7B%221%22:%22en%22%7D%7D">
<head>
<title>evbox</title><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="description" name="description" content="web for evbox device"><meta data-n-head="1" data-hid="mobile-web-app-capable" name="mobile-web-app-capable" content="yes"><meta data-n-head="1" data-hid="apple-mobile-web-app-title" name="apple-mobile-web-app-title" content="evbox"><meta data-n-head="1" data-hid="author" name="author" content="bruce.lu"><meta data-n-head="1" data-hid="theme-color" name="theme-color" content="#fff"><meta data-n-head="1" data-hid="og:type" name="og:type" property="og:type" content="website"><meta data-n-head="1" data-hid="og:title" name="og:title" property="og:title" content="evbox"><meta data-n-head="1" data-hid="og:site_name" name="og:site_name" property="og:site_name" content="evbox"><meta data-n-head="1" data-hid="og:description" name="og:description" property="og:description" content="web for evbox device"><link data-n-head="1" rel="icon" type="image/x-icon" href="/favicon.ico"><link data-n-head="1" rel="manifest" href="/_nuxt/manifest.ec4a7e8a.json"><link data-n-head="1" rel="shortcut icon" href="/_nuxt/icons/icon_64.5f6a36.png"><link data-n-head="1" rel="apple-touch-icon" href="/_nuxt/icons/icon_512.5f6a36.png" sizes="512x512"><link rel="preload" href="/_nuxt/64a5c00d864d8eea896f.js" as="script"><link rel="preload" href="/_nuxt/8a709989afb013926c1b.js" as="script"><link rel="preload" href="/_nuxt/eeafa4dc446371943266.js" as="script"><link rel="preload" href="/_nuxt/38a5427918074cb43446.js" as="script">
</head>
<body>
<div id="__nuxt"><style>#nuxt-loading{visibility:hidden;opacity:0;position:absolute;left:0;right:0;top:0;bottom:0;display:flex;justify-content:center;align-items:center;flex-direction:column;animation:nuxtLoadingIn 10s ease;-webkit-animation:nuxtLoadingIn 10s ease;animation-fill-mode:forwards;overflow:hidden}@keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}@-webkit-keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}#nuxt-loading>div,#nuxt-loading>div:after{border-radius:50%;width:5rem;height:5rem}#nuxt-loading>div{font-size:10px;position:relative;text-indent:-9999em;border:.5rem solid #f5f5f5;border-left:.5rem solid #fff;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:nuxtLoading 1.1s infinite linear;animation:nuxtLoading 1.1s infinite linear}#nuxt-loading.error>div{border-left:.5rem solid #ff4500;animation-duration:5s}@-webkit-keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}</style><script>window.addEventListener("error",function(){var e=document.getElementById("nuxt-loading");e&&(e.className+=" error")})</script><div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div></div>
<script type="text/javascript" src="/_nuxt/64a5c00d864d8eea896f.js"></script><script type="text/javascript" src="/_nuxt/8a709989afb013926c1b.js"></script><script type="text/javascript" src="/_nuxt/eeafa4dc446371943266.js"></script><script type="text/javascript" src="/_nuxt/38a5427918074cb43446.js"></script></body>
</html>
# STATIC
**This directory is not required, you can delete it if you don't want to use it.**
This directory contains your static files.
Each file inside this directory is mapped to `/`.
Thus you'd want to delete this README.md before deploying to production.
Example: `/static/robots.txt` is mapped as `/robots.txt`.
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static).
(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{213:function(t,e,n){"use strict";n.r(e),n.d(e,"Workbox",(function(){return f})),n.d(e,"messageSW",(function(){return r}));try{self["workbox:window:4.3.1"]&&_()}catch(r){}var r=function(t,e){return new Promise((function(i){var n=new MessageChannel;n.port1.onmessage=function(t){return i(t.data)},t.postMessage(e,[n.port2])}))};function o(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}try{self["workbox:core:4.3.1"]&&_()}catch(r){}var c=function(){var t=this;this.promise=new Promise((function(e,i){t.resolve=e,t.reject=i}))},h=function(t,e){return new URL(t,location).href===new URL(e,location).href},v=function(t,e){Object.assign(this,e,{type:t})};function u(t){return function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];try{return Promise.resolve(t.apply(this,e))}catch(t){return Promise.reject(t)}}}function a(t,e,i){return i?e?e(t):t:(t&&t.then||(t=Promise.resolve(t)),e?t.then(e):t)}function s(){}var f=function(t){var e,n;function f(e,n){var r;return void 0===n&&(n={}),(r=t.call(this)||this).t=e,r.i=n,r.o=0,r.u=new c,r.s=new c,r.h=new c,r.v=r.v.bind(i(i(r))),r.l=r.l.bind(i(i(r))),r.g=r.g.bind(i(i(r))),r.m=r.m.bind(i(i(r))),r}n=t,(e=f).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var l,d,w=f.prototype;return w.register=u((function(t){var e,i,n=this,u=(void 0===t?{}:t).immediate,r=void 0!==u&&u;return e=function(){return n.p=Boolean(navigator.serviceWorker.controller),n.P=n.R(),a(n.k(),(function(t){n.B=t,n.P&&(n.O=n.P,n.s.resolve(n.P),n.h.resolve(n.P),n.j(n.P),n.P.addEventListener("statechange",n.l,{once:!0}));var e=n.B.waiting;return e&&h(e.scriptURL,n.t)&&(n.O=e,Promise.resolve().then((function(){n.dispatchEvent(new v("waiting",{sw:e,wasWaitingBeforeRegister:!0}))}))),n.O&&n.u.resolve(n.O),n.B.addEventListener("updatefound",n.g),navigator.serviceWorker.addEventListener("controllerchange",n.m,{once:!0}),"BroadcastChannel"in self&&(n.C=new BroadcastChannel("workbox"),n.C.addEventListener("message",n.v)),navigator.serviceWorker.addEventListener("message",n.v),n.B}))},(i=function(){if(!r&&"complete"!==document.readyState)return function(t,e){return t&&t.then?t.then(s):Promise.resolve()}(new Promise((function(t){return addEventListener("load",t)})))}())&&i.then?i.then(e):e()})),w.getSW=u((function(){return this.O||this.u.promise})),w.messageSW=u((function(t){return a(this.getSW(),(function(i){return r(i,t)}))})),w.R=function(){var t=navigator.serviceWorker.controller;if(t&&h(t.scriptURL,this.t))return t},w.k=u((function(){var t=this;return function(t,e){try{var i=t()}catch(t){return e(t)}return i&&i.then?i.then(void 0,e):i}((function(){return a(navigator.serviceWorker.register(t.t,t.i),(function(e){return t.L=performance.now(),e}))}),(function(t){throw t}))})),w.j=function(t){r(t,{type:"WINDOW_READY",meta:"workbox-window"})},w.g=function(){var t=this.B.installing;this.o>0||!h(t.scriptURL,this.t)||performance.now()>this.L+6e4?(this.W=t,this.B.removeEventListener("updatefound",this.g)):(this.O=t,this.u.resolve(t)),++this.o,t.addEventListener("statechange",this.l)},w.l=function(t){var e=this,i=t.target,n=i.state,r=i===this.W,u=r?"external":"",a={sw:i,originalEvent:t};!r&&this.p&&(a.isUpdate=!0),this.dispatchEvent(new v(u+n,a)),"installed"===n?this._=setTimeout((function(){"installed"===n&&e.B.waiting===i&&e.dispatchEvent(new v(u+"waiting",a))}),200):"activating"===n&&(clearTimeout(this._),r||this.s.resolve(i))},w.m=function(t){var e=this.O;e===navigator.serviceWorker.controller&&(this.dispatchEvent(new v("controlling",{sw:e,originalEvent:t})),this.h.resolve(e))},w.v=function(t){var e=t.data;this.dispatchEvent(new v("message",{data:e,originalEvent:t}))},l=f,(d=[{key:"active",get:function(){return this.s.promise}},{key:"controlling",get:function(){return this.h.promise}}])&&o(l.prototype,d),f}(function(){function t(){this.D={}}var e=t.prototype;return e.addEventListener=function(t,e){this.T(t).add(e)},e.removeEventListener=function(t,e){this.T(t).delete(e)},e.dispatchEvent=function(t){t.target=this,this.T(t.type).forEach((function(e){return e(t)}))},e.T=function(t){return this.D[t]=this.D[t]||new Set},t}())}}]);
\ No newline at end of file
!function(e){function r(data){for(var r,n,f=data[0],l=data[1],d=data[2],i=0,h=[];i<f.length;i++)n=f[i],Object.prototype.hasOwnProperty.call(o,n)&&o[n]&&h.push(o[n][0]),o[n]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(v&&v(data);h.length;)h.shift()();return c.push.apply(c,d||[]),t()}function t(){for(var e,i=0;i<c.length;i++){for(var r=c[i],t=!0,n=1;n<r.length;n++){var l=r[n];0!==o[l]&&(t=!1)}t&&(c.splice(i--,1),e=f(f.s=r[0]))}return e}var n={},o={3:0},c=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var c,script=document.createElement("script");script.charset="utf-8",script.timeout=120,f.nc&&script.setAttribute("nonce",f.nc),script.src=function(e){return f.p+""+{0:"cd5fd0246db5dba702f3",5:"37ae72f19a34500a84df"}[e]+".js"}(e);var l=new Error;c=function(r){script.onerror=script.onload=null,clearTimeout(d);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),c=r&&r.target&&r.target.src;l.message="Loading chunk "+e+" failed.\n("+n+": "+c+")",l.name="ChunkLoadError",l.type=n,l.request=c,t[1](l)}o[e]=void 0}};var d=setTimeout((function(){c({type:"timeout",target:script})}),12e4);script.onerror=script.onload=c,document.head.appendChild(script)}return Promise.all(r)},f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,function(r){return e[r]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(object,e){return Object.prototype.hasOwnProperty.call(object,e)},f.p="/_nuxt/",f.oe=function(e){throw console.error(e),e};var l=window.webpackJsonp=window.webpackJsonp||[],d=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var v=d;t()}([]);
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/*!
* Vue.js v2.6.10
* (c) 2014-2019 Evan You
* Released under the MIT License.
*/
/*!
* vue-router v3.0.7
* (c) 2019 Evan You
* @license MIT
*/
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*!
* portal-vue © Thorsten Lünborg, 2019
*
* Version: 2.1.6
*
* LICENCE: MIT
*
* https://github.com/linusborg/portal-vue
*
*/
/*!
* vue-no-ssr v1.1.1
* (c) 2018-present egoist <0x142857@gmail.com>
* Released under the MIT License.
*/
/**!
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.16.0
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*!
* vue-client-only v2.0.0
* (c) 2019-present egoist <0x142857@gmail.com>
* Released under the MIT License.
*/
(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{209:function(t,n,e){var r=e(18);t.exports=function(t,n){if(!r(t)||t._t!==n)throw TypeError("Incompatible receiver, "+n+" required!");return t}},210:function(t,n,e){"use strict";var strong=e(211),r=e(209);t.exports=e(212)("Set",(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(t){return strong.def(r(this,"Set"),t=0===t?0:t,t)}},strong)},211:function(t,n,e){"use strict";var r=e(22).f,o=e(79),c=e(146),l=e(36),f=e(144),d=e(145),v=e(100),h=e(147),_=e(102),w=e(19),m=e(99).fastKey,C=e(209),y=w?"_s":"size",k=function(t,n){var e,r=m(n);if("F"!==r)return t._i[r];for(e=t._f;e;e=e.n)if(e.k==n)return e};t.exports={getConstructor:function(t,n,e,v){var h=t((function(t,r){f(t,h,n,"_i"),t._t=n,t._i=o(null),t._f=void 0,t._l=void 0,t[y]=0,null!=r&&d(r,e,t[v],t)}));return c(h.prototype,{clear:function(){for(var t=C(this,n),data=t._i,e=t._f;e;e=e.n)e.r=!0,e.p&&(e.p=e.p.n=void 0),delete data[e.i];t._f=t._l=void 0,t[y]=0},delete:function(t){var e=C(this,n),r=k(e,t);if(r){var o=r.n,c=r.p;delete e._i[r.i],r.r=!0,c&&(c.n=o),o&&(o.p=c),e._f==r&&(e._f=o),e._l==r&&(e._l=c),e[y]--}return!!r},forEach:function(t){C(this,n);for(var e,r=l(t,arguments.length>1?arguments[1]:void 0,3);e=e?e.n:this._f;)for(r(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!k(C(this,n),t)}}),w&&r(h.prototype,"size",{get:function(){return C(this,n)[y]}}),h},def:function(t,n,e){var r,o,c=k(t,n);return c?c.v=e:(t._l=c={i:o=m(n,!0),k:n,v:e,p:r=t._l,n:void 0,r:!1},t._f||(t._f=c),r&&(r.n=c),t[y]++,"F"!==o&&(t._i[o]=c)),t},getEntry:k,setStrong:function(t,n,e){v(t,n,(function(t,e){this._t=C(t,n),this._k=e,this._l=void 0}),(function(){for(var t=this._k,n=this._l;n&&n.r;)n=n.p;return this._t&&(this._l=n=n?n.n:this._t._f)?h(0,"keys"==t?n.k:"values"==t?n.v:[n.k,n.v]):(this._t=void 0,h(1))}),e?"entries":"values",!e,!0),_(n)}}},212:function(t,n,e){"use strict";var r=e(13),o=e(12),c=e(26),l=e(146),meta=e(99),f=e(145),d=e(144),v=e(18),h=e(20),_=e(103),w=e(62),m=e(104);t.exports=function(t,n,e,C,y,k){var D=r[t],S=D,x=y?"set":"add",I=S&&S.prototype,E={},W=function(t){var n=I[t];c(I,t,"delete"==t?function(a){return!(k&&!v(a))&&n.call(this,0===a?0:a)}:"has"==t?function(a){return!(k&&!v(a))&&n.call(this,0===a?0:a)}:"get"==t?function(a){return k&&!v(a)?void 0:n.call(this,0===a?0:a)}:"add"==t?function(a){return n.call(this,0===a?0:a),this}:function(a,b){return n.call(this,0===a?0:a,b),this})};if("function"==typeof S&&(k||I.forEach&&!h((function(){(new S).entries().next()})))){var F=new S,R=F[x](k?{}:-0,1)!=F,A=h((function(){F.has(1)})),z=_((function(t){new S(t)})),M=!k&&h((function(){for(var t=new S,n=5;n--;)t[x](n,n);return!t.has(-0)}));z||((S=n((function(n,e){d(n,S,t);var r=m(new D,n,S);return null!=e&&f(e,y,r[x],r),r}))).prototype=I,I.constructor=S),(A||M)&&(W("delete"),W("has"),y&&W("get")),(M||R)&&W(x),k&&I.clear&&delete I.clear}else S=C.getConstructor(n,t,y,x),l(S.prototype,e),meta.NEED=!0;return w(S,t),E[t]=S,o(o.G+o.W+o.F*(S!=D),E),k||C.setStrong(S,t,y),S}},214:function(t,n,e){"use strict";e.r(n);e(101),e(3),e(1),e(210),e(49),e(148),e(42);var r=e(60),o=e.n(r),c={mounted:function(){return regeneratorRuntime.async((function(t){for(;;)switch(t.prev=t.next){case 0:try{this.getWifiData()}catch(t){console.log(t)}case 1:case"end":return t.stop()}}),null,this)},data:function(){var t=this;return{connectWifi:function(n){var e;return regeneratorRuntime.async((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,regeneratorRuntime.awrap(o.a.get("http://192.168.1.104/wifi?mode=2&ssid=".concat(t.ssid,"&password=").concat(t.password)));case 2:return e=n.sent,n.abrupt("return",e);case 4:case"end":return n.stop()}}))},getWifiData:function(n){var param,e;return regeneratorRuntime.async((function(r){for(;;)switch(r.prev=r.next){case 0:return t.bInScan=!0,param=n?"true":"false",r.next=4,regeneratorRuntime.awrap(o.a.get("http://192.168.1.104/wifi?scan=".concat(param)));case 4:e=r.sent,t.wifiData=e.data.wifiData,t.ssids=Array.from(new Set(t.wifiData.wifi.ssids)).filter((function(t){return""!=t&&null!=t})).map((function(t){var data=t.match(/ESSID:\"(.+)\"/)[1];if("\\"!=data[0])return data;for(var n=data.length,e=0;e<n;e+=1)String.fromCharCode(data[e]);return data})).filter((function(t){return"\\"!=t[0]})),t.devSn=t.wifiData.info.sn,t.bInScan=!1,console.log(t.devSn),console.log(t.ssids);case 11:case"end":return r.stop()}}))},cancelDisabled:!1,connDisabled:!1,bInScan:!1,ssid:"",devSn:"",password:"",ssids:["NO WIFI AVAILABLE"]}},computed:{connEnabled:function(){return this.password.length>=4&&!this.connDisabled}},methods:{scanWifi:function(t){this.getWifiData(!0)},config:function(t){console.log(t.target.innerText),this.ssid=t.target.innerText,this.password="",this.cancelDisabled=!1,this.connDisabled=!1,this.$bvModal.show("config")},closeModal:function(){this.$refs.config.hide()},connect:function(){this.connectWifi(),this.cancelDisabled=!0,this.connDisabled=!0}}},l=e(45),component=Object(l.a)(c,(function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("div",{staticClass:"grid"},[e("div",{staticClass:"row"},[e("nuxt-link",{staticClass:"col-4",attrs:{to:"/"}},[t._v("返回主页")]),t._v(" "),e("label",{staticClass:"col-4"},[t._v("WIFI配置")]),t._v(" "),e("label",{staticClass:"col-4"},[t._v(t._s(t.devSn))])],1),t._v(" "),e("div",{staticClass:"row"},[e("label",{staticClass:"col-4 offset-2"},[t._v("附近热点")]),t._v(" "),e("b-button",{staticClass:"col-4",attrs:{disabled:t.bInScan,variant:"primary"},on:{click:t.scanWifi}},[t._v("重新扫描")])],1),t._v(" "),e("div",{staticClass:"row"},t._l(t.ssids,(function(n){return e("b-button",{key:n.id,staticClass:"col-10 offset-1 mt-3",attrs:{variant:"primary"},on:{click:t.config}},[t._v(t._s(n))])})),1),t._v(" "),e("b-modal",{ref:"config",attrs:{"hide-header-close":"","no-close-on-esc":"","no-close-on-backdrop":"","hide-footer":"",id:"config",size:"mw-100",title:"WIFI连接配置"}},[e("div",{staticClass:"grid"},[e("div",{staticClass:"row"},[e("label",{staticClass:"col-4 offset-2",attrs:{disabled:"",variant:"info"}},[t._v("热点名")]),t._v(" "),e("b-button",{staticClass:"col-4",attrs:{disabled:""}},[t._v(t._s(t.ssid))])],1),t._v(" "),e("div",{staticClass:"row mt-4"},[e("label",{staticClass:"col-4 offset-2"},[t._v("密码")]),t._v(" "),e("b-input",{staticClass:"col-4",model:{value:t.password,callback:function(n){t.password=n},expression:"password"}},[t._v(t._s(t.ssid))])],1),t._v(" "),e("div",{staticClass:"row mt-4"},[e("b-button",{staticClass:"col-2 offset-3",attrs:{disabled:t.cancelDisabled,variant:"outline-danger"},on:{click:t.closeModal}},[t._v("取消")]),t._v(" "),e("b-button",{staticClass:"col-2 offset-2",attrs:{disabled:!t.connEnabled,variant:"primary"},on:{click:t.connect}},[t._v("连接")])],1)])])],1)}),[],!1,null,null,null);n.default=component.exports}}]);
\ No newline at end of file
{"name":"evbox","short_name":"evbox","description":"web for evbox device","icons":[{"src":"/_nuxt/icons/icon_64.5f6a36.png","sizes":"64x64","type":"image/png"},{"src":"/_nuxt/icons/icon_120.5f6a36.png","sizes":"120x120","type":"image/png"},{"src":"/_nuxt/icons/icon_144.5f6a36.png","sizes":"144x144","type":"image/png"},{"src":"/_nuxt/icons/icon_152.5f6a36.png","sizes":"152x152","type":"image/png"},{"src":"/_nuxt/icons/icon_192.5f6a36.png","sizes":"192x192","type":"image/png"},{"src":"/_nuxt/icons/icon_384.5f6a36.png","sizes":"384x384","type":"image/png"},{"src":"/_nuxt/icons/icon_512.5f6a36.png","sizes":"512x512","type":"image/png"}],"start_url":"/?standalone=true","display":"standalone","background_color":"#ffffff","theme_color":"#fff","lang":"en"}
\ No newline at end of file
<!doctype html>
<html lang="en" data-n-head="%7B%22lang%22:%7B%221%22:%22en%22%7D%7D">
<head>
<title>evbox</title><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="description" name="description" content="web for evbox device"><meta data-n-head="1" data-hid="mobile-web-app-capable" name="mobile-web-app-capable" content="yes"><meta data-n-head="1" data-hid="apple-mobile-web-app-title" name="apple-mobile-web-app-title" content="evbox"><meta data-n-head="1" data-hid="author" name="author" content="bruce.lu"><meta data-n-head="1" data-hid="theme-color" name="theme-color" content="#fff"><meta data-n-head="1" data-hid="og:type" name="og:type" property="og:type" content="website"><meta data-n-head="1" data-hid="og:title" name="og:title" property="og:title" content="evbox"><meta data-n-head="1" data-hid="og:site_name" name="og:site_name" property="og:site_name" content="evbox"><meta data-n-head="1" data-hid="og:description" name="og:description" property="og:description" content="web for evbox device"><link data-n-head="1" rel="icon" type="image/x-icon" href="/favicon.ico"><link data-n-head="1" rel="manifest" href="/_nuxt/manifest.ec4a7e8a.json"><link data-n-head="1" rel="shortcut icon" href="/_nuxt/icons/icon_64.5f6a36.png"><link data-n-head="1" rel="apple-touch-icon" href="/_nuxt/icons/icon_512.5f6a36.png" sizes="512x512"><link rel="preload" href="/_nuxt/64a5c00d864d8eea896f.js" as="script"><link rel="preload" href="/_nuxt/8a709989afb013926c1b.js" as="script"><link rel="preload" href="/_nuxt/eeafa4dc446371943266.js" as="script"><link rel="preload" href="/_nuxt/38a5427918074cb43446.js" as="script">
</head>
<body>
<div id="__nuxt"><style>#nuxt-loading{visibility:hidden;opacity:0;position:absolute;left:0;right:0;top:0;bottom:0;display:flex;justify-content:center;align-items:center;flex-direction:column;animation:nuxtLoadingIn 10s ease;-webkit-animation:nuxtLoadingIn 10s ease;animation-fill-mode:forwards;overflow:hidden}@keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}@-webkit-keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}#nuxt-loading>div,#nuxt-loading>div:after{border-radius:50%;width:5rem;height:5rem}#nuxt-loading>div{font-size:10px;position:relative;text-indent:-9999em;border:.5rem solid #f5f5f5;border-left:.5rem solid #fff;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:nuxtLoading 1.1s infinite linear;animation:nuxtLoading 1.1s infinite linear}#nuxt-loading.error>div{border-left:.5rem solid #ff4500;animation-duration:5s}@-webkit-keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}</style><script>window.addEventListener("error",function(){var e=document.getElementById("nuxt-loading");e&&(e.className+=" error")})</script><div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div></div>
<script type="text/javascript" src="/_nuxt/64a5c00d864d8eea896f.js"></script><script type="text/javascript" src="/_nuxt/8a709989afb013926c1b.js"></script><script type="text/javascript" src="/_nuxt/eeafa4dc446371943266.js"></script><script type="text/javascript" src="/_nuxt/38a5427918074cb43446.js"></script></body>
</html>
importScripts('https://cdn.jsdelivr.net/npm/workbox-cdn@4.3.1/workbox/workbox-sw.js')
// --------------------------------------------------
// Configure
// --------------------------------------------------
// Set workbox config
workbox.setConfig({
"debug": false
})
// Start controlling any existing clients as soon as it activates
workbox.core.clientsClaim()
// Skip over the SW waiting lifecycle stage
workbox.core.skipWaiting()
workbox.precaching.cleanupOutdatedCaches()
// --------------------------------------------------
// Precaches
// --------------------------------------------------
// Precache assets
// --------------------------------------------------
// Runtime Caching
// --------------------------------------------------
// Register route handlers for runtimeCaching
workbox.routing.registerRoute(new RegExp('/_nuxt/'), new workbox.strategies.CacheFirst ({}), 'GET')
workbox.routing.registerRoute(new RegExp('/'), new workbox.strategies.NetworkFirst ({}), 'GET')
<!doctype html>
<html lang="en" data-n-head="%7B%22lang%22:%7B%221%22:%22en%22%7D%7D">
<head>
<title>evbox</title><meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="description" name="description" content="web for evbox device"><meta data-n-head="1" data-hid="mobile-web-app-capable" name="mobile-web-app-capable" content="yes"><meta data-n-head="1" data-hid="apple-mobile-web-app-title" name="apple-mobile-web-app-title" content="evbox"><meta data-n-head="1" data-hid="author" name="author" content="bruce.lu"><meta data-n-head="1" data-hid="theme-color" name="theme-color" content="#fff"><meta data-n-head="1" data-hid="og:type" name="og:type" property="og:type" content="website"><meta data-n-head="1" data-hid="og:title" name="og:title" property="og:title" content="evbox"><meta data-n-head="1" data-hid="og:site_name" name="og:site_name" property="og:site_name" content="evbox"><meta data-n-head="1" data-hid="og:description" name="og:description" property="og:description" content="web for evbox device"><link data-n-head="1" rel="icon" type="image/x-icon" href="/favicon.ico"><link data-n-head="1" rel="manifest" href="/_nuxt/manifest.ec4a7e8a.json"><link data-n-head="1" rel="shortcut icon" href="/_nuxt/icons/icon_64.5f6a36.png"><link data-n-head="1" rel="apple-touch-icon" href="/_nuxt/icons/icon_512.5f6a36.png" sizes="512x512"><link rel="preload" href="/_nuxt/64a5c00d864d8eea896f.js" as="script"><link rel="preload" href="/_nuxt/8a709989afb013926c1b.js" as="script"><link rel="preload" href="/_nuxt/eeafa4dc446371943266.js" as="script"><link rel="preload" href="/_nuxt/38a5427918074cb43446.js" as="script">
</head>
<body>
<div id="__nuxt"><style>#nuxt-loading{visibility:hidden;opacity:0;position:absolute;left:0;right:0;top:0;bottom:0;display:flex;justify-content:center;align-items:center;flex-direction:column;animation:nuxtLoadingIn 10s ease;-webkit-animation:nuxtLoadingIn 10s ease;animation-fill-mode:forwards;overflow:hidden}@keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}@-webkit-keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}#nuxt-loading>div,#nuxt-loading>div:after{border-radius:50%;width:5rem;height:5rem}#nuxt-loading>div{font-size:10px;position:relative;text-indent:-9999em;border:.5rem solid #f5f5f5;border-left:.5rem solid #fff;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:nuxtLoading 1.1s infinite linear;animation:nuxtLoading 1.1s infinite linear}#nuxt-loading.error>div{border-left:.5rem solid #ff4500;animation-duration:5s}@-webkit-keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}</style><script>window.addEventListener("error",function(){var e=document.getElementById("nuxt-loading");e&&(e.className+=" error")})</script><div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div></div>
<script type="text/javascript" src="/_nuxt/64a5c00d864d8eea896f.js"></script><script type="text/javascript" src="/_nuxt/8a709989afb013926c1b.js"></script><script type="text/javascript" src="/_nuxt/eeafa4dc446371943266.js"></script><script type="text/javascript" src="/_nuxt/38a5427918074cb43446.js"></script></body>
</html>
<template>
<nuxt-link to="/wifi">wifi配置</nuxt-link>
</template>
\ No newline at end of file
wifi/index.vue
\ No newline at end of file
<template> <template>
<div style="width:220px;"> <div class="grid">
<div> <div class="row">
<nuxt-link to="/">返回主页</nuxt-link> <nuxt-link to="/" class="col-4">返回主页</nuxt-link>
<label>WIFI配置</label> <label class="col-4">WIFI配置</label>
<label>{{devSn}}</label> <label class="col-4">{{devSn}}</label>
</div> </div>
<div>
<div>
<label>附近热点</label>
<b-button size="sm" variant="primary" v-on:click="scanWifi">重新扫描</b-button>
<div style="flex-direction:column;margin-top:10px">
<b-button size="sm" variant="info" v-on:click="config"
v-for=" item in ssids" style="width:200px;margin-bottom:10px" v-bind:key="item.id">
{{ item }}
</b-button>
</div>
<b-modal hide-header-close no-close-on-esc no-close-on-backdrop hide-footer ref="config" id="config" size="sm" title="WIFI连接配置">
<div>
<div>
<label disabled variant="info">热点名:</label>
<b-button disabled> {{ssid}}</b-button>
</div>
<div style="flex-direction:row;display:flex"> <div class="row">
<label style="margin-right:10px">密码:</label> <label class="col-4 offset-2">附近热点</label>
<b-input v-model="password" style="width:60%"> {{ssid}} </b-input> <b-button :disabled="bInScan" class="col-4" variant="primary" v-on:click="scanWifi">重新扫描</b-button>
</div> </div>
</div>
<b-button :disabled="cancelDisabled" class="mt-3" variant="outline-danger" block @click="closeModal">取消</b-button> <div class="row">
<b-button :disabled= "!connEnabled" class="mt-2" variant="outline-warning" block @click="connect">连接</b-button> <b-button
</b-modal> class="col-10 offset-1 mt-3"
</div> variant="primary"
<div></div> v-on:click="config"
v-for=" item in ssids"
v-bind:key="item.id"
>{{ item }}</b-button>
</div> </div>
<b-modal
hide-header-close
no-close-on-esc
no-close-on-backdrop
hide-footer
ref="config"
id="config"
size="mw-100"
title="WIFI连接配置"
>
<div class="grid">
<div class="row">
<label class="col-4 offset-2" disabled variant="info">热点名</label>
<b-button class="col-4" disabled>{{ssid}}</b-button>
</div>
<div class="row mt-4">
<label class="col-4 offset-2">密码</label>
<b-input class="col-4" v-model="password">{{ssid}}</b-input>
</div>
<div class="row mt-4">
<b-button
:disabled="cancelDisabled"
class="col-2 offset-3"
variant="outline-danger"
@click="closeModal"
>取消</b-button>
<b-button
:disabled="!connEnabled"
class="col-2 offset-2"
variant="primary"
@click="connect"
>连接</b-button>
</div>
</div>
</b-modal>
</div> </div>
</template> </template>
<script> <script>
import axios from 'axios' import axios from "axios";
export default { export default {
async mounted (){ async mounted() {
try{ try {
this.getWifiData(); this.getWifiData();
}catch(err){ } catch (err) {
console.log(err); console.log(err);
} }
}, },
data() { data() {
return { return {
getWifiData: async ()=>{ connectWifi: async e => {
let response = await axios.get('http://192.168.1.104/wifi?scan=false') let response = await axios.get(`http://192.168.1.104/wifi?mode=2&ssid=${this.ssid}&password=${this.password}`);
this.wifiData = response.data.wifiData return response;
this.ssids = Array.from(new Set(this.wifiData.wifi.ssids)).filter(e => e != "" && e != undefined).map(e => { },
let data = e.match(/ESSID:\"(.+)\"/)[1]; getWifiData: async e => {
if (data[0] != '\\') { this.bInScan = true;
return data let param = e ? "true" : "false";
}else{ let response = await axios.get(
var count = data.length; `http://192.168.1.104/wifi?scan=${param}`
var str = ""; );
this.wifiData = response.data.wifiData;
for(var index = 0; index < count; index += 1) this.ssids = Array.from(new Set(this.wifiData.wifi.ssids))
str += String.fromCharCode(data[index]); .filter(e => e != "" && e != undefined)
return data .map(e => {
} let data = e.match(/ESSID:\"(.+)\"/)[1];
}).filter(e => e[0]!='\\'); if (data[0] != "\\") {
this.devSn = this.wifiData.info.sn; return data;
console.log(this.devSn); } else {
console.log(this.ssids); var count = data.length;
}, var str = "";
cancelDisabled: false,
connDisabled: false, for (var index = 0; index < count; index += 1)
ssid: "", str += String.fromCharCode(data[index]);
devSn:"", return data;
password: "", }
ssids: ["NO WIFI AVAILABLE"] })
} .filter(e => e[0] != "\\");
this.devSn = this.wifiData.info.sn;
this.bInScan = false;
console.log(this.devSn);
console.log(this.ssids);
},
cancelDisabled: false,
connDisabled: false,
bInScan: false,
ssid: "",
devSn: "",
password: "",
ssids: ["NO WIFI AVAILABLE"]
};
},
computed: {
connEnabled() {
return this.password.length >= 4 && !this.connDisabled;
}
},
methods: {
scanWifi: function(event) {
this.getWifiData(true);
},
config: function(event) {
console.log(event.target.innerText);
this.ssid = event.target.innerText;
this.password = "";
this.cancelDisabled = false;
this.connDisabled = false;
this.$bvModal.show("config");
}, },
computed: { closeModal() {
connEnabled() { this.$refs["config"].hide();
return (this.password.length >= 4) && !this.connDisabled;
}
}, },
methods: { connect() {
scanWifi: function(event){ this.connectWifi();
console.log("hello"); this.cancelDisabled = true;
}, this.connDisabled = true;
config: function(event){
console.log(event.target.innerText);
this.ssid = event.target.innerText;
this.password = "";
this.cancelDisabled = false;
this.connDisabled = false;
this.$bvModal.show('config');
},
closeModal(){
this.$refs['config'].hide();
},
connect(){
console.log(this.ssid, this.password, this.connEnabled);
this.cancelDisabled = true;
this.connDisabled = true;
}
} }
} }
};
</script> </script>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论