Commit 07f75b2c by zhaopanyu

zpy

parent 66779310
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
}, },
"dependencies": { "dependencies": {
"@riophae/vue-treeselect": "0.4.0", "@riophae/vue-treeselect": "0.4.0",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^1.0.2",
"axios": "0.28.1", "axios": "0.28.1",
"clipboard": "2.0.8", "clipboard": "2.0.8",
"core-js": "3.37.1", "core-js": "3.37.1",
......
<template>
<div class="bottom">
<div class="footer">
<div class="outerNet">
<div class="item" v-for="item in hyperlinkList" @click="goLink(item)">{{ item.mcbt }}</div>
</div>
<div class="info">
<div class="deptName">
<!-- <div class="logo">-->
<!-- <img src="@/assets/images/miniLogo.png" alt="">-->
<!-- </div>-->
<div class="name">中国石化胜利油田分公司</div>
</div>
<div class="department">企管法规部(三基工作办公室)@2024 </div>
<div class="support">技术支持:XXXXXXXXXXXXXXXXX</div>
<div class="postcode">邮政编码:257000 </div>
<div class="telephone">电话:0546-******</div>
</div>
</div>
</div>
</template>
<script>
// import {
// listHyperlink, //查询超链接维护列表
// } from "@/api/portalWebsite/home.js"
export default {
name: "footerNav",
data() {
return {
baseURL: process.env.VUE_APP_BASE_API,
hyperlinkList: []
}
},
mounted() {
this.getHyperlink()
},
methods: {
/**查询超链接维护列表*/
getHyperlink() {
// listHyperlink().then(res => {
// console.log('查询超链接维护列表', res)
// this.hyperlinkList = res.rows
// })
},
goLink(item) {
if (item.tzfs == '新页签') {
const url = window.location.protocol + "//" + item.lj
window.open(url, '_blank')
}
if (item.tzfs == '当前页') {
window.location.href = window.location.protocol + "//" + item.lj
}
}
}
}
</script>
<style scoped lang="scss">
.bottom {
z-index: -999;
//background: url("../../assets/images/background7.png") center no-repeat;
//background-size: cover;
//height: 400px;
//width: 100%;
//position: absolute;
//top: 80%;
//margin-top: 200px;
//bottom: 0;
.footer {
//position: relative;
width: 100%;
padding: 3px 100px;
//position: absolute;
//bottom: 0;
//bottom: 10px;
//top: 0;
color: rgba(255, 255, 255, 0.74);
font-size: 12px;
.outerNet {
//position: absolute;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
//bottom: 25px;
//left: 200px;
//left: 30%;
//transform: translate(-50%);
margin-bottom: 5px;
.item {
margin-right: 30px;
text-align: center;
//width: 80px;
//height: 25px;
line-height: 19px;
border: 0.5px solid rgba(255, 255, 255, 0.74);
border-radius: 10px;
padding: 3px 10px;
}
}
.info {
display: flex;
justify-content: space-between;
align-items: flex-end;
.deptName {
display: flex;
align-items: flex-end;
.logo {
margin-right: 5px;
img {
width: 30px;
height: 30px;
}
}
}
}
}
}
</style>
import router from './router' import router from "./router";
import store from './store' import store from "./store";
import { Message } from 'element-ui' import { Message } from "element-ui";
import NProgress from 'nprogress' import NProgress from "nprogress";
import 'nprogress/nprogress.css' import "nprogress/nprogress.css";
import { getToken } from '@/utils/auth' import { getToken } from "@/utils/auth";
import { isRelogin } from '@/utils/request' import { isRelogin } from "@/utils/request";
NProgress.configure({ showSpinner: false }) NProgress.configure({ showSpinner: false });
const whiteList = ['/login', '/register'] const whiteList = ["/login", "/register", "web"];
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start() NProgress.start();
if (getToken()) { if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title) to.meta.title && store.dispatch("settings/setTitle", to.meta.title);
/* has token*/ /* has token*/
if (to.path === '/login') { if (to.path === "/login") {
next({ path: '/' }) next({ path: "/" });
NProgress.done() NProgress.done();
} else if (whiteList.indexOf(to.path) !== -1) { } else if (whiteList.indexOf(to.path) !== -1) {
next() next();
} else { } else {
if (store.getters.roles.length === 0) { if (store.getters.roles.length === 0) {
isRelogin.show = true isRelogin.show = true;
// 判断当前用户是否已拉取完user_info信息 // 判断当前用户是否已拉取完user_info信息
store.dispatch('GetInfo').then(() => { store
isRelogin.show = false .dispatch("GetInfo")
store.dispatch('GenerateRoutes').then(accessRoutes => { .then(() => {
// 根据roles权限生成可访问的路由表 isRelogin.show = false;
router.addRoutes(accessRoutes) // 动态添加可访问路由表 store.dispatch("GenerateRoutes").then((accessRoutes) => {
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 // 根据roles权限生成可访问的路由表
}) router.addRoutes(accessRoutes); // 动态添加可访问路由表
}).catch(err => { next({ ...to, replace: true }); // hack方法 确保addRoutes已完成
store.dispatch('LogOut').then(() => { });
Message.error(err)
next({ path: '/' })
})
}) })
.catch((err) => {
store.dispatch("LogOut").then(() => {
Message.error(err);
next({ path: "/" });
});
});
} else { } else {
next() next();
} }
} }
} else { } else {
// 没有token // 没有token
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入 // 在免登录白名单,直接进入
next() next();
} else { } else {
next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页 next(`/login?redirect=${encodeURIComponent(to.fullPath)}`); // 否则全部重定向到登录页
NProgress.done() NProgress.done();
} }
} }
}) });
router.afterEach(() => { router.afterEach(() => {
NProgress.done() NProgress.done();
}) });
import Vue from 'vue' import Vue from "vue";
import Router from 'vue-router' import Router from "vue-router";
Vue.use(Router) Vue.use(Router);
/* Layout */ /* Layout */
import Layout from '@/layout' import Layout from "@/layout";
/** /**
* Note: 路由配置项 * Note: 路由配置项
...@@ -31,153 +31,159 @@ import Layout from '@/layout' ...@@ -31,153 +31,159 @@ import Layout from '@/layout'
// 公共路由 // 公共路由
export const constantRoutes = [ export const constantRoutes = [
{ {
path: '/redirect', path: "/redirect",
component: Layout, component: Layout,
hidden: true, hidden: true,
children: [ children: [
{ {
path: '/redirect/:path(.*)', path: "/redirect/:path(.*)",
component: () => import('@/views/redirect') component: () => import("@/views/redirect"),
} },
] ],
},
{
path: "/web",
component: () => import("@/views/gasDigitization"),
hidden: true,
}, },
{ {
path: '/login', path: "/login",
component: () => import('@/views/login'), component: () => import("@/views/login"),
hidden: true hidden: true,
}, },
{ {
path: '/register', path: "/register",
component: () => import('@/views/register'), component: () => import("@/views/register"),
hidden: true hidden: true,
}, },
{ {
path: '/404', path: "/404",
component: () => import('@/views/error/404'), component: () => import("@/views/error/404"),
hidden: true hidden: true,
}, },
{ {
path: '/401', path: "/401",
component: () => import('@/views/error/401'), component: () => import("@/views/error/401"),
hidden: true hidden: true,
}, },
{ {
path: '', path: "",
component: Layout, component: Layout,
redirect: 'index', redirect: "index",
children: [ children: [
{ {
path: 'index', path: "index",
component: () => import('@/views/index'), component: () => import("@/views/index"),
name: 'Index', name: "Index",
meta: { title: '首页', icon: 'dashboard', affix: true } meta: { title: "首页", icon: "dashboard", affix: true },
} },
] ],
}, },
{ {
path: '/user', path: "/user",
component: Layout, component: Layout,
hidden: true, hidden: true,
redirect: 'noredirect', redirect: "noredirect",
children: [ children: [
{ {
path: 'profile', path: "profile",
component: () => import('@/views/system/user/profile/index'), component: () => import("@/views/system/user/profile/index"),
name: 'Profile', name: "Profile",
meta: { title: '个人中心', icon: 'user' } meta: { title: "个人中心", icon: "user" },
} },
] ],
} },
] ];
// 动态路由,基于用户权限动态去加载 // 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [ export const dynamicRoutes = [
{ {
path: '/system/user-auth', path: "/system/user-auth",
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['system:user:edit'], permissions: ["system:user:edit"],
children: [ children: [
{ {
path: 'role/:userId(\\d+)', path: "role/:userId(\\d+)",
component: () => import('@/views/system/user/authRole'), component: () => import("@/views/system/user/authRole"),
name: 'AuthRole', name: "AuthRole",
meta: { title: '分配角色', activeMenu: '/system/user' } meta: { title: "分配角色", activeMenu: "/system/user" },
} },
] ],
}, },
{ {
path: '/system/role-auth', path: "/system/role-auth",
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['system:role:edit'], permissions: ["system:role:edit"],
children: [ children: [
{ {
path: 'user/:roleId(\\d+)', path: "user/:roleId(\\d+)",
component: () => import('@/views/system/role/authUser'), component: () => import("@/views/system/role/authUser"),
name: 'AuthUser', name: "AuthUser",
meta: { title: '分配用户', activeMenu: '/system/role' } meta: { title: "分配用户", activeMenu: "/system/role" },
} },
] ],
}, },
{ {
path: '/system/dict-data', path: "/system/dict-data",
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['system:dict:list'], permissions: ["system:dict:list"],
children: [ children: [
{ {
path: 'index/:dictId(\\d+)', path: "index/:dictId(\\d+)",
component: () => import('@/views/system/dict/data'), component: () => import("@/views/system/dict/data"),
name: 'Data', name: "Data",
meta: { title: '字典数据', activeMenu: '/system/dict' } meta: { title: "字典数据", activeMenu: "/system/dict" },
} },
] ],
}, },
{ {
path: '/monitor/job-log', path: "/monitor/job-log",
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['monitor:job:list'], permissions: ["monitor:job:list"],
children: [ children: [
{ {
path: 'index/:jobId(\\d+)', path: "index/:jobId(\\d+)",
component: () => import('@/views/monitor/job/log'), component: () => import("@/views/monitor/job/log"),
name: 'JobLog', name: "JobLog",
meta: { title: '调度日志', activeMenu: '/monitor/job' } meta: { title: "调度日志", activeMenu: "/monitor/job" },
} },
] ],
}, },
{ {
path: '/tool/gen-edit', path: "/tool/gen-edit",
component: Layout, component: Layout,
hidden: true, hidden: true,
permissions: ['tool:gen:edit'], permissions: ["tool:gen:edit"],
children: [ children: [
{ {
path: 'index/:tableId(\\d+)', path: "index/:tableId(\\d+)",
component: () => import('@/views/tool/gen/editTable'), component: () => import("@/views/tool/gen/editTable"),
name: 'GenEdit', name: "GenEdit",
meta: { title: '修改生成配置', activeMenu: '/tool/gen' } meta: { title: "修改生成配置", activeMenu: "/tool/gen" },
} },
] ],
} },
] ];
// 防止连续点击多次路由报错 // 防止连续点击多次路由报错
let routerPush = Router.prototype.push; let routerPush = Router.prototype.push;
let routerReplace = Router.prototype.replace; let routerReplace = Router.prototype.replace;
// push // push
Router.prototype.push = function push(location) { Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch(err => err) return routerPush.call(this, location).catch((err) => err);
} };
// replace // replace
Router.prototype.replace = function push(location) { Router.prototype.replace = function push(location) {
return routerReplace.call(this, location).catch(err => err) return routerReplace.call(this, location).catch((err) => err);
} };
export default new Router({ export default new Router({
mode: 'history', // 去掉url中的# mode: "history", // 去掉url中的#
scrollBehavior: () => ({ y: 0 }), scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes routes: constantRoutes,
}) });
<template>
<div class="container">
<el-row>
<img src="../../assets/images/background1.png" alt="" style="
background-size: 100% 100%;
margin-top: 20px;
height: 300px;
width: 100%;
float: none;
margin: 0 auto;
" />
<img src="../../assets/images/bt.png" alt="" style="
background-size: 100% 100%;
position: absolute;
top: 50%;
left: 50%;
height: 200px;
width: 50%;
transform: translate(-50%, -50%);
" />
</el-row>
<el-row style="margin-top: -10px">
<div class="content">
<el-tabs v-model="activeName" @tab-click="handleClick" type="card">
<el-tab-pane label="产品简介" name="first">
<div class="text" v-html="bmjj"></div>
</el-tab-pane>
<el-tab-pane label="功能特点" name="second">
<div class="text" v-html="zzld"></div>
</el-tab-pane>
<el-tab-pane label="应用成效" name="third">
<div class="text" v-html="sjglry"></div>
</el-tab-pane>
<el-tab-pane label="用法介绍" name="third">
<div class="text" v-html="sjglry"></div>
</el-tab-pane>
</el-tabs>
</div>
</el-row>
</div>
</template>
<script>
// import { addTp } from "@/api/benchmarkVoting.js";
// import store from "@/store";
// import { encrypt, decrypt } from "@/js/aesEncrypt"
// import footerNav from "@/components/footerNav"
export default {
name: "gasDigitization",
// components: { footerNav },
data() {
return {
activeName: 'first',
currentImage: '',
isDialogVisible: false,
name: null,
ipdz: null,
yl1: null,
addLoading: false,
fwXz: [],
zyhXz: [],
kyXz: [],
yzXz: [],
dialogVisible: false,
selectedUnit: {},
showDialog: false, // 控制对话框显示的变量
form: {
yqsc: [], // 用于存储选中的单位
ky: [],
zyh: [],
fw: [],
},
selectedUnits: {
oilGasProduction: [],
research: [],
specialization: [],
serviceCoordination: [],
},
};
},
computed: {
},
mounted() {
},
methods: {
handleClick(tab, event) {
console.log(tab, event);
},
closeDialog() {
this.isDialogVisible = false; // 关闭对话框
},
submitTp() {
this.addLoading = true;
const isValid =
this.fwXz.length > 0 &&
this.zyhXz.length > 0 &&
this.kyXz.length > 0 &&
this.yzXz.length > 0;
if (!isValid) {
this.$modal.msgError("每个板块至少选 1 家单位。");
this.addLoading = false;
return; // 终止提交
}
const params = {
name: this.name,
ipdz: this.ipdz,
yl1: this.yl1,
tpInfoCbListA: this.fwXz,
tpInfoCbListB: this.zyhXz,
tpInfoCbListC: this.kyXz,
tpInfoCbListD: this.yzXz,
};
addTp(params)
.then((response) => {
if (response.code == 200) {
this.$modal.msgSuccess("投票成功");
} else if (response.code == 500) {
this.$modal.msgError("已投票,请勿重复投票");
}
})
.finally(() => {
this.addLoading = false;
});
},
openDialog(unit) {
this.selectedUnit = unit; // 保存当前点击的单位信息
this.showDialog = true; // 显示弹窗
},
tc() {
window.location.href = "http://ipms.slof.com/tzLogout/sjbgtx"
}
},
};
</script>
<style scoped lang="scss">
.content {
margin: 20px 20% 40px 20%;
position: relative;
.text {
font-size: 14px;
text-indent: 2em;
line-height: 25px;
color: #101010;
padding: 0px 20px;
}
}
::v-deep .el-tabs--card>.el-tabs__header {
border-bottom: 1px dashed #dddddd;
}
::v-deep .el-tabs--card>.el-tabs__header .el-tabs__nav {
border-left: none;
border-top: none;
}
::v-deep .el-tabs--card>.el-tabs__header .el-tabs__item.is-active {
border-bottom: 1px dashed #dddddd;
}
::v-deep .el-tabs__item.is-top {
font-size: 16px !important;
}
.preview-img {
width: 100%;
/* 或者根据需要设置 */
height: auto;
/* 保持比例 */
}
.xzText {
font-family: "黑体", sans-serif;
/* 或者使用 "Heiti" */
font-size: 15.5px;
/* 黑色字体 */
}
.btdlg {
display: inline-block !important;
font-family: Microsoft YaHei !important;
font-weight: bold !important;
font-size: 14px !important;
color: #c80000 !important;
line-height: 30px !important;
}
.nrdlg {
display: inline-block !important;
font-family: Microsoft YaHei !important;
font-weight: bold !important;
font-size: 14px !important;
line-height: 30px !important;
}
.nrdlgnr {
display: inline-block !important;
font-family: Microsoft YaHei !important;
font-weight: bold !important;
font-size: 14px !important;
line-height: 30px !important;
}
.img-container {
display: flex;
justify-content: center;
align-items: center;
}
.imgdlg {
/* width: 560px; */
width: 100%;
height: 120px;
}
.imgdlgst {
/* width: 560px; */
width: 100%;
height: 220px;
}
.sj {
/* width: 560px; */
margin: 10px 0;
}
.cc {
text-indent: 2em;
}
.text-align {
display: flex;
justify-content: flex-end;
margin: 0px 10px;
}
.text {
margin-left: auto;
margin: 10px 15px;
}
.row {
display: flex;
flex-direction: row;
align-items: inherit;
justify-content: center;
margin: 20px 0 20px -30px;
}
.checkbox-group-inline {
display: flex;
flex-wrap: wrap;
}
.checkbox-group-inline .el-checkbox {
margin-right: 10px;
/* 给复选框之间增加一些间距 */
}
.box {
position: relative;
top: -20px;
left: 0;
margin-bottom: -20px;
width: 100%;
min-height: 102vh;
background-image: url(../../assets/images/background1.png) !important;
background-size: cover;
background-repeat: no-repeat;
background-position: left top;
background-color: #f55202;
}
.container {
max-width: 100vw;
overflow-y: auto;
height: 100vh;
}
.bg {
padding-bottom: 20px;
padding-top: 30px;
min-height: 102vh;
width: 100%;
background-image: linear-gradient(180deg,
rgba(255, 255, 255, 0) 30%,
rgba(255, 255, 255, 0.65) 100%);
}
h1 {
text-align: center;
color: #333;
}
.toptit {
background-color: transparent;
border-radius: 8px 8px 0 0;
}
.content {
margin: 20px auto;
max-width: 70%;
padding: 20px;
background-color: #f0f8ff;
/* 设置背景色 */
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.bt {
text-indent: 3.6em;
margin: 20px auto;
/* max-width: 70%; */
width: 1200px;
padding: 20px;
background-color: #ffffff;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
overflow-y: auto;
}
.bt1 {
margin: 20px auto;
/* max-width: 70%; */
width: 1200px;
padding: 20px;
background-color: #ffffff;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
overflow-y: auto;
}
.tpxx {
margin: 20px auto;
max-width: 70%;
padding: 10px;
background-color: #f0f8ff;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
text-align: left;
}
h2 {
font-size: 24px;
color: #333;
margin-bottom: 15px;
font-family: "方正小标宋", "Fangzheng Xiaobiao Song", serif;
}
p {
font-size: 16px;
color: #555;
line-height: 1.6;
font-family: "FangSong_GB2312";
}
.bttitle {
font-family: Microsoft YaHei;
font-weight: bold;
font-size: 18px;
color: #000000;
line-height: 30px;
}
.yuan {
display: inline-block;
width: 10px;
height: 10px;
background: #c80000;
border-radius: 50%;
color: #c80000;
vertical-align: middle;
}
.title {
font-family: Microsoft YaHei;
font-weight: bold;
font-size: 14px;
color: #c80000;
line-height: 30px;
}
.titlenr {
font-family: Microsoft YaHei;
font-size: 14px;
line-height: 30px;
}
.nrtab {
margin: 5px 5%;
}
.btsty {
font-family: Microsoft YaHei;
font-weight: bold;
font-size: 16px;
color: #c80000;
line-height: 30px;
}
.kuang {
width: 18px;
height: 18px;
border-radius: 4px;
border: 1px solid #acacac;
display: inline-block;
vertical-align: middle;
}
.xq {
margin-left: auto;
position: absolute;
bottom: 8px;
right: 10px;
font-family: Microsoft YaHei;
font-weight: 400;
font-size: 14px;
color: #006ad7;
line-height: 30px;
text-decoration-line: underline;
cursor: pointer;
}
.xqname {
font-family: Microsoft YaHei;
font-weight: bold;
font-size: 14px;
color: #222222;
line-height: 20px;
margin-left: 10px;
text-align: left;
}
.xqcard {
width: 270px;
height: 60px;
background: #f5f5f5;
display: flex;
flex-direction: row;
background: #f5f5f5;
margin: 5px 0;
padding: 20px 15px;
position: relative;
}
.btdlgsty {
height: 18px;
font-family: Microsoft YaHei;
font-weight: bold;
font-size: 18px;
color: #000000;
line-height: 24px;
text-align: center !important;
}
.flex {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
</style>
'use strict' "use strict";
const path = require('path') const path = require("path");
function resolve(dir) { function resolve(dir) {
return path.join(__dirname, dir) return path.join(__dirname, dir);
} }
const CompressionPlugin = require('compression-webpack-plugin') const CompressionPlugin = require("compression-webpack-plugin");
const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题 const name = process.env.VUE_APP_TITLE || "若依管理系统"; // 网页标题
const port = process.env.port || process.env.npm_config_port || 80 // 端口 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,111 +20,111 @@ module.exports = { ...@@ -20,111 +20,111 @@ module.exports = {
// 例如 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" ? "/" : "/",
// 在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) 的;(项目打包之后,静态资源会放在这个文件夹下)
assetsDir: 'static', assetsDir: "static",
// 是否开启eslint保存检测,有效值:ture | false | 'error' // 是否开启eslint保存检测,有效值:ture | false | 'error'
lintOnSave: process.env.NODE_ENV === 'development', lintOnSave: process.env.NODE_ENV === "development",
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。 // 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
productionSourceMap: false, productionSourceMap: false,
// webpack-dev-server 相关配置 // webpack-dev-server 相关配置
devServer: { devServer: {
host: '0.0.0.0', host: "0.0.0.0",
port: port, port: port,
open: true, open: true,
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
target: `http://localhost:8080`, // target: `http://localhost:8080`,
target: `http://192.168.31.190:8899`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ["^" + process.env.VUE_APP_BASE_API]: "",
} },
} },
}, },
disableHostCheck: true disableHostCheck: true,
}, },
css: { css: {
loaderOptions: { loaderOptions: {
sass: { sass: {
sassOptions: { outputStyle: "expanded" } sassOptions: { outputStyle: "expanded" },
} },
} },
}, },
configureWebpack: { configureWebpack: {
name: name, name: name,
resolve: { resolve: {
alias: { alias: {
'@': resolve('src') "@": resolve("src"),
} },
}, },
plugins: [ plugins: [
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件 // http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
new CompressionPlugin({ new CompressionPlugin({
cache: false, // 不启用文件缓存 cache: false, // 不启用文件缓存
test: /\.(js|css|html|jpe?g|png|gif|svg)?$/i, // 压缩文件格式 test: /\.(js|css|html|jpe?g|png|gif|svg)?$/i, // 压缩文件格式
filename: '[path][base].gz[query]', // 压缩后的文件名 filename: "[path][base].gz[query]", // 压缩后的文件名
algorithm: 'gzip', // 使用gzip压缩 algorithm: "gzip", // 使用gzip压缩
minRatio: 0.8, // 压缩比例,小于 80% 的文件不会被压缩 minRatio: 0.8, // 压缩比例,小于 80% 的文件不会被压缩
deleteOriginalAssets: false // 压缩后删除原文件 deleteOriginalAssets: false, // 压缩后删除原文件
}) }),
], ],
}, },
chainWebpack(config) { chainWebpack(config) {
config.plugins.delete('preload') // TODO: need test config.plugins.delete("preload"); // TODO: need test
config.plugins.delete('prefetch') // TODO: need test config.plugins.delete("prefetch"); // TODO: need test
// set svg-sprite-loader // set svg-sprite-loader
config.module.rule("svg").exclude.add(resolve("src/assets/icons")).end();
config.module config.module
.rule('svg') .rule("icons")
.exclude.add(resolve('src/assets/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/) .test(/\.svg$/)
.include.add(resolve('src/assets/icons')) .include.add(resolve("src/assets/icons"))
.end() .end()
.use('svg-sprite-loader') .use("svg-sprite-loader")
.loader('svg-sprite-loader') .loader("svg-sprite-loader")
.options({ .options({
symbolId: 'icon-[name]' symbolId: "icon-[name]",
}) })
.end() .end();
config.when(process.env.NODE_ENV !== 'development', config => { config.when(process.env.NODE_ENV !== "development", (config) => {
config config
.plugin('ScriptExtHtmlWebpackPlugin') .plugin("ScriptExtHtmlWebpackPlugin")
.after('html') .after("html")
.use('script-ext-html-webpack-plugin', [{ .use("script-ext-html-webpack-plugin", [
{
// `runtime` must same as runtimeChunk name. default is `runtime` // `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/ inline: /runtime\..*\.js$/,
}]) },
.end() ])
.end();
config.optimization.splitChunks({ config.optimization.splitChunks({
chunks: 'all', chunks: "all",
cacheGroups: { cacheGroups: {
libs: { libs: {
name: 'chunk-libs', name: "chunk-libs",
test: /[\\/]node_modules[\\/]/, test: /[\\/]node_modules[\\/]/,
priority: 10, priority: 10,
chunks: 'initial' // only package third parties that are initially dependent chunks: "initial", // only package third parties that are initially dependent
}, },
elementUI: { elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package name: "chunk-elementUI", // split elementUI into a single package
test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm 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 priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
}, },
commons: { commons: {
name: 'chunk-commons', name: "chunk-commons",
test: resolve('src/components'), // can customize your rules test: resolve("src/components"), // can customize your rules
minChunks: 3, // minimum common number minChunks: 3, // minimum common number
priority: 5, priority: 5,
reuseExistingChunk: true reuseExistingChunk: true,
} },
} },
}) });
config.optimization.runtimeChunk('single') config.optimization.runtimeChunk("single");
}) });
} },
} };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment