Browse Source

pixel perfect

root 2 years ago
parent
commit
607510c65b
3 changed files with 35 additions and 9 deletions
  1. 4 4
      js/score.js
  2. 0 1
      score/index.html
  3. 31 4
      score/sankey/index.html

+ 4 - 4
js/score.js

@@ -254,15 +254,15 @@ function getSec(id, force, force2) {
         let str = '<ul class="list-unstyled">'
         str += `<li class="text-warning">**. <span class="sc avgSc" style="left:${dat.singleExam.seAvgScore / dat.singleExam.seFullScore * 300}px" data-toggle="tooltip" data-placement="bottom" title="${dat.singleExam.seAvgScore}">.</span>`
         str += `<span class="sc mySc" style="left:${personScoreList[id] / dat.singleExam.seFullScore * 300}px">${personScoreList[id]}</span>`
-        str += `<span class="sc fullSc" style="left:${300 - 8 * personScoreList[id].toString().length}px">${dat.singleExam.seFullScore}</span></li>`
+        str += `<span class="sc fullSc" style="left:${300 - 8.41 * personScoreList[id].toString().length}px">${dat.singleExam.seFullScore}</span></li>`
         let q = dat.examQuestions;
         for (let i = 0; i < q.length; i++) {
             idc = (q[i].personScore == q[i].eqFullScore ? 'success fullScore' : 'danger"');
-            let pid = procName(q[i].eqDisplayName), ofs = pid.toString().length * 8 - 24
+            let pid = procName(q[i].eqDisplayName), ofs = pid.toString().length * 8.41 - 24
             str += `<li class="text-${idc}" ${procName(q[i].eqDisplayName, 1)}>${pid}<span class="sc avgSc" style="left:${q[i].eqAvgScore / q[i].eqFullScore * 300 - ofs}px" data-toggle="tooltip" data-placement="bottom" title="${q[i].eqAvgScore}">.</span>`
             if (q[i].personScore != q[i].eqFullScore) str += `<span class="sc mySc" style="left:${q[i].personScore / q[i].eqFullScore * 300 - ofs}px">${q[i].personScore}</span>`
-            str += `<span class="sc fullSc" style="left:${300 - 8 * q[i].personScore.toString().length * (q[i].personScore != q[i].eqFullScore) - ofs}px">${q[i].eqFullScore}</span>`
-            str += `<span class="sc" style="left:${350 - 8 * q[i].personScore.toString().length * (q[i].personScore != q[i].eqFullScore) - 8 * q[i].eqFullScore.toString().length - ofs}px">${q[i].qstTagName}</span></li>`
+            str += `<span class="sc fullSc" style="left:${300 - 8.41 * q[i].personScore.toString().length * (q[i].personScore != q[i].eqFullScore) - ofs}px">${q[i].eqFullScore}</span>`
+            str += `<span class="sc" style="left:${350 - 8.41 * q[i].personScore.toString().length * (q[i].personScore != q[i].eqFullScore) - 8.41 * q[i].eqFullScore.toString().length - ofs}px">${q[i].qstTagName}</span></li>`
         }
         $('#detailDat').html(str + '</ul>')
         $("[data-toggle='tooltip']").tooltip();

+ 0 - 1
score/index.html

@@ -15,7 +15,6 @@
     <link rel="stylesheet" href="/css/style.css">
     <script type="text/javascript" src="/js/score.js"></script>
     <style>
-
         .btn.btn-how {
             min-height: 35px;
             margin-right: 1px;

+ 31 - 4
score/sankey/index.html

@@ -10,7 +10,20 @@
 &family=Noto+Serif+SC:wght@300;400;500;600;700&display=swap" rel="stylesheet">
     <link rel="stylesheet" href="/css/style.css">
     <script>
-        var wid = 0, skip = 0
+        var e
+        fetch('/js/e.json', {
+            method: 'GET',
+            headers: {
+                'Content-type': 'application/json',
+            }
+        }).then(res => {
+            return res.json()
+        }).then(f => {
+            e = f;
+        });
+
+        var wid = 0, skip = 0, only = 0
+
         var col = {
             '向量': '#337ab7',
             '隐': '#b5b5b5'
@@ -19,6 +32,17 @@
             str = str.split(' ')[0]
             return col[str] ? col[str] : (pam ? '#6f9f3f' : '#3f3f3f')
         }
+        function is11(str) {
+            if(str[str.length-1]==' ')str=str.split(' ')[0]
+            if(str=='向量')return true
+            var queryData = e.data.filter(function (e) {
+                return e.name == str
+            });
+            if(!queryData[0])return false
+            var o = queryData[0].organization
+
+            return o.slice(o.length - 3) == '11班'
+        }
         function unique(arr) {
             let hash = [];
             for (let i = 0; i < arr.length; i++) {
@@ -32,6 +56,7 @@
             let res = [];
             for (let i = 0; i < arr.length; i++) {
                 if (!arr[i]) continue;
+                if (only && (!is11(arr[i].source) || !is11(arr[i].target))) continue;
                 res.push({
                     source: arr[i].source, target: arr[i].target,
                     value: wid ? 1 : arr.filter(function (e) {
@@ -52,6 +77,7 @@
             if ($('#filter').val()) o = 800
             else o = 3000
             if (wid) o /= 1.75
+            if (only) o /= 1.75
             $("#sanky").css('height', o + 'px')
             cc = echarts.init($("#sanky")[0]);
             fetch('/a.log', {
@@ -71,11 +97,11 @@
                 for (var i = 0; i < f.length; i++) {
                     if (skip && f[i].source == f[i].target.split(' ')[0]) continue;
                     if ($('#filter').val() && f[i].source != $('#filter').val()) continue;
-                    p.push(f[i].source)
-                    p.push(f[i].target)
+                    if (!only || is11(f[i].source)) p.push(f[i].source)
+                    if (!only || is11(f[i].target)) p.push(f[i].target)
                 }
                 p = unique(p)
-
+                console.log(p)
                 var ppp = [];
                 for (let i = 0; i < p.length; i++) {
                     ppp.push({
@@ -168,6 +194,7 @@
         <div class="input-group-btn">
             <button data-toggle="button" class="btn btn-default" onclick="skip=!skip;get()">忽略自环</button>
             <button class="btn btn-default" data-toggle="button" onclick="wid=!wid;get()">固定宽度</button>
+            <button class="btn btn-default" data-toggle="button" onclick="only=!only;get()">只看11班</button>
         </div>
         <span class="input-group-addon">
             提示:保持鼠标不动,可以随意滑动滚轮而不改变焦点