gemercheung vor 2 Jahren
Ursprung
Commit
a972a28a17
10 geänderte Dateien mit 181 neuen und 78 gelöschten Zeilen
  1. 2 0
      .env
  2. 2 1
      .env.development
  3. 3 2
      .env.production
  4. 2 2
      index.html
  5. 12 10
      package.json
  6. 104 35
      pnpm-lock.yaml
  7. 19 17
      src/components/chatRoom/controls/actions.ts
  8. 3 3
      src/hooks/userApp.ts
  9. 8 8
      src/hooks/userSocket.ts
  10. 26 0
      vite.config.ts

+ 2 - 0
.env

@@ -1,3 +1,4 @@
+VUE_APP_REGION_URL=''
 # 场景资源地址
 VITE_APP_RESOURCE_URL=https://4dkk.4dage.com/
 # 静态资源地址
@@ -12,3 +13,4 @@ VITE_APP_STATIC_DIR=viewer
 VITE_APP_APIS_URL=https://test.4dkankan.com/
 # VITE_APP_APIS_URL=https://v4-uat.4dkankan.com/
 VITE_USE_HTTPS=1
+VITE_PUBLIC_DIR=''

+ 2 - 1
.env.development

@@ -1 +1,2 @@
-VITE_APP_SDK_DIR=https://4dkk.4dage.com/v4/sdk/4.2.1
+VITE_APP_SDK_DIR=https://4dkk.4dage.com/v4/sdk/4.2.1
+VITE_PUBLIC_DIR=''

+ 3 - 2
.env.production

@@ -1,9 +1,9 @@
 # 场景资源地址
-VITE_APP_RESOURCE_URL=https://4dkk.4dage.com/
+VITE_APP_RESOURCE_URL=https://testeurs3.4dkankan.com/
 # 静态资源地址
 VITE_APP_CDN_URL=https://4dkk.4dage.com/v4/www/
 # sdk文件地址
-VITE_APP_SDK_DIR=https://4dkk.4dage.com/v4/sdk/4.2.1
+VITE_APP_SDK_DIR=https://testeurs3.4dkankan.com/v4/www/sdk
 # socket地址
 VITE_APP_SOCKET_URL=wss://ws.4dkankan.com
 # 静态资源目录
@@ -12,3 +12,4 @@ VITE_APP_STATIC_DIR=viewer
 VITE_APP_APIS_URL=https://test.4dkankan.com/
 # VITE_APP_APIS_URL=https://v4-uat.4dkankan.com/
 VITE_USE_HTTPS=1
+VITE_PUBLIC_DIR='livestream'

+ 2 - 2
index.html

@@ -25,8 +25,8 @@
   <body>
     <div id="app"></div>
     <script type="module" src="/src/main.ts"></script>
-    <script src="<{VITE_APP_SDK_DIR}>/kankan-sdk-deps.js?v=4.37.3-alpha.78"></script>
-    <script src="<{VITE_APP_SDK_DIR}>/kankan-sdk.js?v=4.37.3-alpha.78"></script>
+    <script src="<{VITE_APP_SDK_DIR}>/kankan-sdk-deps.js?v=4.3.3-alpha.8"></script>
+    <script src="<{VITE_APP_SDK_DIR}>/kankan-sdk.js?v=4.3.3-alpha.8"></script>
     <script src="<{BASE_URL}><{VITE_APP_STATIC_DIR}>/static/lib/flv.min.js"></script>
     <script src="<{BASE_URL}><{VITE_APP_STATIC_DIR}>/static/lib/vconsole.js"></script>
     <script src="<{BASE_URL}><{VITE_APP_STATIC_DIR}>/static/lib/swiper/swiper-bundle.min.js"></script>

+ 12 - 10
package.json

@@ -32,10 +32,21 @@
     "add": "^2.0.6",
     "commitizen": "^4.2.5",
     "cz-customizable": "^7.0.0",
