123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 |
- <!DOCTYPE html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>数字校园</title>
- <script type="text/javascript" src="/js/jquery.min.js"></script>
- <link rel="stylesheet" href="/css/bootstrap.min.css">
- <script type="text/javascript" src="/js/bootstrap.min.js"></script>
- <script type="text/javascript" src="/js/md5.js"></script>
- <link rel="preconnect" href="https://fonts.googleapis.com">
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Anonymous+Pro:ital,wght@0,400;0,700;1,400;1,700
- &family=Noto+Serif+SC:wght@300;400;500;600;700&display=swap" rel="stylesheet">
- <link rel="stylesheet" href="/css/style.css">
- <script>
- var status, oid, user, pwd
- const rot = '43.143.233.184:81', root = 'https://43.143.233.184:81/'
- function getCookie(name) {
- let arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
- if (arr != null) return arr[2];
- return null;
- }
- function delCookie(name, path = 'u') {
- var exp = new Date();
- exp.setTime(exp.getTime() - 1);
- var cval = getCookie(name);
- if (cval != null)
- document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString() + ((path == 'u') ? '' : ';path=' + path)
- }
- function getUrl(e) {
- return e.replace('dd.sdsz.com.cn', rot).replace(/^http:/, 'https:').replace(rot.split(':')[0] + '/', rot + '/')
- }
- function setStatus(e, fast) {
- console.log('STATUS', e)
- status = e
- if (e == 1) {
- $('#loginSt').text('登录成功')
- $('.login').hide(200)
- $('#loginSt').addClass('label-success')
- $('#loginSt').removeClass('label-danger')
- $('.reqLogin').show(300)
- } else if (e == 2) {
- $('#loginSt').text('登录失败')
- $('#loginSt').removeClass('label-success')
- $('#loginSt').addClass('label-danger')
- } else {
- $('.login').show(200)
- $('#loginSt').text('未登录')
- $('#loginSt').removeClass('label-success')
- $('#loginSt').removeClass('label-danger')
- $('.reqLogin').hide(300 * !fast)
- $('#avatar').attr('src', '')
- $('#user').text('-')
- }
- }
- function delCookies(force) {
- if (force) {
- delCookie('CASTGC', '/')
- delCookie('gosh', '/score/')
- if (force <= 2) {
- delCookie('gosh', '/sso/')
- delCookie('gowd', '/sso/')
- }
- }
- if (force >= 2) {
- delCookie('JSESSIONID', '/bxn-portal/')
- delCookie('JSESSIONID', '/bxn-library/')
- delCookie('JSESSIONID', '/bxn-core-uic/')
- }
- delCookie('JSESSIONID', '/')
- delCookie('JSESSIONID', '/sso/')
- }
- var ggg
- function getMail(from, i, id, uid) {
- console.log(i, id, uid)
- $('.mil-' + i).toggleClass('active')
- if ($('.mail-' + i).text() == '') {
- get(`${['bxn-office/mails/user/showMailDetail?source=&mailItemId', 'bxn-office/messages/sys/sysMsgDetail?unwrap=true&sysMsgId', 'bxn-office/notices/user/getNoticeDetail?unwrap=true¬iceId'][from]}=${id}${['&userMailItemId=', '&ownerId=', ''][from]}${uid || ''}${['', '&_=0', '&_=0'][from]}`, e => {
- f = ''
- if (from == 0) {
- if (e.match('"下载"')) {
- f = e.replace(/.*?ico.*?(bxn-office\/a.*?)title.*?file-info">(.*?)<.*?/gs, '<a href="https://43.143.233.184:81/$1>~$2</a>,\n').split('/span')[0].replace(/,/g, '<br>').replace(/~/g, '<span class="glyphicon glyphicon-link"></span>')
- }
- e = e.replace(/^.*"bbcode-content">(.*?)<\/div>.*/gs, '$1').replace(/([\t\n\r ]| |<br>|<p><br\/><\/p>)+/g, '<br>').replace(/<br>style/g, ' style').replace(/<br>$/gs, '')
- } else if (from == 1) {
- e = e.replace(/.*容:<\/label>(.*?)<\/p>.*/gs, '$1').replace(/([\t\n\r ]| |<br>|<p><br\/><\/p>)+/g, '<br>').replace(/<br>style/g, ' style').replace(/<br>$/gs, '')
- } else if (from == 2) {
- if (e.match('件:')) {
- f = e.replace(/.*件:.*?<a.*?(<a.*?href=")(.*?) .*?fo">[ \t\n\r]*(.*?)[ \t\n\r]*<.*/gs, '$1https://43.143.233.184:81$2><span class="glyphicon glyphicon-link"></span>$3</a>')
- }
- e = e.replace(/.*?通..容:.*?tent">(.*?)<\/t.*/gs, '$1').replace(/([\t\n\r ]| |<br>|<p><br\/><\/p>)+/g, '<br>').replace(/<br>style/g, ' style').replace(/<br>$/gs, '')
- }
- $('.mail-' + i).html(f + e)
- $('.mail-' + i).toggle(300)
- })
- } else {
- $('.mail-' + i).toggle(300)
- }
- }
- var mails = []
- function insertMail(e) {
- e = '[' + e.slice(0, e.length - 1) + ']'
- e = JSON.parse(e)
- $('#mailList').empty()
- e = e.concat(mails)
- console.log(e)
- e = e.sort(function (a, b) { return new Date(b.time) - new Date(a.time) });
- mails = e
- for (let i = 0; i < e.length; i++) {
- $('#mailList').append(`<li class="mail mil-${i}"><span style="width:100%;display:inline-block;cursor:pointer" onclick="getMail(${e[i].from},${i},'${e[i].id}',${e[i].uid})"><b>${e[i].title}</b><span class="pull-right" style="color:#999;">${e[i].name} ${e[i].time.split(' ')[0]} <span class="full-time" style="color:#bbb;">${e[i].time.split(' ')[1]}</span></span></span><span class="mail-text mail-${i}"></span></span></li>`)
- }
- $('.mail-text,.full-time').hide()
- }
- function postLogin() {
- console.log("POSTLOGIN")
- if (status != 1) return;
- if (!user) user = getCookie('gosh'), pwd = getCookie('gowd')
- document.cookie = "gosh=" + user + ";path=/score/";
- document.cookie = "gosh=" + user + ";path=/sso/";
- document.cookie = "gowd=" + pwd + ";path=/sso/";
- $('#changePwd').val(pwd)
- // get('bxn-portal/portal/osforstudent/index', 0, e => {
- // let res = JSON.parse(e.match(/user_resources.*window\.admin/gs)[0].replace(/(?:user_resources =|window\.admin|([^)]);)/gs, '$1'))
- // console.log(res)
- // })
- get('bxn-library/library/jumpExamreport?jumpUrl=http://36.112.23.77/analysis/auto/%23/autoLogin', e => {
- $('#scoreOld').attr('href', e)
- })
- get('bxn-portal/portal/api/proxy?username=true&userId=true&needvalidate=true&t=http%3A%2F%2F202.94.10.118%2Fbxn-library%2Fapi%2Flibrary%2FgetLatestBorrowBook%3Fcategory%3D1&resourceId=103519&cache=nocache&systime=0', e => {
- e = JSON.parse(e)
- $('#user').text(e.requestParams[0].ownerName)
- oid = e.requestParams[0].ownerId
- $('#avatar').attr('src', root + 'avatar/tiny/' + oid)
- })
- get('bxn-office/mails/user/index', e => {
- // 这代码谁写的?真是太烂了,我一行就把他五行干掉了(是刚才的我写的)
- // e = e.replace(/\n^(?!.*(sender|mailDetail|mailItemId)).*$/gm, '').replace(/[\r\n ]+/g, '')
- // e = e.replace(/<(a|td|span)[^<]*>([^<]*)<\/\1>/g, ',$2')
- // e = e.replace(/<(a|td|span)[^<]*>([^<]*)<\/\1>/g, ',$2')
- // e = e.replace(/<tr[^"]*"([^"]*)"[^"]*"([^"]*)"><td[^>]*>/g, '\n,$1,$2').replace(/(.sender{\n|\t.*)/gm, '')
- // e = e.replace(/^,(.*),(.*),(.*),(.*),(.*),(.{10,10})(.{8,8})$/gm, '{"id":"$1","uid":"$2","name":"$3","title":"$5","time":"$6 $7"},').replace(/\n/g, '')
- e = e.replace(/.*?mailItemId=(.*?) .*?MailItemId=(.*?)>.*?sender">(.*?) ?<.*?tail">(.*?)<.*?tail">(.*?)</gs, '{"from":0,"id":$1,"uid":$2,"name":"$3","title":"$4","time":"$5"},').split('/td')[0]
- insertMail(e)
- })
- get('bxn-office/messages/sys/sysInfoList', e => {
- e = e.replace(/.*?a-id="(.*?)".*?erId="(.*?)".*?d-td t.*?>\n?[\t\n\r]*(.*?)\n?[\t\n\r]*<\/td>.*?>(.*?)</gs, '{"from":1,"id":"$1","uid":"$2","name":"<i>消息</i>","title":"$3","time":"$4"},').split('/td')[0]
- insertMail(e)
- })
- get('bxn-office/notices/user/received', e => {
- e = e.replace(/.*?ta-id="(.*?)".*?d-td.*?d-td .*?on"> ?(.*?)<.*?ta-id.*?>(.*?)<(?:.*?d-td){4,4}">[\t\n\r ]*(.*?)[\t\n\r ]*</gs, '{"from":2,"id":"$1","title":"$2","name":"<i>通知</i> - $3","time":"$4"},').split('/td')[0]
- console.log(e)
- insertMail(e)
- })
- }
- function login() {
- console.log("LOGIN!!")
- if (status == 1) return;
- delCookies()
- user = $('#loginId').val(), pwd = $('#loginPwd').val()
- return fetch(root + "sso/login", {
- "headers": {
- "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
- // "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
- },
- "method": "GET",
- "mode": "cors",
- "credentials": 'include'
- }).then(() => {
- return fetch('https://43.143.233.184/andlogin', {
- method: 'POST',
- headers: { 'Content-type': 'application/json' },
- body: JSON.stringify({
- user: user,
- pwd: pwd,
- cook: getCookie('JSESSIONID')
- }),
- credentials: 'include',
- })
- }).then(e => e.text()).then(e => { setStatus((e != 'success') + 1), Promise.resolve() })
- }
- function matches(e) {
- return e.match('(<tr>|DOCTYPE|[/n]\\?username=|requestParams|\"newmessage\")')
- }
- async function next(e, call) {//异步递归嘿嘿嘿,再多 302 也不怕;再加上回调函数,真是妙
- if (e.length < 3000 && !matches(e)) {
- return fetch(getUrl(e), {
- method: 'GET',
- credentials: 'include'
- }).then(e => e.text()).then(res => { next(res, call) })
- }
- else return call(e), new Promise((resolve, reject) => { })
- }
- function pre(e, url, call) {
- if (e.match('北师大实验中学--登录')) {
- console.log("ERR", e, url)
- delCookies(3)
- setStatus(0)
- tryLogin()
- } else {
- $('#bxn' + url.split('bxn')[1].split('/')[0]).addClass('btn-success')
- call(e)
- }
- }
- function get(url, call = () => { }) {
- console.log("GET", url)
- if (status != 1) return
- next(root + url, e => { pre(e, url, call); })
- }
- function change() {
- if (status != 1 || pwd == $('#changePwd').val()) return
- var fd = new URLSearchParams()
- fd.append('rating', '4')
- fd.append('ratingWord', '极佳')
- fd.append('oldPassword', pwd)
- fd.append('newPassword', $('#changePwd').val())
- fd.append('reNewPassword', $('#changePwd').val())
- fetch(root + 'bxn-core-uic/uic-public/personal/management/password/save', {
- "headers": {
- "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
- // "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
- },
- method: 'POST',
- body: fd,
- credentials: 'include',
- })
- $('#changeBtn').addClass('btn-success')
- }
- function tryLogin() {
- if (getCookie('CASTGC')) {
- setStatus(1), postLogin()
- } else if (getCookie('gosh') && getCookie('gosh') != 'null') {
- $('#loginId').val(getCookie('gosh'))
- $('#loginPwd').val(getCookie('gowd'))
- login().then(() => { status == 2 ? setStatus(0, 1) : postLogin() })
- } else setStatus(0, 1)
- }
- $().ready(() => {
- $('.e').addClass('reqLogin')
- $('.e').removeClass('e')
- tryLogin()
- $("[data-toggle='tooltip']").tooltip();
- })
- </script>
- <style>
- .form-control {
- font-weight: bold;
- font-family: 'Courier New', Courier, monospace;
- }
- li {
- border-bottom: 3px solid #eee;
- }
- li:hover {
- background-color: #eee;
- }
- .box {
- transition-duration: 300ms;
- }
- .box::before {
- content: '';
- display: block;
- width: 100%;
- height: 3px;
- margin-top: 10px;
- border-bottom: 1px solid;
- border-image: linear-gradient(to right, transparent, #6aaad8, #75ddb6, transparent) 1;
- }
- .box:hover::before {
- border-bottom: 3px solid;
- border-image: linear-gradient(to right, transparent, #6aaad8, #75ddb6, transparent) 1;
- }
- .box:hover {
- background-image: linear-gradient(#faffef, transparent);
- }
- .page-header.nohr {
- margin-bottom: 0;
- border-bottom: none;
- }
- .lim {
- max-height: 210px;
- overflow: auto;
- }
- .lim:hover {
- max-height: 500px;
- overflow: auto;
- }
- .boxMail::-webkit-scrollbar {
- width: 5px;
- }
- .boxMail::-webkit-scrollbar-track {
- background-color: transparent;
- }
- .boxMail::-webkit-scrollbar-thumb {
- background-color: transparent;
- border-radius: 2px;
- }
- .boxMail:hover::-webkit-scrollbar-thumb {
- background-color: #bbb;
- }
- .mail {
- transition-duration: 300ms;
- }
- .mail.active {
- background-image: linear-gradient(to right, #fffaf0, #f4f2ef);
- border-left: 3px solid #ccc;
- padding-left: 5px;
- }
- </style>
- </head>
- <body>
- <div class="page-header nohr">
- <h2><img src="RC.png" width="32px" style="position:relative;top:-4px">
- 数字校园
- <button class="btn btn-default btn-xs">
- <span class="glyphicon glyphicon-question-sign"></span>
- </button>
- </h2>
- <span id="loginSt" class="label label-default">未登录</span>
- <span id="user" class="label label-default">-</span>
- <button class="btn btn-danger btn-xs e" onclick="postLogin()" title="刷新数据">
- <span class="glyphicon glyphicon-refresh"></span>
- </button>
- <button class="btn btn-danger btn-xs e" onclick="delCookies(1);setStatus(0)" onmouseenter="$('#double-off').css('scale','100%')" onmouseleave="$('#double-off').css('scale','0')" title="退出登录">
- <span class="glyphicon glyphicon-log-out"></span>
- </button>
- <button id="double-off" class="btn btn-danger btn-xs e" onclick="delCookies(2);location.reload()" onmouseenter="$('#double-off').css('scale','100%')" onmouseleave="$('#double-off').css('scale','0')" style="scale:0;transition-duration: 1000ms;" data-toggle="tooltip" data-placement="right" title="全部重置">
- <span class="glyphicon glyphicon-off"></span>
- </button>
- <button class="btn btn-danger btn-xs login" onclick="delCookies(2);location.reload()" data-toggle="tooltip" data-placement="right" title="全部重置">
- <span class="glyphicon glyphicon-off"></span>
- </button>
- <img id="avatar" style="position:absolute;right:10px;top:10px;">
- </div>
- <div class="col-md-4 col-sm-6 box">
- <div class="page-header">
- <h3><span class="glyphicon glyphicon-stats"></span> 成绩</h3>
- </div>
- <div class="btn-group">
- <a id="scoreOld" class="btn btn-default e" target="_blank">原版</a>
- <a class="btn btn-default e" href="/score" target="_blank">新版</a>
- </div>
- </div>
- <div class="col-md-4 col-sm-6 box">
- <div class="page-header">
- <h3><span class="glyphicon glyphicon-user"></span> 账号
- <div id="cookie" class="btn-group" style="display: none;">
- <button id="bxn-portal" class="btn btn-default btn-xs" onclick="get('bxn-portal/portal/osforstudent/index')">bxn-portal</button>
- <button id="bxn-core-uic" class="btn btn-default btn-xs" onclick="get('bxn-core-uic/uic/index')">bxn-core-uic</button>
- <button id="bxn-library" class="btn btn-default btn-xs" onclick="get('bxn-library/library/jumpExamreport?jumpUrl=')">bxn-library</button>
- <button id="bxn-office" class="btn btn-default btn-xs" onclick="get('bxn-office/mail/index')">bxn-office</button>
- </div>
- </h3>
- </div>
- <button class="btn btn-default e" onclick="$('#change').toggle(200)">修改密码</button>
- <button class="btn btn-default e" onclick="$('#cookie').toggle(200)">cookie</button>
- <div class="login">
- <br>
- <div class="input-group">
- <span class="input-group-addon">账号</span>
- <input id="loginId" type="id" class="form-control" placeholder="20222222">
- </div>
- <br>
- <div class="input-group">
- <span class="input-group-addon">密码</span>
- <input id="loginPwd" type="password" class="form-control" placeholder="password">
- <span class="input-group-btn">
- <button class="btn btn-default" type="button" onclick="login().then(postLogin)">
- <span class="glyphicon glyphicon-log-out"></span> 登录
- </button>
- </span>
- </div>
- </div>
- <div id="change" style="display: none;">
- <br>
- <div class="input-group">
- <span class="input-group-addon">新密码</span>
- <input id="changePwd" type="password" class="form-control" placeholder="password" onmouseenter="this.type='id'" onmouseleave="this.type='password'">
- <span class="input-group-btn"><button id="changeBtn" class="btn btn-default" type="button" onclick="change()">修改</button></span>
- </div>
- </div>
- </div>
- <div class="col-md-4 col-sm-6 box boxMail lim">
- <div class="page-header">
- <h3><span class="glyphicon glyphicon-envelope"></span> 通知
- <button class="btn btn-default btn-xs reqLogin" onclick="$('.mail-text').hide(300);$('.mail').removeClass('active')">全部收起</button>
- <button class="btn btn-default btn-xs reqLogin" onclick="$('.boxMail').toggleClass('col-sm-6').toggleClass('col-md-4').toggleClass('col-sm-12').toggleClass('lim');$('.full-time').toggle()">
- <span class="glyphicon glyphicon-fullscreen"></span>
- </button>
- </h3>
- </div>
- <ul id="mailList" class="list-unstyled e">
- <il>获取中...</il>
- </ul>
- </div>
- <div style="position:fixed;bottom:10px;left:10px;color:#ccc">
- 北师大实验中学
- </div>
- </body>
|