|
@@ -1,5 +1,5 @@
|
|
|
-$(document).ready(function() {
|
|
|
- $('#toggleEye').click(function() {
|
|
|
+$(document).ready(function () {
|
|
|
+ $('#toggleEye').click(function () {
|
|
|
var pwdInput = $('#WiFiPwd');
|
|
|
var pwdType = pwdInput.attr('type');
|
|
|
|
|
@@ -11,27 +11,32 @@ $(document).ready(function() {
|
|
|
$(this).removeClass('am-icon-eye').addClass('am-icon-eye-slash');
|
|
|
}
|
|
|
});
|
|
|
- $('#confirm').click(function(event) {
|
|
|
+
|
|
|
+ $('#confirm').click(function (event) {
|
|
|
event.preventDefault()
|
|
|
$(this).prop("disabled", true);
|
|
|
- setTimeout(function() {
|
|
|
+ setTimeout(function () {
|
|
|
$("#confirm").prop("disabled", false);
|
|
|
}, 1000);
|
|
|
+
|
|
|
var wifiName = $('#WiFiName').val();
|
|
|
- if (wifiName.trim().length === 0){
|
|
|
+ if (wifiName.trim().length === 0) {
|
|
|
layer.msg('必须输入Wi-Fi账号✅');
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
var wifiPwd = $('#WiFiPwd').val();
|
|
|
- if (wifiPwd.trim().length < 8){
|
|
|
+ if (wifiPwd.trim().length < 8) {
|
|
|
layer.msg('必须输入正确的Wi-Fi密码✅');
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
var uuId = $('#UUId').val();
|
|
|
- if (uuId.trim().length === 0){
|
|
|
+ if (uuId.trim().length === 0) {
|
|
|
layer.msg('必须传UUId✅');
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
$.ajax({
|
|
|
url: 'http://ptt.radio1964.com/v1/device/set-wifi', // 替换为后台接口的实际URL
|
|
|
method: 'POST', // 替换为后台接口的实际请求方法
|
|
@@ -40,21 +45,22 @@ $(document).ready(function() {
|
|
|
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();
|
|
|
- }
|
|
|
+ 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) {
|
|
|
+ error: function (error) {
|
|
|
layer.msg('💤 请稍后再试');
|
|
|
}
|
|
|
});
|