Эх сурвалжийг харах

修改vite需要替换的原始配置

蒋吉兆 3 жил өмнө
parent
commit
129bbfdc7d

+ 4 - 4
web/.env.development

@@ -1,6 +1,6 @@
 ENV = 'development'
 
-VUE_APP_CLI_PORT = 8080
-VUE_APP_SERVER_PORT = 8888
-VUE_APP_BASE_API = /api
-VUE_APP_BASE_PATH = http://127.0.0.1
+VITE_CLI_PORT = 8080
+VITE_SERVER_PORT = 8888
+VITE_BASE_API = /api
+VITE_BASE_PATH = http://127.0.0.1

+ 4 - 4
web/.env.production

@@ -1,7 +1,7 @@
 ENV = 'production'
 
-VUE_APP_CLI_PORT = 8080
-VUE_APP_SERVER_PORT = 8888
-VUE_APP_BASE_API = /api
+VITE_CLI_PORT = 8080
+VITE_SERVER_PORT = 8888
+VITE_BASE_API = /api
 #下方修改为你的线上ip
-VUE_APP_BASE_PATH = http://8.141.61.63
+VITE_BASE_PATH = http://8.141.61.63

+ 181 - 81
web/package-lock.json

@@ -545,6 +545,15 @@
         "@babel/helper-plugin-utils": "^7.8.3"
       }
     },
+    "@babel/plugin-syntax-import-meta": {
+      "version": "7.10.4",
+      "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz",
+      "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==",
+      "dev": true,
+      "requires": {
+        "@babel/helper-plugin-utils": "^7.10.4"
+      }
+    },
     "@babel/plugin-syntax-json-strings": {
       "version": "7.8.3",
       "resolved": "https://registry.npm.taobao.org/@babel/plugin-syntax-json-strings/download/@babel/plugin-syntax-json-strings-7.8.3.tgz",
@@ -1064,6 +1073,12 @@
         "regenerator-runtime": "^0.13.4"
       }
     },
+    "@babel/standalone": {
+      "version": "7.15.4",
+      "resolved": "https://registry.npmjs.org/@babel/standalone/-/standalone-7.15.4.tgz",
+      "integrity": "sha512-UO0QCTFjX5NSuwX/i8+/pesmRPoRTtf46Cpn8VHcXvNinEr2lxqe8Ix10TfU/UK5qsaOrcKk24We8wH1G0nTZA==",
+      "dev": true
+    },
     "@babel/template": {
       "version": "7.14.5",
       "resolved": "https://registry.nlark.com/@babel/template/download/@babel/template-7.14.5.tgz",
@@ -1471,6 +1486,25 @@
         }
       }
     },
+    "@vitejs/plugin-legacy": {
+      "version": "1.5.2",
+      "resolved": "https://registry.npmjs.org/@vitejs/plugin-legacy/-/plugin-legacy-1.5.2.tgz",
+      "integrity": "sha512-b1CaWY/wi7gQZnZaxH+ujPTPb91bEPgnnk7l0WIwxoQtW5UC5MQywRcAbFX+Ise62exXctOMBtsnXKJw2KajXw==",
+      "dev": true,
+      "requires": {
+        "@babel/standalone": "^7.14.9",
+        "core-js": "^3.16.0",
+        "magic-string": "^0.25.7",
+        "regenerator-runtime": "^0.13.9",
+        "systemjs": "^6.10.2"
+      }
+    },
+    "@vitejs/plugin-vue": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-1.6.0.tgz",
+      "integrity": "sha512-n3i8htn8pTg9M+kM3cnEfsPZx/6ngInlTroth6fA1LQTJq5aTVQ8ggaE5pPoAy9vCgHPtcaXMzwpldhqRAkebQ==",
+      "dev": true
+    },
     "@vue/babel-helper-vue-jsx-merge-props": {
       "version": "1.2.1",
       "resolved": "https://registry.npm.taobao.org/@vue/babel-helper-vue-jsx-merge-props/download/@vue/babel-helper-vue-jsx-merge-props-1.2.1.tgz?cache=0&sync_timestamp=1602851177883&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40vue%2Fbabel-helper-vue-jsx-merge-props%2Fdownload%2F%40vue%2Fbabel-helper-vue-jsx-merge-props-1.2.1.tgz",
@@ -1765,62 +1799,11 @@
           "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=",
           "dev": true
         },
