test
wj 2 years ago
parent 7cb8f7407e
commit 1b43c4b254

@ -1,6 +1,7 @@
<template> <template>
<div id="app"> <div id="app">
<router-view /> <router-view />
<el-backtop target="#app"></el-backtop>
</div> </div>
</template> </template>
@ -17,6 +18,38 @@ export default {
} }
} }
</script> </script>
<style>
.width-full{
width: 100%;
}
.height-full{
height: 100%;
}
.mt15{
margin-top: 15px;
}
.p0{
padding: 0;
}
.p10{
padding: 10px;
}
.m0{
margin: 0;
}
.el-card__header{
padding: 0;
}
.d-block{
display: block;
}
</style>
<style lang="scss"> <style lang="scss">
//tabel //tabel
.el-table th.gutter { .el-table th.gutter {

@ -0,0 +1,10 @@
import request from '@/utils/request'
export function sysMsgTodoPage(query) {
return request({
url: '/spms/sysMsgTodo/page',
method: 'POST',
data: query
})
}

@ -0,0 +1,11 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg t="1700031660336" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8074"
xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">
<path
d="M961.494778 163.055425 712.444901 8.538501c-20.49099-12.761994-48.420976-11.057995-67.262967 4.081998L511.969 119.792446 378.785066 12.636499c-18.763991-15.097993-46.776977-16.910992-67.191967-4.119998l-249.129877 154.559924c-33.058984 20.57199-36.794982 68.764966-6.564997 93.653954l115.608943 96.585952-94.004954 73.476964c-31.079985 23.968988-29.337986 72.402964 3.503998 93.986954L320.127095 679.33517c20.62699 13.590993 47.820976 12.570994 67.535967-2.314999l124.322939-95.727953 123.569939 95.653953c19.141991 14.733993 47.582977 15.754992 67.671967 2.348999l239.204882-158.550922c32.569984-21.687989 34.376983-69.647966 3.657998-93.810954l-93.731954-73.459964 115.553943-96.591952C998.26176 231.864391 994.735762 183.793415 961.494778 163.055425L961.494778 163.055425zM796.25686 386.209315l109.908946 86.148957L671.159921 628.134195l-109.562946-84.784958L796.25686 386.209315 796.25686 386.209315zM561.690975 157.273428l120.159941-96.660952 244.914879 151.954925L803.019856 316.050349 561.690975 157.273428 561.690975 157.273428zM743.267886 349.009333 511.824 504.004257 279.742115 350.471332l232.237885-153.631924L743.267886 349.009333 743.267886 349.009333zM462.102025 543.486237l-109.233946 84.099959L117.232195 472.361272l108.807946-85.023958L462.102025 543.486237 462.102025 543.486237zM97.219205 212.5764 342.712084 61.100475l119.593941 96.217953L221.639143 316.519349 97.219205 212.5764 97.219205 212.5764z"
p-id="8075" fill="#1296db"></path>
<path
d="M519.265996 654.201182 359.448075 775.833122 172.313168 651.794184l0 154.424924c0 20.67199 10.387995 38.939981 28.499986 50.116975l282.212861 159.500921c18.559991 10.488995 41.873979 11.098995 60.42697 0.486L824.017846 855.845083c17.101992-10.535995 27.724986-29.550985 27.724986-49.625976L851.742832 661.055179 677.720918 775.313123 519.265996 654.201182zM232.688138 764.252128l94.685953 62.752969c20.53599 13.579993 47.810976 12.641994 67.453967-2.238999l124.357939-94.622953 123.651939 94.489953c19.077991 14.707993 47.656976 15.857992 67.673967 2.352999l80.85196-53.568974-0.005 31.577984L514.309999 963.45103 232.688138 805.030108 232.688138 764.252128 232.688138 764.252128z"
p-id="8076" fill="#1296db"></path>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700031162455" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4954" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M807.424 986.624H225.28c-30.208 0-53.76-23.552-53.76-53.76V363.008h51.2v569.856c0 1.536 1.024 2.56 2.56 2.56h582.144c1.536 0 2.56-1.024 2.56-2.56V363.008h51.2v569.856c0 30.208-23.552 53.76-53.76 53.76z" p-id="4955" fill="#d81e06"></path><path d="M993.28 542.72c-6.656 0-13.312-2.56-17.92-7.68l-455.68-455.68-455.68 455.68c-10.24 10.24-26.112 10.24-36.352 0s-10.24-26.112 0-36.352L501.76 25.6c10.24-10.24 26.112-10.24 36.352 0l473.6 473.6c10.24 10.24 10.24 26.112 0 36.352-5.12 4.608-11.776 7.168-18.432 7.168z" p-id="4956" fill="#d81e06"></path><path d="M517.12 720.896c-13.824 0-26.112-10.24-27.648-24.576l-39.424-276.992c-6.144-40.96 26.112-77.824 67.072-77.824 41.472 0 73.216 36.864 67.072 77.824l-39.424 276.992c-2.048 14.336-13.824 24.576-27.648 24.576z" p-id="4957" fill="#d81e06"></path><path d="M517.12 788.48m-37.888 0a37.888 37.888 0 1 0 75.776 0 37.888 37.888 0 1 0-75.776 0Z" p-id="4958" fill="#d81e06"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1700031219867" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6137" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M677.736296 306.536296H212.385185c-15.739259 0-28.444444-12.705185-28.444444-28.444444s12.705185-28.444444 28.444444-28.444445h465.351111c15.739259 0 28.444444 12.705185 28.444445 28.444445s-12.705185 28.444444-28.444445 28.444444zM622.933333 482.322963H209.351111c-15.739259 0-28.444444-12.705185-28.444444-28.444444s12.705185-28.444444 28.444444-28.444445H622.933333c15.739259 0 28.444444 12.705185 28.444445 28.444445s-12.705185 28.444444-28.444445 28.444444zM540.823704 653.937778H209.351111c-15.739259 0-28.444444-12.705185-28.444444-28.444445s12.705185-28.444444 28.444444-28.444444h331.567408c15.739259 0 28.444444 12.705185 28.444444 28.444444s-12.8 28.444444-28.539259 28.444445zM883.01037 683.804444h-54.708148c-12.61037 0-22.755556-10.145185-22.755555-22.755555s10.145185-22.755556 22.755555-22.755556h54.708148c12.61037 0 22.755556 10.145185 22.755556 22.755556s-10.145185 22.755556-22.755556 22.755555zM883.01037 766.008889h-54.708148c-12.61037 0-22.755556-10.145185-22.755555-22.755556s10.145185-22.755556 22.755555-22.755555h54.708148c12.61037 0 22.755556 10.145185 22.755556 22.755555s-10.145185 22.755556-22.755556 22.755556zM937.813333 587.472593H691.38963c-12.61037 0-22.755556-10.145185-22.755556-22.755556s10.145185-22.755556 22.755556-22.755556H937.718519c12.61037 0 22.755556 10.145185 22.755555 22.755556s-10.145185 22.755556-22.660741 22.755556z" p-id="6138" fill="#d81e06"></path><path d="M814.554074 958.577778c-50.251852 0-91.211852-40.865185-91.211852-91.211852V565.096296c0-12.61037 10.145185-22.755556 22.755556-22.755555h136.912592c12.61037 0 22.755556 10.145185 22.755556 22.755555v302.26963c0 50.346667-40.865185 91.211852-91.211852 91.211852zM768.948148 587.851852v279.514074c0 25.220741 20.48 45.700741 45.700741 45.700741s45.700741-20.48 45.700741-45.700741V587.851852H768.948148z" p-id="6139" fill="#d81e06"></path><path d="M304.355556 964.266667h-1.042963c-7.86963-0.284444-15.36-3.887407-20.48-9.860741L201.955556 860.634074l-90.832593 93.392593c-8.059259 8.343704-20.385185 10.903704-31.099259 6.542222a28.472889 28.472889 0 0 1-17.730371-26.358519L62.577778 135.585185c0-41.813333 34.038519-75.851852 75.851852-75.851852h629.38074c41.813333 0 75.851852 34.038519 75.851852 75.851852v251.828148c0 15.739259-12.705185 28.444444-28.444444 28.444445s-28.444444-12.705185-28.444445-28.444445V135.585185c0-10.42963-8.533333-18.962963-18.962963-18.962963H138.42963c-10.42963 0-18.962963 8.533333-18.962963 18.962963l-0.284445 728.557037 63.620741-65.422222c5.594074-5.688889 13.179259-8.817778 21.238518-8.628148 7.964444 0.284444 15.454815 3.792593 20.66963 9.860741l81.161482 94.056296 94.34074-94.435556c5.30963-5.30963 12.61037-8.343704 20.100741-8.343703s14.791111 3.034074 20.100741 8.343703L556.562963 915.721481c11.093333 11.093333 11.093333 29.108148 0 40.201482s-29.108148 11.093333-40.201482 0L420.408889 859.875556l-95.857778 96.047407c-5.404444 5.30963-12.61037 8.343704-20.195555 8.343704z" p-id="6140" fill="#d81e06"></path></svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

@ -29,10 +29,10 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.app-main { .app-main {
/* 50= navbar 50 */ /* 50= navbar 50 */
min-height: calc(100vh - 50px); height: calc(100vh - 50px);
width: 100%; width: 100%;
position: relative; position: relative;
overflow: hidden; overflow: auto;
} }
.fixed-header + .app-main { .fixed-header + .app-main {
@ -42,7 +42,7 @@ export default {
.hasTagsView { .hasTagsView {
.app-main { .app-main {
/* 84 = navbar + tags-view = 50 + 34 */ /* 84 = navbar + tags-view = 50 + 34 */
min-height: calc(100vh - 84px); height: calc(100vh - 84px);
} }
.fixed-header + .app-main { .fixed-header + .app-main {

@ -1,25 +1,223 @@
<template> <template>
<div class="app-container home"> <div class="app-container home">
<el-row :gutter="20"> <div>
<el-col :sm="24" :lg="12" style="padding-left: 20px"> <h2>欢迎使用供应商自助管理系统</h2>
<h2>欢迎使用供应商自助管理系统</h2> <el-divider/>
</div>
<!-- 分割线 -->
<div class="mt10 grid-container grid-container3" style="height: 15%">
<el-card v-for="item in card" class="grid-item" body-style="padding:0px;height:100%">
<el-row :gutter="20">
<el-image class="height-full" style="border-radius: 4px;width: 30%;"
:src="item.svg">
<div slot="placeholder" class="image-slot">
加载中<span class="dot">...</span>
</div>
</el-image>
<div class="height-full fr center mr20">
<span class="header d-block">
{{ item.title }}
</span>
<span class="d-block mt10" :style="{'font-size': '32px','font-weight': 'bolder',color:item.color}">
{{ item.text }}
</span>
</div>
</el-row>
</el-card>
</div>
<!-- 分割线 -->
<div class="m0 grid-container grid-container2" style="height: calc(40%);margin-top: 10px">
<el-card class="grid-item" body-style="padding:0px;height:100%">
<div slot="header" class="header">
<el-icon class="el-icon-s-comment"/>
待办事项
<el-button type="text" class="fr" style="font-size: 15px;color: unset"
@click="linkPage('/pur/auditDelivery')">更多
<el-icon class="el-icon-d-arrow-right"/>
</el-button>
</div>
<el-table
v-loading="msgLoading"
:data="msgList"
stripe
style="width: 100%;margin-top: 10px">
<el-table-column
type="index"
label="序号"
width="50"/>
<el-table-column
label="消息编码"
prop="code"
width="120"/>
<el-table-column
label="消息类型"
prop="msgTypeName"
width="120"/>
<el-table-column
label="消息内容"
prop="msgContent"
width="280"/>
<el-table-column
label="处理状态"
prop="dealStatus"
width="120"/>
<el-table-column
label="创建时间"
prop="createTime"
width="140"/>
<el-table-column label="操作" width="80" fixed="right">
<template slot-scope="scope">
<el-button
type="text"
@click="linkPage('/pur/auditDelivery')"
>处理
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card class="grid-item" body-style="padding:0px;height:100%">
<div slot="header" class="header">
<el-icon class="el-icon-s-platform"/>
审核送货单
<el-button type="text" class="fr" style="font-size: 15px;color: unset"
@click="linkPage('/pur/auditDelivery')">更多
<el-icon class="el-icon-d-arrow-right"/>
</el-button>
</div>
<el-table
v-loading="orderLoading"
:data="orderList"
stripe
style="width: 100%;margin-top: 10px">
<el-table-column
type="index"
label="序号"
width="50"/>
<el-table-column label="送货单号" prop="billNo" width="180"/>
<el-table-column label="单据类型" prop="billTypeName" width="150"/>
<el-table-column label="送货单位" prop="fromName" width="220"/>
<el-table-column label="创建时间" prop="createTime" width="150"/>
<el-table-column label="核对时间" prop="checkTime" width="150"/>
</el-col> <el-table-column label="采购部门" prop="deptName" width="120">
</el-row> </el-table-column>
<el-divider/> <el-table-column label="收货仓库" prop="invName" width="120">
</el-table-column>
<el-table-column label="核对人" prop="checkUserName" width="120">
</el-table-column>
<el-table-column label="来源单号" prop="corpOrderId" width="180"/>
<!-- <el-table-column label="来源" prop="fromType" width="120">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ fromTypeMap[scope.row.fromType] }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="审核状态" prop="status" width="100">-->
<!-- <template slot-scope="scope">-->
<!-- <el-tag :type="statusFilterType(scope.row.status)">{{-->
<!-- checkStatus[scope.row.status]-->
<!-- }}-->
<!-- </el-tag>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="备注" prop="remark" width="180"/>
<el-table-column label="操作" width="80" fixed="right">
<template slot-scope="scope">
<el-button
type="text"
@click="linkPage('/pur/auditDelivery')"
>处理
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</div> </div>
</template> </template>
<script> <script>
import {getOrderList} from "../api/inout/order";
import {sysMsgTodoPage} from "../api/system/sysMsgTodoApi";
import 已对照产品 from "@/assets/svg/已对照产品.svg"
import 库存预警 from "@/assets/svg/库存预警.svg"
import 资质预警 from "@/assets/svg/资质预警.svg"
export default { export default {
name: "Index", name: "Index",
data() { data() {
return { return {
// //
version: "4.3.0", version: "4.3.0",
card: [
{color: '#ef5c3b', title: '已对照产品', text: '999999', svg: 已对照产品},
{color: '#ef5c3b', title: '库存预警', text: '999999', svg: 库存预警},
{color: '#ef5c3b', title: '资质预警', text: '999999', svg: 资质预警},
],
// ==================================================
msgLoading: false,
msgList: [],
msgQuery: {
page: 1,
limit: 5
},
// =======================================================================
// ==================================================
orderLoading: false,
orderList: [],
orderQuery: {
page: 1,
limit: 5,
status: 10,
vueType: "supDelivery",
}
// =======================================================================
}; };
}, },
created() {
this.getSysMsgTodoList()
this.getOrderList()
},
methods: { methods: {
linkPage(path) {
this.$router.push({path})
},
getSysMsgTodoList() {
this.msgLoading = true
sysMsgTodoPage(this.msgQuery).then(res => {
this.msgLoading = false
if (res.code != 20000) {
this.$message.error(res.message())
return
}
this.msgList = res.data.list || []
}).catch(e => {
this.msgLoading = false
this.msgList = []
})
},
getOrderList() {
this.orderLoading = true;
getOrderList(this.orderQuery)
.then((res) => {
this.orderLoading = false;
if (res.code === 20000) {
this.orderList = res.data.list || [];
this.orderTotal = res.data.total || 0;
} else {
this.$message.error(res.message);
}
})
.catch((error) => {
this.$message.error(error.message)
this.orderLoading = false;
this.orderList = [];
this.orderTotal = 0;
});
},
goTarget(href) { goTarget(href) {
window.open(href, "_blank"); window.open(href, "_blank");
}, },
@ -28,7 +226,68 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.center{
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
}
.el-row .el-card {
margin: 0;
.el-card__body {
padding: 0 !important;
}
}
.grid-item {
height: 100%;
padding: 15px;
.el-row, .el-col {
height: 100%;
}
.header {
color: #676a6c;
font-size: 20px;
font-weight: bolder;
}
}
.grid-container {
height: inherit;
display: grid;
grid-gap: 10px;
.el-card {
margin: 0;
}
}
.grid-container1 {
grid-template-columns: repeat(1, 1fr);
}
.grid-container2 {
grid-template-columns: repeat(2, 1fr);
}
.grid-container3 {
grid-template-columns: repeat(3, 1fr);
}
.grid-container4 {
grid-template-columns: repeat(4, 1fr);
}
.home { .home {
blockquote { blockquote {
padding: 10px 20px; padding: 10px 20px;
margin: 0 0 20px; margin: 0 0 20px;
@ -52,6 +311,7 @@ export default {
margin: 0; margin: 0;
} }
height: calc(100%);
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px; font-size: 13px;
color: #676a6c; color: #676a6c;
@ -68,7 +328,8 @@ export default {
h2 { h2 {
margin-top: 10px; margin-top: 10px;
font-size: 26px; font-size: 26px;
font-weight: 100; color: #000610;
font-weight: bolder;
} }
p { p {

@ -11,6 +11,7 @@
</el-row> </el-row>
</div> </div>
<el-form <el-form
@submit.native.prevent
class="card-box login-form" class="card-box login-form"
autocomplete="on" autocomplete="on"
:model="ruleForm" :model="ruleForm"

@ -1,15 +1,15 @@
"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 || "UDI自助平台"; // 网页标题 const name = process.env.VUE_APP_TITLE || 'UDI自助平台' // 网页标题
const port = process.env.port || process.env.npm_config_port || 80; // 端口 const port = process.env.port || process.env.npm_config_port || 84 // 端口
// 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,16 +20,16 @@ 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.VUE_APP_CONTEXT_PATH, publicPath: process.env.VUE_APP_CONTEXT_PATH,
// 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist // 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist
outputDir: "UDI_SPMS_CLIENT", outputDir: 'UDI_SPMS_CLIENT',
// 用于放置生成的静态资源 (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: false, open: false,
proxy: { proxy: {
@ -38,94 +38,99 @@ module.exports = {
target: process.env.VUE_APP_BASE_API, target: process.env.VUE_APP_BASE_API,
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)?$/i, // 压缩文件格式 test: /\.(js|css|html)?$/i, // 压缩文件格式
filename: "[path].gz[query]", // 压缩后的文件名 filename: '[path].gz[query]', // 压缩后的文件名
algorithm: "gzip", // 使用gzip压缩 algorithm: 'gzip', // 使用gzip压缩
minRatio: 0.8, // 压缩率小于1才会压缩 minRatio: 0.8 // 压缩率小于1才会压缩
}), })
], ],
}, },
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("icons") .rule('svg')
.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
config .when(process.env.NODE_ENV !== 'development',
.plugin("ScriptExtHtmlWebpackPlugin") config => {
.after("html") config
.use("script-ext-html-webpack-plugin", [ .plugin('ScriptExtHtmlWebpackPlugin')
{ .after('html')
// `runtime` must same as runtimeChunk name. default is `runtime` .use('script-ext-html-webpack-plugin', [{
inline: /runtime\..*\.js$/, // `runtime` must same as runtimeChunk name. default is `runtime`
}, inline: /runtime\..*\.js$/
]) }])
.end(); .end()
config.optimization.splitChunks({ config
chunks: "all", .optimization.splitChunks({
cacheGroups: { chunks: 'all',
libs: { cacheGroups: {
name: "chunk-libs", libs: {
test: /[\\/]node_modules[\\/]/, name: 'chunk-libs',
priority: 10, test: /[\\/]node_modules[\\/]/,
chunks: "initial", // only package third parties that are initially dependent priority: 10,
}, chunks: 'initial' // only package third parties that are initially dependent
elementUI: { },
name: "chunk-elementUI", // split elementUI into a single package elementUI: {
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app 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
}, test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
commons: { },
name: "chunk-commons", commons: {
test: resolve("src/components"), // can customize your rules name: 'chunk-commons',
minChunks: 3, // minimum common number test: resolve('src/components'), // can customize your rules
priority: 5, minChunks: 3, // minimum common number
reuseExistingChunk: true, priority: 5,
}, reuseExistingChunk: true
}, }
}); }
config.optimization.runtimeChunk("single"), })
{ config.optimization.runtimeChunk('single'),
from: path.resolve(__dirname, "./public/robots.txt"), //防爬虫文件 {
to: "./", //到根目录下 from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
}; to: './' //到根目录下
}); }
}, }
}; )
}
}

Loading…
Cancel
Save