|
@@ -1,62 +1,63 @@
|
|
|
-$(document).ready(function() {
|
|
|
- $('#toggleEye').click(function() {
|
|
|
- var pwdInput = $('#WiFiPwd');
|
|
|
- var pwdType = pwdInput.attr('type');
|
|
|
+$(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');
|
|
|
+ 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('💤 请稍后再试');
|
|
|
}
|
|
|
});
|
|
|
- $('#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('💤 请稍后再试');
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
+ });
|
|
|
+});
|