-        "ansi-styles": {
-          "version": "4.3.0",
-          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
-          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "color-convert": "^2.0.1"
-          }
-        },
-        "chalk": {
-          "version": "4.1.2",
-          "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
-          "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "ansi-styles": "^4.1.0",
-            "supports-color": "^7.1.0"
-          }
-        },
-        "color-convert": {
-          "version": "2.0.1",
-          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
-          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "color-name": "~1.1.4"
-          }
-        },
-        "color-name": {
-          "version": "1.1.4",
-          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
-          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
-          "dev": true,
-          "optional": true
-        },
-        "has-flag": {
-          "version": "4.0.0",
-          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
-          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
-          "dev": true,
-          "optional": true
-        },
-        "loader-utils": {
-          "version": "2.0.0",
-          "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
-          "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "big.js": "^5.2.2",
-            "emojis-list": "^3.0.0",
-            "json5": "^2.1.2"
-          }
+        "dotenv": {
+          "version": "8.6.0",
+          "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz",
+          "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==",
+          "dev": true
         },
         "ssri": {
           "version": "8.0.1",
@@ -1830,28 +1813,6 @@
           "requires": {
             "minipass": "^3.1.1"
           }
-        },
-        "supports-color": {
-          "version": "7.2.0",
-          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
-          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "has-flag": "^4.0.0"
-          }
-        },
-        "vue-loader-v16": {
-          "version": "npm:[email protected]",
-          "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.5.0.tgz",
-          "integrity": "sha512-WXh+7AgFxGTgb5QAkQtFeUcHNIEq3PGVQ8WskY5ZiFbWBkOwcCPRs4w/2tVyTbh2q6TVRlO3xfvIukUtjsu62A==",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "chalk": "^4.1.0",
-            "hash-sum": "^2.0.0",
-            "loader-utils": "^2.0.0"
-          }
         }
       }
     },
@@ -4735,9 +4696,9 @@
       }
     },
     "dotenv": {
-      "version": "8.6.0",
-      "resolved": "https://registry.nlark.com/dotenv/download/dotenv-8.6.0.tgz",
-      "integrity": "sha1-Bhr2ZNGff02PxuT/m1hM4jety4s=",
+      "version": "10.0.0",
+      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
+      "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==",
       "dev": true
     },
     "dotenv-expand": {
@@ -4970,6 +4931,12 @@
         "is-symbol": "^1.0.2"
       }
     },
+    "esbuild": {
+      "version": "0.12.25",
+      "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.12.25.tgz",
+      "integrity": "sha512-woie0PosbRSoN8gQytrdCzUbS2ByKgO8nD1xCZkEup3D9q92miCze4PqEI9TZDYAuwn6CruEnQpJxgTRWdooAg==",
+      "dev": true
+    },
     "escalade": {
       "version": "3.1.1",
       "resolved": "https://registry.npm.taobao.org/escalade/download/escalade-3.1.1.tgz?cache=0&sync_timestamp=1602567260031&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fescalade%2Fdownload%2Fescalade-3.1.1.tgz",
@@ -9840,6 +9807,15 @@
         "inherits": "^2.0.1"
       }
     },
+    "rollup": {
+      "version": "2.56.3",
+      "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.56.3.tgz",
+      "integrity": "sha512-Au92NuznFklgQCUcV96iXlxUbHuB1vQMaH76DHl5M11TotjOHwqk9CwcrT78+Tnv4FN9uTBxq6p4EJoYkpyekg==",
+      "dev": true,
+      "requires": {
+        "fsevents": "~2.3.2"
+      }
+    },
     "run-async": {
       "version": "2.4.1",
       "resolved": "https://registry.npm.taobao.org/run-async/download/run-async-2.4.1.tgz?cache=0&sync_timestamp=1587966119578&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Frun-async%2Fdownload%2Frun-async-2.4.1.tgz",
@@ -10811,6 +10787,12 @@
         "util.promisify": "~1.0.0"
       }
     },
