shuisheng vor 2 Jahren
Ursprung
Commit
21da907f54

+ 1 - 0
DISCLAIMER.md

@@ -0,0 +1 @@
+# 免责声明

+ 24 - 10
handleGiteeJenkins.js → handleGiteeJenkins.mjs

@@ -1,12 +1,14 @@
 // WARN 该文件只是方便我将当前项目复制一份到我电脑的另一个位置(gitee私有仓库的位置),其他人不需要管这个文件~
-const fs = require('fs');
-const path = require('path');
-const { execSync } = require('child_process');
+
+import { execSync } from 'node:child_process';
+import fs from 'node:fs';
+import path from 'node:path';
+import trash from 'trash';
 
 const allFile = [];
 const ignore = ['.DS_Store', '.git', 'node_modules', 'dist'];
-const localDir = path.resolve(__dirname);
-const giteeDir = path.resolve(__dirname, '../../jenkins/billd-live');
+const localDir = '/Users/huangshuisheng/Desktop/hss/github/billd-live';
+const giteeDir = '/Users/huangshuisheng/Desktop/hss/jenkins/billd-live';
 
 const dir = fs.readdirSync(localDir).filter((item) => {
   if (ignore.includes(item)) {
@@ -57,10 +59,22 @@ function putFile() {
   }
 }
 
-if (path.resolve(__dirname) === giteeDir) {
-  // eslint-disable-next-line
-  console.log('当前在gitee文件目录,直接退出!');
-} else {
+async function clearOld() {
+  const giteeDirAllFile = fs.readdirSync(giteeDir);
+  const queue = [];
+  giteeDirAllFile.forEach((url) => {
+    const fullurl = `${giteeDir}/${url}`;
+    if (!['node_modules', '.git'].includes(url)) {
+      queue.push(trash(fullurl));
+    }
+  });
+  await Promise.all(queue);
+}
+
+clearOld().then(() => {
+  const gitignoreTxt =
+    'node_modules\ndist\ncomponents.d.ts\n.eslintcache\n.DS_Store\n';
+  fs.writeFileSync(path.resolve(giteeDir, './.gitignore'), gitignoreTxt);
   findFile(dir);
   putFile();
   execSync(`pnpm i`, { cwd: giteeDir });
@@ -69,4 +83,4 @@ if (path.resolve(__dirname) === giteeDir) {
     cwd: giteeDir,
   });
   execSync(`git push`, { cwd: giteeDir });
-}
+});

+ 3 - 2
package.json

@@ -9,7 +9,7 @@
   "scripts": {
     "build": "webpack --config ./script/config/webpack.common.ts --env production",
     "commit": "cz",
-    "copy": "node ./handleGiteeJenkins.js",
+    "copy": "ts-node ./handleGiteeJenkins.mjs",
     "lint": "eslint --config ./.eslintrc.js . --ext .js,.jsx,.ts,.tsx,.vue --cache",
     "lint:fix": "eslint --config ./.eslintrc.js . --ext .js,.jsx,.ts,.tsx,.vue --cache --fix",
     "prepare": "husky install",
@@ -49,6 +49,7 @@
     "qrcode": "^1.5.3",
     "socket.io-client": "^4.7.2",
     "spark-md5": "^3.0.2",
+    "trash": "^8.1.1",
     "video.js": "^8.3.0",
     "vue": "^3.3.4",
     "vue-demi": "^0.13.11",
@@ -123,4 +124,4 @@
     "webpackbar": "^5.0.2",
     "windicss-webpack-plugin": "^1.7.7"
   }
-}
+}

+ 211 - 5
pnpm-lock.yaml

@@ -56,6 +56,9 @@ dependencies:
   spark-md5:
     specifier: ^3.0.2
     version: 3.0.2
+  trash:
+    specifier: ^8.1.1
+    version: 8.1.1
   video.js:
     specifier: ^8.3.0
     version: 8.3.0
@@ -2470,6 +2473,23 @@ packages:
     resolution: {integrity: sha512-sXo/qW2/pAcmT43VoRKOJbDOfV3cYpq3szSVfIThQXNt+E4DfKj361vaAt3c88U5tPUxzEswam7GW48PJqtKAg==}
     dev: true
 
+  /@sindresorhus/chunkify@0.2.0:
+    resolution: {integrity: sha512-mOAiwqu+bIIkNFDCXFJxZEmF9p9WHfSBbpLLmgysYnNkEs7aA0/AvU9+6zLHFqI7JnqdqwAuWu8CbGwGIszRdw==}
+    engines: {node: '>=12'}
+    dev: false
+
+  /@sindresorhus/df@1.0.1:
+    resolution: {integrity: sha512-1Hyp7NQnD/u4DSxR2DGW78TF9k7R0wZ8ev0BpMAIzA6yTQSHqNb5wTuvtcPYf4FWbVse2rW7RgDsyL8ua2vXHw==}
+    engines: {node: '>=0.10.0'}
+    dev: false
+
+  /@sindresorhus/df@3.1.1:
+    resolution: {integrity: sha512-SME/vtXaJcnQ/HpeV6P82Egy+jThn11IKfwW8+/XVoRD0rmPHVTeKMtww1oWdVnMykzVPjmrDN9S8NBndPEHCQ==}
+    engines: {node: '>=8'}
+    dependencies:
+      execa: 2.1.0
+    dev: false
+
   /@socket.io/component-emitter@3.1.0:
     resolution: {integrity: sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==}
     dev: false
