Explorar o código

feature: 初始化wifi版本

Damon hai 1 ano
pai
achega
f903515c94

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>

+ 130 - 0
.idea/workspace.xml

@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AutoImportSettings">
+    <option name="autoReloadType" value="SELECTIVE" />
+  </component>
+  <component name="ChangeListManager">
+    <list default="true" id="d7df7679-0b04-4bc0-b250-d8113c4735e3" name="Changes" comment="feature: 初始化wifi版本">
+      <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/index.html" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/assets/js/amazeui.ie8polyfill.min.js" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/css/amazeui.min.css" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/css/app.css" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/css/layer.css" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/fonts/fontawesome-webfont.eot@" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/fonts/fontawesome-webfont.eot@v=4.5.0" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/fonts/fontawesome-webfont.svg@v=4.5.0" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/fonts/fontawesome-webfont.ttf@v=4.5.0" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/fonts/fontawesome-webfont.woff2@v=4.5.0" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/fonts/fontawesome-webfont.woff@v=4.5.0" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/js/amazeui.min.js" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/js/app.js" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/js/jquery-3.7.1.min.js" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/resource/js/layer.js" afterDir="false" />
+    </list>
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="Git.Settings">
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
+  </component>
+  <component name="MarkdownSettingsMigration">
+    <option name="stateVersion" value="1" />
+  </component>
+  <component name="ProjectColorInfo">{
+  &quot;associatedIndex&quot;: 5
+}</component>
+  <component name="ProjectId" id="2k0V4GkqoKqRti9lY7ICMEsiaiw" />
+  <component name="ProjectLevelVcsManager">
+    <ConfirmationsSetting value="2" id="Add" />
+  </component>
+  <component name="ProjectViewState">
+    <option name="hideEmptyMiddlePackages" value="true" />
+    <option name="showLibraryContents" value="true" />
+  </component>
+  <component name="PropertiesComponent">{
+  &quot;keyToString&quot;: {
+    &quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
+    &quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
+    &quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
+    &quot;git-widget-placeholder&quot;: &quot;master&quot;,
+    &quot;kotlin-language-version-configured&quot;: &quot;true&quot;,
+    &quot;last_opened_file_path&quot;: &quot;/Users/zhaoheqing/Desktop/work_maowang/web/wifi&quot;,
+    &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
+    &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
+    &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
+    &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
+    &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
+    &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
+  }
+}</component>
+  <component name="RunManager">
+    <configuration default="true" type="JetRunConfigurationType">
+      <module name="wifi" />
+      <method v="2">
+        <option name="Make" enabled="true" />
+      </method>
+    </configuration>
+    <configuration default="true" type="KotlinStandaloneScriptRunConfigurationType">
+      <module name="wifi" />
+      <option name="filePath" />
+      <method v="2">
+        <option name="Make" enabled="true" />
+      </method>
+    </configuration>
+  </component>
+  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="d7df7679-0b04-4bc0-b250-d8113c4735e3" name="Changes" comment="" />
+      <created>1722420288252</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1722420288252</updated>
+      <workItem from="1722420289696" duration="427000" />
+      <workItem from="1722420733649" duration="25000" />
+    </task>
+    <task id="LOCAL-00001" summary="feature: 初始化wifi版本">
+      <option name="closed" value="true" />
+      <created>1722420336093</created>
+      <option name="number" value="00001" />
+      <option name="presentableId" value="LOCAL-00001" />
+      <option name="project" value="LOCAL" />
+      <updated>1722420336093</updated>
+    </task>
+    <task id="LOCAL-00002" summary="feature: 初始化wifi版本">
+      <option name="closed" value="true" />
+      <created>1722420488685</created>
+      <option name="number" value="00002" />
+      <option name="presentableId" value="LOCAL-00002" />
+      <option name="project" value="LOCAL" />
+      <updated>1722420488685</updated>
+    </task>
+    <option name="localTasksCounter" value="3" />
+    <servers />
+  </component>
+  <component name="TypeScriptGeneratedFilesManager">
+    <option name="version" value="3" />
+  </component>
+  <component name="Vcs.Log.Tabs.Properties">
+    <option name="TAB_STATES">
+      <map>
+        <entry key="MAIN">
+          <value>
+            <State />
+          </value>
+        </entry>
+      </map>
+    </option>
+  </component>
+  <component name="VcsManagerConfiguration">
+    <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
+    <MESSAGE value="Initial commit" />
+    <MESSAGE value="feature: 初始化wifi版本" />
+    <option name="LAST_COMMIT_MESSAGE" value="feature: 初始化wifi版本" />
+  </component>
+</project>

