Jelajahi Sumber

feat: :build: 脚手架升级2.5.0

chaooo 1 tahun lalu
induk
melakukan
7161d60bb0
40 mengubah file dengan 189 tambahan dan 81 penghapusan
  1. 2 2
      .eslintignore
  2. 18 0
      .eslintrc-auto-import.json
  3. 48 1
      .eslintrc.cjs
  4. 1 0
      .gitignore
  5. 1 0
      .prettierignore
  6. 2 0
      .prettierrc.cjs
  7. 1 0
      .stylelintignore
  8. 0 7
      .stylelintrc.cjs
  9. 27 16
      package.json
  10. 1 1
      src/api/areaboard/index.ts
  11. 1 1
      src/api/student/index.ts
  12. 0 2
      src/api/student/types.ts
  13. 2 1
      src/api/teacher/index.ts
  14. 0 2
      src/api/training/types.ts
  15. 1 1
      src/components/Charts/AverageBarChart.vue
  16. 2 2
      src/components/Charts/CircleChart.vue
  17. 2 2
      src/components/Charts/CurveLineChart.vue
  18. 1 1
      src/components/Charts/DoubleChart.vue
  19. 1 1
      src/components/Charts/FocusBarChart.vue
  20. 1 1
      src/components/Charts/FocusCircleChart.vue
  21. 1 1
      src/components/Charts/IndicatorsBarChart.vue
  22. 1 1
      src/components/Charts/LineChart.vue
  23. 3 3
      src/components/Charts/LiquidChart.vue
  24. 1 1
      src/components/Charts/PercentBarChart.vue
  25. 1 1
      src/components/Charts/PieChart.vue
  26. 1 1
      src/components/Charts/RadarChart.vue
  27. 1 1
      src/components/Charts/RelaxBarChart.vue
  28. 1 1
      src/components/Charts/SimplePieChart.vue
  29. 1 4
      src/layout/admin.vue
  30. 1 2
      src/layout/components/Navbar/UserInfo.vue
  31. 2 2
      src/layout/components/Sidebar/Link.vue
  32. 1 1
      src/layout/components/Sidebar/SidebarItem.vue
  33. 0 1
      src/layout/components/Sidebar/index.vue
  34. 1 1
      src/layout/components/TagsView/ScrollPane.vue
  35. 8 3
      src/views/evaluation/index.vue
  36. 1 1
      src/views/login/redirect.vue
  37. 2 4
      src/views/student/index.vue
  38. 4 4
      src/views/training/index.vue
  39. 7 6
      tsconfig.json
  40. 39 1
      vite.config.ts

+ 2 - 2
.eslintignore

@@ -10,5 +10,5 @@ public
 src/assets
 
 .eslintrc.cjs
-.prettier.cjs
-.stylelint.cjs
+.prettierrc.cjs
+.stylelintrc.cjs

+ 18 - 0
.eslintrc-auto-import.json