@@ -2487,6 +2507,11 @@ packages:
       webpack: 5.76.2(@swc/core@1.3.84)(esbuild@0.15.18)(webpack-cli@4.10.0)
     dev: true
 
+  /@stroncium/procfs@1.2.1:
+    resolution: {integrity: sha512-X1Iui3FUNZP18EUvysTHxt+Avu2nlVzyf90YM8OYgP6SGzTzzX/0JgObfO1AQQDzuZtNNz29bVh8h5R97JrjxA==}
+    engines: {node: '>=8'}
+    dev: false
+
   /@swc/core-darwin-arm64@1.3.84:
     resolution: {integrity: sha512-mqK0buOo+toF2HoJ/gWj2ApZbvbIiNq3mMwSTHCYJHlQFQfoTWnl9aaD5GSO4wfNFVYfEZ1R259o5uv5NlVtoA==}
     engines: {node: '>=10'}
@@ -3334,6 +3359,14 @@ packages:
       indent-string: 4.0.0
     dev: true
 
+  /aggregate-error@4.0.1:
+    resolution: {integrity: sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==}
+    engines: {node: '>=12'}
+    dependencies:
+      clean-stack: 4.2.0
+      indent-string: 5.0.0
+    dev: false
+
   /ajv-formats@2.1.1(ajv@8.12.0):
     resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}
     peerDependencies:
@@ -3485,11 +3518,23 @@ packages:
       is-string: 1.0.7
     dev: true
 
+  /array-union@1.0.2:
+    resolution: {integrity: sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==}
+    engines: {node: '>=0.10.0'}
+    dependencies:
+      array-uniq: 1.0.3
+    dev: false
+
   /array-union@2.1.0:
     resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==}
     engines: {node: '>=8'}
     dev: true
 
+  /array-uniq@1.0.3:
+    resolution: {integrity: sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==}
+    engines: {node: '>=0.10.0'}
+    dev: false
+
   /array.prototype.findlastindex@1.2.2:
     resolution: {integrity: sha512-tb5thFFlUcp7NdNF6/MpDk/1r/4awWG1FIz3YqDf+/zJSTezBb+/5WViH41obXULHVpDzoiCLpJ/ZO9YbJMsdw==}
     engines: {node: '>= 0.4'}
@@ -3936,6 +3981,13 @@ packages:
     engines: {node: '>=6'}
     dev: true
 
+  /clean-stack@4.2.0:
+    resolution: {integrity: sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==}
+    engines: {node: '>=12'}
+    dependencies:
+      escape-string-regexp: 5.0.0
+    dev: false
+
   /cli-cursor@2.1.0:
     resolution: {integrity: sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw==}
     engines: {node: '>=4'}
@@ -4923,6 +4975,13 @@ packages:
     resolution: {integrity: sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==}
     dev: false
 
+  /dir-glob@2.2.2:
+    resolution: {integrity: sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==}
+    engines: {node: '>=4'}
+    dependencies:
+      path-type: 3.0.0
+    dev: false
+
   /dir-glob@3.0.1:
     resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
     engines: {node: '>=8'}
@@ -5057,6 +5116,12 @@ packages:
     resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==}
     engines: {node: '>= 0.8'}
 
+  /end-of-stream@1.4.4:
+    resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==}
+    dependencies:
+      once: 1.4.0
+    dev: false
+
   /engine.io-client@6.5.2:
     resolution: {integrity: sha512-CQZqbrpEYnrpGqC07a9dJDz4gePZUgTPMU3NKJPSeQOyw27Tst4Pl3FemKoFGAlHzgZmKjoRmiJvbWfhCXUlIg==}
     dependencies:
@@ -5452,6 +5517,11 @@ packages:
     engines: {node: '>=10'}
     dev: true
 
+  /escape-string-regexp@5.0.0:
+    resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
+    engines: {node: '>=12'}
+    dev: false
+
   /escodegen@2.1.0:
     resolution: {integrity: sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==}
     engines: {node: '>=6.0'}
@@ -5761,6 +5831,21 @@ packages:
     resolution: {integrity: sha512-qaeGN5bx63s/AXgQo8gj6fBkxge+OoLddLniox5qtLAEY5HSnuSlISXVPxnSae1dWblvTh4/HoMIB+mbMsvZzw==}
     dev: false
 
+  /execa@2.1.0:
+    resolution: {integrity: sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw==}
+    engines: {node: ^8.12.0 || >=9.7.0}
+    dependencies:
+      cross-spawn: 7.0.3
+      get-stream: 5.2.0
+      is-stream: 2.0.1
+      merge-stream: 2.0.0
+      npm-run-path: 3.1.0
+      onetime: 5.1.2
+      p-finally: 2.0.1
+      signal-exit: 3.0.7
+      strip-final-newline: 2.0.0
+    dev: false
+
   /execa@5.1.1:
     resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==}
     engines: {node: '>=10'}
@@ -6227,6 +6312,13 @@ packages:
     engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
     dev: true
 
+  /get-stream@5.2.0:
+    resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==}
+    engines: {node: '>=8'}
+    dependencies:
+      pump: 3.0.0
+    dev: false
+
   /get-stream@6.0.1:
     resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==}
     engines: {node: '>=10'}
@@ -6387,6 +6479,18 @@ packages:
       slash: 4.0.0
     dev: true
 