+    "eslint": "^8.23.1",
+    "eslint-config-prettier": "^8.5.0",
+    "eslint-define-config": "^1.7.0",
+    "eslint-plugin-jest": "^25.7.0",
+    "eslint-plugin-prettier": "^4.2.1",
+    "eslint-plugin-vue": "^8.7.1",
+    "jest": "^27.5.1",
+    "lint-staged": "12.1.4",
+    "npm-run-all": "^4.1.5",
     "prettier": "^2.7.1",
     "sass": "^1.55.0",
+    "terser": "^5.15.1",
     "typescript": "^4.8.4",
     "vite": "^3.2.0",
+    "vite-plugin-chunk-split": "^0.4.3",
     "vite-plugin-eslint": "^1.8.1",
     "vite-plugin-html-env": "^1.2.7",
     "vite-plugin-mkcert": "^1.10.1",
@@ -43,16 +54,7 @@
     "vite-plugin-windicss": "^1.8.8",
     "vue-eslint-parser": "^9.1.0",
     "vue-tsc": "^1.0.9",
-    "windicss": "^3.5.6",
-    "eslint": "^8.23.1",
-    "eslint-config-prettier": "^8.5.0",
-    "eslint-define-config": "^1.7.0",
-    "eslint-plugin-jest": "^25.7.0",
-    "eslint-plugin-prettier": "^4.2.1",
-    "eslint-plugin-vue": "^8.7.1",
-    "jest": "^27.5.1",
-    "lint-staged": "12.1.4",
-    "npm-run-all": "^4.1.5"
+    "windicss": "^3.5.6"
   },
   "config": {
     "commitizen": {

+ 104 - 35
pnpm-lock.yaml

@@ -26,10 +26,12 @@ specifiers:
   pinia-plugin-persistedstate: ^2.3.0
   prettier: ^2.7.1
   sass: ^1.55.0
+  terser: ^5.15.1
   trtc-js-sdk: ^4.14.6
   typescript: ^4.8.4
   uuid: ^9.0.0
   vite: ^3.2.0
+  vite-plugin-chunk-split: ^0.4.3
   vite-plugin-eslint: ^1.8.1
   vite-plugin-html-env: ^1.2.7
   vite-plugin-mkcert: ^1.10.1
@@ -68,13 +70,15 @@ devDependencies:
   eslint-plugin-jest: 25.7.0_5hzdnpurunnvkypr2bvkyudjkm
   eslint-plugin-prettier: 4.2.1_v7o5sx5x3wbs57ifz6wc4f76we
   eslint-plugin-vue: 8.7.1_eslint@8.27.0
-  jest: 27.5.1
+  jest: 27.5.1_ts-node@10.9.1
   lint-staged: 12.1.4
   npm-run-all: 4.1.5
   prettier: 2.7.1
   sass: 1.55.0
+  terser: 5.15.1
   typescript: 4.8.4
-  vite: 3.2.0_sass@1.55.0
+  vite: 3.2.0_sass@1.55.0+terser@5.15.1
+  vite-plugin-chunk-split: 0.4.3_sass@1.55.0+terser@5.15.1
   vite-plugin-eslint: 1.8.1_eslint@8.27.0+vite@3.2.0
   vite-plugin-html-env: 1.2.7_vite@3.2.0
   vite-plugin-mkcert: 1.10.1_vite@3.2.0
@@ -462,7 +466,7 @@ packages:
       cosmiconfig-typescript-loader: 4.2.0_gbbg4brkmakf6m5nuj7scelzny
       lodash: 4.17.21
       resolve-from: 5.0.0
-      ts-node: 10.9.1_yodorn5kzjgomblrsstrk2spaa
+      ts-node: 10.9.1_evej5wzm4hojmu6uzxwpspdmsu
       typescript: 4.8.4
     transitivePeerDependencies:
       - '@swc/core'
@@ -497,7 +501,6 @@ packages:
     dependencies:
       '@jridgewell/trace-mapping': 0.3.9
     dev: true
-    optional: true
 
   /@esbuild/android-arm/0.15.12:
     resolution: {integrity: sha512-IC7TqIqiyE0MmvAhWkl/8AEzpOtbhRNDo7aph47We1NbE5w2bt/Q+giAhe0YYeVpYnIhGMcuZY92qDK6dQauvA==}
@@ -582,7 +585,7 @@ packages:
       slash: 3.0.0
     dev: true
 
-  /@jest/core/27.5.1:
+  /@jest/core/27.5.1_ts-node@10.9.1:
     resolution: {integrity: sha512-AK6/UTrvQD0Cd24NSqmIA6rKsu0tKIxfiCducZvqxYdmMisOYAsdItspT+fQDQYARPf8XgjAFZi0ogW2agH5nQ==}
     engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
     peerDependencies:
@@ -603,7 +606,7 @@ packages:
       exit: 0.1.2
       graceful-fs: 4.2.10
       jest-changed-files: 27.5.1
-      jest-config: 27.5.1
+      jest-config: 27.5.1_ts-node@10.9.1
       jest-haste-map: 27.5.1
       jest-message-util: 27.5.1
       jest-regex-util: 27.5.1
@@ -788,6 +791,13 @@ packages:
     engines: {node: '>=6.0.0'}
     dev: true
 
+  /@jridgewell/source-map/0.3.2:
+    resolution: {integrity: sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==}
+    dependencies:
+      '@jridgewell/gen-mapping': 0.3.2
+      '@jridgewell/trace-mapping': 0.3.9
+    dev: true
+
   /@jridgewell/sourcemap-codec/1.4.14:
     resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==}
     dev: true
@@ -964,22 +974,18 @@ packages:
   /@tsconfig/node10/1.0.9:
     resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==}
     dev: true