+ 62 - 0
index.html

@@ -0,0 +1,62 @@
+<!doctype html>
+<html class="no-js">
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="description" content="">
+    <meta name="keywords" content="">
+    <meta name="viewport"
+          content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+    <title>猫王音响 - Wi-Fi配置</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="Cache-Control" content="no-siteapp" />
+    <link rel="stylesheet" href="resource/css/amazeui.min.css">
+    <link rel="stylesheet" href="resource/css/app.css">
+    <link rel="stylesheet" href="resource/css/layer.css">
+</head>
+<body>
+    <div class="am-g">
+        <!-- LOGO -->
+        <div class="am-u-sm-12 am-text-center">
+             <i class="am-icon-wifi myapp-login-logo"></i>
+            <br>
+            <br>
+            <div><b class="title" >配置设备Wi-Fi</b></div>
+            <span class="wi-fi-front font-color">UUID: {{.uuid}}</span>
+        </div>
+        <!-- 设置WiFi框 -->
+        <div class="am-u-sm-11 am-u-sm-centered">
+            <form class="am-form">
+                <fieldset class="myapp-login-form am-form-set">
+                    <div class="am-form-group am-form-icon">
+                        <i class="am-icon-wifi"></i>
+                        <input id="WiFiName" type="text" value="{{.wifiName}}" class="myapp-login-input-text am-form-field" placeholder="请输入您的Wi-Fi账号" required="required">
+                    </div>
+                    <div class="am-form-group am-form-icon ">
+                        <i class="am-icon-lock"></i>
+                            <input id="WiFiPwd" type="password" class="myapp-login-input-text am-form-field" placeholder="请输入您的Wi-Fi密码" required="required" data="passworedtype">
+                            <span class="toggle-pwd">
+                                <i id="toggleEye" class="am-icon-eye-slash"></i>
+                            </span>
+                    </div>
+                    <input id="UUId" type="hidden" value="{{.uuid}}">
+                </fieldset>
+                    <div class="wi-fi-front">
+                        <!-- <span >目前仅支持2.4G的Wi-Fi网络,</span><br> -->
+                        <span class="wi-fi-front">不支持酒店、机场等需要认证的Wi-Fi网络。</span>
+                    </div></br>
+            
+                <button  id="confirm" class="myapp-login-form-submit am-btn am-btn-primary am-btn-block ">确 定</button>
+
+            </form>
+        </div>
+
+    </div>
+    <!--[if (gte IE 9)|!(IE)]><!-->
+    <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.4.1.min.js"></script>
+    <script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
+    <script src="resource/js/amazeui.min.js"></script>
+    <script src="resource/js/app.js"></script>
+    <script src="resource/js/layer.js"></script>
+</body>
+</html>

+ 59 - 0
resource/assets/js/amazeui.ie8polyfill.min.js

@@ -0,0 +1,59 @@
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

+<html xmlns="http://www.w3.org/1999/xhtml"><head>

+<meta content="text/html; charset=utf-8" http-equiv="Content-Type">

+<title>系统发生错误</title>

+<style type="text/css">

+*{ padding: 0; margin: 0; }

+html{ overflow-y: scroll; }

