aexiaoliou il y a 1 an
Parent
commit
6b8b68b198

+ 2 - 1
.gitignore

@@ -1 +1,2 @@
-.vscode/settings.json
+.vscode/settings.json
+release

+ 10 - 2
Jenkinsfile

@@ -71,12 +71,20 @@ pipeline {
             // }
 
             steps {
-                echo '拷贝测试环境变量'
+                echo '拷贝后端测试环境变量'
                 sh '''
                     cd api 
-                    cp .test.env .env
+                    cp ./dotenv/.test.env .env
                     cd ..
                 '''
+                echo '拷贝后台测试环境变量'
+                sh '''
+                    cd h5 
+                    cp ./dotenv/test-on-server.test.env .env
+                    cd ..
+                '''
+                echo '构建前端'
+                sh 'npm update && npm run build:test-on-server'
                 echo 'test step执行完了'
             }
         }

+ 1 - 1
api/app/common.php

@@ -45,7 +45,7 @@ if (!function_exists('getVirRootDir')) {
     {
         if (isset($_SERVER['HTTP_X_ORIGINAL_URI'])) {
             $url = $_SERVER['HTTP_X_ORIGINAL_URI'];
-            return preg_replace('/\\\\index\.php.*/m', '', $url);
+            return preg_replace('/\/index\.php.*/m', '', $url);
         } elseif (isset($_SERVER['SCRIPT_NAME'])) {
             $url = $_SERVER['SCRIPT_NAME'];
             $url = substr($url, 0, strripos($url, "/"));

api/.htc_local.env → api/dotenv/.htc_local.env


api/.local.env → api/dotenv/.local.env


api/.test.env → api/dotenv/.test.env


+ 2 - 2
h5/.env.custom

@@ -5,8 +5,8 @@ VITE_PORT = 8888
 VITE_OPEN = false
 
 # public path 配置线上环境路径(打包)、本地通过 http-server 访问时,请置空即可
-VITE_PUBLIC_PATH = "/custom/"
-VITE_OUTPUT_DIR= "../api/public/custom"
+VITE_PUBLIC_PATH = "./"
+VITE_OUTPUT_DIR= "../release"
 VITE_APP_API_SIGN_SECRET = "api_sign_secret"
 # VITE_PUBLIC_PATH = /vue-next-admin-preview/
 # VITE_APP_API_SIGN_SECRET = YCKJ2015

h5/.env.development → h5/dotenv/.dev.env


h5/.env.production → h5/dotenv/.prod.env


+ 12 - 0
h5/dotenv/.test-on-server.env

@@ -0,0 +1,12 @@
+# port 端口号
+VITE_PORT = 8888
+
+# open 运行 npm run dev 时自动打开浏览器
+VITE_OPEN = false
+
+# public path 配置线上环境路径(打包)、本地通过 http-server 访问时,请置空即可
+VITE_PUBLIC_PATH = "./"
+VITE_OUTPUT_DIR= "../release"
+VITE_APP_API_SIGN_SECRET = "api_sign_secret"
+# VITE_PUBLIC_PATH = /vue-next-admin-preview/
+# VITE_APP_API_SIGN_SECRET = YCKJ2015

h5/.env.test → h5/dotenv/.test.env


+ 1 - 0
h5/package.json

@@ -9,6 +9,7 @@
         "dev:workerman": "vite --force --mode workerman",
 		"build": "vite build",
 		"build:test": "set NODE_ENV=test && vite build --mode test ",
+        "build:test-on-server": "set NODE_ENV=test && vite build --mode test ",
 		"build:company": "set NODE_ENV=company && vite build --mode company ",
 		"build:customer": "set NODE_ENV=customer && vite build --mode customer ",
 		"build:release": "set NODE_ENV=release && vite build --mode release ",

+ 2 - 2
h5/src/config.ts

@@ -37,8 +37,8 @@ if (env.MODE == 'release') {
 }
 if (env.MODE == 'test') {
 	//公网
-	config.file = 'https://php80.ycxxkj.com/lechang_storage_test/api';
-	config.host = 'https://php80.ycxxkj.com/lechang_storage_test/api/public/index.php';
+	config.file = 'https://php80.ycxxkj.com/project-manager_test/api';
+    config.host = 'https://php80.ycxxkj.com/project-manager_test/api/public/index.php';
 }
 
 console.log('==config:==', config);

+ 69 - 65
h5/vite.config.ts

@@ -1,71 +1,75 @@
-import vue from '@vitejs/plugin-vue';
-import { resolve } from 'path';
-import { defineConfig, loadEnv, ConfigEnv } from 'vite';
-import vueSetupExtend from 'vite-plugin-vue-setup-extend';
-import vueJsx from '@vitejs/plugin-vue-jsx';
+import vue from '@vitejs/plugin-vue'
+import { resolve } from 'path'
+import { defineConfig, loadEnv, ConfigEnv } from 'vite'
+import vueSetupExtend from 'vite-plugin-vue-setup-extend'
+import vueJsx from '@vitejs/plugin-vue-jsx'
 const pathResolve = (dir: string) => {
-	return resolve(__dirname, '.', dir);
-};
+    return resolve(__dirname, '.', dir)
+}
 
 const alias: Record<string, string> = {
-	'/@': pathResolve('./src/'),
-	'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js',
-};
+    '/@': pathResolve('./src/'),
+    'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js',
+}
 
 const viteConfig = defineConfig((mode: ConfigEnv) => {
-	const env = loadEnv(mode.mode, process.cwd());
-	console.log('process.env.VITE_OUTPUT_DIR', env.VITE_OUTPUT_DIR);
-	return {
-		plugins: [
-			vue(),
-			vueSetupExtend(),
-			vueJsx(),
-		],
-		root: process.cwd(),
-		resolve: { alias },
-		base: mode.command === 'serve' ? './' : env.VITE_PUBLIC_PATH,
-		optimizeDeps: {
-			include: ['element-plus/lib/locale/lang/zh-cn', 'element-plus/lib/locale/lang/en', 'element-plus/lib/locale/lang/zh-tw'],
-		},
-		server: {
-			host: '0.0.0.0',
-			port: env.VITE_PORT as unknown as number,
-			open: env.VITE_OPEN,
-			hmr: true,
-			proxy: {
-				'/gitee': {
-					target: 'https://gitee.com',
-					ws: true,
-					changeOrigin: true,
-					rewrite: (path) => path.replace(/^\/gitee/, ''),
-				},
-			},
-		},
-		build: {
-			outDir: env.VITE_OUTPUT_DIR,
-			chunkSizeWarningLimit: 1500,
-			rollupOptions: {
-				output: {
-					entryFileNames: `assets/[name].[hash].js`,
-					chunkFileNames: `assets/[name].[hash].js`,
-					assetFileNames: `assets/[name].[hash].[ext]`,
-					// compact: true,
-					manualChunks: {
-						vue: ['vue', 'vue-router', 'pinia'],
-						echarts: ['echarts'],
-					},
-				},
-			},
-			sourcemap: true,
-		},
-		css: { preprocessorOptions: { css: { charset: false } } },
-		define: {
-			__VUE_I18N_LEGACY_API__: JSON.stringify(false),
-			__VUE_I18N_FULL_INSTALL__: JSON.stringify(false),
-			__INTLIFY_PROD_DEVTOOLS__: JSON.stringify(false),
-			__VERSION__: JSON.stringify(process.env.npm_package_version),
-		},
-	};
-});
+    const env = loadEnv(mode.mode, process.cwd())
 
-export default viteConfig;
+    console.log('process.env.VITE_OUTPUT_DIR', env.VITE_OUTPUT_DIR)
+
+    let config = {
+        plugins: [
+            vue(),
+            vueSetupExtend(),
+            vueJsx(),
+        ],
+        root: process.cwd(),
+        resolve: { alias },
+        base: mode.command === 'serve' ? './' : env.VITE_PUBLIC_PATH,
+        optimizeDeps: {
+            include: ['element-plus/lib/locale/lang/zh-cn', 'element-plus/lib/locale/lang/en', 'element-plus/lib/locale/lang/zh-tw'],
+        },
+        server: {
+            host: '0.0.0.0',
+            port: env.VITE_PORT as unknown as number,
+            open: env.VITE_OPEN,
+            hmr: true,
+            proxy: {
+                '/gitee': {
+                    target: 'https://gitee.com',
+                    ws: true,
+                    changeOrigin: true,
+                    rewrite: (path) => path.replace(/^\/gitee/, ''),
+                },
+            },
+        },
+        build: {
+            outDir: env.VITE_OUTPUT_DIR,
+            chunkSizeWarningLimit: 1500,
+            rollupOptions: {
+                output: {
+                    entryFileNames: `assets/[name].[hash].js`,
+                    chunkFileNames: `assets/[name].[hash].js`,
+                    assetFileNames: `assets/[name].[hash].[ext]`,
+                    // compact: true,
+                    manualChunks: {
+                        vue: ['vue', 'vue-router', 'pinia'],
+                        echarts: ['echarts'],
+                    },
+                },
+            },
+            sourcemap: true,
+        },
+        css: { preprocessorOptions: { css: { charset: false } } },
+        define: {
+            __VUE_I18N_LEGACY_API__: JSON.stringify(false),
+            __VUE_I18N_FULL_INSTALL__: JSON.stringify(false),
+            __INTLIFY_PROD_DEVTOOLS__: JSON.stringify(false),
+            __VERSION__: JSON.stringify(process.env.npm_package_version),
+        },
+    }
+
+    return config
+})
+
+export default viteConfig