+  /globby@7.1.1:
+    resolution: {integrity: sha512-yANWAN2DUcBtuus5Cpd+SKROzXHs2iVXFZt/Ykrfz6SAXqacLX25NZpltE+39ceMexYF4TtEadjuSTw8+3wX4g==}
+    engines: {node: '>=4'}
+    dependencies:
+      array-union: 1.0.2
+      dir-glob: 2.2.2
+      glob: 7.2.3
+      ignore: 3.3.10
+      pify: 3.0.0
+      slash: 1.0.0
+    dev: false
+
   /gopd@1.0.1:
     resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==}
     dependencies:
@@ -6699,6 +6803,10 @@ packages:
     resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
     dev: true
 
+  /ignore@3.3.10:
+    resolution: {integrity: sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==}
+    dev: false
+
   /ignore@5.2.4:
     resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==}
     engines: {node: '>= 4'}
@@ -6737,6 +6845,11 @@ packages:
     engines: {node: '>=8'}
     dev: true
 
+  /indent-string@5.0.0:
+    resolution: {integrity: sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==}
+    engines: {node: '>=12'}
+    dev: false
+
   /individual@2.0.0:
     resolution: {integrity: sha512-pWt8hBCqJsUWI/HtcfWod7+N9SgAqyPEaF7JQjwzjn5vGrpg6aQ5qeAFQ7dx//UH4J1O+7xqew+gCeeFt6xN/g==}
     dev: false
@@ -6956,6 +7069,11 @@ packages:
     engines: {node: '>=8'}
     dev: true
 
+  /is-path-inside@4.0.0:
+    resolution: {integrity: sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==}
+    engines: {node: '>=12'}
+    dev: false
+
   /is-plain-obj@1.1.0:
     resolution: {integrity: sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==}
     engines: {node: '>=0.10.0'}
@@ -7713,6 +7831,22 @@ packages:
     engines: {node: '>=0.10.0'}
     dev: true
 
+  /mount-point@3.0.0:
+    resolution: {integrity: sha512-jAhfD7ZCG+dbESZjcY1SdFVFqSJkh/yGbdsifHcPkvuLRO5ugK0Ssmd9jdATu29BTd4JiN+vkpMzVvsUgP3SZA==}
+    engines: {node: '>=0.10.0'}
+    dependencies:
+      '@sindresorhus/df': 1.0.1
+      pify: 2.3.0
+      pinkie-promise: 2.0.1
+    dev: false
+
+  /move-file@3.1.0:
+    resolution: {integrity: sha512-4aE3U7CCBWgrQlQDMq8da4woBWDGHioJFiOZ8Ie6Yq2uwYQ9V2kGhTz4x3u6Wc+OU17nw0yc3rJ/lQ4jIiPe3A==}
+    engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
+    dependencies:
+      path-exists: 5.0.0
+    dev: false
+
   /mpd-parser@1.1.1:
     resolution: {integrity: sha512-uZ/db5wQdlQn1L+OD49YXBhPI9UGeK1SeQE4D5EoaJIhf0WM9X3HDj8d+9PjoG06CgCvGZw3YW/wsHku+CH3yA==}
     hasBin: true
@@ -7905,6 +8039,13 @@ packages:
     engines: {node: '>=10'}
     dev: true
 
+  /npm-run-path@3.1.0:
+    resolution: {integrity: sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==}
+    engines: {node: '>=8'}
+    dependencies:
+      path-key: 3.1.1
+    dev: false
+
   /npm-run-path@4.0.1:
     resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==}
     engines: {node: '>=8'}
@@ -8080,13 +8221,17 @@ packages:
   /os-homedir@1.0.2:
     resolution: {integrity: sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ==}
     engines: {node: '>=0.10.0'}
-    dev: true
 
   /os-tmpdir@1.0.2:
     resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==}
     engines: {node: '>=0.10.0'}
     dev: true
 
+  /p-finally@2.0.1:
+    resolution: {integrity: sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==}
+    engines: {node: '>=8'}
+    dev: false
+
   /p-limit@1.3.0:
     resolution: {integrity: sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==}
     engines: {node: '>=4'}
@@ -8141,6 +8286,13 @@ packages:
       aggregate-error: 3.1.0
     dev: true
 
+  /p-map@5.5.0:
+    resolution: {integrity: sha512-VFqfGDHlx87K66yZrNdI4YGtD70IRyd+zSvgks6mzHPRNkoKy+9EKP4SFC77/vTTQYmRmti7dvqC+m5jBrBAcg==}
+    engines: {node: '>=12'}
+    dependencies:
+      aggregate-error: 4.0.1
+    dev: false
+
   /p-retry@4.6.2:
     resolution: {integrity: sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==}
     engines: {node: '>=8'}
@@ -8219,6 +8371,11 @@ packages:
     resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
     engines: {node: '>=8'}
 
+  /path-exists@5.0.0:
+    resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==}
+    engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
+    dev: false
+
   /path-is-absolute@1.0.1:
     resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==}
     engines: {node: '>=0.10.0'}
@@ -8243,7 +8400,6 @@ packages:
     engines: {node: '>=4'}
     dependencies:
       pify: 3.0.0
-    dev: true
 
   /path-type@4.0.0:
     resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
@@ -8270,12 +8426,10 @@ packages:
   /pify@2.3.0:
     resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==}
     engines: {node: '>=0.10.0'}
-    dev: true
 
   /pify@3.0.0:
     resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==}
     engines: {node: '>=4'}
-    dev: true
 
   /pinia-plugin-persistedstate@3.2.0(pinia@2.0.33):
     resolution: {integrity: sha512-tZbNGf2vjAQcIm7alK40sE51Qu/m9oWr+rEgNm/2AWr1huFxj72CjvpQcIQzMknDBJEkQznCLAGtJTIcLKrKdw==}
