@ -0,0 +1,27 @@ |
|||||
|
import Vue from 'vue' |
||||
|
|
||||
|
/** |
||||
|
* 在src/components下的组件会自动注册为全局组件 |
||||
|
* |
||||
|
* require.context()方法 |
||||
|
* 作用:创建当前模块的上下文 |
||||
|
* 用法:require.context(directory, flag, regExp) |
||||
|
* directory: 要导入的当前模块的文件夹目录 |
||||
|
* flag: 是否搜索当前路径的子目录 |
||||
|
* regExp: 要匹配的文件 |
||||
|
*/ |
||||
|
const components = require.context('components/', true, /\.vue$/) |
||||
|
components.keys().forEach((filename) => { |
||||
|
const arr = filename |
||||
|
.replace(/\.\//, '') |
||||
|
.replace(/\.vue$/, '') |
||||
|
.split('/') |
||||
|
const componentName = arr[arr.length - 2] |
||||
|
const componentConfig = components(filename).default |
||||
|
|
||||
|
Vue.component(componentName, componentConfig) |
||||
|
}) |
||||
|
|
||||
|
const requireAll = (requireContext) => requireContext.keys().map(requireContext) |
||||
|
const req = require.context('./svg-icon/svg', false, /\.svg$/) |
||||
|
requireAll(req) |
@ -0,0 +1,159 @@ |
|||||
|
<template> |
||||
|
<div class="screen-dropdown-menu" |
||||
|
:style="{height: dropdownMenuVisible ? dataList.length > 4 ? '260px' : `${dataList.length * 50 + 10}px` : '0px', opacity: dropdownMenuVisible ? '1' : '0', '--top': top }"> |
||||
|
<div class="screen-dropdown-menu-border" |
||||
|
:style="{overflowY: dataList.length > 5 ? 'auto' : 'hidden'}"> |
||||
|
<div :class="['screen-dropdown-menu-item', item.select ? 'screen-dropdown-menu-item-active' : '']" |
||||
|
@click.stop="onChooseItem(item)" |
||||
|
v-for="item in dataList" |
||||
|
:key="item.value">{{item.label}}</div> |
||||
|
</div> |
||||
|
<div class="screen-dropdown-menu-arrow"></div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: 'screen-dropdown-menu', |
||||
|
data () { |
||||
|
return { |
||||
|
dataList: [], |
||||
|
dropdownMenuVisible: true |
||||
|
} |
||||
|
}, |
||||
|
props: { |
||||
|
menuList: { |
||||
|
type: Array, |
||||
|
required: true, |
||||
|
default: () => [] |
||||
|
}, |
||||
|
defaultSelected: { |
||||
|
type: String | Number, |
||||
|
default: () => '' |
||||
|
}, |
||||
|
visible: { |
||||
|
type: Boolean, |
||||
|
default: () => false |
||||
|
}, |
||||
|
top: { |
||||
|
type: String, |
||||
|
default: '60px' |
||||
|
} |
||||
|
}, |
||||
|
watch: { |
||||
|
// 下拉菜单列表数据 |
||||
|
menuList: { |
||||
|
immediate: true, |
||||
|
handler: function (value) { |
||||
|
if (value.length > 0) { |
||||
|
value.forEach(item => { |
||||
|
item.select = false |
||||
|
}) |
||||
|
this.dataList = value |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
// 默认选中item |
||||
|
defaultSelected: { |
||||
|
immediate: true, |
||||
|
handler: function (value) { |
||||
|
this.dataList.forEach(item => { |
||||
|
if (item.value === value) { |
||||
|
item.select = true |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
// 下拉菜单显示隐藏 |
||||
|
visible: { |
||||
|
immediate: true, |
||||
|
handler: function (value) { |
||||
|
this.dropdownMenuVisible = value |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
onChooseItem (item) { |
||||
|
this.dataList.forEach(data => { |
||||
|
if (data.value === item.value) { |
||||
|
data.select = true |
||||
|
} else { |
||||
|
data.select = false |
||||
|
} |
||||
|
}) |
||||
|
this.$emit('onChooseItem', item) |
||||
|
this.dropdownMenuVisible = false |
||||
|
this.$emit('update:visible', false) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.screen-dropdown-menu { |
||||
|
width: 100%; |
||||
|
position: absolute; |
||||
|
// box-shadow: 0 2px 12px 0 #5c7bc7; |
||||
|
border: 1px solid #00a4b9; |
||||
|
|
||||
|
background: rgba(4, 39, 50, 0.8); |
||||
|
z-index: 100; |
||||
|
left: 0; |
||||
|
top: var(--top); |
||||
|
border-radius: 4px; |
||||
|
max-height: 260px; |
||||
|
transition: height 0.1s linear, opacity 0.1s linear; |
||||
|
&-border { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
overflow-y: auto; |
||||
|
border-radius: 4px; |
||||
|
box-sizing: border-box; |
||||
|
padding: 10px 0 0; |
||||
|
&::-webkit-scrollbar { |
||||
|
/*滚动条整体样式*/ |
||||
|
width: 10px; /*高宽分别对应横竖滚动条的尺寸*/ |
||||
|
height: 1px; |
||||
|
} |
||||
|
&::-webkit-scrollbar-thumb { |
||||
|
/*滚动条里面小方块*/ |
||||
|
border-radius: 10px; |
||||
|
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); |
||||
|
background: #2bccff; |
||||
|
} |
||||
|
&::-webkit-scrollbar-track { |
||||
|
/*滚动条里面轨道*/ |
||||
|
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); |
||||
|
border-radius: 10px; |
||||
|
background: #061836; |
||||
|
} |
||||
|
} |
||||
|
&-item { |
||||
|
width: 100%; |
||||
|
height: 50px; |
||||
|
line-height: 50px; |
||||
|
text-align: left; |
||||
|
color: #fff; |
||||
|
font-size: 14px; |
||||
|
box-sizing: border-box; |
||||
|
padding: 0 12px; |
||||
|
&:hover { |
||||
|
color: #fff; |
||||
|
background: rgba(0, 205, 236); |
||||
|
} |
||||
|
} |
||||
|
.screen-dropdown-menu-item-active { |
||||
|
color: #fff; |
||||
|
background: rgba(0, 205, 236); |
||||
|
} |
||||
|
&-arrow { |
||||
|
position: absolute; |
||||
|
width: 0px; |
||||
|
height: 0px; |
||||
|
top: -12px; |
||||
|
left: 35px; |
||||
|
border: 6px solid transparent; |
||||
|
border-bottom: 6px solid #061a3b; |
||||
|
} |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,47 @@ |
|||||
|
<template> |
||||
|
<svg :class="svgClass" |
||||
|
aria-hidden="true" |
||||
|
:style="{fill:fill}"> |
||||
|
<use :xlink:href="iconName"></use> |
||||
|
</svg> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: 'svg-icon', |
||||
|
props: { |
||||
|
iconClass: { |
||||
|
type: String, |
||||
|
required: true |
||||
|
}, |
||||
|
className: { |
||||
|
type: String |
||||
|
}, |
||||
|
fill: { |
||||
|
type: String, |
||||
|
default: 'currentColor' |
||||
|
} |
||||
|
}, |
||||
|
computed: { |
||||
|
iconName () { |
||||
|
return `#icon-${this.iconClass}` |
||||
|
}, |
||||
|
svgClass () { |
||||
|
if (this.className) { |
||||
|
return 'svg-icon ' + this.className |
||||
|
} else { |
||||
|
return 'svg-icon' |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.svg-icon { |
||||
|
width: 1em; |
||||
|
height: 1em; |
||||
|
vertical-align: -0.15em; |
||||
|
overflow: hidden; |
||||
|
} |
||||
|
</style> |
After Width: | Height: | Size: 472 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 872 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 677 B |
After Width: | Height: | Size: 688 B |
After Width: | Height: | Size: 786 B |
After Width: | Height: | Size: 663 B |
@ -1,56 +0,0 @@ |
|||||
export default { |
|
||||
state: { |
|
||||
standardScale: 1, |
|
||||
standardAId: '1175270520603930625', |
|
||||
// standardAId: '66f3987a8ea0261a6693689689f9e56b',
|
|
||||
standardAgencyType: 'district', |
|
||||
standardMapCenter: [120.364165, 36.103091], |
|
||||
// standardMapCenter: [120.312565, 36.021688],
|
|
||||
standardProjectBoxVisible: false, // 难点堵点项目详情弹窗
|
|
||||
standardProjectId: '' // 难点堵点项目id
|
|
||||
}, |
|
||||
mutations: { |
|
||||
set_standardScale (state, standardScale) { |
|
||||
state = Object.assign(state, { standardScale }) |
|
||||
}, |
|
||||
// 组织机构id
|
|
||||
set_standardAgencyId (state, agencyId) { |
|
||||
state.standardAId = agencyId |
|
||||
}, |
|
||||
// 组织机构类型(街道-district,社区-community, 网格-grid)
|
|
||||
set_standardAgencyType (state, standardAgencyType) { |
|
||||
state.standardAgencyType = standardAgencyType |
|
||||
}, |
|
||||
set_standardMapCenter (state, standardMapCenter) { |
|
||||
state.standardMapCenter = standardMapCenter |
|
||||
}, |
|
||||
// 难点堵点项目详情弹窗visible
|
|
||||
set_standardProjectBoxVisible (state, standardProjectBoxVisible) { |
|
||||
state.standardProjectBoxVisible = standardProjectBoxVisible |
|
||||
}, |
|
||||
// 难点堵点项目id
|
|
||||
set_standardProjectId (state, standardProjectId) { |
|
||||
state.standardProjectId = standardProjectId |
|
||||
} |
|
||||
}, |
|
||||
actions: { |
|
||||
SET_STANDARDSCALE ({ commit }, standardScale) { |
|
||||
commit('set_standardScale', standardScale) |
|
||||
}, |
|
||||
SET_STANDARDAGENCYID ({ commit }, agencyId) { |
|
||||
commit('set_standardAgencyId', agencyId) |
|
||||
}, |
|
||||
SET_STANDARDAGENCYTYPE ({ commit }, agencyType) { |
|
||||
commit('set_standardAgencyType', agencyType) |
|
||||
}, |
|
||||
SET_STANDARDMAPCENTER ({ commit }, standardMapCenter) { |
|
||||
commit('set_standardMapCenter', standardMapCenter) |
|
||||
}, |
|
||||
SET_STANDARDPROJECTBOXVISIBLE ({ commit }, standardProjectBoxVisible) { |
|
||||
commit('set_standardProjectBoxVisible', standardProjectBoxVisible) |
|
||||
}, |
|
||||
SET_STANDARDPROJECTID ({ commit }, standardProjectId) { |
|
||||
commit('set_standardProjectId', standardProjectId) |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,236 @@ |
|||||
|
<template> |
||||
|
<div class="agency-select"> |
||||
|
<div class="item">{{cityName}}</div> |
||||
|
<div class="item">{{districtName}}</div> |
||||
|
<div class="item" |
||||
|
ref="street" |
||||
|
@click="onChangeStreet"> |
||||
|
<div>{{selectStreet.label === '全部党工委' ? '党工委' : selectStreet.label}}</div> |
||||
|
<svg-icon icon-class="bottom-sword" |
||||
|
fill="#fff"> |
||||
|
</svg-icon> |
||||
|
<screen-dropdown-menu top="40px" |
||||
|
:menuList="streetList" |
||||
|
:visible.sync="streetDropMenuVisible" |
||||
|
:defaultSelected="selectStreet.value" |
||||
|
@onChooseItem="onChooseStreet"> |
||||
|
</screen-dropdown-menu> |
||||
|
</div> |
||||
|
<div class="item" |
||||
|
ref="community" |
||||
|
@click="onChangeCommunity"> |
||||
|
<div>{{selectCommunity.label === '全部社区' ? '社区' : selectCommunity.label}}</div> |
||||
|
<svg-icon icon-class="bottom-sword" |
||||
|
fill="#fff"> |
||||
|
</svg-icon> |
||||
|
<screen-dropdown-menu top="40px" |
||||
|
:menuList="communityList" |
||||
|
:visible.sync="communityDropMenuVisible" |
||||
|
:defaultSelected="selectCommunity.value" |
||||
|
@onChooseItem="onChooseCommunity"> |
||||
|
</screen-dropdown-menu> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
// import { getOrgTree } from 'api/shibeiScreen/screenContentLeft' |
||||
|
import { mapGetters, mapActions } from 'vuex' |
||||
|
export default { |
||||
|
name: 'agency-select', |
||||
|
data () { |
||||
|
return { |
||||
|
streetList: [], |
||||
|
communityList: [{ |
||||
|
label: '全部社区', |
||||
|
value: '', |
||||
|
center: [] |
||||
|
}], |
||||
|
selectStreet: { |
||||
|
label: '全部党工委', |
||||
|
value: '', |
||||
|
center: [] |
||||
|
}, |
||||
|
selectCommunity: { |
||||
|
label: '全部社区', |
||||
|
value: '', |
||||
|
center: [] |
||||
|
}, |
||||
|
streetDropMenuVisible: false, |
||||
|
communityDropMenuVisible: false, |
||||
|
cityName: '青岛市', |
||||
|
districtName: '' |
||||
|
} |
||||
|
}, |
||||
|
created () { |
||||
|
// this.getOrgTree() |
||||
|
}, |
||||
|
computed: { |
||||
|
...mapGetters(['shibeiAId', 'shibeiAgencyType']) |
||||
|
}, |
||||
|
watch: { |
||||
|
shibeiAId (value) { |
||||
|
if (this.shibeiAgencyType === 'district') { |
||||
|
this.communityList = [{ label: '全部社区', value: '', center: [] }] |
||||
|
this.selectStreet = { label: '全部党工委', value: '', center: [] } |
||||
|
this.selectCommunity = { label: '全部社区', value: '', center: [] } |
||||
|
} else if (this.shibeiAgencyType === 'community') { |
||||
|
const item = this.streetList.find(item => item.value === this.shibeiAId) |
||||
|
this.selectStreet = { label: item.label, value: item.value, center: item.centerMark } |
||||
|
this.selectCommunity = { label: '全部社区', value: '', center: [] } |
||||
|
this.communityList = [{ |
||||
|
label: '全部社区', value: '', center: [] |
||||
|
}] |
||||
|
this.communityList = [...this.communityList, ...item.children] |
||||
|
} else if (this.shibeiAgencyType === 'grid') { |
||||
|
this.recurrenceAgencyId(this.shibeiAId, this.streetList) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
mounted () { |
||||
|
window.addEventListener('click', e => { |
||||
|
if (this.$refs.street && !this.$refs.street.contains(e.target)) { |
||||
|
if (this.streetDropMenuVisible) { |
||||
|
this.streetDropMenuVisible = !this.streetDropMenuVisible |
||||
|
} |
||||
|
} |
||||
|
if (this.$refs.community && !this.$refs.community.contains(e.target)) { |
||||
|
if (this.communityDropMenuVisible) { |
||||
|
this.communityDropMenuVisible = !this.communityDropMenuVisible |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
methods: { |
||||
|
...mapActions({ |
||||
|
set_shibeiAgencyId: 'SET_SHIBEIAGENCYID', |
||||
|
set_shibeiAgencyType: 'SET_SHIBEIAGENCYTYPE', |
||||
|
set_shibeiMapCenter: 'SET_SHIBEIMAPCENTER' |
||||
|
}), |
||||
|
async getOrgTree () { |
||||
|
try { |
||||
|
const res = await getOrgTree() |
||||
|
console.log(res) |
||||
|
this.streetList = [] |
||||
|
this.streetList.push({ |
||||
|
label: '全部党工委', |
||||
|
value: '', |
||||
|
center: [], |
||||
|
children: [] |
||||
|
}) |
||||
|
this.districtName = res.data.label |
||||
|
this.streetList = [...this.streetList, ...res.data.children] |
||||
|
} catch (err) { |
||||
|
console.error(err) |
||||
|
} |
||||
|
}, |
||||
|
onChangeStreet () { |
||||
|
this.streetDropMenuVisible = !this.streetDropMenuVisible |
||||
|
}, |
||||
|
onChangeCommunity () { |
||||
|
this.communityDropMenuVisible = !this.communityDropMenuVisible |
||||
|
}, |
||||
|
onChooseStreet (item) { |
||||
|
this.selectStreet = { |
||||
|
label: item.label, |
||||
|
value: item.value, |
||||
|
center: item.centerMark || item.center || [] |
||||
|
} |
||||
|
this.selectCommunity = { |
||||
|
label: '全部社区', |
||||
|
value: '', |
||||
|
center: [] |
||||
|
} |
||||
|
this.communityList = [] |
||||
|
this.communityList.push({ |
||||
|
label: '全部社区', |
||||
|
value: '', |
||||
|
center: [] |
||||
|
}) |
||||
|
this.communityList = [...this.communityList, ...item.children] |
||||
|
if (this.selectCommunity.value) { |
||||
|
this.set_shibeiAgencyId(this.selectCommunity.value) |
||||
|
this.set_shibeiAgencyType('grid') |
||||
|
this.set_shibeiMapCenter(this.selectCommunity.center) |
||||
|
} else if (this.selectStreet.value) { |
||||
|
this.set_shibeiAgencyId(this.selectStreet.value) |
||||
|
this.set_shibeiAgencyType('community') |
||||
|
this.set_shibeiMapCenter(this.selectStreet.center) |
||||
|
} else { |
||||
|
// this.set_shibeiAgencyId('66f3987a8ea0261a6693689689f9e56b') |
||||
|
this.set_shibeiAgencyId('1175270520603930625') |
||||
|
this.set_shibeiAgencyType('district') |
||||
|
// this.set_shibeiMapCenter([120.312565, 36.021688]) |
||||
|
this.set_shibeiMapCenter([120.364165, 36.103091]) |
||||
|
} |
||||
|
}, |
||||
|
onChooseCommunity (item) { |
||||
|
this.selectCommunity = { |
||||
|
label: item.label, |
||||
|
value: item.value, |
||||
|
center: item.centerMark |
||||
|
} |
||||
|
if (this.selectCommunity.value) { |
||||
|
this.set_shibeiAgencyId(this.selectCommunity.value) |
||||
|
this.set_shibeiAgencyType('grid') |
||||
|
this.set_shibeiMapCenter(this.selectCommunity.center) |
||||
|
} else if (this.selectStreet.value) { |
||||
|
this.set_shibeiAgencyId(this.selectStreet.value) |
||||
|
this.set_shibeiAgencyType('community') |
||||
|
this.set_shibeiMapCenter(this.selectStreet.center) |
||||
|
} else { |
||||
|
// this.set_shibeiAgencyId('66f3987a8ea0261a6693689689f9e56b') |
||||
|
this.set_shibeiAgencyId('1175270520603930625') |
||||
|
this.set_shibeiAgencyType('district') |
||||
|
// this.set_shibeiMapCenter([120.312565, 36.021688]) |
||||
|
this.set_shibeiMapCenter([120.364165, 36.103091]) |
||||
|
} |
||||
|
}, |
||||
|
recurrenceAgencyId (agencyId, list) { |
||||
|
try { |
||||
|
list.forEach(item => { |
||||
|
if (item.children && item.children.length > 0) { |
||||
|
if (item.value === agencyId) { |
||||
|
throw (item) |
||||
|
} else { |
||||
|
if (item.children && item.children.length > 0) { |
||||
|
this.recurrenceAgencyId(agencyId, item.children) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} catch (err) { |
||||
|
this.selectCommunity = { label: err.label, value: err.value, center: err.centerMark } |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
.agency-select { |
||||
|
width: 100%; |
||||
|
height: 40px; |
||||
|
box-sizing: border-box; |
||||
|
padding-bottom: 8px; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
.item { |
||||
|
width: 100%; |
||||
|
height: 32px; |
||||
|
background: #031b3d; |
||||
|
border: 1px solid #03327e; |
||||
|
border-radius: 3px; |
||||
|
color: #fefefe; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
box-sizing: border-box; |
||||
|
padding: 0 17px; |
||||
|
position: relative; |
||||
|
& + .item { |
||||
|
margin-left: 12px; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</style> |
@ -1,5 +1,160 @@ |
|||||
const { defineConfig } = require('@vue/cli-service') |
const { defineConfig } = require('@vue/cli-service') |
||||
|
|
||||
|
//引入node.js核心模块path,意思是路径模块
|
||||
|
const path = require('path') |
||||
|
|
||||
|
////这个函数的意思就是拼接目录,__dirname,是node.js的固有的,意思是绝对路径的前缀👆🏻
|
||||
|
function join(dir) { |
||||
|
return path.join(__dirname, dir) |
||||
|
} |
||||
|
|
||||
|
function diffOutputDir() { |
||||
|
if (process.env.NODE_ENV === 'production') { |
||||
|
return path.resolve(__dirname, '../screen-backend/app/public/frontend') |
||||
|
} else if (process.env.VUE_APP_SCREEN === 'beta') { |
||||
|
return 'screen' |
||||
|
} else if (process.env.VUE_APP_SCREEN === 'dev') { |
||||
|
return 'screen' |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function diffPublicPath() { |
||||
|
if (process.env.NODE_ENV === 'production') { |
||||
|
return '/public/frontend' |
||||
|
} else if (process.env.VUE_APP_SCREEN === 'beta') { |
||||
|
return '/vue_egg_ssr' |
||||
|
} else if (process.env.VUE_APP_SCREEN === 'dev') { |
||||
|
return './' |
||||
|
} |
||||
|
} |
||||
|
|
||||
module.exports = defineConfig({ |
module.exports = defineConfig({ |
||||
transpileDependencies: true, |
// 资源根路径
|
||||
lintOnSave:false |
// publicPath: diffPublicPath(), //部署应用包时的基本URL, 用法和webpack本身的output.publicPath一致.
|
||||
|
|
||||
|
// 打包根路径
|
||||
|
// outputDir: diffOutputDir(), // npm run build 打包构建后存放的目录
|
||||
|
|
||||
|
// 静态资源文件夹名
|
||||
|
assetsDir: 'static', |
||||
|
|
||||
|
// 保存时是否使用 eslint-loader
|
||||
|
lintOnSave: false, |
||||
|
|
||||
|
// 生产环境 source map
|
||||
|
productionSourceMap: false, |
||||
|
|
||||
|
// 调整 webpack 配置
|
||||
|
chainWebpack: (config) => { |
||||
|
config.plugins.delete('prefetch') |
||||
|
config.resolve.alias |
||||
|
.set('api', join('src/api')) |
||||
|
.set('assets', join('src/assets')) |
||||
|
.set('components', join('src/components')) |
||||
|
// .set('directives', join('src/directives'))
|
||||
|
// .set('filters', join('src/filters'))
|
||||
|
.set('store', join('src/store')) |
||||
|
.set('style', join('src/style')) |
||||
|
.set('utils', join('src/utils')) |
||||
|
// .set('shibeiScreen', join('src/views'))
|
||||
|
|
||||
|
// svg图标加载
|
||||
|
config.module |
||||
|
.rule('svg') |
||||
|
.exclude.add(path.join(__dirname, 'src/components/svg-icon/svg')) |
||||
|
.end() |
||||
|
|
||||
|
config.module |
||||
|
.rule('icons') // 定义一个名叫 icons 的规则
|
||||
|
.test(/\.svg$/) // 设置 icons 的匹配正则
|
||||
|
.include.add(path.join(__dirname, 'src/components/svg-icon/svg')) // 设置当前规则的作用目录,只在当前目录下才执行当前规则
|
||||
|
.end() |
||||
|
.use('svg-sprite') // 指定一个名叫 svg-sprite 的 loader 配置
|
||||
|
.loader('svg-sprite-loader') // 该配置使用 svg-sprite-loader 作为处理 loader
|
||||
|
.options({ |
||||
|
// 该 svg-sprite-loader 的配置
|
||||
|
symbolId: 'icon-[name]' |
||||
|
}) |
||||
|
.end() |
||||
|
|
||||
|
// 修复HMR
|
||||
|
config.resolve.symlinks(true) |
||||
|
// 打包结果分析
|
||||
|
if (process.env.NODE_ENV === 'development') { |
||||
|
config |
||||
|
.plugin('webpack-bundle-analyzer') |
||||
|
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
// 调整 webpack 配置
|
||||
|
// configureWebpack: (config) => {
|
||||
|
// config.devtool =
|
||||
|
// process.env.NODE_ENV === 'production' ? 'none' : 'cheap-eval-source-map'
|
||||
|
// if (
|
||||
|
// process.env.NODE_ENV === 'beta' ||
|
||||
|
// process.env.NODE_ENV === 'production'
|
||||
|
// ) {
|
||||
|
// config.externals = {
|
||||
|
// AMap: 'AMap',
|
||||
|
// BMapGL: 'BMapGL',
|
||||
|
// BMAP_EARTH_MAP: 'BMAP_EARTH_MAP',
|
||||
|
// echarts: 'echarts',
|
||||
|
// vue: 'Vue',
|
||||
|
// 'element-ui': 'ELEMENT',
|
||||
|
// THREE: 'THREE',
|
||||
|
// TWEEN: 'TWEEN'
|
||||
|
// }
|
||||
|
// } else {
|
||||
|
// config.externals = {
|
||||
|
// AMap: 'AMap',
|
||||
|
// BMapGL: 'BMapGL',
|
||||
|
// BMAP_EARTH_MAP: 'BMAP_EARTH_MAP',
|
||||
|
// echarts: 'echarts',
|
||||
|
// THREE: 'THREE',
|
||||
|
// TWEEN: 'TWEEN'
|
||||
|
// }
|
||||
|
// }
|
||||
|
// },
|
||||
|
|
||||
|
// css 相关
|
||||
|
css: { |
||||
|
// 将组件内的 css 提取到 一个单独的文件
|
||||
|
// extract: true,
|
||||
|
// 是否开启 css source map
|
||||
|
sourceMap: false, |
||||
|
// 为预处理器的 loader 传递自定义选项
|
||||
|
loaderOptions: {} |
||||
|
}, |
||||
|
|
||||
|
// 开发环境 dev-server
|
||||
|
// devServer: {
|
||||
|
// open: false,
|
||||
|
// host: '0.0.0.0',
|
||||
|
// port: 8091,
|
||||
|
// proxy: {
|
||||
|
// '/api': {
|
||||
|
// target: 'http://127.0.0.1:10001/api/',
|
||||
|
// pathRewrite: {
|
||||
|
// '^/api': ''
|
||||
|
// },
|
||||
|
// logLevel: 'debug',
|
||||
|
// changeOrigin: true,
|
||||
|
// secure: false
|
||||
|
// },
|
||||
|
// '/screenBaseUrl': {
|
||||
|
// target: 'http://127.0.0.1:10001/',
|
||||
|
// pathRewrite: {
|
||||
|
// '^/screenBaseUrl': ''
|
||||
|
// },
|
||||
|
// changeOrigin: true,
|
||||
|
// secure: false
|
||||
|
// }
|
||||
|
// },
|
||||
|
// https: false,
|
||||
|
// hotOnly: true,
|
||||
|
// before: (app) => {}
|
||||
|
// },
|
||||
|
|
||||
|
transpileDependencies: true |
||||
}) |
}) |
||||
|