fix: 修复控制台接口

This commit is contained in:
Shu Guang 2025-05-16 22:28:03 +08:00
parent 23e3e37f70
commit 5c5ee575d0
17 changed files with 209 additions and 346 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"remainingRequest":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/src/views/user/Console.vue","dependencies":[{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/src/views/user/Console.vue","mtime":1742646402778},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/cache-loader/dist/cjs.js","mtime":1743264595665},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/index.js","mtime":1743264596512}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:aW1wb3J0IHsgcmVuZGVyLCBzdGF0aWNSZW5kZXJGbnMgfSBmcm9tICIuL0NvbnNvbGUudnVlP3Z1ZSZ0eXBlPXRlbXBsYXRlJmlkPTFlZGJhNjhkJnNjb3BlZD10cnVlIgppbXBvcnQgc2NyaXB0IGZyb20gIi4vQ29uc29sZS52dWU/dnVlJnR5cGU9c2NyaXB0Jmxhbmc9anMiCmV4cG9ydCAqIGZyb20gIi4vQ29uc29sZS52dWU/dnVlJnR5cGU9c2NyaXB0Jmxhbmc9anMiCmltcG9ydCBzdHlsZTAgZnJvbSAiLi9Db25zb2xlLnZ1ZT92dWUmdHlwZT1zdHlsZSZpbmRleD0wJmlkPTFlZGJhNjhkJmxhbmc9Y3NzIgppbXBvcnQgc3R5bGUxIGZyb20gIi4vQ29uc29sZS52dWU/dnVlJnR5cGU9c3R5bGUmaW5kZXg9MSZpZD0xZWRiYTY4ZCZzY29wZWQ9dHJ1ZSZsYW5nPWNzcy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ZSgiL1VzZXJzL3NodWd1YW5nL0Rlc2t0b3Av5q+V6K6+L0NvZGVNYXN0ZXIvQ29kZU1hc3Rlci9ub2RlX21vZHVsZXMvdnVlLWhvdC1yZWxvYWQtYXBpL2Rpc3QvaW5kZXguanMiKQogIGFwaS5pbnN0YWxsKHJlcXVpcmUoJ3Z1ZScpKQogIGlmIChhcGkuY29tcGF0aWJsZSkgewogICAgbW9kdWxlLmhvdC5hY2NlcHQoKQogICAgaWYgKCFhcGkuaXNSZWNvcmRlZCgnMWVkYmE2OGQnKSkgewogICAgICBhcGkuY3JlYXRlUmVjb3JkKCcxZWRiYTY4ZCcsIGNvbXBvbmVudC5vcHRpb25zKQogICAgfSBlbHNlIHsKICAgICAgYXBpLnJlbG9hZCgnMWVkYmE2OGQnLCBjb21wb25lbnQub3B0aW9ucykKICAgIH0KICAgIG1vZHVsZS5ob3QuYWNjZXB0KCIuL0NvbnNvbGUudnVlP3Z1ZSZ0eXBlPXRlbXBsYXRlJmlkPTFlZGJhNjhkJnNjb3BlZD10cnVlIiwgZnVuY3Rpb24gKCkgewogICAgICBhcGkucmVyZW5kZXIoJzFlZGJhNjhkJywgewogICAgICAgIHJlbmRlcjogcmVuZGVyLAogICAgICAgIHN0YXRpY1JlbmRlckZuczogc3RhdGljUmVuZGVyRm5zCiAgICAgIH0pCiAgICB9KQogIH0KfQpjb21wb25lbnQub3B0aW9ucy5fX2ZpbGUgPSAic3JjL3ZpZXdzL3VzZXIvQ29uc29sZS52dWUiCmV4cG9ydCBkZWZhdWx0IGNvbXBvbmVudC5leHBvcnRz"}]} {"remainingRequest":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/src/views/user/Console.vue","dependencies":[{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/src/views/user/Console.vue","mtime":1747403482892},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/cache-loader/dist/cjs.js","mtime":1743264595665},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/index.js","mtime":1743264596512}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:aW1wb3J0IHsgcmVuZGVyLCBzdGF0aWNSZW5kZXJGbnMgfSBmcm9tICIuL0NvbnNvbGUudnVlP3Z1ZSZ0eXBlPXRlbXBsYXRlJmlkPTFlZGJhNjhkJnNjb3BlZD10cnVlIgppbXBvcnQgc2NyaXB0IGZyb20gIi4vQ29uc29sZS52dWU/dnVlJnR5cGU9c2NyaXB0Jmxhbmc9anMiCmV4cG9ydCAqIGZyb20gIi4vQ29uc29sZS52dWU/dnVlJnR5cGU9c2NyaXB0Jmxhbmc9anMiCmltcG9ydCBzdHlsZTAgZnJvbSAiLi9Db25zb2xlLnZ1ZT92dWUmdHlwZT1zdHlsZSZpbmRleD0wJmlkPTFlZGJhNjhkJmxhbmc9bGVzcyZzY29wZWQ9dHJ1ZSIKCgovKiBub3JtYWxpemUgY29tcG9uZW50ICovCmltcG9ydCBub3JtYWxpemVyIGZyb20gIiEuLi8uLi8uLi9ub2RlX21vZHVsZXMvdnVlLWxvYWRlci9saWIvcnVudGltZS9jb21wb25lbnROb3JtYWxpemVyLmpzIgp2YXIgY29tcG9uZW50ID0gbm9ybWFsaXplcigKICBzY3JpcHQsCiAgcmVuZGVyLAogIHN0YXRpY1JlbmRlckZucywKICBmYWxzZSwKICBudWxsLAogICIxZWRiYTY4ZCIsCiAgbnVsbAogIAopCgovKiBob3QgcmVsb2FkICovCmlmIChtb2R1bGUuaG90KSB7CiAgdmFyIGFwaSA9IHJlcXVpcmUoIi9Vc2Vycy9zaHVndWFuZy9EZXNrdG9wL+avleiuvi9Db2RlTWFzdGVyL0NvZGVNYXN0ZXIvbm9kZV9tb2R1bGVzL3Z1ZS1ob3QtcmVsb2FkLWFwaS9kaXN0L2luZGV4LmpzIikKICBhcGkuaW5zdGFsbChyZXF1aXJlKCd2dWUnKSkKICBpZiAoYXBpLmNvbXBhdGlibGUpIHsKICAgIG1vZHVsZS5ob3QuYWNjZXB0KCkKICAgIGlmICghYXBpLmlzUmVjb3JkZWQoJzFlZGJhNjhkJykpIHsKICAgICAgYXBpLmNyZWF0ZVJlY29yZCgnMWVkYmE2OGQnLCBjb21wb25lbnQub3B0aW9ucykKICAgIH0gZWxzZSB7CiAgICAgIGFwaS5yZWxvYWQoJzFlZGJhNjhkJywgY29tcG9uZW50Lm9wdGlvbnMpCiAgICB9CiAgICBtb2R1bGUuaG90LmFjY2VwdCgiLi9Db25zb2xlLnZ1ZT92dWUmdHlwZT10ZW1wbGF0ZSZpZD0xZWRiYTY4ZCZzY29wZWQ9dHJ1ZSIsIGZ1bmN0aW9uICgpIHsKICAgICAgYXBpLnJlcmVuZGVyKCcxZWRiYTY4ZCcsIHsKICAgICAgICByZW5kZXI6IHJlbmRlciwKICAgICAgICBzdGF0aWNSZW5kZXJGbnM6IHN0YXRpY1JlbmRlckZucwogICAgICB9KQogICAgfSkKICB9Cn0KY29tcG9uZW50Lm9wdGlvbnMuX19maWxlID0gInNyYy92aWV3cy91c2VyL0NvbnNvbGUudnVlIgpleHBvcnQgZGVmYXVsdCBjb21wb25lbnQuZXhwb3J0cw=="}]}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"remainingRequest":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/src/views/Index.vue","dependencies":[{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/src/views/Index.vue","mtime":1742646402775},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/cache-loader/dist/cjs.js","mtime":1743264595665},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/index.js","mtime":1743264596512}],"contextDependencies":[],"result":[{"type":"Bu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iAoIWFwaS5pc1JlY29yZGVkKCcyMzU0MzYwOCcpKSB7CiAgICAgIGFwaS5jcmVhdGVSZWNvcmQoJzIzNTQzNjA4JywgY29tcG9uZW50Lm9wdGlvbnMpCiAgICB9IGVsc2UgewogICAgICBhcGkucmVsb2FkKCcyMzU0MzYwOCcsIGNvbXBvbmVudC5vcHRpb25zKQogICAgfQogICAgbW9kdWxlLmhvdC5hY2NlcHQoIi4vSW5kZXgudnVlP3Z1ZSZ0eXBlPXRlbXBsYXRlJmlkPTIzNTQzNjA4JnNjb3BlZD10cnVlIiwgZnVuY3Rpb24gKCkgewogICAgICBhcGkucmVyZW5kZXIoJzIzNTQzNjA4JywgewogICAgICAgIHJlbmRlcjogcmVuZGVyLAogICAgICAgIHN0YXRpY1JlbmRlckZuczogc3RhdGljUmVuZGVyRm5zCiAgICAgIH0pCiAgICB9KQogIH0KfQpjb21wb25lbnQub3B0aW9ucy5fX2ZpbGUgPSAic3JjL3ZpZXdzL0luZGV4LnZ1ZSIKZXhwb3J0IGRlZmF1bHQgY29tcG9uZW50LmV4cG9ydHM="}]} {"remainingRequest":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/src/views/Index.vue","dependencies":[{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/src/views/Index.vue","mtime":1747401845585},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/cache-loader/dist/cjs.js","mtime":1743264595665},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/index.js","mtime":1743264596512}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:aW1wb3J0IHsgcmVuZGVyLCBzdGF0aWNSZW5kZXJGbnMgfSBmcm9tICIuL0luZGV4LnZ1ZT92dWUmdHlwZT10ZW1wbGF0ZSZpZD0yMzU0MzYwOCZzY29wZWQ9dHJ1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AgICAgYXBpLnJlbG9hZCgnMjM1NDM2MDgnLCBjb21wb25lbnQub3B0aW9ucykKICAgIH0KICAgIG1vZHVsZS5ob3QuYWNjZXB0KCIuL0luZGV4LnZ1ZT92dWUmdHlwZT10ZW1wbGF0ZSZpZD0yMzU0MzYwOCZzY29wZWQ9dHJ1ZSIsIGZ1bmN0aW9uICgpIHsKICAgICAgYXBpLnJlcmVuZGVyKCcyMzU0MzYwOCcsIHsKICAgICAgICByZW5kZXI6IHJlbmRlciwKICAgICAgICBzdGF0aWNSZW5kZXJGbnM6IHN0YXRpY1JlbmRlckZucwogICAgICB9KQogICAgfSkKICB9Cn0KY29tcG9uZW50Lm9wdGlvbnMuX19maWxlID0gInNyYy92aWV3cy9JbmRleC52dWUiCmV4cG9ydCBkZWZhdWx0IGNvbXBvbmVudC5leHBvcnRz"}]}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"remainingRequest":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/src/views/Index.vue?vue&type=template&id=23543608&scoped=true","dependencies":[{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/src/views/Index.vue","mtime":1742646402775},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/cache-loader/dist/cjs.js","mtime":1743264595665},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/cache-loader/dist/cjs.js","mtime":1743264595665},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/babel-loader/lib/index.js","mtime":1743264596348},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/loaders/templateLoader.js","mtime":1743264597097},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/cache-loader/dist/cjs.js","mtime":1743264595665},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/index.js","mtime":1743264596512}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:CiAgPGRpdj4KICA8ZGl2IGNsYXNzPSJiYWNrZ3JvdW5kIj4KICAgIDwhLS0g6IOM5pmvIFNWRyDlhYPntKAgLS0+CiAgICA8c3ZnCiAgICAgIGNsYXNzPSJiZy1sZWZ0IgogICAgICBoZWlnaHQ9IjkwdmgiCiAgICAgIHZpZXdCb3g9IjAgMCA5NjAgMTA4MCIKICAgICAgZmlsbD0ibm9uZSIKICAgICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogICAgPgogICAgICA8IS0tIOecgeeVpSBTVkcg5YaF5a65IC0tPgogICAgPC9zdmc+CiAgICA8c3ZnCiAgICAgIGNsYXNzPSJiZy1yaWdodCIKICAgICAgaGVpZ2h0PSI5MHZoIgogICAgICB2aWV3Qm94PSIwIDAgOTYwIDEwODAiCiAgICAgIGZpbGw9Im5vbmUiCiAgICAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgID4KICAgICAgPCEtLSDnnIHnlaUgU1ZHIOWGheWuuSAtLT4KICAgIDwvc3ZnPgogIDwvZGl2PgogIDxkaXYgY2xhc3M9ImNvbnRhaW5lciI+CiAgICA8IS0tIEhlYWRlciBTZWN0aW9uIC0tPgogICAgPGRpdiBjbGFzcz0iaGVhZGVyIj4KICAgICAgPGgxPuaZuuernuS6kei1my3moKHlm63nq57otZvnrqHnkIbns7vnu588L2gxPgogICAgICA8cD4KICAgICAgICDln7rkuo5WdWUgMuWSjFNwcmluZyBCb2905byA5Y+R77yM6ZuG5oiQ5LqG6Zi/6YeM5LqRT1NT44CBQW50IERlc2lnbiBWdWXjgIFFY2hhcnRz562J5aSa6aG55oqA5pyv77yM5Li65qCh5Zut56ue6LWb566h55CG5o+Q5L6b5LqG5LiA56uZ5byP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g+aJgOaciTwvZGl2PgogIDwvZGl2Pgo8L2Rpdj4K"},null]} {"remainingRequest":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/index.js??vue-loader-options!/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/src/views/Index.vue?vue&type=template&id=23543608&scoped=true","dependencies":[{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/src/views/Index.vue","mtime":1747401845585},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/cache-loader/dist/cjs.js","mtime":1743264595665},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/cache-loader/dist/cjs.js","mtime":1743264595665},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/babel-loader/lib/index.js","mtime":1743264596348},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/loaders/templateLoader.js","mtime":1743264597097},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/cache-loader/dist/cjs.js","mtime":1743264595665},{"path":"/Users/shuguang/Desktop/毕设/CodeMaster/CodeMaster/node_modules/vue-loader/lib/index.js","mtime":1743264596512}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:CjxkaXYgY2xhc3M9ImluZGV4LXBhZ2UiPgogIDxkaXYgY2xhc3M9ImJhY2tncm91bmQiPgogICAgPGRpdiBjbGFzcz0iZ3JhZGllbnQtYmciPjwvZGl2PgogICAgPGRpdiBjbGFzcz0icGFydGljbGVzIj48L2Rpdj4KICA8L2Rpdj4KICAKICA8ZGl2IGNsYXNzPSJjb250YWluZXIiPgogICAgPCEtLSBIZXJvIFNlY3Rpb24gLS0+CiAgICA8ZGl2IGNsYXNzPSJoZXJvLXNlY3Rpb24iPgogICAgICA8ZGl2IGNsYXNzPSJoZXJvLWNvbnRlbnQiPgogICAgICAgIDxoMSBjbGFzcz0iYW5pbWF0ZS10aXRsZSI+5pm656ue5LqR6LWbPC9oMT4KICAgICAgICA8aDIgY2xhc3M9ImFuaW1hdGUtc3VidGl0bGUiPuaWsOS4gOS7o+agoeWbreernui1m+euoeeQhuezu+e7nzwvaDI+CiAgICAgICAgPHAgY2xhc3M9ImFuaW1hdGUtdGV4dCI+CiAgICAgICAgICDln7rkuo5WdWUgMuWSjFNwcmluZyBCb2905byA5Y+R77yM6ZuG5oiQ5aSa6aG55YmN5rK/5oqA5pyv77yMCiAgICAgICAgICDmiZPpgKDmmbrog73ljJbnq57otZvnrqHnkIblubPlj7AKICAgICAgICA8L3A+CiAgICAgICAgPGRpdiBjbGFzcz0iaGVyby1idXR0b25zIj4KICAgICAgICAgIDxyb3V0ZXItbGluayB0bz0iL3JhY2UvbGlzdCIgY2xhc3M9InByaW1hcnktYnRuIj4KICAgICAgICAgICAgPHNwYW4+56uL5Y2z5L2T6aqMPC9zcGFuPgogICAgICAgICAgICA8aSBjbGFzcz0iZmFzIGZhLWFycm93LXJpZ2h0Ij48L2k+CiAgICAgICAgICA8L3JvdXRlci1saW5rPgogICAgICAgICAgPHJvdXRlci1saW5rIHRvPSIvcmFjZS9saXN0IiBjbGFzcz0ic2Vjb25kYXJ5LWJ0biI+CiAgICAgICAgICAgIDxzcGFuPuS6huino+abtOWkmjwvc3Bhbj4KICAgICAgICAgIDwvcm91dGVyLWxpbms+CiAgICAgICAgPC9kaXY+CiAgICAgIDwvZGl2PgogICAgPC9kaXY+CgogICAgPCEtLSBGZWF0dXJlcyBHcmlkIC0tPgogICAgPGRpdiBjbGFzcz0iZmVhdHVyZXMtc2VjdGlvbiI+CiAgICAgIDxoMiBjbGFzcz0ic2VjdGlvbi10aXRsZSI+5qC45b+D54m55oCnPC9oMj4KICAgICAgPGRpdiBjbGFzcz0iZmVhdHVyZXMtZ3JpZCI+CiAgICAgICAgPGRpdiAKICAgICAgICAgIHYtZm9yPSJmZWF0dXJlIGluIGZlYXR1cmVzIiAKICAgICAgICAgIDprZXk9ImZlYXR1cmUudGl0bGUiIAogICAgICAgICAgY2xhc3M9ImZlYXR1cmUtY2FyZCIKICAgICAgICA+CiAgICAgICAgICA8ZGl2IGNsYXNzPSJmZWF0dXJlLWljb24iPgogICAgICAgICAgICA8aSA6Y2xhc3M9ImZlYXR1cmUuaWNvbiI+PC9pPgogICAgICAgICAgPC9kaXY+CiAgICAgICAgICA8aDM+e3sgZmVhdHVyZS50aXRsZSB9fTwvaDM+CiAgICAgICAgICA8cD57eyBmZWF0dXJlLmRlc2NyaXB0aW9uIH19PC9wPgogICAgICAgIDwvZGl2PgogICAgICA8L2Rpdj4KICAgIDwvZGl2PgoKICAgIDwhLS0gQ29udGFjdCBTZWN0aW9uIC0tPgogICAgPGRpdiBjbGFzcz0iY29udGFjdC1zZWN0aW9uIj4KICAgICAgPGRpdiBjbGFzcz0iY29udGFjdC1jb250ZW50Ij4KICAgICAgICA8aDI+5Yqg5YWl5oiR5LusPC9oMj4KICAgICAgICA8cD7miavmj4/kuIvmlrnkuoznu7TnoIHvvIzliqDlhaXmioDmnK/kuqTmtYHnvqQ8L3A+CiAgICAgICAgPGRpdiBjbGFzcz0icXItY29kZSI+CiAgICAgICAgICA8IS0tIOS6jOe7tOeggeWNoOS9jSAtLT4KICAgICAgICA8L2Rpdj4KICAgICAgPC9kaXY+CiAgICA8L2Rpdj4KICA8L2Rpdj4KPC9kaXY+Cg=="},null]}

