ソースを参照

验证 账号权限

zhuf 1 年間 前
コミット
e02e85a22e
共有11 個のファイルを変更した2548 個の追加1133 個の削除を含む
  1. 16 14
      package.json
  2. 2466 783
      pnpm-lock.yaml
  3. 1 1
      public/config.js
  4. 1 1
      src/store/user.store.ts
  5. 33 1
      src/store/user.ts
  6. 0 42
      tsconfig.json
  7. 0 12
      tsconfig.node.json
  8. 31 0
      vite.config.ts
  9. 0 121
      vite.config.ts.js
  10. 0 133
      vite.config.ts.timestamp-1672734515047.mjs
  11. 0 25
      windi.config.ts

+ 16 - 14
package.json

@@ -20,30 +20,32 @@
     "@element-plus/icons-vue": "^2.1.0",
     "@vueuse/components": "^9.13.0",
     "@vueuse/core": "^9.13.0",
-    "agora-rtc-sdk-ng": "^4.17.2",
-    "axios": "^1.3.6",
-    "element-plus": "^2.3.4",
-    "tinymce": "^6.4.2",
-    "vue": "^3.2.47",
-    "vue-router": "^4.1.6"
+    "agora-rtc-sdk-ng": "^4.18.2",
+    "axios": "^1.5.0",
+    "element-plus": "^2.3.14",
+    "tinymce": "^6.7.0",
+    "vue": "^3.3.4",
+    "vue-router": "^4.2.4"
   },
   "devDependencies": {
     "@antfu/eslint-config": "^0.27.0",
-    "@iconify/json": "^2.2.56",
-    "@types/node": "^18.16.1",
-    "@vitejs/plugin-vue": "^4.2.1",
+    "@iconify/json": "^2.2.116",
+    "@types/node": "^18.17.16",
+    "@vitejs/plugin-legacy": "^4.1.1",
+    "@vitejs/plugin-vue": "^4.3.4",
     "@windicss/plugin-scrollbar": "^1.2.3",
-    "eslint": "^8.39.0",
+    "eslint": "^8.49.0",
     "husky": "^8.0.3",
     "magic-string": "^0.26.7",
-    "sass": "^1.62.1",
+    "sass": "^1.67.0",
     "typescript": "^4.9.5",
     "unplugin-auto-import": "^0.10.3",
     "unplugin-icons": "^0.14.15",
     "unplugin-vue-components": "^0.22.12",
-    "vite": "^4.3.3",
-    "vite-plugin-windicss": "^1.8.10",
-    "vue-tsc": "^1.6.0",
+    "vite": "^4.4.9",
+    "vite-plugin-top-level-await": "^1.3.1",
+    "vite-plugin-windicss": "^1.9.1",
+    "vue-tsc": "^1.8.11",
     "windicss": "^3.5.6"
   }
 }

File diff suppressed because it is too large
+ 2466 - 783
pnpm-lock.yaml


+ 1 - 1
public/config.js

@@ -29,7 +29,7 @@ function isWhich() {
   } else if (window.location.href.startsWith(production.web_pc)) {
     return production
   } else {
-    return local
+    return production
   }
 }
 window.GLOBAL_CONFIG = isWhich()

File diff suppressed because it is too large
+ 1 - 1
src/store/user.store.ts


+ 33 - 1
src/store/user.ts

@@ -1,4 +1,5 @@
 import { IUser } from './user.d';
+import axios from 'axios'
 // #ifdef DEV
 import dictionary from './user.store';
 console.groupCollapsed('user');
@@ -18,4 +19,35 @@ console.log('user :>> ', user);
 export default user
 
 const ROLE_MAP: { [key: string]: 'teacher' | 'student' } = { '72': 'teacher', '75': 'teacher', '76': 'student' }
-export const UserRole: 'teacher' | 'student' | 'admin' | 'other' = user.sm_info.sm_id === '739' ? 'admin' : (ROLE_MAP[user.user_role_id] ?? 'other')
+let TempUserRole: 'teacher' | 'student' | 'admin' | 'other' = user.sm_info.sm_id === '739' ? 'admin' : (ROLE_MAP[user.user_role_id] ?? 'other')
+
+await axios.create({
+  baseURL: window.GLOBAL_CONFIG.api,
+  timeout: 6 * 1000,
+  headers: {
+    'Content-Type': 'application/x-www-form-urlencoded',
+  },
+  method: 'post',
+})({
+  url: '/dyaw/xlfw_pbgl/index',
+  data: {
+    token: user.token,
+    client: 'web',
+    site: 'dyaw',
+    api: 'json',
+    user_id: user.user_id
+  }
+}).then(resp => {
+  const res = resp.data
+  if (res.code === '1') {
+    if (res.data.page_data?.length >= 1) {
+      if (TempUserRole === 'admin')
+        TempUserRole = 'teacher'
+    }
+  }
+})
+
+
+export const UserRole = TempUserRole
+
+console.log('UserRole : ', UserRole)