@@ -1,10 +1,18 @@
 {
   "globals": {
+    "Component": true,
+    "ComponentPublicInstance": true,
+    "ComputedRef": true,
     "EffectScope": true,
     "ElForm": true,
     "ElMessage": true,
     "ElMessageBox": true,
     "ElTree": true,
+    "ElNotification": true,
+    "InjectionKey": true,
+    "PropType": true,
+    "Ref": true,
+    "VNode": true,
     "asyncComputed": true,
     "autoResetRef": true,
     "computed": true,
@@ -19,7 +27,9 @@
     "createGlobalState": true,
     "createInjectionState": true,
     "createReactiveFn": true,
+    "createReusableTemplate": true,
     "createSharedComposable": true,
+    "createTemplatePromise": true,
     "createUnrefFn": true,
     "customRef": true,
     "debouncedRef": true,
@@ -90,6 +100,7 @@
     "toReactive": true,
     "toRef": true,
     "toRefs": true,
+    "toValue": true,
     "triggerRef": true,
     "tryOnBeforeMount": true,
     "tryOnBeforeUnmount": true,
@@ -100,11 +111,14 @@
     "unrefElement": true,
     "until": true,
     "useActiveElement": true,
+    "useAnimate": true,
+    "useArrayDifference": true,
     "useArrayEvery": true,
     "useArrayFilter": true,
     "useArrayFind": true,
     "useArrayFindIndex": true,
     "useArrayFindLast": true,
+    "useArrayIncludes": true,
     "useArrayJoin": true,
     "useArrayMap": true,
     "useArrayReduce": true,
@@ -190,6 +204,8 @@
     "useOnline": true,
     "usePageLeave": true,
     "useParallax": true,
+    "useParentElement": true,
+    "usePerformanceObserver": true,
     "usePermission": true,
     "usePointer": true,
     "usePointerLock": true,
@@ -255,8 +271,10 @@
     "watchArray": true,
     "watchAtMost": true,
     "watchDebounced": true,
+    "watchDeep": true,
     "watchEffect": true,
     "watchIgnorable": true,
+    "watchImmediate": true,
     "watchOnce": true,
     "watchPausable": true,
     "watchPostEffect": true,

+ 48 - 1
.eslintrc.cjs

@@ -1,4 +1,5 @@
 module.exports = {
+  //root: true,
   env: {
     browser: true,
     es2021: true,
@@ -10,11 +11,16 @@ module.exports = {
     "plugin:vue/vue3-recommended",
     "./.eslintrc-auto-import.json",
     "prettier",
+    "plugin:@typescript-eslint/recommended",
+    "plugin:prettier/recommended",
   ],
   parserOptions: {
     ecmaVersion: "latest",
     sourceType: "module",
     parser: "@typescript-eslint/parser",
+    // project: "./tsconfig.*?.json",
+    // createDefaultProgram: false,
+    // extraFileExtensions: [".vue"],
   },
   plugins: ["vue", "@typescript-eslint"],
   rules: {
@@ -23,8 +29,49 @@ module.exports = {
     "@typescript-eslint/no-explicit-any": "off", // 关闭any类型的警告
     "vue/no-v-model-argument": "off",
     "@typescript-eslint/no-non-null-assertion": "off",
-    "vue/comment-directive": "off",
+    "@typescript-eslint/ban-ts-ignore": "off",
+    "@typescript-eslint/ban-ts-comment": "off",
+    "@typescript-eslint/ban-types": "off",
+    "@typescript-eslint/explicit-function-return-type": "off",
+    "@typescript-eslint/no-explicit-any": "off",
+    "@typescript-eslint/no-var-requires": "off",
+    "@typescript-eslint/no-empty-function": "off",
+    "@typescript-eslint/no-use-before-define": "off",
+    "@typescript-eslint/no-non-null-assertion": "off",
+    "@typescript-eslint/explicit-module-boundary-types": "off",
+    "vue/script-setup-uses-vars": "error",
+    "vue/no-reserved-component-names": "off",
+    "vue/custom-event-name-casing": "off",
+    "vue/attributes-order": "off",
+    "vue/one-component-per-file": "off",
+    "vue/html-closing-bracket-newline": "off",
+    "vue/max-attributes-per-line": "off",
+    "vue/multiline-html-element-content-newline": "off",
+    "vue/singleline-html-element-content-newline": "off",
+    "vue/attribute-hyphenation": "off",
+    "vue/require-default-prop": "off",
+    "vue/require-explicit-emits": "off",
+    "vue/html-self-closing": [
+      "error",
+      {
+        html: {
+          void: "always",
+          normal: "never",
+          component: "always",
+        },
+        svg: "always",
+        math: "always",
+      },
+    ],
+    "vue/multi-word-component-names": "off",
   },
+  // eslint不能对html文件生效
+  overrides: [
+    {
+      files: ["*.html"],
+      processor: "vue/.vue",
+    },
+  ],
   // https://eslint.org/docs/latest/use/configure/language-options#specifying-globals
   globals: {
     DialogOption: "readonly",

+ 1 - 0
.gitignore

@@ -15,3 +15,4 @@ dist-ssr
 
 package-lock.json
 pnpm-lock.yaml
+stats.html

+ 1 - 0
.prettierignore

@@ -8,3 +8,4 @@ public
 *.md
 
 src/assets
+stats.html

+ 2 - 0
.prettierrc.cjs

@@ -33,4 +33,6 @@ module.exports = {
   useTabs: false,
   // vue 文件中是否缩进 <style> 和 <script> 标签,默认 false
   vueIndentScriptAndStyle: false,
+
+  endOfLine: "auto",
 };

+ 1 - 0
.stylelintignore

@@ -8,3 +8,4 @@ public
 *.md
 
 src/assets
+stats.html

+ 0 - 7
.stylelintrc.cjs

@@ -39,12 +39,5 @@ module.exports = {
         ignoreProperties: ["menuBg", "menuText", "menuActiveText"],
       },
     ],
-    // at-rule-no-unknown: 屏蔽一些scss等语法检查
-    "at-rule-no-unknown": [
-      true,
-      {
-        ignoreAtRules: ["mixin", "extend", "content"],
-      },
-    ],
   },
 };

+ 27 - 16
package.json

@@ -1,13 +1,12 @@
 {
   "name": "shuimu-dashboard-h5",
   "private": true,
-  "version": "2.4.0",
-  "type": "module",
+  "version": "2.5.0",
   "scripts": {
     "preinstall": "npx only-allow pnpm",
     "dev": "vite serve --mode development",
-    "build:beta": "vite build --mode staging &&vue-tsc --noEmit",
-    "build:prod": "vite build --mode production &&vue-tsc --noEmit",
+    "build:beta": "vite build --mode staging && vue-tsc --noEmit",
+    "build:prod": "vite build --mode production && vue-tsc --noEmit",
     "preview": "vite preview",
     "prepare": "husky install",
     "lint:eslint": "eslint  --fix --ext .ts,.js,.vue ./src ",
@@ -31,7 +30,8 @@
     ],
     "*.{vue,html}": [
       "eslint --fix",
-      "prettier --write"
+      "prettier --write",
+      "stylelint --fix"
     ],
     "*.{scss,css}": [
       "stylelint --fix",
@@ -42,6 +42,7 @@
     ]
   },
   "dependencies": {
+    "@element-plus/icons-vue": "^2.1.0",
     "@vitejs/plugin-vue": "^4.2.3",
     "@vueuse/core": "^10.1.2",
     "@wangeditor/editor": "^5.1.23",
@@ -53,24 +54,27 @@
     "element-plus": "^2.3.6",
     "html2canvas": "^1.4.1",
     "lodash-es": "^4.17.21",
+    "mockjs": "^1.1.0",
     "nprogress": "^0.2.0",
     "path-browserify": "^1.0.1",
     "path-to-regexp": "^6.2.0",
     "pinia": "^2.0.33",
     "screenfull": "^6.0.0",
-    "vue": "^3.3.1",
+    "sortablejs": "^1.15.0",
+    "vue": "^3.3.4",
     "vue-i18n": "9.2.2",
-    "vue-router": "^4.2.0"
+    "vue-router": "^4.2.0",
+    "xlsx": "^0.18.5"
   },
   "devDependencies": {
     "@commitlint/cli": "^17.6.3",
     "@commitlint/config-conventional": "^17.6.3",
-    "@element-plus/icons-vue": "^2.1.0",
     "@iconify-json/ep": "^1.1.10",
     "@types/codemirror": "^5.60.7",
     "@types/lodash": "^4.14.195",
     "@types/nprogress": "^0.2.0",
     "@types/path-browserify": "^1.0.0",
+    "@types/sortablejs": "^1.15.1",
     "@typescript-eslint/eslint-plugin": "^5.59.6",
     "@typescript-eslint/parser": "^5.59.6",
     "autoprefixer": "^10.4.14",
@@ -78,6 +82,7 @@
     "cz-git": "^1.6.1",
     "eslint": "^8.40.0",
     "eslint-config-prettier": "^8.8.0",
+    "eslint-plugin-import": "^2.28.0",
     "eslint-plugin-prettier": "^4.2.1",
     "eslint-plugin-vue": "^9.13.0",
     "fast-glob": "^3.2.11",
@@ -87,24 +92,30 @@
     "postcss-html": "^1.5.0",
     "postcss-scss": "^4.0.6",
     "prettier": "^2.8.8",
+    "rollup-plugin-visualizer": "^5.9.2",
     "sass": "^1.58.3",
-    "stylelint": "^15.5.0",
+    "stylelint": "^15.10.2",
     "stylelint-config-html": "^1.1.0",
     "stylelint-config-recess-order": "^4.0.0",
-    "stylelint-config-recommended-scss": "11.0.0 ",
-    "stylelint-config-recommended-vue": "^1.4.0",
-    "stylelint-config-standard": "^33.0.0",
-    "stylelint-config-standard-scss": "^9.0.0",
+    "stylelint-config-recommended-scss": "^12.0.0",
+    "stylelint-config-recommended-vue": "^1.5.0",
+    "stylelint-config-standard": "^34.0.0",
+    "stylelint-config-standard-scss": "^10.0.0",
     "typescript": "^5.0.4",
     "unocss": "^0.51.13",
     "unplugin-auto-import": "^0.15.3",
     "unplugin-icons": "^0.16.1",
     "unplugin-vue-components": "^0.24.1",
-    "vite": "^4.3.9",
+    "vite": "^4.4.2",
+    "vite-plugin-compression": "^0.5.1",
+    "vite-plugin-mock": "^3.0.0",
     "vite-plugin-svg-icons": "^2.0.1",
-    "vue-tsc": "^1.6.5 "
+    "vue-tsc": "^1.7.0 "
   },
   "repository": "http://120.78.146.64:3000/shuimuai/shuimu-dashboard-h5/src/master",
   "author": "索隆",
-  "license": "MIT"
+  "license": "MIT",
+  "engines": {
+    "node": ">=16.0.0"
+  }
 }

+ 1 - 1
src/api/areaboard/index.ts

@@ -1,6 +1,6 @@
 import request from "@/utils/request";
 import {AxiosPromise} from "axios";
-import {AddressId, Area, AreaCard, AreaLineData, AreaParams} from "@/api/areaboard/types";
+import {Area, AreaCard, AreaLineData, AreaParams} from "@/api/areaboard/types";
 import {DashboardData} from "@/api/dashboard/types";
 import {SchoolList} from "@/api/school/types";
 

+ 1 - 1
src/api/student/index.ts

@@ -1,6 +1,6 @@
 import request from "@/utils/request";
 import {AxiosPromise} from "axios";
-import {StudentBoard, StudentList, StudentManage, StudentParams} from "@/api/student/types";
+import {StudentBoard, StudentManage, StudentParams} from "@/api/student/types";
 
 /**
  * 学生管理

+ 0 - 2
src/api/student/types.ts

@@ -1,5 +1,3 @@
-import {TeacherItem} from "@/api/teacher/types";
-
 /**
  * 获取学生管理参数
  */

+ 2 - 1
src/api/teacher/index.ts

@@ -1,7 +1,8 @@
 import request from "@/utils/request";
 import {AxiosPromise} from "axios";
 import {GradeList} from "@/api/grade/types";
-import {TeacherEquipment, TeacherList, TeacherManage} from "@/api/teacher/types";
+import {TeacherEquipment, TeacherManage} from "@/api/teacher/types";
+
 /**
  * 获取教师管理列表
  */

+ 0 - 2
src/api/training/types.ts

@@ -1,5 +1,3 @@
-import {TeacherItem} from "@/api/teacher/types";
-
 /**
  * 获取训练记录参数
  * ?school_id=95&is_formal=1&search=略&grade_id=35&page=1&page_size=10

+ 1 - 1
src/components/Charts/AverageBarChart.vue

@@ -1,6 +1,6 @@
 <!--  脑电评估检测指数分析看板 柱状图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">

+ 2 - 2
src/components/Charts/CircleChart.vue

@@ -1,6 +1,6 @@
 <!-- 圆形进度图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">
@@ -63,7 +63,7 @@ const options = {
   animation: true,
   title: {
     show: true,
-    text: (props.data*1).toFixed(2) + "%",
+    text: (props.data * 1).toFixed(2) + "%",
     x: "center",
     y: "center",
     textStyle: {

+ 2 - 2
src/components/Charts/CurveLineChart.vue

@@ -1,6 +1,6 @@
 <!-- 圆饼图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">
@@ -50,7 +50,7 @@ const options = {
       formatter: function (value: number, index: number) {
         return Math.ceil(index / 60) + "分钟";
       },
-      interval: (index: number, value: string) => {
+      interval: (index: number) => {
         return index % 60 == 0;
       },
     },

+ 1 - 1
src/components/Charts/DoubleChart.vue

@@ -1,6 +1,6 @@
 <!-- 双圈图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">

+ 1 - 1
src/components/Charts/FocusBarChart.vue

@@ -1,6 +1,6 @@
 <!--  专注力四维柱状图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">

+ 1 - 1
src/components/Charts/FocusCircleChart.vue

@@ -1,6 +1,6 @@
 <!-- 圆形进度图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">

+ 1 - 1
src/components/Charts/IndicatorsBarChart.vue

@@ -1,6 +1,6 @@
 <!--  脑电评估检测指数分析看板 柱状图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">

+ 1 - 1
src/components/Charts/LineChart.vue

@@ -1,6 +1,6 @@
 <!-- 圆饼图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">

+ 3 - 3
src/components/Charts/LiquidChart.vue

@@ -1,6 +1,6 @@
 <!-- 水球图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">
@@ -72,10 +72,10 @@ const options = {
       label: {
         formatter: labelFormatter,
         color: props.color, // 在波浪上方时的文字颜色
-        insideColor: props.color,//"#ffffff", // 在波浪下方时的文字颜色
+        insideColor: props.color, //"#ffffff", // 在波浪下方时的文字颜色
         fontSize: 30, // 文字大小
       },
-      data: [(props.data>100?100:props.data) / 100], // 水球的注满度 100%
+      data: [(props.data > 100 ? 100 : props.data) / 100], // 水球的注满度 100%
     },
   ],
 };

+ 1 - 1
src/components/Charts/PercentBarChart.vue

@@ -1,6 +1,6 @@
 <!--  评分占比柱状图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">

+ 1 - 1
src/components/Charts/PieChart.vue

@@ -1,6 +1,6 @@
 <!-- 圆饼图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">

+ 1 - 1
src/components/Charts/RadarChart.vue

@@ -1,6 +1,6 @@
 <!-- 五维雷达图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">

+ 1 - 1
src/components/Charts/RelaxBarChart.vue

@@ -1,6 +1,6 @@
 <!--  3维放松度分析柱状图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">

+ 1 - 1
src/components/Charts/SimplePieChart.vue

@@ -1,6 +1,6 @@
 <!-- 圆饼图 -->
 <template>
-  <div :id="id" :class="className" :style="{height, width}" />
+  <div :id="id" :class="className" :style="{height, width}"></div>
 </template>
 
 <script setup lang="ts">

+ 1 - 4
src/layout/admin.vue

@@ -1,7 +1,7 @@
 <script setup lang="ts">
 import {computed, watchEffect} from "vue";
 import {useWindowSize} from "@vueuse/core";
-import {AppMain, TagsView, AdminNavbar} from "./components/index";
+import {AdminNavbar, AppMain} from "./components/index";
 import Sidebar from "./components/Sidebar/index.vue";
 
 import {useAppStore} from "@/store/modules/app";
@@ -110,9 +110,6 @@ function handleOutsideClick() {
 .mobile .fixed-header {
   width: 100%;
 }
-//.mobile .app-main{
-//  padding-top: 70px;
-//}
 
 .drawer-bg {
   position: absolute;

+ 1 - 2
src/layout/components/Navbar/UserInfo.vue

@@ -2,11 +2,10 @@
 import SvgIcon from "@/components/SvgIcon/index.vue";
 import {useUserStore} from "@/store/modules/user";
 import {useTagsViewStore} from "@/store/modules/tagsView";
-import {useRoute, useRouter} from "vue-router";
+import {useRouter} from "vue-router";
 
 const userStore = useUserStore();
 const tagsViewStore = useTagsViewStore();
-const route = useRoute();
 const router = useRouter();
 /**
  * 注销

+ 2 - 2
src/layout/components/Sidebar/Link.vue

@@ -31,9 +31,9 @@ function push() {
 
 <template>
   <a v-if="isExternal(to)" :href="to" target="_blank" rel="noopener">
-    <slot />
+    <slot></slot>
   </a>
   <div v-else @click="push">
-    <slot />
+    <slot></slot>
   </div>
 </template>

+ 1 - 1
src/layout/components/Sidebar/SidebarItem.vue

@@ -102,7 +102,7 @@ function addActiveClass(routePath: string) {
   });
 }
 
-router.afterEach((to, from) => {
+router.afterEach((to) => {
   //console.log(from.fullPath, to.fullPath, "路由变动");
   setTimeout(() => {
     addActiveClass(to.fullPath);

+ 0 - 1
src/layout/components/Sidebar/index.vue

@@ -7,7 +7,6 @@ import {useSettingsStore} from "@/store/modules/settings";
 import {usePermissionStore} from "@/store/modules/permission";
 import {useAppStore} from "@/store/modules/app";
 import {storeToRefs} from "pinia";
-import variables from "@/styles/variables.module.scss";
 
 const settingsStore = useSettingsStore();
 const permissionStore = usePermissionStore();

+ 1 - 1
src/layout/components/TagsView/ScrollPane.vue

@@ -79,7 +79,7 @@ defineExpose({
 
 <template>
   <el-scrollbar ref="scrollContainer" :vertical="false" class="scroll-container" @wheel.prevent="handleScroll">
-    <slot />
+    <slot></slot>
   </el-scrollbar>
 </template>
 

+ 8 - 3
src/views/evaluation/index.vue

@@ -50,7 +50,7 @@ async function getStudentData(schoolId: number) {
         changeStudent(studentActive.value);
       } else {
         changeStudent(0);
-        studentStatus.value = (studentSearch.value != "");
+        studentStatus.value = studentSearch.value != "";
         studentMessage.value = "学校学生还未进行过测评,暂无测评数据!";
       }
     })
@@ -64,7 +64,7 @@ async function getStudentData(schoolId: number) {
 function getStudentSearch() {
   getStudentData(userStore.schoolId);
 }
-function changeStudent(studentId:number) {
+function changeStudent(studentId: number) {
   studentActive.value = studentId;
   // 切换学生图表
   if (studentId > 0) {
@@ -249,7 +249,7 @@ onMounted(() => {
                 </div>
               </div>
             </el-col>
-            <el-col :xs="24" :span="8"></el-col>
+            <el-col :xs="24" :span="8" />
           </el-row>
         </template>
         <template v-if="btmStatus">
@@ -321,9 +321,11 @@ onMounted(() => {
   position: relative;
   padding: 30px;
 }
+
 .empty {
   padding: 135px 0;
 }
+
 .evaluate-chart {
   position: relative;
   box-sizing: border-box;
@@ -332,6 +334,7 @@ onMounted(() => {
   padding: 0 10px 20px 386px;
   background: #fff;
   border-radius: 30px;
+
   &.empty {
     padding: 200px 0;
   }
@@ -384,9 +387,11 @@ onMounted(() => {
       padding: 8px 0 0 90px;
       color: #23283c;
       cursor: pointer;
+
       &:hover {
         background: #e5eefe;
       }
+
       &.active {
         color: #4284f2;
         background: #e5eefe;

+ 1 - 1
src/views/login/redirect.vue

@@ -1,5 +1,5 @@
 <template>
-  <div />
+  <div></div>
 </template>
 
 <script setup lang="ts">

+ 2 - 4
src/views/student/index.vue

@@ -17,8 +17,6 @@ defineOptions({
  * 班级数据
  */
 const gradeData = ref<GradeList[]>();
-// 班级编号
-let gradeId = ref(0);
 async function getGradeData(schoolId: number) {
   getGradeSelect(schoolId)
     .then(({data}) => {
@@ -73,11 +71,11 @@ function alertError() {
 }
 onMounted(() => {
   let page_no = getUrlParam("page");
-  if (page_no && page_no > 0) {
+  if (page_no && Number(page_no) > 0) {
     pageParams.page = Number(page_no);
   }
   let page_size = getUrlParam("size");
-  if (page_size && page_size > 0) {
+  if (page_size && Number(page_size) > 0) {
     pageParams.page_size = Number(page_size);
   }
   // 获取班级

+ 4 - 4
src/views/training/index.vue

@@ -76,11 +76,11 @@ function alertError() {
 }
 onMounted(() => {
   let page_no = getUrlParam("page");
-  if (page_no && page_no > 0) {
+  if (page_no && Number(page_no) > 0) {
     pageParams.page = Number(page_no);
   }
   let page_size = getUrlParam("size");
-  if (page_size && page_size > 0) {
+  if (page_size && Number(page_size) > 0) {
     pageParams.page_size = Number(page_size);
   }
   getGradeData(userStore.schoolId);
@@ -101,8 +101,8 @@ onMounted(() => {
     <!-- 学生查找 -->
     <div class="training-search">
       <el-select v-model="pageParams.is_formal" placeholder="正式学生/体验用户" size="large">
-        <el-option key="1" :value="Number(1)" label="正式学生"></el-option>
-        <el-option key="2" :value="Number(2)" label="体验用户"></el-option>
+        <el-option key="1" :value="Number(1)" label="正式学生" />
+        <el-option key="2" :value="Number(2)" label="体验用户" />
       </el-select>
       <el-select v-if="pageParams.is_formal == 1" v-model="pageParams.grade_id" placeholder="请选择班级" size="large">
         <el-option v-for="item in gradeData" :key="item.id" :label="item.name" :value="item.id" />

+ 7 - 6
tsconfig.json

@@ -1,15 +1,16 @@
 {
   "compilerOptions": {
-    "target": "es2022",
+    "target": "esnext",
     "useDefineForClassFields": true,
-    "module": "es2022",
+    "module": "esnext",
     "moduleResolution": "node",
     "strict": true,
+    "noLib": false,
     "jsx": "preserve",
     "sourceMap": true,
     "resolveJsonModule": true,
     "esModuleInterop": true,
-    "lib": ["es2022", "dom"],
+    "lib": ["esnext", "dom"],
     "baseUrl": ".",
     "allowJs": true,
     "paths": {
@@ -20,7 +21,7 @@
     "allowSyntheticDefaultImports": true /* 允许默认导入 */,
     "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */
   },
-  "include": ["src/**/*.ts", "src/**/*.vue", "src/types/**/*.d.ts"],
-  "exclude": ["node_modules", "dist", "**/*.js"],
-  "references": [{"path": "./tsconfig.node.json"}]
+  "include": ["src/**/*.ts", "src/**/*.vue", "src/types/**/*.d.ts", "vite.config.ts"],
+  "exclude": ["node_modules", "dist", "**/*.js"]
+  // "references": [{ "path": "./tsconfig.node.json" }]
 }

+ 39 - 1
vite.config.ts

@@ -11,13 +11,19 @@ import IconsResolver from "unplugin-icons/resolver";
 
 import {createSvgIconsPlugin} from "vite-plugin-svg-icons";
 
-import UnoCSS from "unocss/vite";
+import {viteMockServe} from "vite-plugin-mock";
+import visualizer from "rollup-plugin-visualizer";
 
+import UnoCSS from "unocss/vite";
 import path from "path";
+
+import viteCompression from "vite-plugin-compression";
+
 const pathSrc = path.resolve(__dirname, "src");
 
 export default defineConfig(({mode}: ConfigEnv): UserConfig => {
   const env = loadEnv(mode, process.cwd());
+
   return {
     resolve: {
       alias: {
@@ -100,6 +106,29 @@ export default defineConfig(({mode}: ConfigEnv): UserConfig => {
         // 指定symbolId格式
         symbolId: "icon-[dir]-[name]",
       }),
+      // 代码压缩
+      viteCompression({
+        verbose: true, // 默认即可
+        disable: true, // 是否禁用压缩,默认禁用,true为禁用,false为开启,打开压缩需配置nginx支持
+        deleteOriginFile: true, // 删除源文件
+        threshold: 10240, // 压缩前最小文件大小
+        algorithm: "gzip", // 压缩算法
+        ext: ".gz", // 文件类型
+      }),
+
+      viteMockServe({
+        ignore: /^\_/,
+        mockPath: "mock",
+        enable: mode === "development",
+        // https://github.com/anncwb/vite-plugin-mock/issues/9
+      }),
+
+      visualizer({
+        filename: "./stats.html",
+        open: false,
+        gzipSize: true,
+        brotliSize: true,
+      }),
     ],
     // 预加载项目必需的组件
     optimizeDeps: {
@@ -145,7 +174,16 @@ export default defineConfig(({mode}: ConfigEnv): UserConfig => {
         "element-plus/es/components/pagination/style/css",
         "element-plus/es/components/tree/style/css",
         "element-plus/es/components/alert/style/css",
+        "element-plus/es/components/radio-button/style/css",
+        "element-plus/es/components/checkbox-group/style/css",
+        "element-plus/es/components/checkbox/style/css",
+        "element-plus/es/components/tabs/style/css",
+        "element-plus/es/components/tab-pane/style/css",
+        "element-plus/es/components/rate/style/css",
+        "element-plus/es/components/date-picker/style/css",
+        "element-plus/es/components/notification/style/css",
         "@vueuse/core",
+        "sortablejs",
 
         "path-to-regexp",
         "echarts",