@@ -8303,6 +8457,18 @@ packages:
       vue-demi: 0.13.11(vue@3.3.4)
     dev: false
 
+  /pinkie-promise@2.0.1:
+    resolution: {integrity: sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==}
+    engines: {node: '>=0.10.0'}
+    dependencies:
+      pinkie: 2.0.4
+    dev: false
+
+  /pinkie@2.0.4:
+    resolution: {integrity: sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==}
+    engines: {node: '>=0.10.0'}
+    dev: false
+
   /pkcs7@1.0.4:
     resolution: {integrity: sha512-afRERtHn54AlwaF2/+LFszyAANTCggGilmcmILUzEjvs3XgFZT+xE6+QWQcAGmu4xajy+Xtj7acLOPdx5/eXWQ==}
     hasBin: true
@@ -9080,6 +9246,13 @@ packages:
     dev: false
     optional: true
 
+  /pump@3.0.0:
+    resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==}
+    dependencies:
+      end-of-stream: 1.4.4
+      once: 1.4.0
+    dev: false
+
   /punycode@2.3.0:
     resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==}
     engines: {node: '>=6'}
@@ -9758,6 +9931,11 @@ packages:
       mrmime: 1.0.1
       totalist: 1.1.0
 
+  /slash@1.0.0:
+    resolution: {integrity: sha512-3TYDR7xWt4dIqV2JauJr+EJeW356RXijHeUlO+8djJ+uBXPn8/2dpzBc8yQhh583sVvc9CvFAeQVgijsH+PNNg==}
+    engines: {node: '>=0.10.0'}
+    dev: false
+
   /slash@3.0.0:
     resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==}
     engines: {node: '>=8'}
@@ -10311,6 +10489,20 @@ packages:
     dev: false
     optional: true
 
+  /trash@8.1.1:
+    resolution: {integrity: sha512-r15NUF+BJpDBKLTyOXaB+PhF8qh53TAOTpu/wCt6bqpu488jamsiOV7VdC//yPwAnyGIv1EJgetEnjLNer5XVw==}
+    engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
+    dependencies:
+      '@sindresorhus/chunkify': 0.2.0
+      '@stroncium/procfs': 1.2.1
+      globby: 7.1.1
+      is-path-inside: 4.0.0
+      move-file: 3.1.0
+      p-map: 5.5.0
+      uuid: 8.3.2
+      xdg-trashdir: 3.1.0
+    dev: false
+
   /treemate@0.3.11:
     resolution: {integrity: sha512-M8RGFoKtZ8dF+iwJfAJTOH/SM4KluKOKRJpjCMhI8bG3qB74zrFoArKZ62ll0Fr3mqkMJiQOmWYkdYgDeITYQg==}
     dev: false
@@ -10612,7 +10804,6 @@ packages:
     engines: {node: '>=0.10.0'}
     dependencies:
       os-homedir: 1.0.2
-    dev: true
 
   /util-deprecate@1.0.2:
     resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
@@ -11303,6 +11494,21 @@ packages:
       utf-8-validate:
         optional: true
 
+  /xdg-basedir@4.0.0:
+    resolution: {integrity: sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==}
+    engines: {node: '>=8'}
+    dev: false
+
+  /xdg-trashdir@3.1.0:
+    resolution: {integrity: sha512-N1XQngeqMBoj9wM4ZFadVV2MymImeiFfYD+fJrNlcVcOHsJFFQe7n3b+aBoTPwARuq2HQxukfzVpQmAk1gN4sQ==}
+    engines: {node: '>=10'}
+    dependencies:
+      '@sindresorhus/df': 3.1.1
+      mount-point: 3.0.0
+      user-home: 2.0.0
+      xdg-basedir: 4.0.0
+    dev: false
+
   /xml-name-validator@4.0.0:
     resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==}
     engines: {node: '>=12'}

+ 0 - 62
src/hooks/loginModal/index copy.vue

@@ -1,62 +0,0 @@
-<template>
-  <div
-    v-if="show"
-    class="useTip-wrap"
-  >
-    <ModalCpt
-      :title="title"
-      :mask-closable="maskClosable"
-      @close="show = !show"
-    >
-      <div class="container">
-        <img
-          class="qq-logo"
-          src="@/assets/img/qq-logo.webp"
-          alt=""
-          @click="handleQQlogin"
-        />
-        <div>qq登录</div>
-      </div>
-
-      <template #footer></template>
-    </ModalCpt>
-  </div>
-</template>
-
-<script lang="ts">
-import { defineComponent, ref } from 'vue';
-
-import ModalCpt from '@/components/Modal/index.vue';
-import { useQQLogin } from '@/hooks/use-login';
-
-export default defineComponent({
-  components: { ModalCpt },
-  setup() {
-    const title = ref('登录');
-    const show = ref(false);
-    const maskClosable = ref(true);
-    function handleQQlogin() {
-      show.value = !show.value;
-      useQQLogin();
-    }
-    return {
-      title,
-      show,
-      maskClosable,
-      handleQQlogin,
-    };
-  },
-});
-</script>
-
-<style lang="scss" scoped>
-.useTip-wrap {
-  .container {
-    text-align: center;
-    .qq-logo {
-      cursor: pointer;
-      width: 60px;
-    }
-  }
-}
-</style>

+ 3 - 5
src/hooks/loginModal/index.vue