-    optional: true
 
   /@tsconfig/node12/1.0.11:
     resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==}
     dev: true
-    optional: true
 
   /@tsconfig/node14/1.0.3:
     resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==}
     dev: true
-    optional: true
 
   /@tsconfig/node16/1.0.3:
     resolution: {integrity: sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==}
     dev: true
-    optional: true
 
   /@types/babel__core/7.1.20:
     resolution: {integrity: sha512-PVb6Bg2QuscZ30FvOU7z4guG6c926D9YRvOxEaelzndpMsvP+YM74Q/dAFASpg2l6+XLalxSGxcq/lrgYWZtyQ==}
@@ -1236,7 +1242,7 @@ packages:
       vite: ^3.0.0
       vue: ^3.2.25
     dependencies:
-      vite: 3.2.0_sass@1.55.0
+      vite: 3.2.0_sass@1.55.0+terser@5.15.1
       vue: 3.2.41
     dev: true
 
@@ -1409,7 +1415,6 @@ packages:
     resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==}
     engines: {node: '>=0.4.0'}
     dev: true
-    optional: true
 
   /acorn/7.4.1:
     resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==}
@@ -1530,7 +1535,6 @@ packages:
   /arg/4.1.3:
     resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==}
     dev: true
-    optional: true
 
   /argparse/1.0.10:
     resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==}
@@ -1922,6 +1926,10 @@ packages:
     dependencies:
       delayed-stream: 1.0.0
 
+  /commander/2.20.3:
+    resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
+    dev: true
+
   /commander/8.3.0:
     resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==}
     engines: {node: '>= 12'}
@@ -1978,7 +1986,7 @@ packages:
     dependencies:
       '@types/node': 14.18.33
       cosmiconfig: 7.0.1
-      ts-node: 10.9.1_yodorn5kzjgomblrsstrk2spaa
+      ts-node: 10.9.1_evej5wzm4hojmu6uzxwpspdmsu
       typescript: 4.8.4
     dev: true
     optional: true
@@ -1998,7 +2006,6 @@ packages:
   /create-require/1.1.1:
     resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==}
     dev: true
-    optional: true
 
   /cross-spawn/6.0.5:
     resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==}
@@ -2178,7 +2185,6 @@ packages:
     resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
     engines: {node: '>=0.3.1'}
     dev: true
