Commit c7adcd28 by 王志慧

Merge branch 'v4.27.0' of http://192.168.3.233:8090/saas/scrm-micro-shop into v4.27.0

2 parents c07f8f0f ecf6fcfc
const path = require('path')
class copyDir {
apply(compiler) {
// done是webpack 得编译完成周期
compiler.hooks.afterEmit.tap('DonePlugins', function(stats) {
// console.log('编译完成!!')
// 因为写在文件夹里面 要找外面的文件要加../
// 删除element
removeDir(`${__dirname}/../dist/static/css`)
// cpSync(
// path.join(__dirname, '../copyDirTarget'),
// path.join(__dirname, '../dist')
// )
// cpSync(
// path.join(__dirname, '../copyDirTarget'),
// path.join(__dirname, '../dist//dj-carlife-web')
// )
// removeDir(`${__dirname}/../copyDirTarget`)
})
}
}
/** 主要版本 */
const major = process.version.match(/v([0-9]*).([0-9]*)/)[1]
/** 特性版本 */
const minor = process.version.match(/v([0-9]*).([0-9]*)/)[2]
/**
* 文件夹复制
* @param {string} source 源文件夹
* @param {string} destination 目标文件夹
*/
function cpSync(source, destination) {
const fs = require('fs')
// console.log('source', source)
// 判断node版本不是16.7.0以上的版本
// 则进入兼容处理
// 这样处理是因为16.7.0的版本支持了直接复制文件夹的操作
if (Number(major) < 16 || (Number(major) == 16 && Number(minor) < 7)) {
// 如果存在文件夹 先递归删除该文件夹
if (fs.existsSync(destination)) fs.rmSync(destination, { recursive: true })
// 新建文件夹 递归新建
fs.mkdirSync(destination, { recursive: true })
// 读取源文件夹
const rd = fs.readdirSync(source)
// console.log('rd', rd)
for (const fd of rd) {
// 循环拼接源文件夹/文件全名称
const sourceFullName = source + '/' + fd
// 循环拼接目标文件夹/文件全名称
const destFullName = destination + '/' + fd
// 读取文件信息
const lstatRes = fs.lstatSync(sourceFullName)
// 是否是文件
if (lstatRes.isFile()) fs.copyFileSync(sourceFullName, destFullName)
// 是否是文件夹
if (lstatRes.isDirectory()) cpSync(sourceFullName, destFullName)
}
} else fs.cpSync(source, destination, { force: true, recursive: true })
}
/**
* @caption 删除本地文件夹/文件
* @param {String} directoryPath 例: d://x/x/x.json 或者 d://x/x/x
*/
function removeDir(directoryPath) {
const fs = require('fs')
fs.readdir(directoryPath, (err, files) => {
if (err) {
console.error('读取目录失败:', err)
return
}
if (files.length === 0) {
console.log('目录为空,没有文件可删除。')
return
}
const lastFile = files[files.length - 1]
const filePath = path.join(directoryPath, lastFile)
fs.unlink(filePath, err => {
if (err) {
console.error('删除文件失败:', err)
} else {
console.log('最后一个文件已被成功删除。')
}
})
})
// 判断文件是否存在
// require('fs').existsSync(directoryPath) && dleteDir()
// function dleteDir() {
// const files = fs.readdirSync(directoryPath)
// for (var i = 0; i < files.length; i++) {
// const newPath = path.join(directoryPath, files[i])
// const stat = fs.statSync(newPath)
// if (stat.isDirectory()) {
// // 如果是文件夹就递归下去
// removeDir(newPath)
// } else {
// // 删除文件
// fs.unlinkSync(newPath)
// }
// }
// fs.rmdirSync(directoryPath) // 如果文件夹是空的,就将自己删除掉
// }
}
module.exports = copyDir
const removeDir = require('./removeFn')
class AsyncRomveDir {
apply(compiler) {
// console.log('自定义异步组件');
compiler.hooks.afterEmit.tapAsync('AsyncPlugin', (compilation, cb) => {
setTimeout(() => {
// console.log()
removeDir(`${__dirname}/../copyDirTarget`)
cb()
}, 5000)
})
}
}
module.exports = AsyncRomveDir
/**
* @caption 删除本地文件夹/文件
* @param {String} directoryPath 例: d://x/x/x.json 或者 d://x/x/x
*/
function removeDir(directoryPath) {
const fs = require('fs')
const path = require('path')
// 判断文件是否存在
require('fs').existsSync(directoryPath) && dleteDir()
function dleteDir() {
const files = fs.readdirSync(directoryPath)
for (var i = 0; i < files.length; i++) {
const newPath = path.join(directoryPath, files[i])
const stat = fs.statSync(newPath)
if (stat.isDirectory()) {
// 如果是文件夹就递归下去
removeDir(newPath)
} else {
// 删除文件
fs.unlinkSync(newPath)
}
}
fs.rmdirSync(directoryPath) // 如果文件夹是空的,就将自己删除掉
}
}
module.exports = removeDir
...@@ -60,3 +60,20 @@ export const afterTodayOptions = { ...@@ -60,3 +60,20 @@ export const afterTodayOptions = {
return false return false
} }
} }
/**
* url下载文件
*
*/
export function downLoadFile(url) {
// console.log(row)
// return
const Temp = document.createElement('a')
// Temp.href = process.env.VUE_APP_BASE_URL + '/article/export.do?articleId=' + row.id
Temp.href = url + '?timestamp=' + new Date().getTime()
// console.log(url)
// console.log(Temp.href)
document.body.append(Temp)
Temp.click()
document.body.removeChild(Temp)
}
...@@ -247,22 +247,22 @@ export const Util = { ...@@ -247,22 +247,22 @@ export const Util = {
// throw new Error("Unable to clone obj! Its type isn't supported.") // throw new Error("Unable to clone obj! Its type isn't supported.")
// }, // },
/** // /**
* url下载文件 // * url下载文件
* // *
*/ // */
downLoadFile: function(url) { // downLoadFile: function(url) {
// console.log(row) // // console.log(row)
// return // // return
const Temp = document.createElement('a') // const Temp = document.createElement('a')
// Temp.href = process.env.VUE_APP_BASE_URL + '/article/export.do?articleId=' + row.id // // Temp.href = process.env.VUE_APP_BASE_URL + '/article/export.do?articleId=' + row.id
Temp.href = url + '?timestamp=' + new Date().getTime() // Temp.href = url + '?timestamp=' + new Date().getTime()
// console.log(url) // // console.log(url)
// console.log(Temp.href) // // console.log(Temp.href)
document.body.append(Temp) // document.body.append(Temp)
Temp.click() // Temp.click()
document.body.removeChild(Temp) // document.body.removeChild(Temp)
}, // },
/** /**
* @param {Object} json * @param {Object} json
...@@ -337,5 +337,5 @@ export const showToast = Util.Info ...@@ -337,5 +337,5 @@ export const showToast = Util.Info
export const showLoading = Util.loading export const showLoading = Util.loading
export const hideLoading = Util.closeLoading export const hideLoading = Util.closeLoading
export const deepClone = Util.deepClone export const deepClone = Util.deepClone
export const downLoadFile = Util.downLoadFile // export const downLoadFile = Util.downLoadFile
export const returnFloat = Util.returnFloat export const returnFloat = Util.returnFloat
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
<template> <template>
<el-alert title="每月最后一天24:00按当月业务完成情况自动计算员工绩效。" <el-alert title="每月最后一天24:00按当月业务完成情况自动计算员工绩效。"
show-icon show-icon
class="tip-cla"> class="tip-cla"></el-alert>
</el-alert>
</template> </template>
<div class="container"> <div class="container">
<GLCombiForm ref="showSearch" <GLCombiForm ref="showSearch"
...@@ -97,9 +96,9 @@ ...@@ -97,9 +96,9 @@
</template> </template>
<script> <script>
import * as dayjs from 'dayjs' // import * as dayjs from 'dayjs'
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import { downLoadFile } from '@/common/util' import { downLoadFile } from '@/common/format'
import ResidentDetailDialog from './residentDetailDialog.vue' import ResidentDetailDialog from './residentDetailDialog.vue'
import ResidentCorrectionDialog from './residentCorrectionDialog.vue' import ResidentCorrectionDialog from './residentCorrectionDialog.vue'
export default { export default {
...@@ -122,7 +121,7 @@ export default { ...@@ -122,7 +121,7 @@ export default {
{ {
label: '绩效月份', label: '绩效月份',
prop: 'performanceMonth', prop: 'performanceMonth',
addHtml: 'performanceMonth', addHtml: 'performanceMonth'
}, },
{ {
label: '员工姓名', label: '员工姓名',
...@@ -135,7 +134,7 @@ export default { ...@@ -135,7 +134,7 @@ export default {
label: '员工手机号', label: '员工手机号',
name: 'staffPhone', name: 'staffPhone',
type: 'input', type: 'input',
inputType: "number", inputType: 'number',
isClear: true, isClear: true,
maxlength: '11' maxlength: '11'
}, },
...@@ -306,7 +305,7 @@ export default { ...@@ -306,7 +305,7 @@ export default {
prop: 'status', prop: 'status',
width: '100px', width: '100px',
addHtml: 'applyStatus' addHtml: 'applyStatus'
}, }
] ]
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
...@@ -324,16 +323,18 @@ export default { ...@@ -324,16 +323,18 @@ export default {
// 基本数据 // 基本数据
baseData: { baseData: {
merchantList: [], merchantList: [],
statusList: [{ statusList: [
{
confId: 0, confId: 0,
confName: '未下发' confName: '未下发'
}, },
{ {
confId: 1, confId: 1,
confName: '已下发' confName: '已下发'
}] }
]
}, },
setMonthFlag: false,//第一次进入页面时设置绩效月份参数值 setMonthFlag: false //第一次进入页面时设置绩效月份参数值
} }
}, },
components: { components: {
...@@ -348,15 +349,15 @@ export default { ...@@ -348,15 +349,15 @@ export default {
methods: { methods: {
getLastMonth() { getLastMonth() {
// 获取上个月日期 // 获取上个月日期
var date = new Date; var date = new Date()
var year = date.getFullYear(); var year = date.getFullYear()
var month = date.getMonth(); var month = date.getMonth()
if (month == 0) { if (month == 0) {
year = year - 1; year = year - 1
month = 12; month = 12
} }
month = month > 10 ? month : "0" + month month = month > 10 ? month : '0' + month
this.searchForm.performanceMonth = year.toString() + '-' + month; this.searchForm.performanceMonth = year.toString() + '-' + month
}, },
getServiceCenterList() { getServiceCenterList() {
const params = { const params = {
...@@ -373,7 +374,8 @@ export default { ...@@ -373,7 +374,8 @@ export default {
}, },
beforeSearchFn() { beforeSearchFn() {
return new Promise(resolve => { return new Promise(resolve => {
if (!this.setMonthFlag) {//进入页面时设置绩效月份参数值 if (!this.setMonthFlag) {
//进入页面时设置绩效月份参数值
this.getLastMonth() this.getLastMonth()
} }
this.tableSearchForm = this.getParams() this.tableSearchForm = this.getParams()
...@@ -425,13 +427,13 @@ export default { ...@@ -425,13 +427,13 @@ export default {
distribute_commit(selectedData) { distribute_commit(selectedData) {
if (!selectedData?.length) { if (!selectedData?.length) {
this.$message({ this.$message({
message: "请选择需要下发的记录", message: '请选择需要下发的记录',
type: "warning", type: 'warning',
showClose: true showClose: true
}) })
return false return false
} }
var idList = selectedData.map((item) => { var idList = selectedData.map(item => {
return item.id return item.id
}) })
this.$confirm('<strong>是否确定下发?</strong> <div>完成工资记录下发后,员工可查看到对应的工资记录,且不允许再修改</div> ', '提示', { this.$confirm('<strong>是否确定下发?</strong> <div>完成工资记录下发后,员工可查看到对应的工资记录,且不允许再修改</div> ', '提示', {
...@@ -439,7 +441,8 @@ export default { ...@@ -439,7 +441,8 @@ export default {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { })
.then(() => {
this.$apis.performanceManage.batchIssueApi({ idList: idList }).then(res => { this.$apis.performanceManage.batchIssueApi({ idList: idList }).then(res => {
this.$notify({ this.$notify({
type: 'success', type: 'success',
...@@ -447,7 +450,8 @@ export default { ...@@ -447,7 +450,8 @@ export default {
}) })
this.$refs.residentRef.refreshTable() this.$refs.residentRef.refreshTable()
}) })
}).catch(err => { })
.catch(err => {
console.log(err) console.log(err)
}) })
}, },
...@@ -462,11 +466,11 @@ export default { ...@@ -462,11 +466,11 @@ export default {
this.$apis.performanceManage.exportDetailApi(params).then(res => { this.$apis.performanceManage.exportDetailApi(params).then(res => {
downLoadFile(res) downLoadFile(res)
}) })
}, }
} }
} }
</script> </script>
<style scoped> <style scoped lang="scss">
.tip-cla { .tip-cla {
margin: 16px 0 16px 0; margin: 16px 0 16px 0;
width: 1184px; width: 1184px;
...@@ -474,10 +478,12 @@ export default { ...@@ -474,10 +478,12 @@ export default {
background: #e4e3ff; background: #e4e3ff;
border-radius: 4px; border-radius: 4px;
} }
.flex { .flex {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.dot { .dot {
width: 6px; width: 6px;
height: 6px; height: 6px;
...@@ -485,12 +491,15 @@ export default { ...@@ -485,12 +491,15 @@ export default {
border-radius: 4px; border-radius: 4px;
margin-right: 6px; margin-right: 6px;
} }
.green { .green {
background: #4aca74; background: #4aca74;
} }
.red { .red {
background: #eb4e4e; background: #eb4e4e;
} }
.grey { .grey {
background: #999999; background: #999999;
} }
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
<template> <template>
<el-alert title="每月最后一天24:00按当月业务完成情况自动计算员工绩效。" <el-alert title="每月最后一天24:00按当月业务完成情况自动计算员工绩效。"
show-icon show-icon
class="tip-cla"> class="tip-cla"></el-alert>
</el-alert>
</template> </template>
<div class="container"> <div class="container">
<GLCombiForm ref="showSearch" <GLCombiForm ref="showSearch"
...@@ -97,9 +96,9 @@ ...@@ -97,9 +96,9 @@
</template> </template>
<script> <script>
import * as dayjs from 'dayjs' // import * as dayjs from 'dayjs'
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import { downLoadFile } from '@/common/util' import { downLoadFile } from '@/common/format'
import TechnicianDetailDialog from './technicianDetailDialog.vue' import TechnicianDetailDialog from './technicianDetailDialog.vue'
import TechnicianCorrectionDialog from './technicianCorrectionDialog.vue' import TechnicianCorrectionDialog from './technicianCorrectionDialog.vue'
export default { export default {
...@@ -122,7 +121,7 @@ export default { ...@@ -122,7 +121,7 @@ export default {
{ {
label: '绩效月份', label: '绩效月份',
prop: 'performanceMonth', prop: 'performanceMonth',
addHtml: 'performanceMonth', addHtml: 'performanceMonth'
}, },
{ {
label: '员工姓名', label: '员工姓名',
...@@ -135,7 +134,7 @@ export default { ...@@ -135,7 +134,7 @@ export default {
label: '员工手机号', label: '员工手机号',
name: 'staffPhone', name: 'staffPhone',
type: 'input', type: 'input',
inputType: "number", inputType: 'number',
isClear: true, isClear: true,
maxlength: '11' maxlength: '11'
}, },
...@@ -239,7 +238,7 @@ export default { ...@@ -239,7 +238,7 @@ export default {
prop: 'status', prop: 'status',
width: '100px', width: '100px',
addHtml: 'applyStatus' addHtml: 'applyStatus'
}, }
] ]
}, },
pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' }, pageConf: { pageSize: 'pageSize', pageNum: 'currentPage', totalCount: 'total' },
...@@ -257,16 +256,18 @@ export default { ...@@ -257,16 +256,18 @@ export default {
// 基本数据 // 基本数据
baseData: { baseData: {
merchantList: [], merchantList: [],
statusList: [{ statusList: [
{
confId: 0, confId: 0,
confName: '未下发' confName: '未下发'
}, },
{ {
confId: 1, confId: 1,
confName: '已下发' confName: '已下发'
}] }
]
}, },
setMonthFlag: false,//第一次进入页面时设置绩效月份参数值 setMonthFlag: false //第一次进入页面时设置绩效月份参数值
} }
}, },
components: { components: {
...@@ -280,14 +281,14 @@ export default { ...@@ -280,14 +281,14 @@ export default {
methods: { methods: {
getLastMonth() { getLastMonth() {
// 获取上个月日期 // 获取上个月日期
var date = new Date; var date = new Date()
var year = date.getFullYear(); var year = date.getFullYear()
var month = date.getMonth(); var month = date.getMonth()
if (month == 0) { if (month == 0) {
year = year - 1; year = year - 1
month = 12; month = 12
} }
this.searchForm.performanceMonth = year.toString() + '-' + month; this.searchForm.performanceMonth = year.toString() + '-' + month
}, },
getServiceCenterList() { getServiceCenterList() {
const params = { const params = {
...@@ -304,7 +305,8 @@ export default { ...@@ -304,7 +305,8 @@ export default {
}, },
beforeSearchFn() { beforeSearchFn() {
return new Promise(resolve => { return new Promise(resolve => {
if (!this.setMonthFlag) {//进入页面时设置绩效月份参数值 if (!this.setMonthFlag) {
//进入页面时设置绩效月份参数值
this.getLastMonth() this.getLastMonth()
} }
this.tableSearchForm = this.getParams() this.tableSearchForm = this.getParams()
...@@ -356,13 +358,13 @@ export default { ...@@ -356,13 +358,13 @@ export default {
distribute_commit(selectedData) { distribute_commit(selectedData) {
if (!selectedData?.length) { if (!selectedData?.length) {
this.$message({ this.$message({
message: "请选择需要下发的记录", message: '请选择需要下发的记录',
type: "warning", type: 'warning',
showClose: true showClose: true
}) })
return false return false
} }
var idList = selectedData.map((item) => { var idList = selectedData.map(item => {
return item.id return item.id
}) })
this.$confirm('<strong>是否确定下发?</strong> <div>完成工资记录下发后,员工可查看到对应的工资记录,且不允许再修改</div> ', '提示', { this.$confirm('<strong>是否确定下发?</strong> <div>完成工资记录下发后,员工可查看到对应的工资记录,且不允许再修改</div> ', '提示', {
...@@ -370,7 +372,8 @@ export default { ...@@ -370,7 +372,8 @@ export default {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { })
.then(() => {
this.$apis.performanceManage.batchIssueApi({ idList: idList }).then(res => { this.$apis.performanceManage.batchIssueApi({ idList: idList }).then(res => {
this.$notify({ this.$notify({
type: 'success', type: 'success',
...@@ -378,7 +381,8 @@ export default { ...@@ -378,7 +381,8 @@ export default {
}) })
this.$refs.residentRef.refreshTable() this.$refs.residentRef.refreshTable()
}) })
}).catch(err => { })
.catch(err => {
console.log(err) console.log(err)
}) })
}, },
...@@ -393,7 +397,7 @@ export default { ...@@ -393,7 +397,7 @@ export default {
this.$apis.performanceManage.exportDetailApi(params).then(res => { this.$apis.performanceManage.exportDetailApi(params).then(res => {
downLoadFile(res) downLoadFile(res)
}) })
}, }
} }
} }
</script> </script>
...@@ -405,10 +409,12 @@ export default { ...@@ -405,10 +409,12 @@ export default {
background: #e4e3ff; background: #e4e3ff;
border-radius: 4px; border-radius: 4px;
} }
.flex { .flex {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.dot { .dot {
width: 6px; width: 6px;
height: 6px; height: 6px;
...@@ -416,12 +422,15 @@ export default { ...@@ -416,12 +422,15 @@ export default {
border-radius: 4px; border-radius: 4px;
margin-right: 6px; margin-right: 6px;
} }
.green { .green {
background: #4aca74; background: #4aca74;
} }
.red { .red {
background: #eb4e4e; background: #eb4e4e;
} }
.grey { .grey {
background: #999999; background: #999999;
} }
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
</div> </div>
</template> </template>
<script> <script>
import ResidentPerformance from "./components/residentPerformance.vue" import ResidentPerformance from './components/residentPerformance.vue'
import TechnicianPerformance from "./components/technicianPerformance.vue" import TechnicianPerformance from './components/technicianPerformance.vue'
export default { export default {
components: { components: {
ResidentPerformance, ResidentPerformance,
...@@ -16,40 +16,34 @@ export default { ...@@ -16,40 +16,34 @@ export default {
}, },
data() { data() {
return { return {
activeName: "1", activeName: '1',
tabPaneList: [ tabPaneList: [
{ {
label: "驻店绩效", label: '驻店绩效',
name: "1" name: '1'
}, },
{ {
label: "技师绩效", label: '技师绩效',
name: "2" name: '2'
} }
], ],
tabName: "ResidentPerformance" tabName: 'ResidentPerformance'
} }
}, },
mounted() { mounted() { },
computed: {},
}, watch: {},
computed: {
},
watch: {
},
methods: { methods: {
handleClick() { handleClick() {
let arr = { let arr = {
1: "residentPerformance", 1: 'residentPerformance',
2: "technicianPerformance" 2: 'technicianPerformance'
} }
this.tabName = arr[+this.activeName] this.tabName = arr[+this.activeName]
console.log(this.tabName); console.log(this.tabName)
}, }
} }
} }
</script> </script>
<style scoped> <style scoped lang="scss">
</style> </style>
...@@ -3,7 +3,9 @@ const packageName = require('./package.json').name ...@@ -3,7 +3,9 @@ const packageName = require('./package.json').name
const node_env = process.env.NODE_ENV === 'production' const node_env = process.env.NODE_ENV === 'production'
const publicPath = node_env ? `/child/${packageName}/` : '/' const publicPath = node_env ? `/child/${packageName}/` : '/'
const resolve = dir => path.join(__dirname, dir) const resolve = dir => path.join(__dirname, dir)
const CopyDir = require('./plugins/copyDir')
const CDN_DOMAIN = 'https://img02.glsx.com.cn/' const CDN_DOMAIN = 'https://img02.glsx.com.cn/'
const isDev = process.env.NODE_ENV !== 'development'
const cdn = { const cdn = {
css: [`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/theme-chalk/index.css`], css: [`${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/theme-chalk/index.css`],
js: [`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`, `${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`, `${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`, `${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`, `${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`, 'https://webapi.amap.com/loader.js'] js: [`${CDN_DOMAIN}ajax/libs/vue/2.6.11/vue.min.js`, `${CDN_DOMAIN}ajax/libs/vue-router/3.2.0/vue-router.min.js`, `${CDN_DOMAIN}ajax/libs/element-ui/2.11.1/index.js`, `${CDN_DOMAIN}ajax/libs/vuex/3.6.2/vuex.min.js`, `${CDN_DOMAIN}ajax/libs/echarts/5.1.2/echarts.min.js`, 'https://webapi.amap.com/loader.js']
...@@ -13,21 +15,22 @@ module.exports = { ...@@ -13,21 +15,22 @@ module.exports = {
publicPath, publicPath,
assetsDir: 'static', assetsDir: 'static',
productionSourceMap: false, productionSourceMap: false,
configureWebpack: { configureWebpack: config => {
resolve: { config.resolve = {
alias: { alias: {
'@': resolve('src'), '@': resolve('src'),
assets: resolve('src/assets'), assets: resolve('src/assets'),
views: resolve('src/views'), views: resolve('src/views'),
components: resolve('src/components') components: resolve('src/components')
} }
}, }
output: { config.output = {
...config.output,
library: `${packageName}-[name]`, library: `${packageName}-[name]`,
libraryTarget: 'umd', // 把微应用打包成 umd 库格式 libraryTarget: 'umd', // 把微应用打包成 umd 库格式
jsonpFunction: `webpackJsonp_${packageName}` jsonpFunction: `webpackJsonp_${packageName}`
}, }
externals: { config.externals = {
vue: 'Vue', vue: 'Vue',
'element-ui': 'ELEMENT', 'element-ui': 'ELEMENT',
'vue-router': 'VueRouter', 'vue-router': 'VueRouter',
...@@ -36,7 +39,38 @@ module.exports = { ...@@ -36,7 +39,38 @@ module.exports = {
echarts: 'echarts', echarts: 'echarts',
AMap: 'AMap' AMap: 'AMap'
} }
// let plugins = []
// if (isDev) {
// // plugins.push(new CopyDir()) // 把dist 文件修改成有两份来兼容部署时请求目录不一样的情况
// }
// config.plugins = [...config.plugins, ...plugins]
}, },
// configureWebpack: {
// resolve: {
// alias: {
// '@': resolve('src'),
// assets: resolve('src/assets'),
// views: resolve('src/views'),
// components: resolve('src/components')
// }
// },
// output: {
// library: `${packageName}-[name]`,
// libraryTarget: 'umd', // 把微应用打包成 umd 库格式
// jsonpFunction: `webpackJsonp_${packageName}`
// },
// externals: {
// vue: 'Vue',
// 'element-ui': 'ELEMENT',
// 'vue-router': 'VueRouter',
// vuex: 'Vuex',
// axios: 'axios',
// echarts: 'echarts',
// AMap: 'AMap'
// }
// },
devServer: { devServer: {
hot: true, hot: true,
disableHostCheck: true, disableHostCheck: true,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!