@@ -3,7 +3,7 @@
     v-if="show"
     class="useTip-wrap"
   >
-    <ModalCpt
+    <Modal
       :title="title"
       :mask-closable="maskClosable"
       @close="show = !show"
@@ -19,25 +19,23 @@
       </div>
 
       <template #footer></template>
-    </ModalCpt>
+    </Modal>
   </div>
 </template>
 
 <script lang="ts">
 import { defineComponent, ref } from 'vue';
 
-import ModalCpt from '@/components/Modal/index.vue';
 import { useQQLogin } from '@/hooks/use-login';
 
 export default defineComponent({
-  components: { ModalCpt },
   setup() {
     const title = ref('登录');
     const show = ref(false);
     const maskClosable = ref(true);
     function handleQQlogin() {
       show.value = !show.value;
-      useQQLogin();
+      useQQLogin({ exp: 24 });
     }
     return {
       title,

+ 2 - 5
src/hooks/modal/index.vue

@@ -3,7 +3,7 @@
     v-if="show"
     class="useTip-wrap"
   >
-    <ModalCpt
+    <Modal
       :title="title"
       :mask-closable="maskClosable"
       @close="handleCancel()"
@@ -28,17 +28,14 @@
           </div>
         </div>
       </template>
-    </ModalCpt>
+    </Modal>
   </div>
 </template>
 
 <script lang="ts">
 import { VNode, defineComponent, ref, render, watch } from 'vue';
 
-import ModalCpt from '@/components/Modal/index.vue';
-
 export default defineComponent({
-  components: { ModalCpt },
   emits: ['ok', 'cancel'],
   setup() {
     const title = ref('');

+ 1 - 1
src/hooks/use-rtcParams.ts

@@ -96,7 +96,7 @@ export const useRTCParams = () => {
     {
       label: '1440P',
       value: 1440,
-      // disabled: true,
+      disabled: true,
     },
   ]);
   const allMediaTypeList: Record<string, { type: MediaTypeEnum; txt: string }> =

+ 1 - 1
src/hooks/use-websocket.ts

@@ -1,6 +1,7 @@
 import { copyToClipBoard, getRandomString } from 'billd-utils';
 import { NButton, useDialog } from 'naive-ui';
 import { computed, h, onUnmounted, ref, watch } from 'vue';
+import { useRoute } from 'vue-router';
 
 import { fetchVerifyPkKey } from '@/api/liveRoom';
 import { fetchRtcV1Publish } from '@/api/srs';
@@ -38,7 +39,6 @@ import {
   WsStartLiveType,
 } from '@/types/websocket';
 import { createVideo } from '@/utils';
-import { useRoute } from 'vue-router';
 
 import { useRTCParams } from './use-rtcParams';
 import { useTip } from './use-tip';

+ 0 - 2
src/layout/pc/index.vue

@@ -5,7 +5,6 @@
     <router-view v-slot="{ Component }">
       <component :is="Component"></component>
     </router-view>
-    <ModalCpt></ModalCpt>
     <SidebarCpt v-if="MODULE_CONFIG_SWITCH.sidebar"></SidebarCpt>
     <LoginModal v-if="appStore.showLoginModal"></LoginModal>
   </div>
@@ -16,7 +15,6 @@ import { MODULE_CONFIG_SWITCH } from '@/constant';
 import { useAppStore } from '@/store/app';
 
 import HeadCpt from './head/index.vue';
-import ModalCpt from './modal/index.vue';
 import SidebarCpt from './sidebar/index.vue';
 
 document.body.style.minWidth = '1200px';

+ 8 - 2
src/network/webRTC.ts

@@ -1,6 +1,6 @@
 import { getRandomString } from 'billd-utils';
 
-import { MediaTypeEnum } from '@/interface';
+import { LiveLineEnum, MediaTypeEnum } from '@/interface';
 import { AppRootState, useAppStore } from '@/store/app';
 import { useNetworkStore } from '@/store/network';
 import { WsCandidateType, WsMsgTypeEnum } from '@/types/websocket';
@@ -151,6 +151,7 @@ export class WebRTCClass {
     this.localStream?.getVideoTracks().forEach((track) => {
       if (!appStore.allTrack.find((info) => info.track?.id === track.id)) {
         addTrack.push({
+          openEye: true,
           id: getRandomString(8),
           track,
           stream,
@@ -167,6 +168,7 @@ export class WebRTCClass {
     this.localStream?.getAudioTracks().forEach((track) => {
       if (!appStore.allTrack.find((info) => info.track?.id === track.id)) {
         addTrack.push({
+          openEye: true,
           id: getRandomString(8),
           track,
           stream,
@@ -183,6 +185,7 @@ export class WebRTCClass {
     stream.getVideoTracks().forEach((track) => {
       if (!appStore.allTrack.find((info) => info.track?.id === track.id)) {
         addTrack.push({
+          openEye: true,
           id: getRandomString(8),
           track,
           stream,
@@ -199,6 +202,7 @@ export class WebRTCClass {
     stream.getAudioTracks().forEach((track) => {
       if (!appStore.allTrack.find((info) => info.track?.id === track.id)) {
         addTrack.push({
+          openEye: true,
           id: getRandomString(8),
           track,
           stream,
@@ -394,6 +398,7 @@ export class WebRTCClass {
 
   handleConnectionEvent = () => {
     if (!this.peerConnection) return;
+    const appStore = useAppStore();
 
     console.warn(`${this.roomId},开始监听pc的icecandidate`);
     // icecandidate
@@ -478,6 +483,7 @@ export class WebRTCClass {
         if (connectionState === 'connected') {
           // 表示每一个 ICE 连接要么正在使用(connected 或 completed 状态),要么已被关闭(closed 状态);并且,至少有一个连接处于 connected 或 completed 状态。
           console.warn(this.roomId, 'connectionState:connected');
+          appStore.setLiveLine(LiveLineEnum.rtc);
           if (this.maxBitrate !== -1) {
             this.setMaxBitrate(this.maxBitrate);
           }
@@ -529,7 +535,7 @@ export class WebRTCClass {
             //   urls: 'stun:stun.l.google.com:19302',
             // },
             {
-              urls: 'turn:hsslive.cn:3478',
+              urls: 'turn:live.hsslive.cn:3478',
               username: 'hss',
               credential: '123456',
             },

+ 1 - 0
src/store/app/index.ts

@@ -19,6 +19,7 @@ export type AppRootState = {
     deviceId?: string;
     mediaName: string;
     type: MediaTypeEnum;
+    openEye: boolean;
     track?: MediaStreamTrack;
     stream?: MediaStream;
     streamid?: string;

+ 20 - 2
src/utils/index.ts

@@ -355,13 +355,31 @@ export function videoToCanvas(data: {
   }
   data.resize?.({ w, h });
   videoEl.addEventListener('resize', handleResize);
+  const defaultRatio = 16 / 9;
   function drawCanvas() {
     canvas.width = w;
     canvas.height = h;
+    const videoRatio = w / h;
+    // 比率的值越大,说明高的值越小
+    // 如果视频的比率比默认dom的比率大,则说明同等宽度的情况下,视频的高度会比默认dom的高度值低
     if (w > h) {
-      canvas.style.minWidth = '100%';
+      if (videoRatio > defaultRatio) {
+        // 视频的比率比dom比率大
+        canvas.style.minWidth = '100%';
+        canvas.style.maxHeight = '100%';
+      } else {
+        canvas.style.minHeight = '100%';
+        canvas.style.maxWidth = '100%';
+      }
     } else {
-      canvas.style.minHeight = '100%';
+      if (videoRatio > defaultRatio) {
+        // 视频的比率比dom比率大
+        canvas.style.minHeight = '100%';
+        canvas.style.maxWidth = '100%';
+      } else {
+        canvas.style.minWidth = '100%';
+        canvas.style.maxHeight = '100%';
+      }
     }
     ctx.drawImage(videoEl, 0, 0, w, h);
     timer = requestAnimationFrame(drawCanvas);

+ 99 - 25
src/views/push/index.vue

@@ -98,9 +98,7 @@
               <i class="ico"></i>
               <span>
                 正在观看:
-                {{
-                  liveUserList.filter((item) => item.id !== mySocketId).length
-                }}
+                {{ liveUserList.length - 1 }}
               </span>
             </span>
           </div>
@@ -136,17 +134,18 @@
             )"
             :key="index"
             class="item"
+            @click="handleActiveObject(item)"
           >
-            <span class="name">
+            <div class="name">
               {{ NODE_ENV === 'development' ? item.id : '' }}({{
                 mediaTypeEnumMap[item.type]
               }}){{ item.mediaName }}
-            </span>
+            </div>
             <div class="control">
               <div
                 v-if="item.audio === 1"
                 class="control-item"
-                @click="handleChangeMuted(item)"
+                @click.stop="handleChangeMuted(item)"
               >
                 <n-popover
                   placement="top"
@@ -168,6 +167,23 @@
                   </div>
                 </n-popover>
               </div>
+              <div
+                class="control-item"
+                @click="handleEye(item)"
+              >
+                <n-icon
+                  size="16"
+                  v-if="item.openEye"
+                >
+                  <EyeOutline></EyeOutline>
+                </n-icon>
+                <n-icon
+                  size="16"
+                  v-else
+                >
+                  <EyeOffOutline></EyeOffOutline>
+                </n-icon>
+              </div>
               <div
                 class="control-item"
                 @click="handleEdit(item)"
@@ -178,7 +194,7 @@
               </div>
               <div
                 class="control-item"
-                @click="handleDel(item)"
+                @click.stop="handleDel(item)"
               >
                 <n-icon size="16">
                   <Close></Close>
@@ -354,6 +370,8 @@
 import {
   Close,
   CreateOutline,
+  EyeOffOutline,
+  EyeOutline,
   VolumeHighOutline,
   VolumeMuteOutline,
 } from '@vicons/ionicons5';
@@ -504,7 +522,8 @@ watch(
     console.log('pkStream', newval);
     if (newval) {
       addMediaOk({
-        id: getRandomEnglishString(8),
+        id: getRandomEnglishString(6),
+        openEye: true,
         audio: 2,
         video: 1,
         mediaName: 'pkStream',
@@ -765,7 +784,8 @@ function handleMixedAudio() {
   const nullAudio = nullAudioStream.value?.getAudioTracks()[0];
   if (nullAudio) {
     allAudioTrack.push({
-      id: getRandomEnglishString(8),
+      openEye: true,
+      id: getRandomEnglishString(6),
       audio: 2,
       video: 1,
       mediaName: '占位空音频',
@@ -1156,6 +1176,7 @@ async function handleCache() {
   cacheStore['resource-list'].forEach((item) => {
     // @ts-ignore
     const obj: AppRootState['allTrack'][0] = {};
+    obj.openEye = item.openEye;
     obj.audio = item.audio;
     obj.video = item.video;
     obj.id = item.id;
@@ -1206,6 +1227,7 @@ async function handleCache() {
             canvasDom.scale(
               item.scaleInfo[window.devicePixelRatio].scaleX || 1
             );
+            canvasDom.opacity = item.openEye ? 1 : 0;
             fabricCanvas.value!.add(canvasDom);
             obj.videoEl = videoEl;
             obj.canvasDom = canvasDom;
@@ -1256,6 +1278,7 @@ async function handleCache() {
           handleMoving({ canvasDom, id: obj.id });
           handleScaling({ canvasDom, id: obj.id });
           canvasDom.scale(item.scaleInfo[window.devicePixelRatio].scaleX || 1);
+          canvasDom.opacity = item.openEye ? 1 : 0;
           fabricCanvas.value.add(canvasDom);
           obj.canvasDom = canvasDom;
         }
@@ -1298,6 +1321,7 @@ async function handleCache() {
             canvasDom.scale(
               item.scaleInfo[window.devicePixelRatio].scaleX || 1
             );
+            canvasDom.opacity = item.openEye ? 1 : 0;
             fabricCanvas.value!.add(canvasDom);
             obj.videoEl = videoEl;
             obj.canvasDom = canvasDom;
@@ -1361,6 +1385,7 @@ async function handleCache() {
           handleMoving({ canvasDom, id: item.id });
           handleScaling({ canvasDom, id: item.id });
           canvasDom.scale(item.scaleInfo[window.devicePixelRatio].scaleX || 1);
+          canvasDom.opacity = item.openEye ? 1 : 0;
           fabricCanvas.value!.add(canvasDom);
           obj.videoEl = videoEl;
           obj.canvasDom = canvasDom;
@@ -1394,6 +1419,7 @@ async function handleCache() {
         handleScaling({ canvasDom, id: obj.id });
         // fabric.Text类型不能除以分辨率
         canvasDom.scale(item.scaleInfo[window.devicePixelRatio].scaleX);
+        canvasDom.opacity = item.openEye ? 1 : 0;
         fabricCanvas.value.add(canvasDom);
         obj.canvasDom = canvasDom;
       }
@@ -1413,6 +1439,7 @@ async function handleCache() {
         handleScaling({ canvasDom, id: obj.id });
         // fabric.Text类型不能除以分辨率
         canvasDom.scale(item.scaleInfo[window.devicePixelRatio].scaleX);
+        canvasDom.opacity = item.openEye ? 1 : 0;
         fabricCanvas.value.add(canvasDom);
         obj.canvasDom = canvasDom;
       }
@@ -1432,6 +1459,7 @@ async function handleCache() {
         handleScaling({ canvasDom, id: obj.id });
         // fabric.Text类型不能除以分辨率
         canvasDom.scale(item.scaleInfo[window.devicePixelRatio].scaleX);
+        canvasDom.opacity = item.openEye ? 1 : 0;
         fabricCanvas.value.add(canvasDom);
         obj.canvasDom = canvasDom;
       }
@@ -1487,7 +1515,8 @@ async function addMediaOk(val: AppRootState['allTrack'][0]) {
     });
     if (!event) return;
     const videoTrack: AppRootState['allTrack'][0] = {
-      id: getRandomEnglishString(8),
+      id: getRandomEnglishString(6),
+      openEye: true,
       audio: 2,
       video: 1,
       mediaName: val.mediaName,
@@ -1515,6 +1544,7 @@ async function addMediaOk(val: AppRootState['allTrack'][0]) {
       videoTrack.audio = 1;
       videoTrack.volume = appStore.normalVolume;
       const audioTrack: AppRootState['allTrack'][0] = {
+        openEye: true,
         id: videoTrack.id,
         audio: 1,
         video: 2,
@@ -1548,7 +1578,8 @@ async function addMediaOk(val: AppRootState['allTrack'][0]) {
     });
     if (!event) return;
     const videoTrack: AppRootState['allTrack'][0] = {
-      id: getRandomEnglishString(8),
+      id: getRandomEnglishString(6),
+      openEye: true,
       deviceId: val.deviceId,
       audio: 2,
       video: 1,
@@ -1584,7 +1615,8 @@ async function addMediaOk(val: AppRootState['allTrack'][0]) {
     });
     if (!event) return;
     const videoTrack: AppRootState['allTrack'][0] = {
-      id: getRandomEnglishString(8),
+      id: getRandomEnglishString(6),
+      openEye: true,
       deviceId: val.deviceId,
       audio: 2,
       video: 1,
@@ -1618,7 +1650,8 @@ async function addMediaOk(val: AppRootState['allTrack'][0]) {
     });
     if (!event) return;
     const microphoneVideoTrack: AppRootState['allTrack'][0] = {
-      id: getRandomEnglishString(8),
+      id: getRandomEnglishString(6),
+      openEye: true,
       deviceId: val.deviceId,
       audio: 1,
       video: 2,
@@ -1645,7 +1678,8 @@ async function addMediaOk(val: AppRootState['allTrack'][0]) {
     console.log('获取麦克风成功');
   } else if (val.type === MediaTypeEnum.txt) {
     const txtTrack: AppRootState['allTrack'][0] = {
-      id: getRandomEnglishString(8),
+      id: getRandomEnglishString(6),
+      openEye: true,
       audio: 2,
       video: 1,
       mediaName: val.mediaName,
@@ -1691,7 +1725,8 @@ async function addMediaOk(val: AppRootState['allTrack'][0]) {
     console.log('获取文字成功', fabricCanvas.value);
   } else if (val.type === MediaTypeEnum.time) {
     const timeTrack: AppRootState['allTrack'][0] = {
-      id: getRandomEnglishString(8),
+      id: getRandomEnglishString(6),
+      openEye: true,
       audio: 2,
       video: 1,
       mediaName: val.mediaName,
@@ -1729,7 +1764,8 @@ async function addMediaOk(val: AppRootState['allTrack'][0]) {
     console.log('获取时间成功', fabricCanvas.value);
   } else if (val.type === MediaTypeEnum.stopwatch) {
     const stopwatchTrack: AppRootState['allTrack'][0] = {
-      id: getRandomEnglishString(8),
+      id: getRandomEnglishString(6),
+      openEye: true,
       audio: 2,
       video: 1,
       mediaName: val.mediaName,
@@ -1768,7 +1804,8 @@ async function addMediaOk(val: AppRootState['allTrack'][0]) {
     console.log('获取秒表成功', fabricCanvas.value);
   } else if (val.type === MediaTypeEnum.img) {
     const imgTrack: AppRootState['allTrack'][0] = {
-      id: getRandomEnglishString(8),
+      id: getRandomEnglishString(6),
+      openEye: true,
       audio: 2,
       video: 1,
       mediaName: val.mediaName,
@@ -1829,7 +1866,8 @@ async function addMediaOk(val: AppRootState['allTrack'][0]) {
     console.log('获取图片成功', fabricCanvas.value);
   } else if (val.type === MediaTypeEnum.media) {
     const mediaVideoTrack: AppRootState['allTrack'][0] = {
-      id: getRandomEnglishString(8),
+      id: getRandomEnglishString(6),
+      openEye: true,
       audio: 2,
       video: 1,
       mediaName: val.mediaName,
@@ -1872,6 +1910,7 @@ async function addMediaOk(val: AppRootState['allTrack'][0]) {
         mediaVideoTrack.volume = appStore.normalVolume;
         const audioTrack: AppRootState['allTrack'][0] = {
           id: mediaVideoTrack.id,
+          openEye: true,
           audio: 1,
           video: 2,
           mediaName: val.mediaName,
@@ -1931,6 +1970,17 @@ function editMediaOk(val: AppRootState['allTrack'][0]) {
           item.canvasDom.set('text', val.txtInfo?.txt);
         }
       }
+      if (val.openEye) {
+        console.log('显示的');
+        if (item.canvasDom) {
+          item.canvasDom.opacity = 1;
+        }
+      } else {
+        console.log('bu显示的');
+        if (item.canvasDom) {
+          item.canvasDom.opacity = 0;
+        }
+      }
     }
     return item;
   });
@@ -1969,6 +2019,32 @@ function handleChangeVolume(item: AppRootState['allTrack'][0], v) {
   handleMixedAudio();
 }
 
+function handleEye(item: AppRootState['allTrack'][0]) {
+  let current;
+  appStore.allTrack.forEach((iten) => {
+    if (iten.id === item.id) {
+      iten.openEye = !iten.openEye;
+      current = iten;
+    }
+  });
+  if (current) {
+    editMediaOk(current);
+  }
+  cacheStore.setResourceList(appStore.allTrack);
+}
+
+function handleActiveObject(item: AppRootState['allTrack'][0]) {
+  let current: AppRootState['allTrack'][0] | undefined;
+  appStore.allTrack.forEach((iten) => {
+    if (iten.id === item.id) {
+      current = iten;
+    }
+  });
+  if (current?.canvasDom) {
+    fabricCanvas.value?.setActiveObject(current.canvasDom);
+  }
+}
+
 function handleDel(item: AppRootState['allTrack'][0]) {
   if (item.canvasDom !== undefined) {
     fabricCanvas.value?.remove(item.canvasDom);
@@ -2111,7 +2187,7 @@ function handleStartMedia(item: { type: MediaTypeEnum; txt: string }) {
     justify-content: space-between;
     box-sizing: border-box;
     margin-left: 10px;
-    width: $w-250;
+    width: $w-300;
     border-radius: 6px;
     background-color: white;
     color: #9499a0;
@@ -2131,6 +2207,7 @@ function handleStartMedia(item: { type: MediaTypeEnum; txt: string }) {
       .list {
         overflow: scroll;
         height: 218px;
+        width: calc(100% + 5px);
 
         @extend %customScrollbar;
 
@@ -2140,12 +2217,9 @@ function handleStartMedia(item: { type: MediaTypeEnum; txt: string }) {
           justify-content: space-between;
           margin: 5px 0;
           font-size: 14px;
-          // &:hover {
-          //   .control {
-          //     display: flex;
-          //     align-items: center;
-          //   }
-          // }
+          height: 20px;
+          cursor: pointer;
+          user-select: none;
           .control {
             display: flex;
             align-items: center;

+ 1 - 1
src/views/push/selectMediaModal/index.vue

@@ -4,7 +4,7 @@
       title="选择直播素材"
       :mask-closable="false"
       @close="emits('close')"
-      width="'350px'"
+      :width="'350px'"
     >
       <n-space justify="center">
         <n-button

+ 1 - 1
tsconfig.json

@@ -47,7 +47,7 @@
   // ts-node的时候会读取这里的配置
   "ts-node": {
     "compilerOptions": {
-      "module": "commonjs" // 指定生成什么模块代码。
+      "module": "ESNext" // 指定生成什么模块代码。
     },
     "transpileOnly": true // 只编译,报警告或者错误一样运行
   }