denny 2 жил өмнө
parent
commit
cf03420d5e

+ 10 - 8
public/config.js

@@ -1,13 +1,15 @@
 
-// 此文件非必要,在生产环境下此文件配置可覆盖运行配置,开发环境下不起效
-// 详情见 src/config/index.js
+// // 此文件非必要,在生产环境下此文件配置可覆盖运行配置,开发环境下不起效
+// // 详情见 src/config/index.js
 
-const APP_CONFIG = {
+exports.AppConfig = {
 	//标题
 	APP_NAME: "Flyinsono",
-	//超时
-	Dashboard_SetInterval: 1800000,
-
 	//接口地址,如遇跨域需使用nginx代理
-	API_URL: "http://127.0.0.1"
-}
+	API_URL: "http://127.0.0.1",
+	//服务端口,如用nginx代理,则已nginx的监听端口为准
+	APP_Port: "9304",
+	//如果是一级目录,则只要一个'/',如果是二级目录为report则为'/report/'
+	Sub_Domain: "/",
+};
+

+ 0 - 28
public/index.html

@@ -5,9 +5,6 @@
 		<meta http-equiv="X-UA-Compatible" content="IE=edge">
 		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
 		<link rel="icon" href="<%= BASE_URL %>favicon.ico">
-		<script type="text/javascript">
-			document.write("<script src='config.js?"+new Date().getTime()+"'><\/script>");
-		</script>
 	</head>
 	<body>
 		<noscript>
@@ -21,31 +18,6 @@
 			}
 		</script>
 		<div id="app" class="aminui">
-			<!-- <div class="app-loading">
-				<div class="app-loading__logo">
-					<img src="img/logo.png"/>
-				</div>
-				<div class="app-loading__loader"></div>
-			</div> 
-			<style>
-				.app-loading {position: absolute;top:0px;left:0px;right:0px;bottom:0px;display: flex;justify-content: center;align-items: center;flex-direction: column;background: #fff;}
-				.app-loading__logo {margin-bottom: 30px;}
-				.app-loading__logo img {vertical-align: bottom;}
-				.app-loading__loader {box-sizing: border-box;width: 35px;height: 35px;border: 5px solid transparent;border-top-color: #000;border-radius: 50%;animation: .5s loader linear infinite;position: relative;}
-				.app-loading__loader:before {box-sizing: border-box;content: '';display: block;width: inherit;height: inherit;position: absolute;top: -5px;left: -5px;border: 5px solid #ccc;border-radius: 50%;opacity: .5;}
-				.app-loading__title {font-size: 24px;color: #333;margin-top: 30px;}
-				[data-theme='dark'] .app-loading {background: #222225;}
-				[data-theme='dark'] .app-loading__loader {border-top-color: #fff;}
-				[data-theme='dark'] .app-loading__title {color: #d0d0d0;}
-				@keyframes loader {
-				    0% {
-				        transform: rotate(0deg);
-				    }
-				    100% {
-				        transform: rotate(360deg);
-				    }
-				}
-			</style> -->
 		</div>
 	</body>
 	<div id="versionCheck" style="display: none;position: absolute;z-index: 99;top:0;left:0;right:0;bottom:0;padding:40px;background:rgba(255,255,255,0.9);color: #333;">

+ 9 - 2
src/config/index.js

@@ -1,6 +1,7 @@
+const appConfig = require("/public/config");
 const DEFAULT_CONFIG = {
 	//标题
-	APP_NAME: APP_CONFIG.APP_NAME,
+	APP_NAME: appConfig.AppConfig.APP_NAME,
 
 	//首页地址
 	DASHBOARD_URL: "/dashboard",
@@ -12,7 +13,13 @@ const DEFAULT_CONFIG = {
 	CORE_VER: "1.6.6",
 
 	//接口地址
-	API_URL: APP_CONFIG.APP_NAME.API_URL,
+	API_URL: appConfig.AppConfig.API_URL,
+
+	//接口地址
+	APP_Port: appConfig.AppConfig.APP_Port,
+
+	//接口地址
+	Sub_Domain: appConfig.AppConfig.Sub_Domain,
 
 	//请求超时
 	TIMEOUT: 30000,

+ 1 - 1
src/router/index.js

@@ -23,7 +23,7 @@ const routes = systemRouter
 let routes_404_r = ()=>{}
 
 const router = createRouter({
-	history: createWebHistory(),
+	history: createWebHistory(config.Sub_Domain),
 	routes: routes
 })
 NProgress.configure({ showSpinner: false });

+ 6 - 4
vue.config.js

@@ -1,19 +1,20 @@
+const appConfig = require("./public/config");
+
 module.exports = {
 	//设置为空打包后不分更目录还是多级目录
-	publicPath:'/',
+	publicPath: appConfig.AppConfig.Sub_Domain,
 	//build编译后存放静态文件的目录
 	//assetsDir: "static",
-
 	// build编译后不生成资源MAP文件
 	productionSourceMap: false,
 
 	//开发服务build后的生产模式还需nginx代理
 	devServer: {
 		open: false, //运行后自动打开浏览器	port: 9800, //挂载端口
-		port: 9304, //挂载端口
+		port: appConfig.AppConfig.APP_Port, //挂载端口
 		proxy: {
 			'/api': {
-				target: 'http://127.0.0.1',
+				target: appConfig.AppConfig.Sub_Domain,
 				ws: true,
 				changeOrigin: true,
 				pathRewrite: {
@@ -23,6 +24,7 @@ module.exports = {
 		}
 	},
 	chainWebpack: config => {
+		console.log("appConfig",appConfig);
 		// 移除 prefetch 插件
 		config.plugins.delete('preload');
 		config.plugins.delete('prefetch');