环境打包
This commit is contained in:
@@ -5,5 +5,6 @@ VUE_APP_TITLE = 管理系统
|
|||||||
ENV = 'production'
|
ENV = 'production'
|
||||||
|
|
||||||
# 若依管理系统/生产环境
|
# 若依管理系统/生产环境
|
||||||
# VUE_APP_BASE_API = '/prod-api'
|
# VUE_APP_BASE_API = "http://192.168.142.241:8080"
|
||||||
VUE_APP_BASE_API = 'http://48.1.16.91:8080'
|
# VUE_APP_BASE_API = "http://192.168.142.241:8080"
|
||||||
|
VUE_APP_BASE_URL = https://nicowebgl.cn/macmini/project/kdemo/
|
||||||
9
.env.production.backup
Normal file
9
.env.production.backup
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# 页面标题
|
||||||
|
VUE_APP_TITLE = 管理系统
|
||||||
|
|
||||||
|
# 生产环境配置
|
||||||
|
ENV = 'production'
|
||||||
|
|
||||||
|
# 若依管理系统/生产环境
|
||||||
|
# VUE_APP_BASE_API = '/prod-api'
|
||||||
|
VUE_APP_BASE_API = 'http://48.1.16.91:8080'
|
||||||
3
cp.sh
Executable file
3
cp.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
mv dist kdemo
|
||||||
|
cp -r kdemo /Users/nicolas/docker/nginx/html/macmini/project
|
||||||
|
rm -rf kdemo
|
||||||
@@ -1,14 +1,17 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
<head>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta charset="utf-8">
|
||||||
<meta name="renderer" content="webkit">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="renderer" content="webkit">
|
||||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<title><%= webpackConfig.name %></title>
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
|
<title>
|
||||||
<style>
|
<%= webpackConfig.name %>
|
||||||
|
</title>
|
||||||
|
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
|
||||||
|
<style>
|
||||||
html,
|
html,
|
||||||
body,
|
body,
|
||||||
#app {
|
#app {
|
||||||
@@ -16,22 +19,28 @@
|
|||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
@media print{
|
|
||||||
body{ display: none; }
|
|
||||||
}
|
|
||||||
table.mxPopupMenu {
|
|
||||||
background: #fff;
|
|
||||||
cursor: pointer;
|
|
||||||
border: 1px solid #ededed;
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.mxPopupMenu {
|
@media print {
|
||||||
position: absolute;
|
body {
|
||||||
}
|
display: none;
|
||||||
body::-webkit-scrollbar {
|
|
||||||
width: 0;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
table.mxPopupMenu {
|
||||||
|
background: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 1px solid #ededed;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.mxPopupMenu {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
body::-webkit-scrollbar {
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.chromeframe {
|
.chromeframe {
|
||||||
margin: 0.2em 0;
|
margin: 0.2em 0;
|
||||||
background: #ccc;
|
background: #ccc;
|
||||||
@@ -108,6 +117,7 @@
|
|||||||
-ms-transform: rotate(0deg);
|
-ms-transform: rotate(0deg);
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
100% {
|
100% {
|
||||||
-webkit-transform: rotate(360deg);
|
-webkit-transform: rotate(360deg);
|
||||||
-ms-transform: rotate(360deg);
|
-ms-transform: rotate(360deg);
|
||||||
@@ -121,6 +131,7 @@
|
|||||||
-ms-transform: rotate(0deg);
|
-ms-transform: rotate(0deg);
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
100% {
|
100% {
|
||||||
-webkit-transform: rotate(360deg);
|
-webkit-transform: rotate(360deg);
|
||||||
-ms-transform: rotate(360deg);
|
-ms-transform: rotate(360deg);
|
||||||
@@ -226,16 +237,18 @@
|
|||||||
_T_));
|
_T_));
|
||||||
})(Object);
|
})(Object);
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
|
||||||
<div id="app">
|
<body>
|
||||||
<div id="loader-wrapper">
|
<div id="app">
|
||||||
<div id="loader"></div>
|
<div id="loader-wrapper">
|
||||||
<div class="loader-section section-left"></div>
|
<div id="loader"></div>
|
||||||
<div class="loader-section section-right"></div>
|
<div class="loader-section section-left"></div>
|
||||||
<div class="load_title">正在加载系统资源,请耐心等待</div>
|
<div class="loader-section section-right"></div>
|
||||||
</div>
|
<div class="load_title">正在加载系统资源,请耐心等待</div>
|
||||||
<script src="./mxClient.min.js"></script>
|
</div>
|
||||||
</div>
|
<script src="<%= BASE_URL %>mxClient.min.js"></script>
|
||||||
</body>
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
15
src/App.vue
15
src/App.vue
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="appaaaa">
|
||||||
<router-view />
|
<router-view />
|
||||||
<theme-picker />
|
<theme-picker />
|
||||||
</div>
|
</div>
|
||||||
@@ -12,22 +12,11 @@ export default {
|
|||||||
name: "App",
|
name: "App",
|
||||||
components: { ThemePicker },
|
components: { ThemePicker },
|
||||||
created() {
|
created() {
|
||||||
// const query = {
|
|
||||||
// pageNum: 1,
|
|
||||||
// pageSize: 100,
|
|
||||||
// dictType: 'sys_title',
|
|
||||||
// }
|
|
||||||
// this.$store.dispatch("getDict", query).then((res) => {
|
|
||||||
// let dictList = JSON.stringify(res.rows)
|
|
||||||
// this.$cache.session.set('dictList', dictList);
|
|
||||||
// }).catch(() => {
|
|
||||||
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
#app .theme-picker {
|
.theme-picker {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ Vue.prototype.$px2rem = px2rem;
|
|||||||
Vue.prototype.$dictLabel = dictLabel;
|
Vue.prototype.$dictLabel = dictLabel;
|
||||||
Vue.directive("px", px2remDirective);
|
Vue.directive("px", px2remDirective);
|
||||||
|
|
||||||
import './assets/icons' // icon
|
import './assets/icons' // icon/ permission control
|
||||||
import './permission' // permission control
|
|
||||||
import { getDicts } from "@/api/system/dict/data"
|
import { getDicts } from "@/api/system/dict/data"
|
||||||
import { getConfigKey } from "@/api/system/config"
|
import { getConfigKey } from "@/api/system/config"
|
||||||
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi"
|
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi"
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
import router from './router'
|
|
||||||
import store from './store'
|
|
||||||
import { Message } from 'element-ui'
|
|
||||||
import NProgress from 'nprogress'
|
|
||||||
import 'nprogress/nprogress.css'
|
|
||||||
import { getToken } from '@/utils/auth'
|
|
||||||
import { isPathMatch } from '@/utils/validate'
|
|
||||||
import { isRelogin } from '@/utils/request'
|
|
||||||
|
|
||||||
NProgress.configure({ showSpinner: false })
|
|
||||||
|
|
||||||
const whiteList = ['/login', '/register']
|
|
||||||
|
|
||||||
const isWhiteList = (path) => {
|
|
||||||
return whiteList.some(pattern => isPathMatch(pattern, path))
|
|
||||||
}
|
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
|
||||||
NProgress.start()
|
|
||||||
// if (getToken()) {
|
|
||||||
// to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
|
|
||||||
// /* has token*/
|
|
||||||
// if (to.path === '/login') {
|
|
||||||
// next({ path: '/' })
|
|
||||||
// NProgress.done()
|
|
||||||
// } else if (isWhiteList(to.path)) {
|
|
||||||
// next()
|
|
||||||
// } else {
|
|
||||||
// if (store.getters.roles.length === 0) {
|
|
||||||
// isRelogin.show = true
|
|
||||||
// // 判断当前用户是否已拉取完user_info信息
|
|
||||||
// store.dispatch('GetInfo').then(() => {
|
|
||||||
// isRelogin.show = false
|
|
||||||
// store.dispatch('GenerateRoutes').then(accessRoutes => {
|
|
||||||
// // 根据roles权限生成可访问的路由表
|
|
||||||
// router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
|
||||||
// next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
|
||||||
// })
|
|
||||||
// }).catch(err => {
|
|
||||||
// store.dispatch('LogOut').then(() => {
|
|
||||||
// Message.error(err)
|
|
||||||
// next({ path: '/' })
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// } else {
|
|
||||||
// next()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// 没有token
|
|
||||||
// if (isWhiteList(to.path)) {
|
|
||||||
// 在免登录白名单,直接进入
|
|
||||||
// if (store.getters.dictList.length === 0) {
|
|
||||||
// const query = {
|
|
||||||
// pageNum: 1,
|
|
||||||
// pageSize: 100,
|
|
||||||
// dictType: "sys_title",
|
|
||||||
// };
|
|
||||||
// store
|
|
||||||
// .dispatch("getDict", query)
|
|
||||||
// .then((res) => {
|
|
||||||
// next();
|
|
||||||
// // let dictList = JSON.stringify(res.rows);
|
|
||||||
// // this.$cache.session.set("dictList", dictList);
|
|
||||||
// })
|
|
||||||
// .catch(() => {});
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
next();
|
|
||||||
// }
|
|
||||||
// next()
|
|
||||||
// } else {
|
|
||||||
// next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页
|
|
||||||
// NProgress.done()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
})
|
|
||||||
|
|
||||||
router.afterEach(() => {
|
|
||||||
NProgress.done()
|
|
||||||
})
|
|
||||||
@@ -66,7 +66,7 @@ export const constantRoutes = [
|
|||||||
// component: Layout,
|
// component: Layout,
|
||||||
name: "Layout_main",
|
name: "Layout_main",
|
||||||
component: () => import("@/views/bigScreen/Layout_main/index.vue"),
|
component: () => import("@/views/bigScreen/Layout_main/index.vue"),
|
||||||
redirect: "home",
|
redirect: "/home",
|
||||||
children: [
|
children: [
|
||||||
// {
|
// {
|
||||||
// path: 'index',
|
// path: 'index',
|
||||||
@@ -233,7 +233,7 @@ Router.prototype.replace = function push(location) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default new Router({
|
export default new Router({
|
||||||
mode: 'history', // 去掉url中的#
|
mode: 'hash', // 加上#
|
||||||
scrollBehavior: () => ({ y: 0 }),
|
scrollBehavior: () => ({ y: 0 }),
|
||||||
routes: constantRoutes
|
routes: constantRoutes
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -518,7 +518,7 @@ export function drawAxes(element, options = {}, ballCallBack) {
|
|||||||
composer.addPass(fxaa);
|
composer.addPass(fxaa);
|
||||||
|
|
||||||
/* ========== 环境光照/HDR环境贴图 ========== */
|
/* ========== 环境光照/HDR环境贴图 ========== */
|
||||||
new RGBELoader().load("/hdr/basic.hdr", (tex) => {
|
new RGBELoader().load(process.env.VUE_APP_BASE_URL + "/hdr/basic.hdr", (tex) => {
|
||||||
tex.mapping = THREE.EquirectangularReflectionMapping;
|
tex.mapping = THREE.EquirectangularReflectionMapping;
|
||||||
scene.environment = tex;
|
scene.environment = tex;
|
||||||
});
|
});
|
||||||
@@ -606,7 +606,7 @@ export function drawAxes(element, options = {}, ballCallBack) {
|
|||||||
|
|
||||||
const img = document.createElement('img')
|
const img = document.createElement('img')
|
||||||
|
|
||||||
img.src = `/icon_xz/${axes}0${i}.png`
|
img.src = process.env.VUE_APP_BASE_URL + `/icon_xz/${axes}0${i}.png`
|
||||||
|
|
||||||
img.style.width = '10px'
|
img.style.width = '10px'
|
||||||
|
|
||||||
|
|||||||
124
vue.config.js
124
vue.config.js
@@ -6,12 +6,11 @@ function resolve(dir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const CompressionPlugin = require('compression-webpack-plugin')
|
const CompressionPlugin = require('compression-webpack-plugin')
|
||||||
|
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||||
|
|
||||||
const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题
|
const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题
|
||||||
|
|
||||||
const baseUrl = 'http://localhost:8080' // 后端接口
|
|
||||||
|
|
||||||
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
|
||||||
|
|
||||||
// vue.config.js 配置说明
|
// vue.config.js 配置说明
|
||||||
//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
|
//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
|
||||||
@@ -20,7 +19,7 @@ module.exports = {
|
|||||||
// 部署生产环境和开发环境下的URL。
|
// 部署生产环境和开发环境下的URL。
|
||||||
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
||||||
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
|
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
|
||||||
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
|
publicPath: process.env.NODE_ENV === "production" ? "https://nicowebgl.cn/macmini/project/kdemo/" : "/",
|
||||||
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
||||||
outputDir: "dist",
|
outputDir: "dist",
|
||||||
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
||||||
@@ -31,23 +30,8 @@ module.exports = {
|
|||||||
// webpack-dev-server 相关配置
|
// webpack-dev-server 相关配置
|
||||||
devServer: {
|
devServer: {
|
||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
port: port,
|
port: 1005,
|
||||||
open: true,
|
open: true,
|
||||||
proxy: {
|
|
||||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
|
||||||
[process.env.VUE_APP_BASE_API]: {
|
|
||||||
target: baseUrl,
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {
|
|
||||||
["^" + process.env.VUE_APP_BASE_API]: "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// springdoc proxy
|
|
||||||
"^/v3/api-docs/(.*)": {
|
|
||||||
target: baseUrl,
|
|
||||||
changeOrigin: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
disableHostCheck: true,
|
disableHostCheck: true,
|
||||||
},
|
},
|
||||||
css: {
|
css: {
|
||||||
@@ -74,87 +58,25 @@ module.exports = {
|
|||||||
minRatio: 0.8, // 压缩比例,小于 80% 的文件不会被压缩
|
minRatio: 0.8, // 压缩比例,小于 80% 的文件不会被压缩
|
||||||
deleteOriginalAssets: false, // 压缩后删除原文件
|
deleteOriginalAssets: false, // 压缩后删除原文件
|
||||||
}),
|
}),
|
||||||
],
|
// 复制 mxGraph resources 和 css 文件
|
||||||
// module: {
|
new CopyWebpackPlugin([
|
||||||
// rules: [
|
{
|
||||||
// {
|
from: path.resolve(__dirname, 'node_modules/mxgraph/javascript/src/resources'),
|
||||||
// test: /\.mjs$/,
|
to: path.resolve(__dirname, 'dist/mxgraph/resources')
|
||||||
// include: /node_modules/,
|
|
||||||
// type: "javascript/auto",
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// },
|
|
||||||
// module: {
|
|
||||||
// rules: [
|
|
||||||
// {
|
|
||||||
// test: /\.js$/,
|
|
||||||
// include: /node_modules\/quill/,
|
|
||||||
// use: {
|
|
||||||
// loader: 'babel-loader',
|
|
||||||
// options: {
|
|
||||||
// presets: ['@babel/preset-env'],
|
|
||||||
// plugins: ['@babel/plugin-proposal-class-properties']
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
// transpileDependencies: ["mermaid", "quill"],
|
|
||||||
chainWebpack(config) {
|
|
||||||
config.plugins.delete("preload"); // TODO: need test
|
|
||||||
config.plugins.delete("prefetch"); // TODO: need test
|
|
||||||
|
|
||||||
// set svg-sprite-loader
|
|
||||||
config.module.rule("svg").exclude.add(resolve("src/assets/icons")).end();
|
|
||||||
config.module
|
|
||||||
.rule("icons")
|
|
||||||
.test(/\.svg$/)
|
|
||||||
.include.add(resolve("src/assets/icons"))
|
|
||||||
.end()
|
|
||||||
.use("svg-sprite-loader")
|
|
||||||
.loader("svg-sprite-loader")
|
|
||||||
.options({
|
|
||||||
symbolId: "icon-[name]",
|
|
||||||
})
|
|
||||||
.end();
|
|
||||||
|
|
||||||
config.when(process.env.NODE_ENV !== "development", (config) => {
|
|
||||||
config
|
|
||||||
.plugin("ScriptExtHtmlWebpackPlugin")
|
|
||||||
.after("html")
|
|
||||||
.use("script-ext-html-webpack-plugin", [
|
|
||||||
{
|
|
||||||
// `runtime` must same as runtimeChunk name. default is `runtime`
|
|
||||||
inline: /runtime\..*\.js$/,
|
|
||||||
},
|
|
||||||
])
|
|
||||||
.end();
|
|
||||||
|
|
||||||
config.optimization.splitChunks({
|
|
||||||
chunks: "all",
|
|
||||||
cacheGroups: {
|
|
||||||
libs: {
|
|
||||||
name: "chunk-libs",
|
|
||||||
test: /[\\/]node_modules[\\/]/,
|
|
||||||
priority: 10,
|
|
||||||
chunks: "initial", // only package third parties that are initially dependent
|
|
||||||
},
|
|
||||||
elementUI: {
|
|
||||||
name: "chunk-elementUI", // split elementUI into a single package
|
|
||||||
test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
|
|
||||||
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
|
|
||||||
},
|
|
||||||
commons: {
|
|
||||||
name: "chunk-commons",
|
|
||||||
test: resolve("src/components"), // can customize your rules
|
|
||||||
minChunks: 3, // minimum common number
|
|
||||||
priority: 5,
|
|
||||||
reuseExistingChunk: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
{
|
||||||
config.optimization.runtimeChunk("single");
|
from: path.resolve(__dirname, 'node_modules/mxgraph/javascript/src/resources'),
|
||||||
});
|
to: path.resolve(__dirname, 'dist/resources')
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
from: path.resolve(__dirname, 'node_modules/mxgraph/javascript/src/css'),
|
||||||
|
to: path.resolve(__dirname, 'dist/mxgraph/css')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: path.resolve(__dirname, 'node_modules/mxgraph/javascript/src/css'),
|
||||||
|
to: path.resolve(__dirname, 'dist/css')
|
||||||
|
}
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user