+    "systemjs": {
+      "version": "6.10.3",
+      "resolved": "https://registry.npmjs.org/systemjs/-/systemjs-6.10.3.tgz",
+      "integrity": "sha512-mXwfLJdaADqWg1J5+Z0bGQEdcXSe+ePPTfzffMB29aVls5cXveRl0vneSV/19t3SfuUBsAraLP8W/g5u9cmYXA==",
+      "dev": true
+    },
     "table": {
       "version": "5.4.6",
       "resolved": "https://registry.nlark.com/table/download/table-5.4.6.tgz",
@@ -11542,6 +11524,43 @@
         "extsprintf": "^1.2.0"
       }
     },
+    "vite": {
+      "version": "2.5.3",
+      "resolved": "https://registry.npmjs.org/vite/-/vite-2.5.3.tgz",
+      "integrity": "sha512-1wMDnjflvtTTkMov8O/Xb5+w1/VW/Gw8oCf8f6dqgHn8lMOEqq0SaPtFEQeikFcOKCfSbiU0nEi0LDIx6DNsaQ==",
+      "dev": true,
+      "requires": {
+        "esbuild": "^0.12.17",
+        "fsevents": "~2.3.2",
+        "postcss": "^8.3.6",
+        "resolve": "^1.20.0",
+        "rollup": "^2.38.5"
+      },
+      "dependencies": {
+        "postcss": {
+          "version": "8.3.6",
+          "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.6.tgz",
+          "integrity": "sha512-wG1cc/JhRgdqB6WHEuyLTedf3KIRuD0hG6ldkFEZNCjRxiC+3i6kkWUUbiJQayP28iwG35cEmAbe98585BYV0A==",
+          "dev": true,
+          "requires": {
+            "colorette": "^1.2.2",
+            "nanoid": "^3.1.23",
+            "source-map-js": "^0.6.2"
+          }
+        }
+      }
+    },
+    "vite-plugin-importer": {
+      "version": "0.2.5",
+      "resolved": "https://registry.npmjs.org/vite-plugin-importer/-/vite-plugin-importer-0.2.5.tgz",
+      "integrity": "sha512-6OtqJmVwnfw8+B4OIh7pIdXs+jLkN7g5PIqmZdpgrMYjIFMiZrcMB1zlyUQSTokKGC90KwXviO/lq1hcUBUG3Q==",
+      "dev": true,
+      "requires": {
+        "@babel/core": "^7.12.17",
+        "@babel/plugin-syntax-import-meta": "^7.10.4",
+        "babel-plugin-import": "^1.13.3"
+      }
+    },
     "vm-browserify": {
       "version": "1.1.2",
       "resolved": "https://registry.npm.taobao.org/vm-browserify/download/vm-browserify-1.1.2.tgz",
@@ -11612,6 +11631,87 @@
         }
       }
     },
