index.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <!DOCTYPE html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  4. <title>北师大实验中学数字校园</title>
  5. <script type="text/javascript" src="/js/jquery.min.js"></script>
  6. <link rel="stylesheet" href="/css/bootstrap.min.css">
  7. <script type="text/javascript" src="/js/bootstrap.min.js"></script>
  8. <script type="text/javascript" src="/js/md5.js"></script>
  9. <link rel="preconnect" href="https://fonts.googleapis.com">
  10. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  11. <link href="https://fonts.googleapis.com/css2?family=Anonymous+Pro:ital,wght@0,400;0,700;1,400;1,700
  12. &family=Noto+Serif+SC:wght@300;400;500;600;700&display=swap" rel="stylesheet">
  13. <link rel="stylesheet" href="/css/style.css">
  14. <script>
  15. var status, oid, user, pwd
  16. const rot = '43.143.233.184:81', root = 'https://43.143.233.184:81/'
  17. function getCookie(name) {
  18. let arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
  19. if (arr != null) return arr[2];
  20. return null;
  21. }
  22. function delCookie(name, path = 'u') {
  23. var exp = new Date();
  24. exp.setTime(exp.getTime() - 1);
  25. var cval = getCookie(name);
  26. if (cval != null)
  27. document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString() + ((path == 'u') ? '' : ';path=' + path)
  28. }
  29. function getUrl(e) {
  30. return e.replace('dd.sdsz.com.cn', rot).replace(/^http:/, 'https:').replace(rot.split(':')[0] + '/', rot + '/')
  31. }
  32. function setStatus(e, fast) {
  33. console.log('STATUS', e)
  34. status = e
  35. if (e == 1) {
  36. $('#loginSt').text('登录成功')
  37. $('.login').hide(200)
  38. $('#loginSt').addClass('label-success')
  39. $('#loginSt').removeClass('label-danger')
  40. $('.reqLogin').show(300)
  41. } else if (e == 2) {
  42. $('#loginSt').text('登录失败')
  43. $('#loginSt').removeClass('label-success')
  44. $('#loginSt').addClass('label-danger')
  45. } else {
  46. $('.login').show(200)
  47. $('#loginSt').text('未登录')
  48. $('#loginSt').removeClass('label-success')
  49. $('#loginSt').removeClass('label-danger')
  50. $('.reqLogin').hide(300 * !fast)
  51. $('#avatar').attr('src', '')
  52. $('#user').text('-')
  53. }
  54. }
  55. function delCookies(force) {
  56. if (force) {
  57. delCookie('CASTGC', '/')
  58. delCookie('gosh', '/score/')
  59. if (force <= 2) {
  60. delCookie('gosh', '/sso/')
  61. delCookie('gowd', '/sso/')
  62. }
  63. }
  64. if (force >= 2) {
  65. delCookie('JSESSIONID', '/bxn-portal/')
  66. delCookie('JSESSIONID', '/bxn-library/')
  67. delCookie('JSESSIONID', '/bxn-core-uic/')
  68. }
  69. delCookie('JSESSIONID', '/')
  70. delCookie('JSESSIONID', '/sso/')
  71. }
  72. var ggg
  73. function getMail(from, i, id, uid) {
  74. console.log(i, id, uid)
  75. $('.mil-' + i).toggleClass('active')
  76. if ($('.mail-' + i).text() == '') {
  77. get(`${['bxn-office/mails/user/showMailDetail?source=&mailItemId', 'bxn-office/messages/sys/sysMsgDetail?unwrap=true&sysMsgId', 'bxn-office/notices/user/getNoticeDetail?unwrap=true&noticeId'][from]}=${id}${['&userMailItemId=', '&ownerId=', ''][from]}${uid || ''}${['', '&_=0', '&_=0'][from]}`, e => {
  78. f = ''
  79. if (from == 0) {
  80. if (e.match('"下载"')) {
  81. 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>')
  82. }
  83. e = e.replace(/^.*"bbcode-content">(.*?)<\/div>.*/gs, '$1')
  84. } else if (from == 1) {
  85. e = e.replace(/.*容:<\/label>(.*?)<\/p>.*/gs, '$1')
  86. } else if (from == 2) {
  87. if (e.replace(/.*?file-list">[ \t\n\r]*(.*?)[ \t\n\r]*<.*$/gs, '$1')) {
  88. 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>')
  89. }
  90. e = e.replace(/.*?通..容:.*?tent">(.*?)<\/td.*/gs, '$1')
  91. }
  92. e = e.replace(/\[right\](.*?)\[\/right\]/gs, '<div class="pull-right">$1</div><br>').replace(/([\t\n\r  ]|&nbsp;|<br>|<p><br\/><\/p>)+/g, '<br>').replace(/<br>(style|class)/g, ' $1').replace(/<br>$/gs, '')
  93. $('.mail-' + i).html(f + e)
  94. $('.mail-' + i).toggle(300)
  95. })
  96. } else {
  97. $('.mail-' + i).toggle(300)
  98. }
  99. }
  100. var mails = []
  101. function insertMail(e) {
  102. e = '[' + e.slice(0, e.length - 1) + ']'
  103. e = JSON.parse(e)
  104. $('#mailList').empty()
  105. e = e.concat(mails)
  106. console.log(e)
  107. e = e.sort(function (a, b) { return new Date(b.time) - new Date(a.time) });
  108. mails = e
  109. for (let i = 0; i < e.length; i++) {
  110. $('#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>`)
  111. }
  112. $('.mail-text,.full-time').hide()
  113. }
  114. function postLogin() {
  115. console.log("POSTLOGIN")
  116. if (status != 1) return;
  117. if (!user) user = getCookie('gosh'), pwd = getCookie('gowd')
  118. document.cookie = "gosh=" + user + ";path=/score/";
  119. document.cookie = "gosh=" + user + ";path=/sso/";
  120. document.cookie = "gowd=" + pwd + ";path=/sso/";
  121. $('#changePwd').val(pwd)
  122. // get('bxn-portal/portal/osforstudent/index', 0, e => {
  123. // let res = JSON.parse(e.match(/user_resources.*window\.admin/gs)[0].replace(/(?:user_resources =|window\.admin|([^)]);)/gs, '$1'))
  124. // console.log(res)
  125. // })
  126. get('bxn-library/library/jumpExamreport?jumpUrl=http://36.112.23.77/analysis/auto/%23/autoLogin', e => {
  127. $('#scoreOld').attr('href', e)
  128. })
  129. 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 => {
  130. e = JSON.parse(e)
  131. $('#user').text(e.requestParams[0].ownerName)
  132. oid = e.requestParams[0].ownerId
  133. $('#avatar').attr('src', root + 'avatar/tiny/' + oid)
  134. })
  135. get('bxn-office/mails/user/index', e => {
  136. // 这代码谁写的?真是太烂了,我一行就把他五行干掉了(是刚才的我写的)
  137. // e = e.replace(/\n^(?!.*(sender|mailDetail|mailItemId)).*$/gm, '').replace(/[\r\n ]+/g, '')
  138. // e = e.replace(/<(a|td|span)[^<]*>([^<]*)<\/\1>/g, ',$2')
  139. // e = e.replace(/<(a|td|span)[^<]*>([^<]*)<\/\1>/g, ',$2')
  140. // e = e.replace(/<tr[^"]*"([^"]*)"[^"]*"([^"]*)"><td[^>]*>/g, '\n,$1,$2').replace(/(.sender{\n|\t.*)/gm, '')
  141. // e = e.replace(/^,(.*),(.*),(.*),(.*),(.*),(.{10,10})(.{8,8})$/gm, '{"id":"$1","uid":"$2","name":"$3","title":"$5","time":"$6 $7"},').replace(/\n/g, '')
  142. e = e.replace(/.*?mailItemId=(.*?) .*?MailItemId=(.*?)>.*?sender">(.*?) ?<.*?tail">(.*?)<.*?tail">(.*?)</gs, '{"from":0,"id":$1,"uid":$2,"name":"$3","title":"$4","time":"$5"},').split('/td')[0]
  143. insertMail(e)
  144. })
  145. get('bxn-office/messages/sys/sysInfoList', e => {
  146. 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]
  147. insertMail(e)
  148. })
  149. get('bxn-office/notices/user/received', e => {
  150. 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]
  151. insertMail(e)
  152. })
  153. }
  154. function login() {
  155. console.log("LOGIN!!")
  156. if (status == 1) return;
  157. delCookies()
  158. user = $('#loginId').val(), pwd = $('#loginPwd').val()
  159. return fetch(root + "sso/login", {
  160. "headers": {
  161. "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
  162. // "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"
  163. },
  164. "method": "GET",
  165. "mode": "cors",
  166. "credentials": 'include'
  167. }).then(() => {
  168. return fetch('https://43.143.233.184/andlogin', {
  169. method: 'POST',
  170. headers: { 'Content-type': 'application/json' },
  171. body: JSON.stringify({
  172. user: user,
  173. pwd: pwd,
  174. cook: getCookie('JSESSIONID')
  175. }),
  176. credentials: 'include',
  177. })
  178. }).then(e => e.text()).then(e => { setStatus((e != 'success') + 1), Promise.resolve() })
  179. }
  180. function matches(e) {
  181. return e.match('(<tr>|DOCTYPE|[/n]\\?username=|requestParams|\"newmessage\")')
  182. }
  183. async function next(e, call) {//异步递归嘿嘿嘿,再多 302 也不怕;再加上回调函数,真是妙
  184. if (e.length < 3000 && !matches(e)) {
  185. return fetch(getUrl(e), {
  186. method: 'GET',
  187. credentials: 'include'
  188. }).then(e => e.text()).then(res => { next(res, call) })
  189. }
  190. else return call(e), new Promise((resolve, reject) => { })
  191. }
  192. function pre(e, url, call) {
  193. if (e.match('北师大实验中学--登录')) {
  194. console.log("ERR", e, url)
  195. delCookies(3)
  196. setStatus(0)
  197. tryLogin()
  198. } else {
  199. $('#bxn' + url.split('bxn')[1].split('/')[0]).addClass('btn-success')
  200. call(e)
  201. }
  202. }
  203. function get(url, call = () => { }) {
  204. console.log("GET", url)
  205. if (status != 1) return
  206. next(root + url, e => { pre(e, url, call); })
  207. }
  208. function change() {
  209. if (status != 1 || pwd == $('#changePwd').val()) return
  210. var fd = new URLSearchParams()
  211. fd.append('rating', '4')
  212. fd.append('ratingWord', '极佳')
  213. fd.append('oldPassword', pwd)
  214. fd.append('newPassword', $('#changePwd').val())
  215. fd.append('reNewPassword', $('#changePwd').val())
  216. fetch(root + 'bxn-core-uic/uic-public/personal/management/password/save', {
  217. "headers": {
  218. "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
  219. // "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"
  220. },
  221. method: 'POST',
  222. body: fd,
  223. credentials: 'include',
  224. })
  225. $('#changeBtn').addClass('btn-success')
  226. }
  227. function tryLogin() {
  228. if (getCookie('CASTGC')) {
  229. setStatus(1), postLogin()
  230. } else if (getCookie('gosh') && getCookie('gosh') != 'null') {
  231. $('#loginId').val(getCookie('gosh'))
  232. $('#loginPwd').val(getCookie('gowd'))
  233. login().then(() => { status == 2 ? setStatus(0, 1) : postLogin() })
  234. } else setStatus(0, 1)
  235. }
  236. $().ready(() => {
  237. $('.e').addClass('reqLogin')
  238. $('.e').removeClass('e')
  239. tryLogin()
  240. $("[data-toggle='tooltip']").tooltip();
  241. })
  242. </script>
  243. <style>
  244. .form-control {
  245. font-weight: bold;
  246. font-family: 'Courier New', Courier, monospace;
  247. }
  248. li {
  249. border-bottom: 3px solid #eee;
  250. }
  251. li:hover {
  252. background-color: #eee;
  253. }
  254. .box {
  255. transition-duration: 300ms;
  256. }
  257. .box::before {
  258. content: '';
  259. display: block;
  260. width: 100%;
  261. height: 3px;
  262. margin-top: 10px;
  263. border-bottom: 1px solid;
  264. border-image: linear-gradient(to right, transparent, #6aaad8, #75ddb6, transparent) 1;
  265. }
  266. .box:hover::before {
  267. border-bottom: 3px solid;
  268. border-image: linear-gradient(to right, transparent, #6aaad8, #75ddb6, transparent) 1;
  269. }
  270. .box:hover {
  271. background-image: linear-gradient(#faffef, transparent);
  272. }
  273. .page-header.nohr {
  274. margin-bottom: 0;
  275. border-bottom: none;
  276. }
  277. .lim {
  278. max-height: 210px;
  279. overflow: auto;
  280. }
  281. .lim:hover {
  282. max-height: 500px;
  283. overflow: auto;
  284. }
  285. .boxMail::-webkit-scrollbar {
  286. width: 5px;
  287. }
  288. .boxMail::-webkit-scrollbar-track {
  289. background-color: transparent;
  290. }
  291. .boxMail::-webkit-scrollbar-thumb {
  292. background-color: transparent;
  293. border-radius: 2px;
  294. }
  295. .boxMail:hover::-webkit-scrollbar-thumb {
  296. background-color: #bbb;
  297. }
  298. .mail {
  299. transition-duration: 300ms;
  300. }
  301. .mail.active {
  302. background-image: linear-gradient(to right, #fffaf0, #f4f2ef);
  303. border-left: 3px solid #ccc;
  304. padding-left: 5px;
  305. }
  306. </style>
  307. </head>
  308. <body>
  309. <div class="page-header nohr">
  310. <h2><img src="RC.png" width="32px" style="position:relative;top:-4px">
  311. 数字校园
  312. <button class="btn btn-default btn-xs">
  313. <span class="glyphicon glyphicon-question-sign"></span>
  314. </button>
  315. </h2>
  316. <span id="loginSt" class="label label-default">未登录</span>
  317. <span id="user" class="label label-default">-</span>
  318. <button class="btn btn-danger btn-xs e" onclick="postLogin()" title="刷新数据">
  319. <span class="glyphicon glyphicon-refresh"></span>
  320. </button>
  321. <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="退出登录">
  322. <span class="glyphicon glyphicon-log-out"></span>
  323. </button>
  324. <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="全部重置">
  325. <span class="glyphicon glyphicon-off"></span>
  326. </button>
  327. <button class="btn btn-danger btn-xs login" onclick="delCookies(2);location.reload()" data-toggle="tooltip" data-placement="right" title="全部重置">
  328. <span class="glyphicon glyphicon-off"></span>
  329. </button>
  330. <img id="avatar" style="position:absolute;right:10px;top:10px;">
  331. </div>
  332. <div class="col-md-4 col-sm-6 box">
  333. <div class="page-header">
  334. <h3><span class="glyphicon glyphicon-stats"></span> 成绩</h3>
  335. </div>
  336. <div class="btn-group">
  337. <a id="scoreOld" class="btn btn-default e" target="_blank">原版</a>
  338. <a class="btn btn-default e" href="/score" target="_blank">新版</a>
  339. </div>
  340. </div>
  341. <div class="col-md-4 col-sm-6 box">
  342. <div class="page-header">
  343. <h3><span class="glyphicon glyphicon-user"></span> 账号
  344. <div id="cookie" class="btn-group" style="display: none;">
  345. <button id="bxn-portal" class="btn btn-default btn-xs" onclick="get('bxn-portal/portal/osforstudent/index')">bxn-portal</button>
  346. <button id="bxn-core-uic" class="btn btn-default btn-xs" onclick="get('bxn-core-uic/uic/index')">bxn-core-uic</button>
  347. <button id="bxn-library" class="btn btn-default btn-xs" onclick="get('bxn-library/library/jumpExamreport?jumpUrl=')">bxn-library</button>
  348. <button id="bxn-office" class="btn btn-default btn-xs" onclick="get('bxn-office/mail/index')">bxn-office</button>
  349. </div>
  350. </h3>
  351. </div>
  352. <button class="btn btn-default e" onclick="$('#change').toggle(200)">修改密码</button>
  353. <button class="btn btn-default e" onclick="$('#cookie').toggle(200)">cookie</button>
  354. <div class="login">
  355. <br>
  356. <div class="input-group">
  357. <span class="input-group-addon">账号</span>
  358. <input id="loginId" type="id" class="form-control" placeholder="20222222">
  359. </div>
  360. <br>
  361. <div class="input-group">
  362. <span class="input-group-addon">密码</span>
  363. <input id="loginPwd" type="password" class="form-control" placeholder="password">
  364. <span class="input-group-btn">
  365. <button class="btn btn-default" type="button" onclick="login().then(postLogin)">
  366. <span class="glyphicon glyphicon-log-out"></span> 登录
  367. </button>
  368. </span>
  369. </div>
  370. </div>
  371. <div id="change" style="display: none;">
  372. <br>
  373. <div class="input-group">
  374. <span class="input-group-addon">新密码</span>
  375. <input id="changePwd" type="password" class="form-control" placeholder="password" onmouseenter="this.type='id'" onmouseleave="this.type='password'">
  376. <span class="input-group-btn"><button id="changeBtn" class="btn btn-default" type="button" onclick="change()">修改</button></span>
  377. </div>
  378. </div>
  379. </div>
  380. <div class="col-md-4 col-sm-6 box boxMail lim">
  381. <div class="page-header">
  382. <h3><span class="glyphicon glyphicon-envelope"></span> 通知
  383. <button class="btn btn-default btn-xs reqLogin" onclick="$('.mail-text').hide(300);$('.mail').removeClass('active')">全部收起</button>
  384. <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()">
  385. <span class="glyphicon glyphicon-fullscreen"></span>
  386. </button>
  387. </h3>
  388. </div>
  389. <ul id="mailList" class="list-unstyled e">
  390. <il>获取中...</il>
  391. </ul>
  392. </div>
  393. <div style="position:fixed;bottom:10px;left:10px;color:#ccc">
  394. 北师大实验中学
  395. </div>
  396. </body>