-    optional: true
 
   /dir-glob/3.0.1:
     resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
@@ -2262,6 +2268,10 @@ packages:
       unbox-primitive: 1.0.2
     dev: true
 
+  /es-module-lexer/1.1.0:
+    resolution: {integrity: sha512-fJg+1tiyEeS8figV+fPcPpm8WqJEflG3yPU0NOm5xMvrNkuiy7HzX/Ljng4Y0hAoiw4/3hQTCFYw+ub8+a2pRA==}
+    dev: true
+
   /es-to-primitive/1.2.1:
     resolution: {integrity: sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==}
     engines: {node: '>= 0.4'}
@@ -2544,7 +2554,7 @@ packages:
       '@typescript-eslint/eslint-plugin': 5.42.1_2udltptbznfmezdozpdoa2aemq
       '@typescript-eslint/experimental-utils': 5.42.1_rmayb2veg2btbq6mbmnyivgasy
       eslint: 8.27.0
-      jest: 27.5.1
+      jest: 27.5.1_ts-node@10.9.1
     transitivePeerDependencies:
       - supports-color
       - typescript
@@ -3534,7 +3544,7 @@ packages:
       - supports-color
     dev: true
 
-  /jest-cli/27.5.1:
+  /jest-cli/27.5.1_ts-node@10.9.1:
     resolution: {integrity: sha512-Hc6HOOwYq4/74/c62dEE3r5elx8wjYqxY0r0G/nFrLDPMFRu6RA/u8qINOIkvhxG7mMQ5EJsOGfRpI8L6eFUVw==}
     engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
     hasBin: true
@@ -3544,14 +3554,14 @@ packages:
       node-notifier:
         optional: true
     dependencies:
-      '@jest/core': 27.5.1
+      '@jest/core': 27.5.1_ts-node@10.9.1
       '@jest/test-result': 27.5.1
       '@jest/types': 27.5.1
       chalk: 4.1.2
       exit: 0.1.2
       graceful-fs: 4.2.10
       import-local: 3.1.0
-      jest-config: 27.5.1
+      jest-config: 27.5.1_ts-node@10.9.1
       jest-util: 27.5.1
       jest-validate: 27.5.1
       prompts: 2.4.2
@@ -3564,7 +3574,7 @@ packages:
       - utf-8-validate
     dev: true
 
-  /jest-config/27.5.1:
+  /jest-config/27.5.1_ts-node@10.9.1:
     resolution: {integrity: sha512-5sAsjm6tGdsVbW9ahcChPAFCk4IlkQUknH5AvKjuLTSlcO/wCZKyFdn7Rg0EkC+OGgWODEy2hDpWB1PgzH0JNA==}
     engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
     peerDependencies:
@@ -3597,6 +3607,7 @@ packages:
       pretty-format: 27.5.1
       slash: 3.0.0
       strip-json-comments: 3.1.1
+      ts-node: 10.9.1_evej5wzm4hojmu6uzxwpspdmsu
     transitivePeerDependencies:
       - bufferutil
       - canvas
@@ -3943,7 +3954,7 @@ packages:
       supports-color: 8.1.1
     dev: true
 
-  /jest/27.5.1:
+  /jest/27.5.1_ts-node@10.9.1:
     resolution: {integrity: sha512-Yn0mADZB89zTtjkPJEXwrac3LHudkQMR+Paqa8uxJHCBr9agxztUifWCyiYrjhMPBoUVBjyny0I7XH6ozDr7QQ==}
     engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
     hasBin: true
@@ -3953,9 +3964,9 @@ packages:
       node-notifier:
         optional: true
     dependencies:
-      '@jest/core': 27.5.1
+      '@jest/core': 27.5.1_ts-node@10.9.1
       import-local: 3.1.0
-      jest-cli: 27.5.1
+      jest-cli: 27.5.1_ts-node@10.9.1
     transitivePeerDependencies:
       - bufferutil
       - canvas
@@ -4247,7 +4258,6 @@ packages:
   /make-error/1.3.6:
     resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==}
     dev: true
