text: ﻿function changepassword(){var t=$("#password"),e=$("#newpassword"),a=$("#new_password_again");if(check_password(t.val()))return!1;if(check_password(e.val()))return!1;if(check_newpassword(a.val()))return!1;if(check_passwordtwo(e.val(),a.val()))return!1;if(t.val()===e.val())return alert("新密码不能与旧密码相同!"),!1;var n=/^[\w_-]{8,24}$/;if(!n.test(t.val())||!n.test(e.val())||!n.test(a.val()))return alert("密码格式不正确!"),!1;e.val(encrypt(e.val())),t.val(encrypt(t.val())),a.val(e.val())}function select_true(t){$("select option[value='"+t+"']").attr("selected",!0)}function check_studentdata(){var t=$("#sno"),e=$("#sname"),a=$("#sage"),n=$("#password");return!check_username(t.val())&&(!check_name(e.val())&&(!check_age(a.val())&&void(null!=n.val()&&(check_password(n.val())||n.val(encrypt(n.val()))))))}function check_teacherdata(){var t=$("#tno"),e=$("#tname"),a=$("#tage"),n=$("#cno1"),r=$("#cno2"),l=$("#cno3"),c=$("#password");return!check_username(t.val())&&(!check_name(e.val())&&(parseInt(a.val())<24||parseInt(a.val())>60||""===a.val()?(alert("年龄必须在24岁到60岁之间"),!1):0===n.val()&&0===r.val()||n.val()!==r.val()?0===n.val()&&0===l.val()||n.val()!==l.val()?0===r.val()&&0===l.val()||r.val()!==l.val()?void(null!=c.val()&&(check_password(c.val())||c.val(encrypt(c.val())))):(alert("2和3课程冲突"),!1):(alert("1和3课程冲突"),!1):(alert("1和2课程冲突"),!1)))}function check_age(t){return""===t&&(alert("年龄不能为空!!"),!0)}function check_name(t){return""===t&&(alert("姓名不能为空!!"),!0)}function check_id(t){return""===t&&(alert("ID不能为空!!"),!0)}function check_username(t){return""===t&&(alert("用户号不能为空!!"),!0)}function check_password(t){return(""===t||!/^[\w_-]{8,24}$/.test(t))&&(alert("密码格式不正确!"),!0)}function check_newpassword(t){return""===t&&(alert("确认密码不能为空!"),!0)}function check_passwordtwo(t,e){return t!==e&&(alert("确认密码不一致!"),!0)}function encrypt(t){try{var e=new jsSHA("SHA3-512","TEXT",{numRounds:parseInt("4096",10)});e.update(t),t=e.getHash("HEX"),console.log(t)}catch(t){alert(t.message)}return hex_md5(t)}function post(t,e,a){$.ajax({url:t,aysnc:!1,type:e,contentType:"application/json; charset=utf-8",data:a,success:function(t){return!0},error:function(t,e,a){return alert("请求失败，消息："+e+"  "+a),!1}})}function getNowFormatDate(){var t=new Date,e=t.getFullYear(),a=t.getMonth()+1,n=t.getDate();return a>=1&&a<=9&&(a="0"+a),n>=0&&n<=9&&(n="0"+n),e+"-"+a+"-"+n}$("#xlsx").click(function(){var t=$(".table thead tr th").length,e=$("tr").find("button").length,a=$("tr").find("a").length,n=$("#tableTitle").val();(e>0||a>0)&&(t-=1),$(".table").tableExport({type:"xlsx",fileName:n+"_"+getNowFormatDate(),ignoreColumn:[t],bootstrap:!0})}),$("#xls").click(function(){var t=$(".table thead tr th").length,e=($("tr").find("button").length,$("tr").find("a").length,$("#tableTitle").val());$(".table").tableExport({type:"excel",fileName:e+"_"+getNowFormatDate(),ignoreColumn:[t],bootstrap:!0})}),$("#csv").click(function(){var t=$(".table thead tr th").length,e=($("tr").find("button").length,$("tr").find("a").length,$("#tableTitle").val());$(".table").tableExport({type:"csv",fileName:e+"_"+getNowFormatDate(),ignoreColumn:[t],bootstrap:!0})});