+body{ background: #fff; font-family: '微软雅黑'; color: #333; font-size: 16px; }

+img{ border: 0; }

+.error{ padding: 24px 48px; }

+.face{ font-size: 100px; font-weight: normal; line-height: 120px; margin-bottom: 12px; }

+h1{ font-size: 32px; line-height: 48px; }

+.error .content{ padding-top: 10px}

+.error .info{ margin-bottom: 12px; }

+.error .info .title{ margin-bottom: 3px; }

+.error .info .title h3{ color: #000; font-weight: 700; font-size: 16px; }

+.error .info .text{ line-height: 24px; }

+.copyright{ padding: 12px 48px; color: #999; }

+.copyright a{ color: #000; text-decoration: none; }

+</style>

+</head>

+<body>

+<div class="error">

+<p class="face">:(</p>

+<h1>无法加载控制器:Modals</h1>

+<div class="content">

+
+	<div class="info">

+		<div class="title">

+			<h3>错误位置</h3>

+		</div>

+		<div class="text">

+			<p>FILE: /www/wwwroot/demos.cc/ThinkPHP/Library/Think/App.class.php &#12288;LINE: 201</p>

+		</div>

+	</div>

+
+
+	<div class="info">

+		<div class="title">

+			<h3>TRACE</h3>

+		</div>

+		<div class="text">

+			<p>#0 /www/wwwroot/demos.cc/ThinkPHP/Library/Think/App.class.php(201): E('\xE6\x97\xA0\xE6\xB3\x95\xE5\x8A\xA0\xE8\xBD\xBD\xE6\x8E\xA7...')<br />
+#1 /www/wwwroot/demos.cc/ThinkPHP/Library/Think/App.class.php(407): Think\App::exec()<br />
+#2 /www/wwwroot/demos.cc/ThinkPHP/Library/Think/Think.class.php(239): Think\App::run()<br />
+#3 /www/wwwroot/demos.cc/ThinkPHP/ThinkPHP.php(193): Think\Think::start()<br />
+#4 /www/wwwroot/demos.cc/index.php(4): require('../../../../www/wwwroot/de...')<br />
+#5 {main}</p>

+		</div>

+	</div>

+
+</div>

+</div>

+<div class="copyright">

+<p><a title="官方网站" href="../../../../../www.thinkphp.cn">ThinkPHP</a><sup>3.2.3</sup> { Fast & Simple OOP PHP Framework } -- [ WE CAN DO IT JUST THINK ]</p>

+</div>

+</body>

+</html>


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 0
resource/css/amazeui.min.css


+ 54 - 0
resource/css/app.css

@@ -0,0 +1,54 @@
+/* Write your styles */
+
+/* 登陆logo */
+.myapp-login-logo { font-size: 130px; color: #ff6a4c;}
+
+// 输入框
+.myapp-login-form {}
+.am-form-set { margin-bottom: 10px;}
+.myapp-login-form .myapp-login-input-text { font-size: 14px!important; padding-left: 48px!important; line-height: 1.8!important; border-radius: 30px!important; margin-top: 8px;}
+.myapp-login-form .myapp-login-input-text:focus { border-color: #ff6a4c!important; -webkit-box-shadow: inset 0 1px 1px rgba(225,86,86,.075),0 0 5px rgba(225,86,86,.3)!important;box-shadow: inset 0 1px 1px rgba(225,86,86,.075),0 0 5px rgba(225,86,86,.3)!important; }
+.am-form-set>input:first-child {border-radius: 30px!important;}
+.myapp-login-form .am-form-icon i {color: #ccc; padding-left: 15px;}
+.myapp-login-form-submit { background: #ff6a4c; border-radius: 30px; border-color: #ff6a4c;}
+.myapp-login-form-submit:hover { background: #ff8e77;border-color: #ff8e77;}
+.myapp-login-form-shortcut { position: relative; height: 30px; line-height: 30px; margin-top: 30px; padding: 0; width: 88%;  overflow: hidden;box-sizing: border-box;-webkit-box-sizing: border-box; }
+.myapp-login-form-shortcut .myapp-login-form-hr { background: #ccc;  position: absolute; top:50%; left:0; right:0;display: block;  width: 100%; z-index: 1;}
+.myapp-login-form-shortcut .myapp-login-form-hr-font { display: inline-block; padding: 0 16px; background: #fff; position: relative; font-size: 12px; color: #ccc; z-index: 2;}
+.myapp-login-form-listico { padding-top: 30px;}
+.myapp-login-form-listico .am-icon-btn { width: 60px; height: 60px; line-height: 60px; font-size: 30px;}
+.myapp-login-form-listico .am-icon-btn:hover { opacity: .9;}
+
+.title {
+    font-size:27px;
+}
+
+.wi-fi-front {
+    font-size: 13px;
+    text-align: center;
+}
+
+.font-color {
+    color: #ccc
+}
+
+.toggle-pwd {
+    position: absolute;
+    top: 50%;
+    right: 10px;
+    margin-right: 50px;
+    transform: translateY(-50%);
+    cursor: pointer;
+}
+
+.toggle-pwd i {
+    display: inline-block;
+    width: 60px;
+    height: 60px;
+    font-size: 18px;
+    color: #ccc;
+}
+
+.toggle-pwd i:hover {
+    color: #333;
+}

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 0
resource/css/layer.css


BIN=BIN
resource/fonts/fontawesome-webfont.eot@


BIN=BIN
resource/fonts/fontawesome-webfont.eot@v=4.5.0


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 655 - 0
resource/fonts/fontawesome-webfont.svg@v=4.5.0


BIN=BIN
resource/fonts/fontawesome-webfont.ttf@v=4.5.0


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 260 - 0
resource/fonts/fontawesome-webfont.woff2@v=4.5.0


BIN=BIN
resource/fonts/fontawesome-webfont.woff@v=4.5.0


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 8 - 0
resource/js/amazeui.min.js


+ 62 - 0
resource/js/app.js

@@ -0,0 +1,62 @@
+$(document).ready(function() {
+    $('#toggleEye').click(function() {
+      var pwdInput = $('#WiFiPwd');
+      var pwdType = pwdInput.attr('type');
+
+      if (pwdType === 'password' && $(this).hasClass('am-icon-eye-slash')) {
+        pwdInput.attr('type', 'text');
+        $(this).removeClass('am-icon-eye-slash').addClass('am-icon-eye');
+      } else {
+        pwdInput.attr('type', 'password');
+        $(this).removeClass('am-icon-eye').addClass('am-icon-eye-slash');
+      }
+    });
+    $('#confirm').click(function(event) {
+      event.preventDefault()
+      $(this).prop("disabled", true);
+      setTimeout(function() {
+        $("#confirm").prop("disabled", false);
+      }, 1000);
+      var wifiName = $('#WiFiName').val();
+      if (wifiName.trim().length === 0){
+        layer.msg('必须输入Wi-Fi账号✅');
+        return
+      }
+      var wifiPwd = $('#WiFiPwd').val();
+      if (wifiPwd.trim().length < 8){
+        layer.msg('必须输入正确的Wi-Fi密码✅');
+        return
+      }
+      var uuId = $('#UUId').val();
+      if (uuId.trim().length === 0){
+        layer.msg('必须传UUId✅');
+        return
+      }
+      $.ajax({
+        url: 'http://ptt.radio1964.com/v1/device/set-wifi', // 替换为后台接口的实际URL
+        method: 'POST', // 替换为后台接口的实际请求方法
+        data: {
+          wifiName: wifiName,
+          wifiPwd: wifiPwd,
+          UUId: uuId,
+        },
+        success: function(response) {
+          layer.msg( '✅ 设置成功'
+          ,{icon:1},function(){
+                var ua = navigator.userAgent.toLowerCase();
+                if(ua.match(/MicroMessenger/i)=="micromessenger") {
+                  WeixinJSBridge.call('closeWindow');
+                } else if(ua.indexOf("alipay")!=-1){
+                  AlipayJSBridge.call('closeWebview');
+                }else if(ua.indexOf("baidu")!=-1){
+                  BLightApp.closeWindow();
+                }
+            window.location.reload();
+          });
+        },
+        error: function(error) {
+          layer.msg('💤 请稍后再试');
+        }
+      });
+    });
+  });

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2 - 0
resource/js/jquery-3.7.1.min.js


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 2 - 0
resource/js/layer.js