-    optional: true
 
   /makeerror/1.0.12:
     resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==}
@@ -4908,6 +4918,14 @@ packages:
       glob: 7.2.3
     dev: true
 
+  /rollup/2.78.1:
+    resolution: {integrity: sha512-VeeCgtGi4P+o9hIg+xz4qQpRl6R401LWEXBmxYKOV4zlF82lyhgh2hTZnheFUbANE8l2A41F458iwj2vEYaXJg==}
+    engines: {node: '>=10.0.0'}
+    hasBin: true
+    optionalDependencies:
+      fsevents: 2.3.2
+    dev: true
+
   /rollup/2.79.1:
     resolution: {integrity: sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==}
     engines: {node: '>=10.0.0'}
@@ -5303,6 +5321,17 @@ packages:
       supports-hyperlinks: 2.3.0
     dev: true
 
+  /terser/5.15.1:
+    resolution: {integrity: sha512-K1faMUvpm/FBxjBXud0LWVAGxmvoPbZbfTCYbSgaaYQaIXI3/TdI7a7ZGA73Zrou6Q8Zmz3oeUTsp/dj+ag2Xw==}
+    engines: {node: '>=10'}
+    hasBin: true
+    dependencies:
+      '@jridgewell/source-map': 0.3.2
+      acorn: 8.8.1
+      commander: 2.20.3
+      source-map-support: 0.5.21
+    dev: true
+
   /test-exclude/6.0.0:
     resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==}
     engines: {node: '>=8'}
@@ -5375,7 +5404,7 @@ packages:
     resolution: {integrity: sha512-ERjHQMWY6rmVVAlNTIxaL1PPKjEfewZZDLcEvjDGyGmr0jLYkX3n579A3CfCThTtcBHHpDjsbI2Ac3xnAx1h6g==}
     dev: false
 
-  /ts-node/10.9.1_yodorn5kzjgomblrsstrk2spaa:
+  /ts-node/10.9.1_evej5wzm4hojmu6uzxwpspdmsu:
     resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
     hasBin: true
     peerDependencies:
@@ -5394,7 +5423,7 @@ packages:
       '@tsconfig/node12': 1.0.11
       '@tsconfig/node14': 1.0.3
       '@tsconfig/node16': 1.0.3
-      '@types/node': 14.18.33
+      '@types/node': 18.11.7
       acorn: 8.8.1
       acorn-walk: 8.2.0
       arg: 4.1.3
@@ -5405,7 +5434,6 @@ packages:
       v8-compile-cache-lib: 3.0.1
       yn: 3.1.1
     dev: true
-    optional: true
 
   /tslib/1.14.1:
     resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==}
@@ -5531,7 +5559,6 @@ packages:
   /v8-compile-cache-lib/3.0.1:
     resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
     dev: true
-    optional: true
 
   /v8-to-istanbul/8.1.1:
     resolution: {integrity: sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==}
@@ -5549,6 +5576,19 @@ packages:
       spdx-expression-parse: 3.0.1
     dev: true
 