+ 0 - 42
tsconfig.json

@@ -1,42 +0,0 @@
-{
-  "compilerOptions": {
-    "target": "ESNext",
-    "useDefineForClassFields": true,
-    "module": "ESNext",
-    "moduleResolution": "Node",
-    "strict": true,
-    "jsx": "preserve",
-    "resolveJsonModule": true,
-    "isolatedModules": true,
-    "esModuleInterop": true,
-    "lib": [
-      "ESNext",
-      "DOM"
-    ],
-    "skipLibCheck": true,
-    "noEmit": true,
-    "allowJs": true,
-    "baseUrl": "./",
-    "paths": {
-      "@/*": [
-        "src/*"
-      ],
-      "~/*": [
-        "src/*"
-      ]
-    },
-  },
-  "include": [
-    "src/**/*.ts",
-    "src/**/*.d.ts",
-    "src/**/*.tsx",
-    "src/**/*.vue",
-    "src/**/**/*.vue",
-    "./auto-imports.d.ts"
-  ],
-  "references": [
-    {
-      "path": "./tsconfig.node.json"
-    }
-  ]
-}

+ 0 - 12
tsconfig.node.json

@@ -1,12 +0,0 @@
-{
-  "compilerOptions": {
-    "composite": true,
-    "module": "ESNext",
-    "moduleResolution": "Node",
-    "allowSyntheticDefaultImports": true
-  },
-  "include": [
-    "vite.config.ts",
-    "plugins/*.ts"
-  ]
-}

+ 31 - 0
vite.config.ts

@@ -8,6 +8,8 @@ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
 import Icons from 'unplugin-icons/vite'
 import IconsResolver from 'unplugin-icons/resolver'
 import ConditionalCompile from './plugins/vite-plugin-conditional-compile'
+import topLevelAwait from 'vite-plugin-top-level-await'
+import legacy from '@vitejs/plugin-legacy'
 
 // https://vitejs.dev/config/
 export default defineConfig({
@@ -38,6 +40,35 @@ export default defineConfig({
     },
   },
   plugins: [
+    legacy({
+      targets: ['defaults', 'ie >= 11', 'chrome 52'],  //需要兼容的目标列表,可以设置多个
+      additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
+      renderLegacyChunks: true,
+      polyfills: [
+        'es.symbol',
+        'es.array.filter',
+        'es.promise',
+        'es.promise.finally',
+        'es/map',
+        'es/set',
+        'es.array.for-each',
+        'es.object.define-properties',
+        'es.object.define-property',
+        'es.object.get-own-property-descriptor',
+        'es.object.get-own-property-descriptors',
+        'es.object.keys',
+        'es.object.to-string',
+        'web.dom-collections.for-each',
+        'esnext.global-this',
+        'esnext.string.match-all'
+      ]
+    }),
+    topLevelAwait({
+      // The export name of top-level await promise for each chunk module
+      promiseExportName: '__tla',
+      // The function to generate import names of top-level await promise in each chunk module
+      promiseImportName: i => `__tla_${i}`
+    }),
     ConditionalCompile(),
     vue({
       reactivityTransform: true,

File diff suppressed because it is too large
+ 0 - 121
vite.config.ts.js


File diff suppressed because it is too large
+ 0 - 133
vite.config.ts.timestamp-1672734515047.mjs


+ 0 - 25
windi.config.ts

@@ -1,25 +0,0 @@
-import { defineConfig } from 'windicss/helpers'
-
-export default defineConfig({
-  darkMode: 'media',
-  shortcuts: {
-    card: 'rounded-xl bg-white p-3 relative box-border',
-    divider: 'w-full h-0 border border-solid border-gray-100 my-2',
-    divider_y: 'w-0 h-full border border-solid border-gray-100 mx-2',
-    icon: 'w-24px h-24px fill-blue-600 bg-light-100 rounded-2px cursor-pointer  mx-4px box-border',
-    icon_reserve:
-      'w-24px h-24px bg-blue-600 fill-light-100 rounded-2px cursor-pointer mx-4px p-2px box-border',
-    flex_center: 'flex justify-center items-center',
-    flex_start: 'flex justify-start items-center',
-    area: 'flex bg-gray-100 text-gray-600 my-2 p-4 text-sm h-300px overflow-auto',
-    pre: 'before:content-["|"] before:w-4px before:h-full before:inline-block before:text-transparent before:mr-6px before:bg-blue-400 text-gray-700',
-  },
-  plugins: [
-    require('@windicss/plugin-scrollbar'),
-    require('windicss/plugin/line-clamp'),
-    // ...
-  ],
-  variants: {
-    scrollbar: ['rounded'],
-  },
-})