Browse Source

work with score

root 2 years ago
parent
commit
ce58c5f1c9
3 changed files with 44 additions and 21 deletions
  1. 11 3
      js/score.js
  2. 0 0
      js/score.min.js
  3. 33 18
      sso/index.html

+ 11 - 3
js/score.js

@@ -3,6 +3,12 @@ var knownExams = '', checked = 0
 // for (let i = 3000; i < 3400; i++)knownExams += i.toString() + ','
 // knownExams = knownExams.slice(0, knownExams.length - 1)
 
+function getCookie(name) {
+    let arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
+    if (arr != null) return arr[2];
+    return null;
+}
+
 function decimal(x, n) {
     x = Math.round(x * 10 ** n) / 10 ** n;
     return x.toFixed(n);
@@ -116,8 +122,8 @@ function getExams(id) {
     })
 }
 
-function check() {
-    var a = prompt('验证身份\n我的数字校园号是:')
+function check(u = 0) {
+    var a = u || prompt('验证身份\n我的数字校园号是:')
     fetch('/js/e.json', {
         method: 'GET',
         headers: {
@@ -134,8 +140,9 @@ function check() {
             getExams(queryData[0].no)
             checked = 1
             $('.fetch').toggle(1000)
+            if (u) $('#Input').val(u)
         }
-        else alert('no')
+        else (!u) && alert('no')
     });
 }
 
@@ -838,6 +845,7 @@ $().ready(function () {
             $("#fetchBtn")[0].click();
         }
     })
+    if (getCookie('gosh')) check(getCookie('gosh'))
 })
 
 //uglifyjs public/js/score.js -c -m eval,toplevel,reserved=[check,nextFile,prevFile,fetchMe,resizeChart,getSe,imageLoaded,getFiles,fontSize,curSe,datSe] -o public/js/score.min.js

File diff suppressed because it is too large
+ 0 - 0
js/score.min.js


+ 33 - 18
sso/index.html

@@ -17,7 +17,7 @@
         var status, oid, user, pwd
         function getCookie(name) {
             let arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
-            if (arr != null) return unescape(arr[2]);
+            if (arr != null) return arr[2];
             return null;
         }
         function delCookie(name, path = 'u') {
@@ -52,19 +52,28 @@
             }
         }
         function delCookies(force) {
-            if (force) delCookie('CASTGC', '/')
-            delCookie('JSESSIONID', '/')
-            delCookie('JSESSIONID', '/sso')
-            delCookie('JSESSIONID', '/sso/')
+            if (force) {
+                delCookie('CASTGC', '/')
+                delCookie('gosh', '/score/')
+                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')
+            delCookie('JSESSIONID', '/sso/')
         }
         function postLogin() {
             if (status != 1) return;
-            $('#changePwd').val($('#loginPwd').val())
+            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)
             getCk('null', 'bxn-library/library/jumpExamreport?jumpUrl=http://36.112.23.77/analysis/auto/%23/autoLogin')
             getCk('null', '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')
         }
@@ -127,11 +136,11 @@
             $('#' + name).addClass('btn-success')
         }
         function change() {
-            if (status != 1 || $('#loginPwd').val() == $('#changePwd').val()) return
+            if (status != 1 || pwd == $('#changePwd').val()) return
             var fd = new URLSearchParams()
             fd.append('rating', '4')
             fd.append('ratingWord', '极佳')
-            fd.append('oldPassword', $('#loginPwd').val())
+            fd.append('oldPassword', pwd)
             fd.append('newPassword', $('#changePwd').val())
             fd.append('reNewPassword', $('#changePwd').val())
             fetch('https://43.143.233.184:81/bxn-core-uic/uic-public/personal/management/password/save', {
@@ -167,6 +176,11 @@
             box-shadow: none;
             opacity: .65;
         }
+
+        .form-control {
+            font-weight: bold;
+            font-family: 'Courier New', Courier, monospace;
+        }
     </style>
 </head>
 
@@ -185,25 +199,26 @@
     </div>
     <div class="col-md-4 col-sm-6 box">
         <div class="page-header">
-            <h3>账号</h3>
+            <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="getCk('bxn-portal','bxn-portal/portal/osforstudent/index')">bxn-portal</button>
+                    <button id="bxn-core-uic" class="btn btn-default btn-xs" onclick="getCk('bxn-core-uic','bxn-core-uic/uic/index')">bxn-core-uic</button>
+                    <button id="bxn-library" class="btn btn-default btn-xs" onclick="getCk('bxn-library','bxn-library/library/jumpExamreport?jumpUrl=')">bxn-library</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);getCookies()">cookie</button>
-        <div id="cookie" class="btn-group" style="display: none;">
-            <button id="bxn-portal" class="btn btn-default btn-xs" onclick="getCk('bxn-portal','bxn-portal/portal/osforstudent/index')">bxn-portal</button>
-            <button id="bxn-core-uic" class="btn btn-default btn-xs" onclick="getCk('bxn-core-uic','bxn-core-uic/uic/index')">bxn-core-uic</button>
-            <button id="bxn-library" class="btn btn-default btn-xs" onclick="getCk('bxn-library','bxn-library/library/jumpExamreport?jumpUrl=')">bxn-library</button>
-        </div>
         <div id="login">
             <br>
             <div class="input-group">
                 <span class="input-group-addon">账号</span>
-                <input id="loginId" type="id" class="form-control" style="font-weight: bold; font-family: 'Courier New', Courier, monospace;" placeholder="20222222" value="20222446">
+                <input id="loginId" type="id" class="form-control" placeholder="20222222" value="20222446">
             </div>
             <br>
             <div class="input-group">
                 <span class="input-group-addon">密码</span>
-                <input id="loginPwd" type="password" class="form-control" style="font-weight: bold; font-family: 'Courier New', Courier, monospace;" placeholder="password" value="thisis1APPLE">
+                <input id="loginPwd" type="password" class="form-control" placeholder="password" value="thisis1APPLE">
                 <span class="input-group-btn"><button class="btn btn-default" type="button" onclick="login()">登录</button></span>
             </div>
         </div>
@@ -211,14 +226,14 @@
             <br>
             <div class="input-group">
                 <span class="input-group-addon">新密码</span>
-                <input id="changePwd" type="password" class="form-control" style="font-weight: bold; font-family: 'Courier New', Courier, monospace;" placeholder="password" onmouseenter="this.type='id'" onmouseleave="this.type='password'">
+                <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">
         <div class="page-header">
-            <h3>查分</h3>
+            <h3><span class="glyphicon glyphicon-stats"></span> 成绩</h3>
         </div>
         <div class="btn-group">
             <a id="scoreOld" class="btn btn-default e" target="_blank">原版</a>

Some files were not shown because too many files changed in this diff