+  /vite-plugin-chunk-split/0.4.3_sass@1.55.0+terser@5.15.1:
+    resolution: {integrity: sha512-PW22WxPRXL+ZlOQ98Ma34g0aNjBQDbA3V7b1s8dVANfKKeBznhxcLOQH7/nv2zmXtKellNiB0ABt37odmBuxwg==}
+    dependencies:
+      es-module-lexer: 1.1.0
+      magic-string: 0.26.7
+      vite: 3.1.0_sass@1.55.0+terser@5.15.1
+    transitivePeerDependencies:
+      - less
+      - sass
+      - stylus
+      - terser
+    dev: true
+
   /vite-plugin-eslint/1.8.1_eslint@8.27.0+vite@3.2.0:
     resolution: {integrity: sha512-PqdMf3Y2fLO9FsNPmMX+//2BF5SF8nEWspZdgl4kSt7UvHDRHVVfHvxsD7ULYzZrJDGRxR81Nq7TOFgwMnUang==}
     peerDependencies:
@@ -5559,7 +5599,7 @@ packages:
       '@types/eslint': 8.4.10
       eslint: 8.27.0
       rollup: 2.79.1
-      vite: 3.2.0_sass@1.55.0
+      vite: 3.2.0_sass@1.55.0+terser@5.15.1
     dev: true
 
   /vite-plugin-html-env/1.2.7_vite@3.2.0:
@@ -5568,7 +5608,7 @@ packages:
     peerDependencies:
       vite: '*'
     dependencies:
-      vite: 3.2.0_sass@1.55.0
+      vite: 3.2.0_sass@1.55.0+terser@5.15.1
     dev: true
 
   /vite-plugin-mkcert/1.10.1_vite@3.2.0:
@@ -5581,7 +5621,7 @@ packages:
       axios: 0.21.4_debug@4.3.4
       debug: 4.3.4
       picocolors: 1.0.0
-      vite: 3.2.0_sass@1.55.0
+      vite: 3.2.0_sass@1.55.0+terser@5.15.1
     transitivePeerDependencies:
       - encoding
       - supports-color
@@ -5606,13 +5646,42 @@ packages:
       '@windicss/plugin-utils': 1.8.8
       debug: 4.3.4
       kolorist: 1.6.0
-      vite: 3.2.0_sass@1.55.0
+      vite: 3.2.0_sass@1.55.0+terser@5.15.1
       windicss: 3.5.6
     transitivePeerDependencies:
       - supports-color
     dev: true
 
-  /vite/3.2.0_sass@1.55.0:
+  /vite/3.1.0_sass@1.55.0+terser@5.15.1:
+    resolution: {integrity: sha512-YBg3dUicDpDWFCGttmvMbVyS9ydjntwEjwXRj2KBFwSB8SxmGcudo1yb8FW5+M/G86aS8x828ujnzUVdsLjs9g==}
+    engines: {node: ^14.18.0 || >=16.0.0}
+    hasBin: true
+    peerDependencies:
+      less: '*'
+      sass: '*'
+      stylus: '*'
+      terser: ^5.4.0
+    peerDependenciesMeta:
+      less:
+        optional: true
+      sass:
+        optional: true
+      stylus:
+        optional: true
+      terser:
+        optional: true
+    dependencies:
+      esbuild: 0.15.12
+      postcss: 8.4.18
+      resolve: 1.22.1
+      rollup: 2.78.1
+      sass: 1.55.0
+      terser: 5.15.1
+    optionalDependencies:
+      fsevents: 2.3.2
+    dev: true
+
+  /vite/3.2.0_sass@1.55.0+terser@5.15.1:
     resolution: {integrity: sha512-Ovj7+cqIdM1I0LPCk2CWxzgADXMix3NLXpUT6g7P7zg/a9grk/TaC3qn9YMg7w7M0POIVCBOp1aBANJW+RH7oA==}
     engines: {node: ^14.18.0 || >=16.0.0}
     hasBin: true
@@ -5639,6 +5708,7 @@ packages:
       resolve: 1.22.1
       rollup: 2.79.1
       sass: 1.55.0
+      terser: 5.15.1
     optionalDependencies:
       fsevents: 2.3.2
     dev: true
@@ -5920,7 +5990,6 @@ packages:
     resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}
     engines: {node: '>=6'}
     dev: true
-    optional: true
 
   /yocto-queue/0.1.0:
     resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}

+ 19 - 17
src/components/chatRoom/controls/actions.ts

@@ -212,26 +212,28 @@ const handleUserMuted = (UserId?: string, muted?: boolean, members?: UserInfoTyp
 };
 
 //被动处理用离开
