index.html 20 KB

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