+    "vue-loader-v16": {
+      "version": "npm:[email protected]",
+      "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.5.0.tgz",
+      "integrity": "sha512-WXh+7AgFxGTgb5QAkQtFeUcHNIEq3PGVQ8WskY5ZiFbWBkOwcCPRs4w/2tVyTbh2q6TVRlO3xfvIukUtjsu62A==",
+      "dev": true,
+      "optional": true,
+      "requires": {
+        "chalk": "^4.1.0",
+        "hash-sum": "^2.0.0",
+        "loader-utils": "^2.0.0"
+      },
+      "dependencies": {
+        "ansi-styles": {
+          "version": "4.3.0",
+          "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+          "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "color-convert": "^2.0.1"
+          }
+        },
+        "chalk": {
+          "version": "4.1.2",
+          "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+          "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "ansi-styles": "^4.1.0",
+            "supports-color": "^7.1.0"
+          }
+        },
+        "color-convert": {
+          "version": "2.0.1",
+          "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+          "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "color-name": "~1.1.4"
+          }
+        },
+        "color-name": {
+          "version": "1.1.4",
+          "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+          "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+          "dev": true,
+          "optional": true
+        },
+        "has-flag": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+          "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+          "dev": true,
+          "optional": true
+        },
+        "loader-utils": {
+          "version": "2.0.0",
+          "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz",
+          "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "big.js": "^5.2.2",
+            "emojis-list": "^3.0.0",
+            "json5": "^2.1.2"
+          }
+        },
+        "supports-color": {
+          "version": "7.2.0",
+          "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+          "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+          "dev": true,
+          "optional": true,
+          "requires": {
+            "has-flag": "^4.0.0"
+          }
+        }
+      }
+    },
     "vue-particle-line": {
       "version": "0.1.4",
       "resolved": "https://registry.npmjs.org/vue-particle-line/-/vue-particle-line-0.1.4.tgz",

+ 6 - 5
web/package.json

@@ -3,8 +3,8 @@
 	"version": "2.3.5",
 	"private": true,
 	"scripts": {
-		"serve": "node openDocument.js && vite",
-		"build": "vite build",
+		"serve": "node openDocument.js && vite --host --mode development",
+		"build": "vite build --mode production",
 		"preview": "vite preview"
 	},
 	"dependencies": {
@@ -28,6 +28,8 @@
 		"vuex-persist": "^2.1.0"
 	},
 	"devDependencies": {
+		"@vitejs/plugin-legacy": "^1.4.4",
+		"@vitejs/plugin-vue": "latest",
 		"@vue/cli-plugin-babel": "~4.5.0",
 		"@vue/cli-plugin-eslint": "~4.5.0",
 		"@vue/cli-plugin-router": "~4.5.0",
@@ -36,13 +38,12 @@
 		"@vue/compiler-sfc": "^3.1.5",
 		"babel-eslint": "^10.1.0",
 		"babel-plugin-import": "^1.13.3",
+		"dotenv": "^10.0.0",
 		"eslint": "^6.7.2",
 		"eslint-plugin-vue": "^7.0.0",
 		"sass": "^1.26.5",
 		"sass-loader": "^8.0.2",
 		"vite": "2",
-		"@vitejs/plugin-legacy": "^1.4.4",
-		"vite-plugin-importer": "^0.2.5",
-		"@vitejs/plugin-vue": "latest"
+		"vite-plugin-importer": "^0.2.5"
 	}
 }

+ 1 - 1
web/src/components/chooseImg/index.vue

@@ -19,7 +19,7 @@
 </template>
 
 <script>