File diff suppressed because one or more lines are too long

View File

@ -305,7 +305,7 @@ export function deleteList(data) {
}); });
} }
// 查看所有资料 // 查看所有资料
export const Allinformation = params => request.get('/api/information/getAll', { params }); export const Allinformation = params => request.get('/api/information/getAll', { params });
// 录制成绩 // 录制成绩
export function RegistrationAdd(data) { export function RegistrationAdd(data) {
@ -335,6 +335,8 @@ export const getWinInfo = params => request.get('/registration/getWinInfo', { pa
export const getCounts = params => request.get('/registration/getCount', { params }); export const getCounts = params => request.get('/registration/getCount', { params });
// 根据参赛类型获取参赛人数 // 根据参赛类型获取参赛人数
export const getCountByCompetitionType = params => request.get('/registration/getCountByCompetitionType', { params }); export const getCountByCompetitionType = params => request.get('/registration/getCountByCompetitionType', { params });
export const getCountTotal = params => request.get('/counts/statistics', { params });
// 根据获奖等级获取参赛人数 // 根据获奖等级获取参赛人数
export const getWinCountByLevel = params => request.get('/registration/getWinCountByLevel', { params }); export const getWinCountByLevel = params => request.get('/registration/getWinCountByLevel', { params });
// 添加好友 // 添加好友

View File

@ -1,220 +1,198 @@
import Vue from 'vue'; // 引入 Vue.js import Vue from 'vue';
import VueRouter from 'vue-router'; // 引入 Vue Router import VueRouter from 'vue-router';
import GlobalLayout from '@/layouts/GlobalLayout'; // 引入全局布局组件 import GlobalLayout from '@/layouts/GlobalLayout';
// import routes from './routes';
Vue.use(VueRouter); // 使用 Vue Router Vue.use(VueRouter);
// 假设这是用户的权限级别,从用户的会话或配置中获取
const usersData = JSON.parse(localStorage.getItem("users")); const usersData = JSON.parse(localStorage.getItem("users"));
const userPrivileges = usersData && usersData.userPrivileges ? parseInt(usersData.userPrivileges) : 0; const userPrivileges = usersData && usersData.userPrivileges ? parseInt(usersData.userPrivileges) : 0;
// const userPrivileges = 2;
const RouteView = { const RouteView = {
name: 'RouteView', name: 'RouteView',
render: h => h('router-view'), // 渲染路由视图组件 render: h => h('router-view'),
}; };
export const routes = [ export const routes = [
{ {
path: '/', // 根路由 path: '/',
name: 'Home', name: 'Home',
meta: { title: '主页' }, meta: { title: '主页' },
redirect: '/race/list', // 重定向至赛事列表页面 redirect: '/race/list',
component: GlobalLayout, // 使用全局布局组件 component: GlobalLayout,
children: [ children: [
{ {
path: '/console', // 赛事管理路由 path: '/console',
name: 'Console', name: 'Console',
redirect: '/console/list', // 默认重定向至赛事列表页面 redirect: '/console/list',
component: RouteView, // 使用路由视图组件 component: RouteView,
meta: { title: '首 页', icon: 'appstore' }, // 路由元信息 meta: { title: '首 页', icon: 'appstore' },
children: [ children: [
{ {
path: '/console/list', // 赛事列表路由 path: '/console/list',
name: 'ConsoleLog', name: 'ConsoleLog',
component: () => import('@/views/user/Console.vue'), // 异步加载赛事列表组件 component: () => import('@/views/user/Console.vue'),
// meta: { title: '大数据', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限 meta: { title: '大数据', auth: 0 },
meta: { title: '大数据', auth: 0 }, // 路由元信息,指定需要的权限
}, },
], ],
}, },
{ {
path: '/race', // 赛事管理路由 path: '/race',
name: 'Race', name: 'Race',
redirect: '/race/list', // 默认重定向至赛事列表页面 redirect: '/race/list',
component: RouteView, // 使用路由视图组件 component: RouteView,
meta: { title: '赛事管理', icon: 'appstore' }, // 路由元信息 meta: { title: '赛事管理', icon: 'appstore' },
children: [ children: [
{ {
path: '/race/list', // 赛事列表路由 path: '/race/list',
name: 'RaceList', name: 'RaceList',
component: () => import('@/views/race/Race'), // 异步加载赛事列表组件 component: () => import('@/views/race/Race'),
meta: { title: '赛事列表', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限 meta: { title: '赛事列表', auth: [0, 1, 2] },
}, },
{ {
path: '/race/record', // 参赛记录路由 path: '/race/record',
name: 'Record', name: 'Record',
component: () => import('@/views/race/Record'), // 异步加载参赛记录组件 component: () => import('@/views/race/Record'),
meta: { title: '参赛记录', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限 meta: { title: '参赛记录', auth: [0, 1, 2] },
}, },
{ {
path: '/race/down', // 参赛记录路由 path: '/race/down',
name: 'Down', name: 'Down',
component: () => import('@/views/race/Down'), // 异步加载参赛记录组件 component: () => import('@/views/race/Down'),
meta: { title: '参赛资料', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限 meta: { title: '参赛资料', auth: [0, 1, 2] },
}, },
], ],
}, },
{ {
path: '/user', // 用户管理路由 path: '/user',
redirect: '/user/student', // 默认重定向至学生列表页面 redirect: '/user/student',
name: 'User', name: 'User',
component: RouteView, // 使用路由视图组件 component: RouteView,
meta: { title: '用户管理', icon: 'user', auth: [0, 1] }, // 路由元信息,指定需要的权限 meta: { title: '用户管理', icon: 'user', auth: [0, 1] },
children: [ children: [
{ {
path: '/user/student', // 学生列表路由 path: '/user/student',
name: 'Student', name: 'Student',
component: () => import('@/views/user/Student'), // 异步加载学生列表组件 component: () => import('@/views/user/Student'),
meta: { title: '学生列表', auth: [0, 1] }, // 路由元信息 meta: { title: '学生列表', auth: [0, 1] },
}, },
{ {
path: '/user/teacher', // 教师列表路由 path: '/user/teacher',
name: 'Teacher', name: 'Teacher',
component: () => import('@/views/user/Teacher'), // 异步加载教师列表组件 component: () => import('@/views/user/Teacher'),
meta: { title: '教师列表', auth: [0] }, // 路由元信息 meta: { title: '教师列表', auth: [0] },
}, },
], ],
}, },
{ {
path: '/community', // 权限管理路由 path: '/community',
redirect: '/community/list', // 默认重定向至角色列表页面 redirect: '/community/list',
name: 'Role', name: 'Role',
component: RouteView, // 使用路由视图组件 component: RouteView,
meta: { title: '交流社区', icon: 'key' }, // 路由元信息 meta: { title: '交流社区', icon: 'key' },
children: [ children: [
{ {
path: '/community/Article', // 权限列表路由 path: '/community/Article',
name: 'Article', name: 'Article',
meta: { title: '论坛首页', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限 meta: { title: '论坛首页', auth: [0, 1, 2] },
component: () => import('@/views/communtiy/Article.vue'), // 异步加载权限列表组件 component: () => import('@/views/communtiy/Article.vue'),
}, },
{ {
path: '/community/publish', // 权限列表路由 path: '/community/publish',
name: 'publish', name: 'publish',
meta: { title: '在线发帖', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限 meta: { title: '在线发帖', auth: [0, 1, 2] },
component: () => import('@/components/edit/tinymce.vue'), // 异步加载权限列表组件 component: () => import('@/components/edit/tinymce.vue'),
}, },
{ {
path: '/community/editcontent', // 权限列表路由 path: '/community/editcontent',
name: 'editcontent', name: 'editcontent',
meta: { title: '修改帖子', auth: [0, 1, 2] ,hidden:true}, // 路由元信息,指定需要的权限 meta: { title: '修改帖子', auth: [0, 1, 2], hidden: true },
component: () => import('@/components/edit/EditContent.vue'), // 异步加载权限列表组件 component: () => import('@/components/edit/EditContent.vue'),
}, },
{ {
path: '/community/pages', path: '/community/pages',
name: 'pages', name: 'pages',
meta: { title: '帖子详细', auth: [0, 1, 2] }, // 路由元信息 meta: { title: '帖子详细', auth: [0, 1, 2] },
component: () => import('@/views/communtiy/pages.vue'), // 异步加载登录页面组件 component: () => import('@/views/communtiy/pages.vue'),
}, },
{ {
path: '/account/center', // 角色列表路由 path: '/account/center',
name: 'AccountCenter', name: 'AccountCenter',
meta: { title: '个人中心', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限 meta: { title: '个人中心', auth: [0, 1, 2] },
component: () => import('@/views/account/center/index.vue'), // 异步加载角色列表组件 component: () => import('@/views/account/center/index.vue'),
}, },
], ],
}, },
{ {
path: '/account', // 权限管理路由 path: '/account',
name: 'Account', name: 'Account',
component: RouteView, // 使用路由视图组件 component: RouteView,
meta: { title: '竞赛助手', icon: 'key' }, // 路由元信息 meta: { title: '竞赛助手', icon: 'key' },
children: [ children: [
{ {
path: '/account/Ai', // 角色列表路由 path: '/account/Ai',
name: 'AccountSettings', name: 'AccountSettings',
meta: { title: '竞赛助手', auth: 0 }, // 路由元信息,指定需要的权限 meta: { title: '竞赛助手', auth: 0 },
component: () => import('@/views/user/Ai.vue'), // 异步加载角色列表组件 component: () => import('@/views/user/Ai.vue'),
}, },
], ],
}, },
], ],
}, },
{ {
path: '/login', // 登录页面路由 path: '/login',
name: 'Login', name: 'Login',
meta: { title: '登陆' }, // 路由元信息 meta: { title: '登陆' },
component: () => import('@/views/Login'), // 异步加载登录页面组件 component: () => import('@/views/Login'),
},{ },
path: '/index', // 登录页面路由 {
path: '/index',
name: 'Index', name: 'Index',
meta: { title: '主页' }, // 路由元信息 meta: { title: '主页' },
component: () => import('@/views/Index'), // 异步加载登录页面组件 component: () => import('@/views/Index'),
}, },
{ {
path: '/404', // 404 页面路由 path: '/404',
component: () => import('@/components/common/404'), // 异步加载 404 组件 component: () => import('@/components/common/404'),
}, },
{ {
path: '*', // 匹配任何不存在的路由 path: '*',
redirect: '/404', // 重定向至 404 页面 redirect: '/404',
}, },
]; ];
// const userPrivileges = 1;
// 这个函数假设是从某处获取用户权限级别
console.log("routes",routes)
// 使用filterRoutes函数过滤路由
// const filteredRoutes = filterRoutes(routes, userPrivileges);
const filteredRoutes = filterRoutes(routes, userPrivileges); const filteredRoutes = filterRoutes(routes, userPrivileges);
// 然后可以使用filteredRoutes来初始化Vue Router或生成路由菜单
const router = new VueRouter({ const router = new VueRouter({
mode: 'hash', mode: 'hash',
base: process.env.BASE_URL, base: process.env.BASE_URL,
routes: routes, // 使用过滤后的路由配置 routes: routes,
// routes: routes, // 使用过滤后的路由配置
}); });
/**
* 根据用户权限过滤路由
* @param {Array} routes 路由配置数组
* @param {number} userPrivileges 当前用户权限级别
* @returns 过滤后的路由数组
*/
export function filterRoutes(routes, userPrivileges) { export function filterRoutes(routes, userPrivileges) {
// 过滤单个路由
function filterSingleRoute(route, userPrivileges) { function filterSingleRoute(route, userPrivileges) {
// 如果路由或其子路由需要的权限高于用户权限,则不包括该路由
if (route.meta && route.meta.auth) { if (route.meta && route.meta.auth) {
if (Array.isArray(route.meta.auth)) { if (Array.isArray(route.meta.auth)) {
// 如果路由需要多个权限,只要用户拥有其中之一即可访问 if (!route.meta.auth.some(authLevel => userPrivileges == authLevel)) {
if (!route.meta.auth.some(authLevel => userPrivileges == authLevel)) {
return null; return null;
} }
} else { } else {
// 如果路由需要的权限高于用户权限,则不包括该路由
if (userPrivileges < route.meta.auth) { if (userPrivileges < route.meta.auth) {
return null; return null;
} }
} }
} }
// 如果路由有子路由,递归过滤子路由
if (route.children && route.children.length >= 0) { if (route.children && route.children.length >= 0) {
route.children = route.children route.children = route.children
.map(childRoute => filterSingleRoute(childRoute, userPrivileges)) .map(childRoute => filterSingleRoute(childRoute, userPrivileges))
.filter(childRoute => childRoute !== null && childRoute?.meta?.hidden!=true); // 过滤掉null值 .filter(childRoute => childRoute !== null && childRoute?.meta?.hidden != true);
} }
return route; return route;
} }
// 过滤所有路由
return routes.map(route => filterSingleRoute(route, userPrivileges)).filter(route => route !== null); return routes.map(route => filterSingleRoute(route, userPrivileges)).filter(route => route !== null);
} }
export default router; // 导出 Vue Router 实例 export default router;

View File

@ -1,157 +0,0 @@
// import GlobalLayout from '@/layouts/GlobalLayout'; // 引入全局布局组件
// const RouteView = {
// name: 'RouteView',
// render: h => h('router-view'), // 渲染路由视图组件
// };
// const routes = [
// {
// path: '/', // 根路由
// name: 'Home',
// meta: { title: '主页' },
// redirect: '/race/list', // 重定向至赛事列表页面
// component: GlobalLayout, // 使用全局布局组件
// children: [
// {
// path: '/console', // 赛事管理路由
// name: 'Console',
// redirect: '/console/list', // 默认重定向至赛事列表页面
// component: RouteView, // 使用路由视图组件
// meta: { title: '首 页', icon: 'appstore' }, // 路由元信息
// children: [
// {
// path: '/console/list', // 赛事列表路由
// name: 'ConsoleLog',
// component: () => import('@/views/user/Console.vue'), // 异步加载赛事列表组件
// // meta: { title: '大数据', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限
// meta: { title: '大数据', auth: 0 }, // 路由元信息,指定需要的权限
// },
// ],
// },
// {
// path: '/race', // 赛事管理路由
// name: 'Race',
// redirect: '/race/list', // 默认重定向至赛事列表页面
// component: RouteView, // 使用路由视图组件
// meta: { title: '赛事管理', icon: 'appstore' }, // 路由元信息
// children: [
// {
// path: '/race/list', // 赛事列表路由
// name: 'RaceList',
// component: () => import('@/views/race/Race'), // 异步加载赛事列表组件
// meta: { title: '赛事列表', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限
// },
// {
// path: '/race/record', // 参赛记录路由
// name: 'Record',
// component: () => import('@/views/race/Record'), // 异步加载参赛记录组件
// meta: { title: '参赛记录', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限
// },
// {
// path: '/race/down', // 参赛记录路由
// name: 'Down',
// component: () => import('@/views/race/Down'), // 异步加载参赛记录组件
// meta: { title: '参赛资料', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限
// },
// ],
// },
// {
// path: '/user', // 用户管理路由
// redirect: '/user/student', // 默认重定向至学生列表页面
// name: 'User',
// component: RouteView, // 使用路由视图组件
// meta: { title: '用户管理', icon: 'user', auth: [0, 1] }, // 路由元信息,指定需要的权限
// children: [
// {
// path: '/user/student', // 学生列表路由
// name: 'Student',
// component: () => import('@/views/user/Student'), // 异步加载学生列表组件
// meta: { title: '学生列表', auth: [0, 1] }, // 路由元信息
// },
// {
// path: '/user/teacher', // 教师列表路由
// name: 'Teacher',
// component: () => import('@/views/user/Teacher'), // 异步加载教师列表组件
// meta: { title: '教师列表', auth: [0] }, // 路由元信息
// },
// ],
// },
// {
// path: '/community', // 权限管理路由
// redirect: '/community/list', // 默认重定向至角色列表页面
// name: 'Role',
// component: RouteView, // 使用路由视图组件
// meta: { title: '交流社区', icon: 'key' }, // 路由元信息
// children: [
// {
// path: '/community/Article', // 权限列表路由
// name: 'Article',
// meta: { title: '论坛首页', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限
// component: () => import('@/views/communtiy/Article.vue'), // 异步加载权限列表组件
// },
// {
// path: '/community/publish', // 权限列表路由
// name: 'publish',
// meta: { title: '在线发帖', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限
// component: () => import('@/components/edit/tinymce.vue'), // 异步加载权限列表组件
// },
// {
// path: '/community/editcontent', // 权限列表路由
// name: 'editcontent',
// meta: { title: '修改帖子', auth: [0, 1, 2] ,hidden:true}, // 路由元信息,指定需要的权限
// component: () => import('@/components/edit/EditContent.vue'), // 异步加载权限列表组件
// },
// {
// path: '/pages', // 登录页面路由
// name: 'pages',
// meta: { title: '内容', auth: [0, 1, 2],hidden:true }, // 路由元信息
// component: () => import('@/views/communtiy/pages.vue'), // 异步加载登录页面组件
// },
// {
// path: '/account/center', // 角色列表路由
// name: 'AccountCenter',
// meta: { title: '个人中心', auth: [0, 1, 2] }, // 路由元信息,指定需要的权限
// component: () => import('@/views/account/center/index.vue'), // 异步加载角色列表组件
// },
// ],
// },
// {
// path: '/account', // 权限管理路由
// name: 'Account',
// component: RouteView, // 使用路由视图组件
// meta: { title: '竞赛助手', icon: 'key' }, // 路由元信息
// children: [
// {
// path: '/account/Ai', // 角色列表路由
// name: 'AccountSettings',
// meta: { title: '竞赛助手', auth: 0 }, // 路由元信息,指定需要的权限
// component: () => import('@/views/user/Ai.vue'), // 异步加载角色列表组件
// },
// ],
// },
// ],
// },
// {
// path: '/login', // 登录页面路由
// name: 'Login',
// meta: { title: '登陆' }, // 路由元信息
// component: () => import('@/views/Login'), // 异步加载登录页面组件
// },
// {
// path: '/index', // 登录页面路由
// name: 'Index',
// meta: { title: '主页' }, // 路由元信息
// component: () => import('@/views/Index'), // 异步加载登录页面组件
// },
// {
// path: '/404', // 404 页面路由
// component: () => import('@/components/common/404'), // 异步加载 404 组件
// },
// {
// path: '*', // 匹配任何不存在的路由
// redirect: '/404', // 重定向至 404 页面
// },
// ];
// export default routes;

View File

@ -5,7 +5,7 @@
<a-col :span="6"> <a-col :span="6">
<a-card class="data-card"> <a-card class="data-card">
<a-statistic <a-statistic
title="注册用户总数" title="用户总数"
:value="totaluser" :value="totaluser"
:precision="0" :precision="0"
style="text-align: center" style="text-align: center"
@ -112,10 +112,10 @@
</template> </template>
<script> <script>
import * as echarts from 'echarts'; import * as echarts from "echarts";
export default { export default {
name: 'Console', name: "Console",
data() { data() {
return { return {
loading: false, loading: false,
@ -147,7 +147,7 @@ export default {
awardChart: null, awardChart: null,
// 使 // 使
useMockData: true, useMockData: false,
}; };
}, },
mounted() { mounted() {
@ -167,31 +167,53 @@ export default {
async fetchAllData() { async fetchAllData() {
this.loading = true; this.loading = true;
try { try {
if (this.useMockData) { //
// 使 await this.fetchStatistics();
this.loadMockData(); //
} else { await Promise.all([
// 使API this.fetchAwardStats(),
await this.fetchUserStats(); this.fetchRegistrationTrend(),
await this.fetchCompetitionStats(); this.fetchHotCompetitions(),
await this.fetchAwardStats(); ]);
await this.fetchRegistrationTrend();
await this.fetchHotCompetitions();
}
//
this.$nextTick(() => { this.$nextTick(() => {
this.initRegistrationTrendChart(); this.initRegistrationTrendChart();
this.initAwardChart(); this.initAwardChart();
}); });
} catch (error) { } catch (error) {
console.error('获取数据失败', error); console.error("获取数据失败", error);
this.$message.error('获取数据失败'); this.$message.error("获取数据失败");
} finally { } finally {
this.loading = false; this.loading = false;
} }
}, },
//
async fetchStatistics() {
try {
// this.$api.getWinCountByLevel
const response = await this.$api.getCountTotal();
console.log("response", response);
if (response.code === 200) {
console.log("response.data", response.data);
const stats = response.data;
// 使
this.totaluser = stats.totalUsers;
this.totalteacher = stats.teacherCount;
this.totalstudent = stats.studentCount;
this.totalmatch = stats.competitionCount;
}
} catch (error) {
console.error("获取统计数据失败:", error);
this.$message.error("获取统计数据失败");
// 0
this.totaluser = 0;
this.totalteacher = 0;
this.totalstudent = 0;
this.totalmatch = 0;
}
},
// //
loadMockData() { loadMockData() {
// //
@ -271,21 +293,21 @@ export default {
// //
async fetchUserStats() { async fetchUserStats() {
// //
await this.$api.getCount().then(res => { await this.$api.getCount().then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.totaluser = res.data; this.totaluser = res.data;
} }
}); });
// //
await this.$api.getTeacherCount().then(res => { await this.$api.getTeacherCount().then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.totalteacher = res.data; this.totalteacher = res.data;
} }
}); });
// //
await this.$api.getStudentCount().then(res => { await this.$api.getStudentCount().then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.totalstudent = res.data; this.totalstudent = res.data;
} }
@ -295,7 +317,7 @@ export default {
// //
async fetchCompetitionStats() { async fetchCompetitionStats() {
// //
await this.$api.AllCompetition().then(res => { await this.$api.AllCompetition().then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.totalmatch = res.data.length; this.totalmatch = res.data.length;
@ -305,7 +327,7 @@ export default {
}); });
// //
await this.$api.Allinformation().then(res => { await this.$api.Allinformation().then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.totalinfo = res.data.length; this.totalinfo = res.data.length;
} }
@ -316,11 +338,14 @@ export default {
const sevenDaysAgo = new Date(currentDate); const sevenDaysAgo = new Date(currentDate);
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7); sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
await this.$api.AllCompetition().then(res => { await this.$api.AllCompetition().then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.totaldays = res.data.filter(item => { this.totaldays = res.data.filter((item) => {
const registrationEndTime = new Date(item.registrationEndTime); const registrationEndTime = new Date(item.registrationEndTime);
return registrationEndTime >= sevenDaysAgo && registrationEndTime <= currentDate; return (
registrationEndTime >= sevenDaysAgo &&
registrationEndTime <= currentDate
);
}).length; }).length;
} }
}); });
@ -329,21 +354,21 @@ export default {
// //
async fetchAwardStats() { async fetchAwardStats() {
// //
await this.$api.getWinCountByLevel({level: '一等奖'}).then(res => { await this.$api.getWinCountByLevel({ level: "一等奖" }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.firstlevel = res.data; this.firstlevel = res.data;
} }
}); });
// //
await this.$api.getWinCountByLevel({level: '二等奖'}).then(res => { await this.$api.getWinCountByLevel({ level: "二等奖" }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.secondlevel = res.data; this.secondlevel = res.data;
} }
}); });
// //
await this.$api.getWinCountByLevel({level: '三等奖'}).then(res => { await this.$api.getWinCountByLevel({ level: "三等奖" }).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.thirdlevel = res.data; this.thirdlevel = res.data;
} }
@ -353,14 +378,14 @@ export default {
// //
async fetchRegistrationTrend() { async fetchRegistrationTrend() {
// //
await this.$api.RegistrationAll().then(res => { await this.$api.RegistrationAll().then((res) => {
if (res.code == 200) { if (res.code == 200) {
// //
this.processRegistrationTrendData(res.data); this.processRegistrationTrendData(res.data);
// //
this.totalsuccess = res.data.filter( this.totalsuccess = res.data.filter(
item => item.registrationStatus == "成功报名", (item) => item.registrationStatus == "成功报名"
).length; ).length;
// //
@ -368,9 +393,12 @@ export default {
const sevenDaysAgo = new Date(currentDate); const sevenDaysAgo = new Date(currentDate);
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7); sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
this.totalday = res.data.filter(item => { this.totalday = res.data.filter((item) => {
const registrationTime = new Date(item.registrationTime); const registrationTime = new Date(item.registrationTime);
return registrationTime >= sevenDaysAgo && registrationTime <= currentDate; return (
registrationTime >= sevenDaysAgo &&
registrationTime <= currentDate
);
}).length; }).length;
} }
}); });
@ -390,7 +418,7 @@ export default {
// //
const competitionCounts = {}; const competitionCounts = {};
registrations.forEach(reg => { registrations.forEach((reg) => {
if (!competitionCounts[reg.competitionId]) { if (!competitionCounts[reg.competitionId]) {
competitionCounts[reg.competitionId] = 0; competitionCounts[reg.competitionId] = 0;
} }
@ -398,7 +426,7 @@ export default {
}); });
// //
const competitionsWithCount = competitions.map(comp => ({ const competitionsWithCount = competitions.map((comp) => ({
...comp, ...comp,
registrationCount: competitionCounts[comp.competitionId] || 0, registrationCount: competitionCounts[comp.competitionId] || 0,
})); }));
@ -424,7 +452,7 @@ export default {
dates.push(dateStr); dates.push(dateStr);
// //
const count = registrations.filter(reg => { const count = registrations.filter((reg) => {
const regDate = new Date(reg.registrationTime); const regDate = new Date(reg.registrationTime);
return this.formatDate(regDate) === dateStr; return this.formatDate(regDate) === dateStr;
}).length; }).length;
@ -450,39 +478,39 @@ export default {
const option = { const option = {
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
axisPointer: { axisPointer: {
type: 'shadow', type: "shadow",
}, },
}, },
grid: { grid: {
left: '3%', left: "3%",
right: '4%', right: "4%",
bottom: '3%', bottom: "3%",
containLabel: true, containLabel: true,
}, },
xAxis: { xAxis: {
type: 'category', type: "category",
data: this.registrationTrendData.dates, data: this.registrationTrendData.dates,
axisLabel: { axisLabel: {
rotate: 45, rotate: 45,
}, },
}, },
yAxis: { yAxis: {
type: 'value', type: "value",
name: '报名人数', name: "报名人数",
}, },
series: [ series: [
{ {
name: '报名人数', name: "报名人数",
type: 'line', type: "line",
data: this.registrationTrendData.counts, data: this.registrationTrendData.counts,
smooth: true, smooth: true,
areaStyle: { areaStyle: {
opacity: 0.3, opacity: 0.3,
}, },
itemStyle: { itemStyle: {
color: '#1890ff', color: "#1890ff",
}, },
}, },
], ],
@ -491,7 +519,7 @@ export default {
this.registrationTrendChart.setOption(option); this.registrationTrendChart.setOption(option);
// //
window.addEventListener('resize', () => { window.addEventListener("resize", () => {
this.registrationTrendChart.resize(); this.registrationTrendChart.resize();
}); });
}, },
@ -503,43 +531,55 @@ export default {
const option = { const option = {
tooltip: { tooltip: {
trigger: 'item', trigger: "item",
formatter: '{a} <br/>{b}: {c} ({d}%)', formatter: "{a} <br/>{b}: {c} ({d}%)",
}, },
legend: { legend: {
orient: 'horizontal', orient: "horizontal",
bottom: 'bottom', bottom: "bottom",
data: ['一等奖', '二等奖', '三等奖'], data: ["一等奖", "二等奖", "三等奖"],
}, },
series: [ series: [
{ {
name: '获奖情况', name: "获奖情况",
type: 'pie', type: "pie",
radius: ['40%', '70%'], radius: ["40%", "70%"],
avoidLabelOverlap: false, avoidLabelOverlap: false,
itemStyle: { itemStyle: {
borderRadius: 10, borderRadius: 10,
borderColor: '#fff', borderColor: "#fff",
borderWidth: 2, borderWidth: 2,
}, },
label: { label: {
show: false, show: false,
position: 'center', position: "center",
}, },
emphasis: { emphasis: {
label: { label: {
show: true, show: true,
fontSize: '18', fontSize: "18",
fontWeight: 'bold', fontWeight: "bold",
}, },
}, },
labelLine: { labelLine: {
show: false, show: false,
}, },
data: [ data: [
{ value: this.firstlevel, name: '一等奖', itemStyle: { color: '#ff4d4f' } }, {
{ value: this.secondlevel, name: '二等奖', itemStyle: { color: '#faad14' } }, value: this.firstlevel,
{ value: this.thirdlevel, name: '三等奖', itemStyle: { color: '#52c41a' } }, name: "一等奖",
itemStyle: { color: "#ff4d4f" },
},
{
value: this.secondlevel,
name: "二等奖",
itemStyle: { color: "#faad14" },
},
{
value: this.thirdlevel,
name: "三等奖",
itemStyle: { color: "#52c41a" },
},
], ],
}, },
], ],
@ -548,7 +588,7 @@ export default {
this.awardChart.setOption(option); this.awardChart.setOption(option);
// //
window.addEventListener('resize', () => { window.addEventListener("resize", () => {
this.awardChart.resize(); this.awardChart.resize();
}); });
}, },
@ -556,18 +596,18 @@ export default {
// //
formatDate(date) { formatDate(date) {
const year = date.getFullYear(); const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, '0'); const day = String(date.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`; return `${year}-${month}-${day}`;
}, },
// //
getCompetitionStatus(status) { getCompetitionStatus(status) {
const statusMap = { const statusMap = {
0: '进行中', 0: "进行中",
1: '已终止', 1: "已终止",
}; };
return statusMap[status] || '未知状态'; return statusMap[status] || "未知状态";
}, },
}, },
}; };