提交 all-in-one 前端本地适配

This commit is contained in:
Chopper711
2026-06-10 22:19:17 +08:00
parent 1bca5606eb
commit f05d03e770
12 changed files with 20 additions and 4 deletions

1
buyer/.gitignore vendored
View File

@@ -12,3 +12,4 @@ yarn-error.log*
*.ntvs*
*.njsproj
*.sln
public/config.local.js

View File

@@ -16,6 +16,8 @@
<script src="<%=js%>"></script>
<% } %>
<script src="/config.js"></script>
<!-- 本地一键启动脚本会生成此文件,用于覆盖开发环境接口和跳转地址。 -->
<script src="/config.local.js"></script>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>

View File

@@ -41,4 +41,5 @@ const routes = [
export default new Router({
routes,
mode: 'history',
base: process.env.BASE_URL,
})

View File

@@ -4,6 +4,7 @@ const path = require('path')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css']
const isProd = process.env.NODE_ENV === 'production'
const publicPath = process.env.VUE_APP_PUBLIC_PATH || '/'
function resolve(dir) {
return path.join(__dirname, dir)
@@ -23,7 +24,7 @@ const assetsCDN = {
// vue.config.js
const vueConfig = {
// 公共路径(必须有的)
publicPath: '/',
publicPath,
// 输出文件目录
outputDir: 'dist',
// 静态资源存放的文件夹(相对于ouputDir)

1
manager/.gitignore vendored
View File

@@ -21,3 +21,4 @@ selenium-debug.log
yarn.lock
package-lock.json
yarn.lock
public/config.local.js

View File

@@ -71,7 +71,9 @@
<% for(var js of htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%=js%>"></script>
<% } %>
<script src="/config.js"></script>
<script src="<%= BASE_URL %>config.js"></script>
<!-- 本地一键启动脚本会生成此文件,用于覆盖开发环境接口和跳转地址。 -->
<script src="<%= BASE_URL %>config.local.js"></script>
<script src="./tinymce/tinymce.min.js"></script>
<noscript>
<strong

View File

@@ -10,6 +10,7 @@ Vue.use(VueRouter);
// 路由配置
const RouterConfig = {
mode: 'history',
base: process.env.BASE_URL,
routes: routers
};
@@ -53,4 +54,3 @@ router.afterEach((to) => {
window.scrollTo(0, 0);
});

View File

@@ -12,6 +12,7 @@ const resolve = dir => {
* 我们可以根据环境变量进行相应的处理只有在产品的时候才让插件去自动注入相应的资源文件到html页面
*/
const enableProduction = process.env.NODE_ENV === "production"; // 是否生产环境
const publicPath = process.env.VUE_APP_PUBLIC_PATH || "/";
let externals = {
@@ -66,6 +67,7 @@ cdn = enableProduction && configs.enableCDN ? cdn : { css: [], js: [] };
externals = enableProduction && configs.enableCDN ? externals : {};
jsPlugin = enableProduction ? jsPlugin : [];
module.exports = {
publicPath,
css: {
loaderOptions: {
// 向 CSS 相关的 loader 传递选项

1
seller/.gitignore vendored
View File

@@ -21,3 +21,4 @@ selenium-debug.log
yarn.lock
package-lock.json
yarn.lock
public/config.local.js

View File

@@ -71,7 +71,9 @@
<% for(var js of htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%=js%>"></script>
<% } %>
<script src="/config.js"></script>
<script src="<%= BASE_URL %>config.js"></script>
<!-- 本地一键启动脚本会生成此文件,用于覆盖开发环境接口和跳转地址。 -->
<script src="<%= BASE_URL %>config.local.js"></script>
<script src="./tinymce/tinymce.min.js"></script>
<noscript>
<strong

View File

@@ -10,6 +10,7 @@ Vue.use(VueRouter);
// 路由配置
const RouterConfig = {
mode: 'history',
base: process.env.BASE_URL,
routes: routers
};

View File

@@ -13,6 +13,7 @@ const resolve = dir => {
*/
const enableProduction = process.env.NODE_ENV === "production"; // 是否生产环境
// const enableProduction = false // 统一取消cdn加载 目前cdn链接的https请求挂了
const publicPath = process.env.VUE_APP_PUBLIC_PATH || "/";
let externals = {
vue: "Vue",
@@ -65,6 +66,7 @@ externals = enableProduction && configs.enableCDN ? externals : {};
jsPlugin = enableProduction ? jsPlugin : [];
module.exports = {
publicPath,
// 输出文件目录,当运行 vue-cli-service build 时生成的生产环境构建文件的目录。注意目标目录在构建之前会被清除
outputDir:'dist',
// 放置生成的静态资源 (js、css、img、fonts) 的目录。