-const path = process.env.VUE_APP_BASE_API
+const path = import.meta.env.VITE_BASE_API
 import { getFileList } from '@/api/fileUploadAndDownload'
 export default {
   props: {

+ 1 - 1
web/src/components/customPic/index.vue

@@ -16,7 +16,7 @@
 
 <script>
 import { mapGetters } from 'vuex'
-const path = process.env.VUE_APP_BASE_API
+const path = import.meta.env.VITE_BASE_API
 export default {
   name: 'CustomPic',
   props: {

+ 1 - 1
web/src/components/upload/image.vue

@@ -17,7 +17,7 @@
 </template>
 
 <script>
-const path = process.env.VUE_APP_BASE_API
+const path = import.meta.env.VITE_BASE_API
 import { mapGetters } from 'vuex'
 import ImageCompress from '@/utils/image'
 export default {

+ 8 - 9
web/src/core/gin-vue-admin.js

@@ -1,19 +1,18 @@
 /*
-* gin-vue-admin web框架组
-*
-* */
+ * gin-vue-admin web框架组
+ *
+ * */
 // 加载网站配置文件夹
 import { register } from './global'
 
 export const run = function(app) {
-  register(app)
-  console.log(`
+    register(app)
+    console.log(`
      欢迎使用 Gin-Vue-Admin
      当前版本:V2.4.5 alpha
      加群方式:微信:shouzi_1994 QQ群:622360840
-     默认自动化文档地址:http://127.0.0.1:${process.env.VUE_APP_SERVER_PORT}/swagger/index.html
-     默认前端文件运行地址:http://127.0.0.1:${process.env.VUE_APP_CLI_PORT}
+     默认自动化文档地址:http://127.0.0.1:${import.meta.env.VITE_SERVER_PORT}/swagger/index.html
+     默认前端文件运行地址:http://127.0.0.1:${import.meta.env.VITE_CLI_PORT}
      如果项目让您获得了收益,希望您能请团队喝杯可乐:https://www.gin-vue-admin.com/docs/coffee
   `)
-}
-
+}

+ 102 - 108
web/src/style/login.scss

@@ -1,134 +1,128 @@
 .login-register-box {
     height: 100vh;
     .login-box {
-      width: 40vw;
-      position: absolute;
-      left: 50%;
-      margin-left: -22vw;
-      top: 5vh;
-      .logo {
-        height: 35vh;
-        width: 35vh;
-      }
+        width: 40vw;
+        position: absolute;
+        left: 50%;
+        margin-left: -22vw;
+        top: 5vh;
+        .logo {
+            height: 35vh;
+            width: 35vh;
+        }
     }
-  }
-  
-  .link-icon {
+}
+
+.link-icon {
     width: 20px;
     min-width: 20px;
     height: 20px;
     border-radius: 10px;
-  }
-  
-  .vPic {
+}
+
+.vPic {
     width: 33%;
     height: 38px;
     float: right !important;
     background: #ccc;
     img {
-      cursor: pointer;
-      vertical-align: middle;
+        cursor: pointer;
+        vertical-align: middle;
     }
-  }
-  
-  .logo_login {
+}
+
+.logo_login {
     width: 100px;
-  }
-  
-  #userLayout.user-layout-wrapper {
+}
+
+#userLayout.user-layout-wrapper {
     height: 100%;
     position: relative;
     &.mobile {
-      .container {
-        .main {
-          max-width: 368px;
-          width: 98%;
+        .container {
+            .main {
+                max-width: 368px;
+                width: 98%;
+            }
         }
-      }
     }
-  
     .container {
-      position: relative;
-      overflow: auto;
-      width: 100%;
-      min-height: 100%;
-      background: #f0f2f5 url(~@/assets/background.svg) no-repeat 50%;
-      background-size: 100%;
-      padding: 110px 0 144px;
-      a {
-        text-decoration: none;
-      }
-  
-      .top {
-        text-align: center;
-        margin-top: -40px;
-        .header {
-          height: 44px;
-          line-height: 44px;
-          margin-bottom: 30px;
-          .badge {
-            position: absolute;
-            display: inline-block;
-            line-height: 1;
-            vertical-align: middle;
-            margin-left: -12px;
-            margin-top: -10px;
-            opacity: 0.8;
-          }
-  
-          .logo {
-            height: 44px;
-            vertical-align: top;
-            margin-right: 16px;
-            border-style: none;
-          }
-  
-          .title {
-            font-size: 33px;
-            color: rgba(0, 0, 0, 0.85);
-            font-family: Avenir, "Helvetica Neue", Arial, Helvetica, sans-serif;
-            font-weight: 600;
-            position: relative;
-            top: 2px;
-          }
-        }
-        .desc {
-          font-size: 14px;
-          color: rgba(0, 0, 0, 0.45);
-          margin-top: 12px;
-        }
-      }
-  
-      .main {
-        min-width: 260px;
-        width: 368px;
-        margin: 0 auto;
-      }
-  
-      .footer {
         position: relative;
+        overflow: auto;
         width: 100%;
-        padding: 0 20px;
-        margin: 40px 0 10px;
-        text-align: center;
-        .links {
-          margin-bottom: 8px;
-          font-size: 14px;
-          width: 330px;
-          display: inline-flex;
-          flex-direction: row;
-          justify-content: space-between;
-          padding-right: 40px;
-          a {
-            color: rgba(0, 0, 0, 0.45);
-            transition: all 0.3s;
-          }
+        min-height: 100%;
+        background: #f0f2f5 url(@/assets/background.svg) no-repeat 50%;
+        background-size: 100%;
+        padding: 110px 0 144px;
+        a {
+            text-decoration: none;
         }
-        .copyright {
-          color: rgba(0, 0, 0, 0.45);
-          font-size: 14px;
-          padding-right: 40px;
+        .top {
+            text-align: center;
+            margin-top: -40px;
+            .header {
+                height: 44px;
+                line-height: 44px;
+                margin-bottom: 30px;
+                .badge {
+                    position: absolute;
+                    display: inline-block;
+                    line-height: 1;
+                    vertical-align: middle;
+                    margin-left: -12px;
+                    margin-top: -10px;
+                    opacity: 0.8;
+                }
+                .logo {
+                    height: 44px;
+                    vertical-align: top;
+                    margin-right: 16px;
+                    border-style: none;
+                }
+                .title {
+                    font-size: 33px;
+                    color: rgba(0, 0, 0, 0.85);
+                    font-family: Avenir, "Helvetica Neue", Arial, Helvetica, sans-serif;
+                    font-weight: 600;
+                    position: relative;
+                    top: 2px;
+                }
+            }
+            .desc {
+                font-size: 14px;
+                color: rgba(0, 0, 0, 0.45);
+                margin-top: 12px;
+            }
+        }
+        .main {
+            min-width: 260px;
+            width: 368px;
+            margin: 0 auto;
+        }
+        .footer {
+            position: relative;
+            width: 100%;
+            padding: 0 20px;
+            margin: 40px 0 10px;
+            text-align: center;
+            .links {
+                margin-bottom: 8px;
+                font-size: 14px;
+                width: 330px;
+                display: inline-flex;
+                flex-direction: row;
+                justify-content: space-between;
+                padding-right: 40px;
+                a {
+                    color: rgba(0, 0, 0, 0.45);
+                    transition: all 0.3s;
+                }
+            }
+            .copyright {
+                color: rgba(0, 0, 0, 0.45);
+                font-size: 14px;
+                padding-right: 40px;
+            }
         }
-      }
     }
-  }
+}

+ 2 - 2
web/src/style/newLogin.scss

@@ -1,7 +1,7 @@
 #userLayout {
     margin: 0;
     padding: 0;
-    background-image: url("~@/assets/login_background.jpg");
+    background-image: url("@/assets/login_background.jpg");
     background-size: cover;
     width: 100%;
     height: 100%;
@@ -19,7 +19,7 @@
         align-items: center;
         justify-content: space-evenly;
         .login_panle_right {
-            background-image: url("~@/assets/login_left.svg");
+            background-image: url("@/assets/login_left.svg");
             background-size: cover;
             width: 40%;
             height: 60%;

+ 87 - 87
web/src/utils/request.js

@@ -4,113 +4,113 @@ import { store } from '@/store'
 import { emitter } from '@/utils/bus.js'
 
 const service = axios.create({
-  baseURL: process.env.VUE_APP_BASE_API,
-  timeout: 99999
+    baseURL: import.meta.env.VITE_BASE_API,
+    timeout: 99999
 })
 let acitveAxios = 0
 let timer
 const showLoading = () => {
-  acitveAxios++
-  if (timer) {
-    clearTimeout(timer)
-  }
-  timer = setTimeout(() => {
-    if (acitveAxios > 0) {
-      emitter.emit('showLoading')
+    acitveAxios++
+    if (timer) {
+        clearTimeout(timer)
     }
-  }, 400)
+    timer = setTimeout(() => {
+        if (acitveAxios > 0) {
+            emitter.emit('showLoading')
+        }
+    }, 400)
 }
 
 const closeLoading = () => {
-  acitveAxios--
-  if (acitveAxios <= 0) {
-    clearTimeout(timer)
-    emitter.emit('closeLoading')
-  }
-}
-// http request 拦截器
-service.interceptors.request.use(
-  config => {
-    if (!config.donNotShowLoading) {
-      showLoading()
+        acitveAxios--
+        if (acitveAxios <= 0) {
+            clearTimeout(timer)
+            emitter.emit('closeLoading')
+        }
     }
-    const token = store.getters['user/token']
-    const user = store.getters['user/userInfo']
-    config.data = JSON.stringify(config.data)
-    config.headers = {
-      'Content-Type': 'application/json',
-      'x-token': token,
-      'x-user-id': user.ID
+    // http request 拦截器
+service.interceptors.request.use(
+    config => {
+        if (!config.donNotShowLoading) {
+            showLoading()
+        }
+        const token = store.getters['user/token']
+        const user = store.getters['user/userInfo']
+        config.data = JSON.stringify(config.data)
+        config.headers = {
+            'Content-Type': 'application/json',
+            'x-token': token,
+            'x-user-id': user.ID
+        }
+        return config
+    },
+    error => {
+        closeLoading()
+        ElMessage({
+            showClose: true,
+            message: error,
+            type: 'error'
+        })
+        return error
     }
-    return config
-  },
-  error => {
-    closeLoading()
-    ElMessage({
-      showClose: true,
-      message: error,
-      type: 'error'
-    })
-    return error
-  }
 )
 
 // http response 拦截器
 service.interceptors.response.use(
-  response => {
-    closeLoading()
-    if (response.headers['new-token']) {
-      store.commit('user/setToken', response.headers['new-token'])
-    }
-    if (response.data.code === 0 || response.headers.success === 'true') {
-      if (response.headers.msg) {
-        response.data.msg = decodeURI(response.headers.msg)
-      }
-      return response.data
-    } else {
-      ElMessage({
-        showClose: true,
-        message: response.data.msg,
-        type: 'error'
-      })
-      if (response.data.data && response.data.data.reload) {
-        store.commit('user/LoginOut')
-      }
-      return response.data.msg ? response.data : response
-    }
-  },
-  error => {
-    closeLoading()
-    switch (error.response.status) {
-      case 500:
-        ElMessageBox.confirm(`
+    response => {
+        closeLoading()
+        if (response.headers['new-token']) {
+            store.commit('user/setToken', response.headers['new-token'])
+        }
+        if (response.data.code === 0 || response.headers.success === 'true') {
+            if (response.headers.msg) {
+                response.data.msg = decodeURI(response.headers.msg)
+            }
+            return response.data
+        } else {
+            ElMessage({
+                showClose: true,
+                message: response.data.msg,
+                type: 'error'
+            })
+            if (response.data.data && response.data.data.reload) {
+                store.commit('user/LoginOut')
+            }
+            return response.data.msg ? response.data : response
+        }
+    },
+    error => {
+        closeLoading()
+        switch (error.response.status) {
+            case 500:
+                ElMessageBox.confirm(`
         <p>检测到接口错误${error}</p>
         <p>错误码<span style="color:red"> 500 </span>:此类错误内容常见于后台panic,请先查看后台日志,如果影响您正常使用可强制登出清理缓存</p>
         `, '接口报错', {
-          dangerouslyUseHTMLString: true,
-          distinguishCancelAndClose: true,
-          confirmButtonText: '清理缓存',
-          cancelButtonText: '取消'
-        })
-          .then(() => {
-            store.commit('user/LoginOut')
-          })
-        break
-      case 404:
-        ElMessageBox.confirm(`
+                        dangerouslyUseHTMLString: true,
+                        distinguishCancelAndClose: true,
+                        confirmButtonText: '清理缓存',
+                        cancelButtonText: '取消'
+                    })
+                    .then(() => {
+                        store.commit('user/LoginOut')
+                    })
+                break
+            case 404:
+                ElMessageBox.confirm(`
           <p>检测到接口错误${error}</p>
           <p>错误码<span style="color:red"> 404 </span>:此类错误多为接口未注册(或未重启)或者请求路径(方法)与api路径(方法)不符--如果为自动化代码请检查是否存在空格</p>
           `, '接口报错', {
-          dangerouslyUseHTMLString: true,
-          distinguishCancelAndClose: true,
-          confirmButtonText: '我知道了',
-          cancelButtonText: '取消'
-        })
-        break
-    }
+                    dangerouslyUseHTMLString: true,
+                    distinguishCancelAndClose: true,
+                    confirmButtonText: '我知道了',
+                    cancelButtonText: '取消'
+                })
+                break
+        }
 
-    return error
-  }
+        return error
+    }
 )
 
-export default service
+export default service

+ 1 - 1
web/src/view/example/breakpoint/breakpoint.vue

@@ -140,7 +140,7 @@ export default {
     },
     async upLoadFileSlice(item) {
       // 切片上传
-      await axios.post(process.env.VUE_APP_BASE_API + '/fileUploadAndDownload/breakpointContinue', item.formData)
+      await axios.post(import.meta.env.VITE_BASE_API + '/fileUploadAndDownload/breakpointContinue', item.formData)
       this.waitNum-- // 百分数增加
       if (this.waitNum === 0) {
         // 切片传完以后 合成文件

+ 1 - 1
web/src/view/example/excel/excel.vue

@@ -31,7 +31,7 @@
 </template>
 
 <script>
-const path = process.env.VUE_APP_BASE_API
+const path = import.meta.env.VITE_BASE_API
 import { mapGetters } from 'vuex'
 import infoList from '@/mixins/infoList'
 import { exportExcel, loadExcelData, downloadTemplate } from '@/api/excel'

+ 1 - 1
web/src/view/example/upload/upload.vue

@@ -67,7 +67,7 @@
 </template>
 
 <script>
-const path = process.env.VUE_APP_BASE_API
+const path = import.meta.env.VITE_BASE_API
 import { mapGetters } from 'vuex'
 import infoList from '@/mixins/infoList'
 import { getFileList, deleteFile } from '@/api/fileUploadAndDownload'

+ 1 - 1
web/src/view/init/index.vue

@@ -116,7 +116,7 @@ export default {
 .init_page{
   margin: 0;
   padding: 0;
-  background-image: url("~@/assets/login_background.jpg");
+  background-image: url("@/assets/login_background.jpg");
   background-size: cover;
   width: 100%;
   height: 100%;

+ 1 - 1
web/src/view/person/person.vue

@@ -106,7 +106,7 @@ import ChooseImg from '@/components/chooseImg'
 import { setUserInfo, changePassword } from '@/api/user'
 
 import { mapGetters, mapMutations } from 'vuex'
-const path = process.env.VUE_APP_BASE_API
+const path = import.meta.env.VITE_BASE_API
 export default {
   name: 'Person',
   components: {

+ 1 - 1
web/src/view/superAdmin/user/user.vue

@@ -96,7 +96,7 @@
 
 <script>
 // 获取列表内容封装在mixins内部  getTableData方法 初始化已封装完成
-const path = process.env.VUE_APP_BASE_API
+const path = import.meta.env.VITE_BASE_API
 import {
   getUserList,
   setUserAuthorities,

+ 1 - 1
web/src/view/systemTools/formCreate/index.vue

@@ -5,7 +5,7 @@
 </template>
 
 <script>
-var path = process.env.VUE_APP_BASE_PATH
+var path = import.meta.env.VITE_BASE_PATH
 export default {
   name: 'FormGenerator',
   data() {

+ 26 - 17
web/vite.config.js

@@ -2,12 +2,25 @@
 import legacyPlugin from '@vitejs/plugin-legacy';
 // import usePluginImport from 'vite-plugin-importer';
 import * as path from 'path';
+import * as dotenv from 'dotenv';
+import * as fs from 'fs';
 import vuePlugin from '@vitejs/plugin-vue';
 // @see https://cn.vitejs.dev/config/
 export default ({
   command,
   mode
 }) => {
+  let NODE_ENV = process.env.NODE_ENV || 'development'
+  let envFiles=[
+    `.env.${NODE_ENV}`
+  ]
+  for (const file of envFiles) {
+		const envConfig = dotenv.parse(fs.readFileSync(file))
+		for (const k in envConfig) {
+			process.env[k] = envConfig[k]
+		}
+	}
+
   let rollupOptions = {};
 
 
@@ -19,20 +32,6 @@ export default ({
     'vue$': 'vue/dist/vue.runtime.esm-bundler.js',
   }
 
-  let proxy = {
-    'undefined': {
-      "target": "undefined:undefined/",
-      "changeOrigin": true,
-      "pathRewrite": {
-        "^undefined": ""
-      }
-    },
-  }
-
-  let define = {
-    'process.env.NODE_ENV': '"development"',
-  }
-
   let esbuild = {}
 
   return {
@@ -41,10 +40,20 @@ export default ({
     resolve: {
       alias,
     },
-    define: define,
+    define: {
+      'process.env': {}
+    },
     server: {
-      // 代理
-      proxy,
+      port: process.env.VITE_CLI_PORT,
+      proxy:{
+       // 把key的路径代理到target位置
+      // detail: https://cli.vuejs.org/config/#devserver-proxy
+      [process.env.VITE_BASE_API]: { // 需要代理的路径   例如 '/api'
+        target: `${process.env.VITE_BASE_PATH}:${process.env.VITE_SERVER_PORT}/`, // 代理到 目标路径
+        changeOrigin: true,
+        rewrite: path => path.replace(new RegExp('^' + process.env.VITE_BASE_API), ''),
+      } 
+      },
     },
     build: {
       target: 'es2015',