Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
93b42a97de
@ -1139,7 +1139,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
<a href="javascript:;" class="dropdown-toggle no-arrow text-center" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a href="javascript:;" class="dropdown-toggle no-arrow text-center" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
<i class="fal fa-tv fa-2x"></i><br>系統監控
|
<i class="fal fa-tv fa-2x"></i><br>系統監控
|
||||||
</a>
|
</a>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu" id="sysMonBtnList">
|
||||||
<button class="dropdown-item" type="button" name="sysMonBtn">電錶</button>
|
<button class="dropdown-item" type="button" name="sysMonBtn">電錶</button>
|
||||||
<button class="dropdown-item" type="button" name="sysMonBtn">照明系統</button>
|
<button class="dropdown-item" type="button" name="sysMonBtn">照明系統</button>
|
||||||
<button class="dropdown-item" type="button" name="sysMonBtn">電梯系統</button>
|
<button class="dropdown-item" type="button" name="sysMonBtn">電梯系統</button>
|
||||||
@ -2072,6 +2072,10 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
location.href = "login.html";
|
location.href = "login.html";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
getSysMonBtnList();
|
||||||
|
})
|
||||||
|
|
||||||
onEvent("click", "button[name^=sysMonBtn]", function () {
|
onEvent("click", "button[name^=sysMonBtn]", function () {
|
||||||
$("#app").load("_systemMonitor.html", loadCallback);
|
$("#app").load("_systemMonitor.html", loadCallback);
|
||||||
})
|
})
|
||||||
@ -2083,6 +2087,15 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
|
|||||||
initTabsByEle();
|
initTabsByEle();
|
||||||
resetYTTooltip();
|
resetYTTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSysMonBtnList() {
|
||||||
|
let url = baseApiUrl + "/api/Device/GetMainSub";
|
||||||
|
ytAjax = new YourTeam.Ajax(url, null, function (data) {
|
||||||
|
console.log(data)
|
||||||
|
/*sysMonBtnList*/
|
||||||
|
},null,"POST").send();
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
<!-- END Body -->
|
<!-- END Body -->
|
||||||
|
@ -27,7 +27,7 @@ class Ajax {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
this.dataType = dataType;
|
this.dataType = dataType;
|
||||||
this.sendData = sendData;
|
this.sendData = sendData;
|
||||||
if (successFunction) this.successFunction = successFunction;
|
/*if (successFunction) this.successFunction = successFunction;*/
|
||||||
if (errorFunction) this.errorFunction = errorFunction;
|
if (errorFunction) this.errorFunction = errorFunction;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -45,8 +45,9 @@ class Ajax {
|
|||||||
* beforeSendFunction
|
* beforeSendFunction
|
||||||
* @description beforeSendFunction
|
* @description beforeSendFunction
|
||||||
*/
|
*/
|
||||||
beforeSendFunction = function () {
|
beforeSendFunction = function (xhr) {
|
||||||
|
let token = localStorage.getItem("JWT-Authorization");
|
||||||
|
xhr.setRequestHeader('Authorization', "Bearer " + token);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* successFunction
|
* successFunction
|
||||||
@ -54,7 +55,13 @@ class Ajax {
|
|||||||
* @param {Object} data the data object from the api return
|
* @param {Object} data the data object from the api return
|
||||||
* @return {Object} data
|
* @return {Object} data
|
||||||
*/
|
*/
|
||||||
successFunction = function (data) {
|
successFunction = function (data,callback) {
|
||||||
|
if (data && data.unauthorized == 401) {
|
||||||
|
location.href = "login.html";
|
||||||
|
}
|
||||||
|
if (callback) {
|
||||||
|
callback(data);
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -74,6 +81,7 @@ class Ajax {
|
|||||||
location.href = "~/Login/Login";
|
location.href = "~/Login/Login";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* completeFunction
|
* completeFunction
|
||||||
* @description completeFunction
|
* @description completeFunction
|
||||||
@ -120,9 +128,9 @@ class Ajax {
|
|||||||
if (sendData) {
|
if (sendData) {
|
||||||
this.sendData = sendData;
|
this.sendData = sendData;
|
||||||
}
|
}
|
||||||
if (successFunction) {
|
//if (successFunction) {
|
||||||
this.successFunction = successFunction;
|
// this.successFunction = successFunction;
|
||||||
}
|
//}
|
||||||
if (errorFunction) {
|
if (errorFunction) {
|
||||||
this.errorFunction = errorFunction;
|
this.errorFunction = errorFunction;
|
||||||
}
|
}
|
||||||
@ -140,11 +148,11 @@ class Ajax {
|
|||||||
//processData: false,
|
//processData: false,
|
||||||
|
|
||||||
beforeSend: this.beforeSendFunction,
|
beforeSend: this.beforeSendFunction,
|
||||||
success: this.successFunction,
|
success:(data) => this.successFunction(data,successFunction),
|
||||||
error: this.errorFunction,
|
error: this.errorFunction,
|
||||||
complete: this.completeFunction,
|
complete: this.completeFunction,
|
||||||
statusCode: {
|
statusCode: {
|
||||||
201: this.successFunction
|
201: (data) => this.successFunction(data,successFunction),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user