🆗 由于默认密码变更,已无法后台登录,改为使用jsessionID登录

🆗 兼容新的打卡
🆗 增加自动打卡开关
This commit is contained in:
jimlee
2023-03-22 19:34:53 +08:00
parent becdffe1d4
commit 8e9842b4f9
3 changed files with 36 additions and 19 deletions

View File

@@ -28,6 +28,7 @@ if ($('#login-span').css('display') !== 'none') {
let jsessonIdInput = document.querySelector('#jsessionId');
let autoDaka = document.querySelector("#toggle--switch")
autoDaka.checked = window.localStorage.getItem("autodaka")
document.querySelector('#login').addEventListener("click", () => {
window.localStorage.setItem("employeeNo", employeeNumberInput.value);
@@ -77,7 +78,7 @@ function loginAndLoadRecord() {
cocoMessage.error("登陆失败!" + result.message, 3000);
}
},
error: function (e) {
error: function () {
cocoMessage.error("请求失败!", 3000);
}
})
@@ -109,6 +110,8 @@ function loadDakaList() {
'<div class="job-detail-buttons">' +
'<button class="search-buttons detail-button">' + (signlog.begin_time == null ? "未打卡" : signlog.begin_time.substr(11, 5)) + '</button>' +
'<button class="search-buttons detail-button">' + (signlog.end_time == null ? "未打卡" : signlog.end_time.substr(11, 5)) + '</button>' +
(signlog.autoDakaBeginTime == null ? "" : '<br><button class="search-buttons detail-button">定时上班卡时间: ' + signlog.autoDakaBeginTime + '</button>') +
(signlog.autoDakaEndTime == null ? "" : '<button class="search-buttons detail-button">定时下班卡时间: ' + signlog.autoDakaEndTime + '</button>') +
(signlog.end_time != null && signlog.end_time.substr(11, 5) > "20:30" ? '<button class="search-buttons detail-button">餐补</button>' : '') +
'</div>' +
(index <= 3 ? '<div class="job-card-buttons">' +
@@ -130,7 +133,7 @@ function loadDakaList() {
}
closeLoading()
},
error: function (e) {
error: function () {
cocoMessage.error("请求失败!", 3000);
closeLoading()
}
@@ -205,7 +208,8 @@ function bindSaveDakaTime() {
function bindAutoDakaToggle() {
document.querySelectorAll("#toggle--switch").forEach((dakaButton) => {
$(dakaButton).off('change').on('change', function (e) {
$(dakaButton).off('change').on('change', function () {
window.localStorage.setItem("autodaka", this.checked);
$.ajax({
method: "get",
url: "/api/daka/auto/" + window.localStorage.getItem("employeeNo") + "/" + autoDaka.checked,
@@ -214,7 +218,7 @@ function bindAutoDakaToggle() {
cocoMessage.error("登陆失败!" + result.message, 3000);
}
},
error: function (e) {
error: function () {
cocoMessage.error("请求失败!", 3000);
}
})
@@ -260,7 +264,7 @@ function saveDakaTime(signDate, beginTime, endTime) {
}
}
},
error: function (e) {
error: function () {
cocoMessage.error("请求失败!", 3000);
}
});
@@ -290,7 +294,7 @@ function saveDakaTime(signDate, beginTime, endTime) {
}
}
},
error: function (e) {
error: function () {
cocoMessage.error("请求失败!", 3000);
}
});
@@ -308,7 +312,7 @@ function randomBeginTime() {
function randomEndTime() {
let hourArray = [18, 19, 20, 21, 22, 23, 20, 21, 22, 20, 20, 21];
let randomHour = hourArray[Math.round(Math.random() * 9)];
let randomMinute = 0;
let randomMinute;
if (randomHour === 18) {
randomMinute = Math.round(Math.random() * 30) + 29;
} else {