林旭祥 3 tygodni temu
rodzic
commit
13050edde9
5 zmienionych plików z 54 dodań i 132 usunięć
  1. 1 3
      .env.production
  2. 46 124
      package-lock.json
  3. 1 0
      package.json
  4. 4 4
      src/views/set/index.vue
  5. 2 1
      vite.config.ts

+ 1 - 3
.env.production

@@ -6,6 +6,4 @@ VITE_BUILD_COMPRESS = gzip
 # 应用访问路径 例如使用前缀 /admin/
 VITE_APP_CONTEXT_PATH = '/'
 # 获取配置项
-VITE_APP_BASE_CTRL = 'https://allctrl.tropsx.com'
-# 获取git提交记录编码
-VITE_GIT_COMMIT_HASH=$(git rev-parse HEAD)
+VITE_APP_BASE_CTRL = 'https://allctrl.tropsx.com'

Plik diff jest za duży
+ 46 - 124
package-lock.json


+ 1 - 0
package.json

@@ -29,6 +29,7 @@
     "socket.io-client": "^2.5.0",
     "speak-tts": "^2.0.8",
     "swiper": "^11.1.4",
+    "vite-plugin-package-version": "^1.1.0",
     "vue": "^3.4.21",
     "vue-lazyload": "^3.0.0",
     "vue-router": "^4.0.13"

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

@@ -27,7 +27,7 @@
         </div>
       </div> -->
     </div>
-    111==={{ gitSha1 }}
+    111==={{ gitCommitHash }}
   </div>
 </template>
 
@@ -35,9 +35,9 @@
 const { proxy } = getCurrentInstance() as any;
 const router = useRouter();
 const data = reactive<any>({
-  gitSha1: ""
+  gitCommitHash: ""
 });
-const { gitSha1 } = toRefs(data);
+const { gitCommitHash } = toRefs(data);
 
 //设置
 const getConfig = () => {
@@ -79,7 +79,7 @@ const confirmExit = () => {
 };
 
 onMounted(() => {
-  gitSha1.value = import.meta.env.VITE_GIT_COMMIT_HASH
+  gitCommitHash.value = import.meta.env.VITE_GIT_COMMIT || ''
 })
 </script>
 

+ 2 - 1
vite.config.ts

@@ -1,6 +1,7 @@
 import { UserConfig, ConfigEnv, loadEnv, defineConfig } from 'vite';
 import createPlugins from './vite/plugins';
 import path from 'path';
+import version from 'vite-plugin-package-version';
 const timeStamp = new Date().getTime();
 export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
   const env = loadEnv(mode, process.cwd());
@@ -14,7 +15,7 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => {
       extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
     },
     // https://cn.vitejs.dev/config/#resolve-extensions
-    plugins: createPlugins(env, command === 'build'),
+    plugins: [createPlugins(env, command === 'build'),version()],
     define: {
       __VITE_GIT_HASH__: JSON.stringify(process.env.VITE_GIT_HASH),
     },

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików