1
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<div class="navbar">
|
||||
<p class="breadcrumb-container"><img src="@/assets/loginImg/logo.png"
|
||||
style="width: 45px;height: 45px;margin-right: 10px;" />预定商城管理平台</p>
|
||||
style="width: 45px;height: 45px;margin-right: 10px;" />云菜窖管理平台</p>
|
||||
<!-- <h3 class="breadcrumb-container">银行供应链贷后监管平台</h3> -->
|
||||
<div class="right-menu">
|
||||
<!-- <p>{{Orgname}} {{departmentName}} 欢迎, {{name}}</p>-->
|
||||
@@ -10,7 +10,7 @@
|
||||
<p class="dy" @click="logout()"><img src="@/assets/images/dy.png"></p> -->
|
||||
</div>
|
||||
</div>
|
||||
<el-footer class="footer" height="40px">Copyright © {{ year }} 预定商城管理平台 All Rights Reserved</el-footer>
|
||||
<el-footer class="footer" height="40px">Copyright © {{ year }} 云菜窖管理平台 All Rights Reserved</el-footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module.exports = {
|
||||
|
||||
title: '预定商城系统',
|
||||
title: '云菜窖',
|
||||
|
||||
/**
|
||||
* @type {boolean} true | false
|
||||
|
||||
@@ -1,281 +1,291 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
|
||||
<div class="tab-header webtop">
|
||||
<!-- 标题 -->
|
||||
<div>轮播图信息</div>
|
||||
<!-- start 添加修改按钮 -->
|
||||
<div>
|
||||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
|
||||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
|
||||
</div>
|
||||
<!-- end 添加修改按钮 -->
|
||||
<!-- end 详情按钮 -->
|
||||
</div>
|
||||
|
||||
<div class="listconadd">
|
||||
|
||||
<el-card class="box-card">
|
||||
|
||||
<div class="item">
|
||||
<span class="item_text">标题:</span>
|
||||
<el-input v-model="formobj.title" placeholder="" class="item_input" clearable />
|
||||
<div class="tab-header webtop">
|
||||
<!-- 标题 -->
|
||||
<div>轮播图信息</div>
|
||||
<!-- start 添加修改按钮 -->
|
||||
<div>
|
||||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
|
||||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
|
||||
</div>
|
||||
<!-- end 添加修改按钮 -->
|
||||
<!-- end 详情按钮 -->
|
||||
</div>
|
||||
|
||||
<div class="item" style="margin-bottom: 100px;margin-top: 100px;">
|
||||
<span class="item_text">轮播图图片:</span>
|
||||
<upload
|
||||
ref="uploadImg2"
|
||||
v-model="imgList"
|
||||
style="margin-top: 20px;"
|
||||
class="item_input"
|
||||
:limit="1"
|
||||
bucket="map"
|
||||
:class="{ hide: hideUploadBtn }"
|
||||
:upload-data="{ type: '0001' }"
|
||||
@change="backData"
|
||||
/>
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="item_text">发布人:</span>
|
||||
<el-input v-model="formobj.publisher" placeholder="" class="item_input" clearable />
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="item_text">发布日期:</span>
|
||||
<el-date-picker v-model="formobj.releaseTime" type="date" class="item_input" value-format="yyyy-MM-dd" placeholder="选择日期" />
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="item_text">时效开始日期:</span>
|
||||
<el-date-picker v-model="formobj.startDate" type="date" class="item_input" value-format="yyyy-MM-dd" placeholder="选择日期" />
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="item_text">时效结束日期:</span>
|
||||
<el-date-picker v-model="formobj.endDate" type="date" class="item_input" value-format="yyyy-MM-dd" placeholder="选择日期" />
|
||||
</div>
|
||||
<div class="listconadd">
|
||||
|
||||
<!-- <div class="item2">
|
||||
<el-card class="box-card">
|
||||
|
||||
<div class="item">
|
||||
<span class="item_text">标题:</span>
|
||||
<el-input v-model="formobj.title" placeholder="" class="item_input" clearable />
|
||||
</div>
|
||||
|
||||
<div class="item" style="margin-bottom: 100px;margin-top: 100px;">
|
||||
<span class="item_text">轮播图图片:</span>
|
||||
<upload ref="uploadImg2" v-model="imgList" style="margin-top: 20px;" class="item_input" :limit="1"
|
||||
bucket="map" :class="{ hide: hideUploadBtn }" :upload-data="{ type: '0001' }"
|
||||
@change="backData" />
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="item_text">发布人:</span>
|
||||
<el-input v-model="formobj.publisher" placeholder="" class="item_input" clearable />
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="item_text">发布日期:</span>
|
||||
<el-date-picker v-model="formobj.releaseTime" type="date" class="item_input"
|
||||
value-format="yyyy-MM-dd" placeholder="选择日期" />
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="item_text">时效开始日期:</span>
|
||||
<el-date-picker v-model="formobj.startDate" type="date" class="item_input" value-format="yyyy-MM-dd"
|
||||
placeholder="选择日期" />
|
||||
</div>
|
||||
<div class="item">
|
||||
<span class="item_text">时效结束日期:</span>
|
||||
<el-date-picker v-model="formobj.endDate" type="date" class="item_input" value-format="yyyy-MM-dd"
|
||||
placeholder="选择日期" />
|
||||
</div>
|
||||
|
||||
<!-- <div class="item2">
|
||||
<span class="item_text">内容:</span>
|
||||
<el-input v-model="formobj.content" type="textarea" :rows="6" placeholder="商品简介" class="item_input"
|
||||
clearable />
|
||||
|
||||
</div> -->
|
||||
|
||||
<div class="item" style="margin-bottom: 100px;margin-top: 100px;">
|
||||
<span class="item_text">内容图片:</span>
|
||||
<upload
|
||||
ref="uploadImg3"
|
||||
v-model="imgListnr"
|
||||
style="margin-top: 20px;"
|
||||
class="item_input"
|
||||
:limit="1"
|
||||
bucket="map"
|
||||
:class="{ hide: hideUploadBtnNr }"
|
||||
:upload-data="{ type: '0001' }"
|
||||
@change="backDataNr"
|
||||
/>
|
||||
</div>
|
||||
<div class="item2">
|
||||
<span class="item_text">轮播图内容:</span>
|
||||
<editor class="item_input" :height="300" :min-height="100" :value="formobj.content" @input="editinput" />
|
||||
</div>
|
||||
<div class="item" style="margin-bottom: 100px;margin-top: 100px;">
|
||||
<span class="item_text">内容图片:</span>
|
||||
<upload ref="uploadImg3" v-model="imgListnr" style="margin-top: 20px;" class="item_input" :limit="1"
|
||||
bucket="map" :class="{ hide: hideUploadBtnNr }" :upload-data="{ type: '0001' }"
|
||||
@change="backDataNr" />
|
||||
</div>
|
||||
<div class="item2">
|
||||
<span class="item_text">轮播图内容:</span>
|
||||
<editor class="item_input" :height="300" :min-height="100" :value="formobj.content"
|
||||
@input="editinput" />
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import req from '@/api/lpk/banner.js'
|
||||
import Editor from '@/components/Editor'
|
||||
import upload from '@/components/uploadFile/upload_yanchejianchaTuBiao.vue'
|
||||
import req from '@/api/lpk/banner.js'
|
||||
import Editor from '@/components/Editor'
|
||||
import upload from '@/components/uploadFile/upload_yanchejianchaTuBiao.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
upload,
|
||||
Editor
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
imgList: [],
|
||||
imgListnr: [],
|
||||
hideUploadBtn: false,
|
||||
hideUploadBtnNr: false,
|
||||
submitdisabled: false,
|
||||
formobj: {
|
||||
sid: '',
|
||||
title: '',
|
||||
publisher: '',
|
||||
releaseTime: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
content: '',
|
||||
bannerUrl: '',
|
||||
bannerPath: '',
|
||||
contentUrl: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
editinput(text) {
|
||||
this.formobj.content = text
|
||||
},
|
||||
saveOrUpdate() {
|
||||
console.log('>>>>>>>>>saveOrUpdate', this.formobj)
|
||||
req.saveNotice(this.formobj)
|
||||
.then(resp => {
|
||||
if (resp.success) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
type: 'success',
|
||||
message: resp.msg
|
||||
})
|
||||
this.handleReturn('true')
|
||||
} else {
|
||||
// 根据resp.code进行异常情况处理
|
||||
export default {
|
||||
components: {
|
||||
upload,
|
||||
Editor
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
imgList: [],
|
||||
imgListnr: [],
|
||||
hideUploadBtn: false,
|
||||
hideUploadBtnNr: false,
|
||||
submitdisabled: false,
|
||||
formobj: {
|
||||
sid: '',
|
||||
title: '',
|
||||
publisher: '',
|
||||
releaseTime: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
content: '',
|
||||
bannerUrl: '',
|
||||
bannerPath: '',
|
||||
contentUrl: ''
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
handleReturn(isreload) {
|
||||
if (isreload === 'true') this.$emit('reloadlist')
|
||||
this.formobj = {
|
||||
sid: '',
|
||||
title: '',
|
||||
publisher: '',
|
||||
releaseTime: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
content: '',
|
||||
bannerUrl: '',
|
||||
bannerPath: '',
|
||||
contentUrl: ''
|
||||
}
|
||||
this.$emit('doback')
|
||||
},
|
||||
showAdd() {},
|
||||
showEdit(row) {
|
||||
req.noticeInit(row.sid)
|
||||
.then(resp => {
|
||||
if (resp.success) {
|
||||
this.formobj = resp.data
|
||||
this.imgList[0].url = resp.data.bannerUrl
|
||||
},
|
||||
methods: {
|
||||
editinput(text) {
|
||||
this.formobj.content = text
|
||||
},
|
||||
saveOrUpdate() {
|
||||
console.log('>>>>>>>>>saveOrUpdate', this.formobj)
|
||||
req.saveNotice(this.formobj)
|
||||
.then(resp => {
|
||||
if (resp.success) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
type: 'success',
|
||||
message: resp.msg
|
||||
})
|
||||
this.handleReturn('true')
|
||||
} else {
|
||||
// 根据resp.code进行异常情况处理
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
handleReturn(isreload) {
|
||||
if (isreload === 'true') this.$emit('reloadlist')
|
||||
this.formobj = {
|
||||
sid: '',
|
||||
title: '',
|
||||
publisher: '',
|
||||
releaseTime: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
content: '',
|
||||
bannerUrl: '',
|
||||
bannerPath: '',
|
||||
contentUrl: ''
|
||||
}
|
||||
this.$emit('doback')
|
||||
},
|
||||
showAdd() {},
|
||||
showEdit(row) {
|
||||
req.noticeInit(row.sid)
|
||||
.then(resp => {
|
||||
if (resp.success) {
|
||||
this.formobj = resp.data
|
||||
this.imgList = []
|
||||
if (resp.data.bannerUrl != '') {
|
||||
this.imgList.push({
|
||||
url: resp.data.bannerUrl
|
||||
})
|
||||
}
|
||||
this.hideUploadBtn = this.imgList.length != 0
|
||||
|
||||
this.imgListnr = []
|
||||
if (resp.data.contentUrl != '') {
|
||||
this.imgListnr.push({
|
||||
url: resp.data.contentUrl
|
||||
})
|
||||
}
|
||||
this.hideUploadBtnNr = this.imgListnr.length != 0
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
this.formobj = row
|
||||
this.imgList = []
|
||||
this.imgListnr = []
|
||||
})
|
||||
},
|
||||
backData(value) {
|
||||
console.log('backData》》》》', value)
|
||||
console.log('imgList', this.imgList)
|
||||
|
||||
if (this.imgList.length > 0) {
|
||||
this.formobj.bannerUrl = this.imgList[0].url
|
||||
} else {
|
||||
this.formobj.bannerUrl = ''
|
||||
}
|
||||
|
||||
this.hideUploadBtn = this.imgList.length !== 0
|
||||
console.log('this.hideUploadBtn', this.hideUploadBtn)
|
||||
},
|
||||
backDataNr(value) {
|
||||
if (this.imgListnr.length > 0) {
|
||||
this.formobj.contentUrl = this.imgListnr[0].url
|
||||
} else {
|
||||
this.formobj.contentUrl = ''
|
||||
}
|
||||
|
||||
this.hideUploadBtnNr = this.imgListnr.length !== 0
|
||||
}
|
||||
})
|
||||
.catch(e => {
|
||||
this.formobj = row
|
||||
})
|
||||
},
|
||||
backData(value) {
|
||||
console.log('backData》》》》', value)
|
||||
console.log('imgList', this.imgList)
|
||||
|
||||
if (this.imgList.length > 0) {
|
||||
this.formobj.bannerUrl = this.imgList[0].url
|
||||
} else {
|
||||
this.formobj.bannerUrl = ''
|
||||
}
|
||||
|
||||
this.hideUploadBtn = this.imgList.length !== 0
|
||||
console.log('this.hideUploadBtn', this.hideUploadBtn)
|
||||
},
|
||||
backDataNr(value) {
|
||||
if (this.imgListnr.length > 0) {
|
||||
this.formobj.contentUrl = this.imgListnr[0].url
|
||||
} else {
|
||||
this.formobj.contentUrl = ''
|
||||
}
|
||||
|
||||
this.hideUploadBtnNr = this.imgListnr.length !== 0
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
// 隐藏上传组件
|
||||
// 隐藏上传组件
|
||||
|
||||
.box-card {
|
||||
margin-left: 60px;
|
||||
margin-right: 60px;
|
||||
min-width: 70%;
|
||||
margin-top: 20px;
|
||||
height: auto;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin-top: 15px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
|
||||
.item_text {
|
||||
flex: 0.8;
|
||||
font-size: 18px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.item_input {
|
||||
flex: 4;
|
||||
font-size: 16px;
|
||||
margin-left: 10px;
|
||||
margin-right: 80px;
|
||||
}
|
||||
|
||||
.item_left_input {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.item_left_text {
|
||||
height: 30px;
|
||||
margin-left: 20px;
|
||||
line-height: 30px;
|
||||
color: #018AD2;
|
||||
padding: 0px 15px;
|
||||
border: 1.5px solid #018AD2;
|
||||
border-radius: 5px;
|
||||
|
||||
}
|
||||
|
||||
.item_right {
|
||||
flex: 1;
|
||||
justify-items: center;
|
||||
|
||||
.item_right_list_text {
|
||||
font-size: 16px;
|
||||
::v-deep .hide {
|
||||
.el-upload--picture-card {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.item_right_list_delect {
|
||||
color: #5E94FF;
|
||||
margin-left: 20px;
|
||||
font-size: 16px;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.item2 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin-top: 15px;
|
||||
.box-card {
|
||||
margin-left: 60px;
|
||||
margin-right: 60px;
|
||||
min-width: 70%;
|
||||
margin-top: 20px;
|
||||
height: auto;
|
||||
|
||||
.item_text {
|
||||
flex: 0.8;
|
||||
font-size: 18px;
|
||||
text-align: right;
|
||||
}
|
||||
.item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin-top: 15px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
|
||||
.item_input {
|
||||
flex: 4;
|
||||
font-size: 16px;
|
||||
margin-left: 10px;
|
||||
margin-right: 80px;
|
||||
}
|
||||
.item_text {
|
||||
flex: 0.8;
|
||||
font-size: 18px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.item_input {
|
||||
flex: 4;
|
||||
font-size: 16px;
|
||||
margin-left: 10px;
|
||||
margin-right: 80px;
|
||||
}
|
||||
|
||||
.item_left_input {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.item_left_text {
|
||||
height: 30px;
|
||||
margin-left: 20px;
|
||||
line-height: 30px;
|
||||
color: #018AD2;
|
||||
padding: 0px 15px;
|
||||
border: 1.5px solid #018AD2;
|
||||
border-radius: 5px;
|
||||
|
||||
}
|
||||
|
||||
.item_right {
|
||||
flex: 1;
|
||||
justify-items: center;
|
||||
|
||||
.item_right_list_text {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.item_right_list_delect {
|
||||
color: #5E94FF;
|
||||
margin-left: 20px;
|
||||
font-size: 16px;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.item2 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin-top: 15px;
|
||||
|
||||
.item_text {
|
||||
flex: 0.8;
|
||||
font-size: 18px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.item_input {
|
||||
flex: 4;
|
||||
font-size: 16px;
|
||||
margin-left: 10px;
|
||||
margin-right: 80px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
249
vue.config.js
249
vue.config.js
@@ -3,10 +3,10 @@ const path = require('path')
|
||||
const defaultSettings = require('./src/settings.js')
|
||||
|
||||
function resolve(dir) {
|
||||
return path.join(__dirname, dir)
|
||||
return path.join(__dirname, dir)
|
||||
}
|
||||
|
||||
const name = defaultSettings.title || '汇融惠享' // page title
|
||||
const name = defaultSettings.title || '云菜窖' // page title
|
||||
|
||||
// 如果端口设置为80,
|
||||
// 使用管理员权限执行命令行。
|
||||
@@ -17,127 +17,128 @@ const port = process.env.port || process.env.npm_config_port || 9531 // dev port
|
||||
|
||||
// 所有配置项说明都可以在中找到https://cli.vuejs.org/config/
|
||||
module.exports = {
|
||||
/**
|
||||
*如果计划在子路径下部署站点,则需要设置publicPath,
|
||||
*例如GitHub页面。如果您计划将站点部署到https://foo.github.io/bar/,
|
||||
*然后publicPath应设置为“/bar/”。
|
||||
*在大多数情况下,请使用“/”!!!
|
||||
*详细信息:https://cli.vuejs.org/config/#publicpath
|
||||
*/
|
||||
publicPath: process.env.NODE_ENV === 'production' ? '/lpk/' : '/',
|
||||
outputDir: 'yythmall-ui',
|
||||
assetsDir: 'static',
|
||||
lintOnSave: process.env.NODE_ENV === 'development',
|
||||
productionSourceMap: false,
|
||||
devServer: {
|
||||
hot: true, // 自动保存
|
||||
host: '0.0.0.0',
|
||||
port: port,
|
||||
open: true,
|
||||
overlay: {
|
||||
warnings: false,
|
||||
errors: true
|
||||
},
|
||||
proxy: {
|
||||
'/api': { // 匹配所有以 '/api'开头的请求路径
|
||||
// target: 'http://192.168.1.109:8111',
|
||||
target: process.env.VUE_APP_URL, // 代理目标的基础路径
|
||||
// target: 'http://jianguan.yyundong.com/shgfapi', // 代理目标的基础路径
|
||||
changeOrigin: true, // 支持跨域
|
||||
pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
|
||||
'^/api': ''
|
||||
}
|
||||
},
|
||||
'/upload': { // 匹配所有以 '/api'开头的请求路径
|
||||
// target: 'http://120.46.131.15:8111',
|
||||
target: process.env.VUE_APP_URL, // 代理目标的基础路径
|
||||
changeOrigin: true, // 支持跨域
|
||||
pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
|
||||
'^/upload': ''
|
||||
}
|
||||
}
|
||||
},
|
||||
disableHostCheck: true
|
||||
},
|
||||
configureWebpack: {
|
||||
// 在webpack的name字段中提供应用程序的标题,以便
|
||||
// 它可以在索引.html插入正确的标题。
|
||||
name: name,
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve('src'),
|
||||
'@C': resolve('src/components')
|
||||
}
|
||||
}
|
||||
},
|
||||
chainWebpack(config) {
|
||||
// 它可以提高第一屏的速度,建议打开预加载
|
||||
config.plugin('preload').tap(() => [{
|
||||
rel: 'preload',
|
||||
// 忽略 runtime.js
|
||||
// https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
|
||||
fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
|
||||
include: 'initial'
|
||||
}])
|
||||
|
||||
// 当有很多页面时,会导致太多无意义的请求
|
||||
config.plugins.delete('prefetch')
|
||||
|
||||
// set svg-sprite-loader 设置 svg精灵加载程序
|
||||
config.module
|
||||
.rule('svg')
|
||||
.exclude.add(resolve('src/icons'))
|
||||
.end()
|
||||
config.module
|
||||
.rule('icons')
|
||||
.test(/\.svg$/)
|
||||
.include.add(resolve('src/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
|
||||
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',
|
||||
test: resolve('src/components'), // can customize your rules
|
||||
minChunks: 3, // minimum common number
|
||||
priority: 5,
|
||||
reuseExistingChunk: true
|
||||
}
|
||||
/**
|
||||
*如果计划在子路径下部署站点,则需要设置publicPath,
|
||||
*例如GitHub页面。如果您计划将站点部署到https://foo.github.io/bar/,
|
||||
*然后publicPath应设置为“/bar/”。
|
||||
*在大多数情况下,请使用“/”!!!
|
||||
*详细信息:https://cli.vuejs.org/config/#publicpath
|
||||
*/
|
||||
publicPath: process.env.NODE_ENV === 'production' ? '/ycjui' : '/',
|
||||
outputDir: 'yythmall-ui',
|
||||
assetsDir: 'static',
|
||||
lintOnSave: process.env.NODE_ENV === 'development',
|
||||
productionSourceMap: false,
|
||||
devServer: {
|
||||
hot: true, // 自动保存
|
||||
host: '0.0.0.0',
|
||||
port: port,
|
||||
open: true,
|
||||
overlay: {
|
||||
warnings: false,
|
||||
errors: true
|
||||
},
|
||||
proxy: {
|
||||
'/api': { // 匹配所有以 '/api'开头的请求路径
|
||||
// target: 'http://192.168.0.105:7211',
|
||||
// target: process.env.VUE_APP_URL, // 代理目标的基础路径
|
||||
target: 'https://ordermall.yxtsoft.com/ycjapi', // 代理目标的基础路径
|
||||
changeOrigin: true, // 支持跨域
|
||||
pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
|
||||
'^/api': ''
|
||||
}
|
||||
},
|
||||
'/upload': { // 匹配所有以 '/api'开头的请求路径
|
||||
// target: 'http://192.168.0.105:7211',
|
||||
// target: process.env.VUE_APP_URL, // 代理目标的基础路径
|
||||
target: 'https://ordermall.yxtsoft.com/ycjapi', // 代理目标的基础路径
|
||||
changeOrigin: true, // 支持跨域
|
||||
pathRewrite: { // 重写路径: 去掉路径中开头的'/api'
|
||||
'^/upload': ''
|
||||
}
|
||||
}
|
||||
},
|
||||
disableHostCheck: true
|
||||
},
|
||||
configureWebpack: {
|
||||
// 在webpack的name字段中提供应用程序的标题,以便
|
||||
// 它可以在索引.html插入正确的标题。
|
||||
name: name,
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve('src'),
|
||||
'@C': resolve('src/components')
|
||||
}
|
||||
})
|
||||
// https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
|
||||
config.optimization.runtimeChunk('single')
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
chainWebpack(config) {
|
||||
// 它可以提高第一屏的速度,建议打开预加载
|
||||
config.plugin('preload').tap(() => [{
|
||||
rel: 'preload',
|
||||
// 忽略 runtime.js
|
||||
// https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
|
||||
fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
|
||||
include: 'initial'
|
||||
}])
|
||||
|
||||
// 当有很多页面时,会导致太多无意义的请求
|
||||
config.plugins.delete('prefetch')
|
||||
|
||||
// set svg-sprite-loader 设置 svg精灵加载程序
|
||||
config.module
|
||||
.rule('svg')
|
||||
.exclude.add(resolve('src/icons'))
|
||||
.end()
|
||||
config.module
|
||||
.rule('icons')
|
||||
.test(/\.svg$/)
|
||||
.include.add(resolve('src/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
|
||||
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',
|
||||
test: resolve('src/components'), // can customize your rules
|
||||
minChunks: 3, // minimum common number
|
||||
priority: 5,
|
||||
reuseExistingChunk: true
|
||||
}
|
||||
}
|
||||
})
|
||||
// https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
|
||||
config.optimization.runtimeChunk('single')
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user