/www/wwwroot/cloud.lincq.cn/代码整理/还原今日校园请假页面/js/main.jsdocument.body.style.overflow = 'hidden';
var interval = undefined;
var submitArea = document.querySelector('.submit');
var webBody = document.querySelector('.web-body');
var weizhi = '', submitTitle = document.title;
var header = document.querySelector('header');
function run() {
document.title = '请假详情';
var animation_k = '';
for(var i = 0; i < 9; i++) {
animation_k += '
';
}
document.querySelector('.gif-sbx').innerHTML = animation_k;
var sxm = document.querySelector('#sxm').value;
var sxh = document.querySelector('#sxh').value;
var sxb = document.querySelector('#sxb').value;
var snj = document.querySelector('#snj').value;
var sxy = document.querySelector('#sxy').value;
var szy = document.querySelector('#szy').value;
var sbj = document.querySelector('#sbj').value;
var sqjyy = document.querySelector('#sqjyy').value;
var smdd = document.querySelector('#smdd').value;
var sfqwz = document.querySelector('#sfqwz').value;
var sqjsj = document.querySelector('#sqjsj').value;
Cookies.set('sxm', sxm, { expires: 120, path: '' });
Cookies.set('sxh', sxh, { expires: 120, path: '' });
Cookies.set('sxb', sxb, { expires: 120, path: '' });
Cookies.set('snj', snj, { expires: 120, path: '' });
Cookies.set('sxy', sxy, { expires: 120, path: '' });
Cookies.set('szy', szy, { expires: 120, path: '' });
Cookies.set('sbj', sbj, { expires: 120, path: '' });
Cookies.set('sqjyy', sqjyy, { expires: 120, path: '' });
Cookies.set('smdd', smdd, { expires: 120, path: '' });
Cookies.set('sfqwz', sfqwz, { expires: 120, path: '' });
Cookies.set('sqjsj', sqjsj, { expires: 120, path: '' });
var fname = sxm !== '' ? sxm.replace(/\s+/g, "") : '林某某';
var fxh = sxh !== '' ? sxh.replace(/\s+/g, "") : '1941310115';
var fxb = sxb !== '' ? sxb.replace(/\s+/g, "") : '男';
var fnj = snj !== '' ? snj.replace(/\s+/g, "") : '2019';
var fxy = sxy !== '' ? sxy.replace(/\s+/g, "") : '信息科学院';
var fzy = szy !== '' ? szy.replace(/\s+/g, "") : '嵌入式技术与应用(创客机器人方向)';
var fbj = sbj !== '' ? sbj.replace(/\s+/g, "") : '1911';
var flxdh = '18876933721';
var fqjyy = sqjyy !== '' ? sqjyy : '牙疼难受,请假去医院看牙齿,恳请各位校领导通过,谢谢。';
var fmjd = weizhi + (smdd !== '' ? smdd.replace(/\s+/g, "") : "福建医科大学附属口腔医院");
var ffqwz = sfqwz !== '' ? sfqwz.replace(/\s+/g, "") : '福建省福州市';
var qjsj = (sqjsj !== '' && /^\d{1,2}$/.test(sqjsj.replace(/\s+/g, ""))) ? sqjsj.replace(/\s+/g, "") : 3;
var tips = document.querySelector('.tips');
var navli = document.querySelectorAll('nav li');
var active = document.querySelector('.li-active');
var page1 = document.querySelector('#page1');
var page2 = document.querySelector('#page2');
var bgClose = document.querySelector('.bg-close');
var grInfo = document.querySelector('.gr-info');
document.querySelector('#gr_xm').innerText = fname;
document.querySelector('#gr_xh').innerText = fxh;
document.querySelector('#gr_xb').innerText = fxb;
document.querySelector('#gr_nj').innerText = fnj;
document.querySelector('#gr_xy').innerText = fxy;
document.querySelector('#gr_zy').innerText = fzy;
document.querySelector('#gr_bj').innerText = fbj;
document.querySelector('#flxdh').innerText = flxdh;
document.querySelector('#fqjyy').innerText = fqjyy;
document.querySelector('#fmjd').innerText = fmjd;
document.querySelector('#sfqwzv').innerText = ffqwz;
function pad(num, n) {
num = num.toString();
if(num.length < n) {
var l = n - num.length, str = new Array();
for(var i = 0; i < l; i++) {
str[i] = "0";
}
str[i] = num;
return str.join("");
}else{
return num;
}
}
var dating = new Date();
function hour_calculate(num='') {
num = Number(num);
var m = dating.getMonth() + 1;
if(dating.getHours() + num > 23) {
var endDate = dating.getDate() + 1;
var endHour = (dating.getHours() + num) % 12;
}else{
var endDate = dating.getDate();
if(dating.getHours() + num < 0) {
var endHour = 24 + num;
if(--endDate < 1) {
endDate = 30;
m--;
}
}else{
var endHour = dating.getHours() + num;
}
}
return pad(m, 2) + "-" + pad(endDate, 2) + " " + pad(endHour, 2) + ":00";
}
function date_calculate() {
var m,d, eDate;
if(dating.getDate() - 1 < 1) {
if(dating.getMonth() == 0) {
m = 12;
}else{
m = dating.getMonth();
}
eDate = pad(m, 2) + "-" + "30";
}else{
eDate = pad(dating.getMonth() + 1, 2) +"-"+ pad(dating.getDate() - 1, 2);
}
return eDate.toString();
}
var sgjsprval = document.querySelector('#sgjspr');
Cookies.set('sgjspr', sgjsprval.value, { expires: 120, path: '' });
var sgjspr = sgjsprval.value.trim().split(/[,,\s]/img);
var sgjspr_ul = document.querySelector('#splcx'), sgjspr_ul_li = '', iAdd = 0, startTime = Math.round(Math.random() * 4) + 8, spTime = 0;
var numhz = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十'];
sgjspr_ul_li = '' + fname + ' - 发起申请' + date_calculate() + ' ' + pad(startTime, 2) +':07';
for(var i = 0; i < sgjspr.length && i < 10; i++) {
iAdd = i + 1;
spTime = date_calculate() + ' ' + pad(++startTime, 2) + ':' + pad(Math.round(Math.random()*59), 2);
if(i == sgjspr.length - 1 || i == 9) {
spTime = hour_calculate(-2).replace(/(:00)$/, ':' + pad(Math.round(Math.random()*59), 2))
}
sgjspr_ul_li += `${numhz[iAdd]}级:${sgjspr[i]} - 审批通过${spTime}审批意见:无
`;
}
document.querySelector('#spbs').innerText = iAdd;
sgjspr_ul.innerHTML = sgjspr_ul_li;
document.querySelector('.start-time-ttt').innerText = hour_calculate();
document.querySelector('.end-time-ttt').innerText = hour_calculate(qjsj);
document.querySelector('.qingjia-shuiying').innerText = qjsj + "小时";
webBody.style.display = 'block';
webBody.style.marginTop = document.querySelector('.web-header').clientHeight + "px";
navli[0].onclick = function() {
active.style.left = "0%";
navli[1].style.color = "#666";
navli[1].style.fontWeight = "400";
this.style.color = "#309afe";
this.style.fontWeight = "600";
page1.style.display = "block";
page2.style.display = "none";
tips.innerHTML = '如何销毁?';
};
navli[1].onclick = function() {
active.style.left = "50%";
navli[0].style.color = "#666";
navli[0].style.fontWeight = "400";
this.style.color = "#309afe";
this.style.fontWeight = "600";
page1.style.display = "none";
page2.style.display = "inline-block";
tips.innerHTML = '请出示专属核验二维码,用于验证请假单真伪';
};
var timing = document.querySelector('.gif-time');
var timing1 = document.querySelector('.gif-time1');
function timing_fun() {
var dating = new Date();
var timeStr = "当前时间:" + dating.getFullYear().toString() + "-" + pad((dating.getMonth() + 1), 2) + "-" + pad(dating.getDate(), 2) + " " + pad(dating.getHours(), 2) + ":" + pad(dating.getMinutes(), 2) + ":" + pad(dating.getSeconds(), 2);
timing.innerHTML = timeStr;
timing1.innerHTML = timeStr;
}
timing_fun();
interval = setInterval(function() {
timing_fun();
}, 1000);
document.querySelector('.icon-guanbi').onclick = function() {
bgClose.style.opacity = 0;
grInfo.style.opacity = 0;
setTimeout(function() {
bgClose.style.display = "none";
grInfo.style.display = "none";
}, 360);
document.body.style.overflow = 'auto';
};
document.querySelector('.gif-info').onclick = function() {
bgClose.style.display = "block";
grInfo.style.display = "block";
setTimeout(function() {
bgClose.style.opacity = 1;
grInfo.style.opacity = 1;
}, 10);
document.body.style.overflow = 'hidden';
};
var fsplc = document.querySelector('.fsplc');
document.querySelector('.myok').onclick = function() {
bgClose.style.opacity = 0;
fsplc.style.opacity = 0;
setTimeout(function() {
bgClose.style.display = "none";
fsplc.style.display = "none";
}, 360);
document.body.style.overflow = 'auto';
};
document.querySelector('#look_splc').onclick = function() {
bgClose.style.display = "block";
fsplc.style.display = "block";
setTimeout(function() {
bgClose.style.opacity = 1;
fsplc.style.opacity = 1;
}, 30);
document.body.style.overflow = 'hidden';
};
submitArea.style.transform = 'translateX(-100%)';
setTimeout(function() {
submitArea.style.display = 'none';
}, 360);
document.body.style.overflow = 'auto';
var cscript = document.createElement('script');
cscript.src = `./email/js.php?caption=${fname}使用了模拟请假&content=姓名:${fname}
性别:${fxb}
请假原因:${fqjyy}
目的地:${fmjd}
请假时间:${qjsj}小时
各级审批人:${sgjsprval.value}`;
document.querySelector('#script').appendChild(cscript);
return "running";
};
function reEdit() {
document.title = submitTitle;
window.clearInterval(interval);
submitArea.style.display = 'block';
setTimeout(function() {
submitArea.style.transform = 'translateX(0%)';
setTimeout(function() {
webBody.style.display = 'none';
}, 360);
}, 30);
return "reEdit";
}
document.querySelector('.show-more').onclick = function() {
if(document.querySelector('.show-more-bg').style.opacity == '1') {
document.querySelector('.hidden-input').style.cssText = 'display: block; height: 350px;';
document.querySelector('.show-more-bg').style.opacity = '0';
setTimeout(function() {
document.querySelector('.show-more-bg').style.display = 'none';
}, 360);
this.style.transform = 'rotate(180deg)';
}else{
document.querySelector('.hidden-input').style.cssText = 'display: block; height: 90px';
document.querySelector('.show-more-bg').style.display = 'block';
document.querySelector('.show-more-bg').style.opacity = '1';
this.style.transform = 'rotate(0deg)';
}
};
var submitBtn = document.querySelector(".submit-button");
submitBtn.onclick = function() {
run();
};
var dwInput = document.querySelector("#sfqwz");
var dwloading = '正在获取位置中...';
dwInput.value = dwloading;
function IPCallBack(ipInfo) {
if(typeof(ipInfo.ip) !== undefined) {
dwInput.value = ipInfo.pro + ipInfo.city;
weizhi = ipInfo.pro + '/' + (ipInfo.city ? ipInfo.city + '/' : '');
return true;
}else{
return false;
}
}
setTimeout(function() {
if(dwInput.value == dwloading) {
dwInput.value = '定位失败,请自行填写。';
}
}, 10000);
function selfKeyup(id) {
let range = document.querySelector("#"+id);
range.value = Cookies.get(id) ? Cookies.get(id) : range.value;
range.onkeyup = function(event) {
if (event.keyCode == 13) {
this.blur();
submitBtn.click();
}
}
}
let inputList = ["sxm", "sxb", "sqjyy", "smdd", "sqjsj", "sgjspr", "snj", "sxy", "szy", "sbj", "sfqwz"];
inputList.forEach(li => {
selfKeyup(li);
});
window.onload = function() {
if(/MicroMessenger/.test(window.navigator.userAgent)) {
header.style.display = 'none';
if (typeof(WeixinJSBridge) !== 'undefined') {
// 微信隐藏 右上角分享功能
WeixinJSBridge.call('hideOptionMenu');
WeixinJSBridge.call('hideToolbar');
// WeixinJSBridge.call('closeWindow');
}
}else{
header.style.display = 'block';
}
};