-const handleUserLeave = (user: UserInfoType, members: UserInfoType[]) => {
-  console.log('有人离开了', user.UserId);
+const handleUserLeave = (user?: UserInfoType, members?: UserInfoType[]) => {
+  console.log('有人离开了', user?.UserId);
   const rtcStore = useRtcStore();
-  let name = user.Nickname;
-  if (user.Role == 'leader') {
-    name = '';
-    Dialog.toast({ content: `主持人离开了房间` });
-  }
+  if (user) {
+    let name = user.Nickname;
+    if (user.Role == 'leader') {
+      name = '';
+      Dialog.toast({ content: `主持人离开了房间` });
+    }
 
-  const data = {
-    role: user.Role,
-    mode: '',
-    Nickname: name,
-    UserId: user.UserId,
-    text: '离开房间',
-  };
+    const data = {
+      role: user.Role,
+      mode: '',
+      Nickname: name,
+      UserId: user.UserId,
+      text: '离开房间',
+    };
 
-  console.log('members', user, members);
-  rtcStore.addToChatList(data);
-  members && rtcStore.setMemberList(members);
+    console.log('members', user, members);
+    rtcStore.addToChatList(data);
+    members && rtcStore.setMemberList(members);
+  }
 };
 //被动处理用离开 全员解散
 const handleLeaderDismiss = () => {

+ 3 - 3
src/hooks/userApp.ts

@@ -22,12 +22,12 @@ interface appOptions {
 // let deferred = KanKan.Deferred()
 export function createApp(options: appOptions): Promise<KanKanInstance> {
   if (!options?.region) {
-    options.region = import.meta.env.VUE_APP_REGION_URL;
+    options.region = import.meta.env.VITE_APP_REGION_URL;
   }
   if (!options?.resource) {
-    options.region = import.meta.env.VUE_APP_RESOURCE_URL;
+    options.resource = import.meta.env.VITE_APP_RESOURCE_URL;
   }
-  if (!options?.resource) {
+  if (!options?.server) {
     options.server = '/';
   }
   console.log('options', options);

+ 8 - 8
src/hooks/userSocket.ts

@@ -38,15 +38,15 @@ async function closeSocket() {
   socket.emit('disconnected');
   console.log('socket', socket.connected);
   rtcStore.clearMemberList();
+  createNewURLEntry({
+    vruserId: '',
+    isTour: 1,
+    name: '',
+    role: '',
+    roomId: rtcStore.roomId,
+    avatar: '',
+  });
   setTimeout(() => {
-    createNewURLEntry({
-      vruserId: '',
-      isTour: 1,
-      name: '',
-      role: '',
-      roomId: rtcStore.roomId,
-      avatar: '',
-    });
     location.reload();
   }, 100);
 }

+ 26 - 0
vite.config.ts

@@ -7,6 +7,7 @@ import WindiCSS from 'vite-plugin-windicss';
 import mkcert from 'vite-plugin-mkcert';
 // import eslintPlugin from 'vite-plugin-eslint'
 // import requireTransform from 'vite-plugin-require-transform'
+import { chunkSplitPlugin } from 'vite-plugin-chunk-split';
 
 function pathResolve(dir: string) {
   return resolve(process.cwd(), '.', dir);
@@ -19,6 +20,14 @@ export default ({ mode }) =>
       // eslintPlugin({
       //   include: ['src/**/*.ts', 'src/**/*.vue', 'src/*.js', 'src/*.vue']
       // }),
+      //@ts-ignore
+      chunkSplitPlugin({
+        strategy: 'default',
+        customSplitting: {
+          'vue-vendor': ['vue'],
+          'utils': [/src\/utils/]
+        },
+      }),
       mkcert(),
       vue(),
       WindiCSS(),
@@ -53,4 +62,21 @@ export default ({ mode }) =>
         },
       },
     },
+    build: {
+      // minify: false,
+      minify: 'terser',
+      // target: 'es2015',
+      // cssTarget: 'chrome86',
+      outDir: 'dist',
+      terserOptions: {
+        compress: {
+          keep_infinity: true,
+          // Used to delete console in production environment
+          drop_console: false,
+        },
+      },
+      // Turning off brotliSize display can slightly reduce packaging time
+      // brotliSize: false,
+      chunkSizeWarningLimit: 2000,
+    },
   });