parent
acb3114d76
commit
8b40973f9f
@ -0,0 +1,28 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function index(params){
|
||||
return request({
|
||||
method:'get',
|
||||
url:'/api/admin/vr/index',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export function show(params){
|
||||
return request({
|
||||
method:'get',
|
||||
url:'/api/admin/vr/show',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(params){
|
||||
return request({
|
||||
method:'get',
|
||||
url:'/api/admin/vr/destroy',
|
||||
params
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function index(params){
|
||||
return request({
|
||||
method:'get',
|
||||
url:'/api/admin/activity_list/index',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function save(data) {
|
||||
return request({
|
||||
url: '/api/admin/activity_list/save',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function show(params){
|
||||
return request({
|
||||
method:'get',
|
||||
url:'/api/admin/activity_list/show',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(params){
|
||||
return request({
|
||||
method:'get',
|
||||
url:'/api/admin/activity_list/destroy',
|
||||
params
|
||||
})
|
||||
}
|
||||
@ -1,16 +1,16 @@
|
||||
module.exports = {
|
||||
|
||||
title: '朗业基础平台',
|
||||
|
||||
/**
|
||||
* @type {boolean} true | false
|
||||
* @description Whether fix the header
|
||||
*/
|
||||
fixedHeader: true,
|
||||
|
||||
/**
|
||||
* @type {boolean} true | false
|
||||
* @description Whether show the logo in sidebar
|
||||
*/
|
||||
sidebarLogo: true
|
||||
module.exports = {
|
||||
|
||||
title: '业务基础平台',
|
||||
|
||||
/**
|
||||
* @type {boolean} true | false
|
||||
* @description Whether fix the header
|
||||
*/
|
||||
fixedHeader: true,
|
||||
|
||||
/**
|
||||
* @type {boolean} true | false
|
||||
* @description Whether show the logo in sidebar
|
||||
*/
|
||||
sidebarLogo: true
|
||||
}
|
||||
|
||||
@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<div>
|
||||
<lx-header icon="md-apps" style="margin-bottom: 10px; border: 0px; margin-top: 15px" text="活动参与管理">
|
||||
<div slot="content"></div>
|
||||
<slot>
|
||||
<div class="selects">
|
||||
<div style="display: flex;align-items: center;">
|
||||
<span style="padding: 0 6px;word-break: keep-all;">
|
||||
活动
|
||||
</span>
|
||||
<Select v-model="select.activity_list_id" style="width: 180px;">
|
||||
<Option v-for="(item,index) of listActivity" :key="item.id" :value="item.id" :label="item.name">
|
||||
</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<div>
|
||||
<span style="padding: 0 6px;word-break: keep-all;">
|
||||
关键字
|
||||
</span>
|
||||
<Input v-model="select.keyword" placeholder="请输入关键字" style="width: 180px"></Input>
|
||||
</div>
|
||||
|
||||
<Button style="margin-left: 10px" type="primary" @click="select={page:1,keyword:''}">重置
|
||||
</Button>
|
||||
<Button style="margin-left: 10px" type="primary" @click="doSearch">查询</Button>
|
||||
</div>
|
||||
</slot>
|
||||
</lx-header>
|
||||
|
||||
|
||||
<xy-table :list="list" :table-item="table">
|
||||
<template v-slot:btns>
|
||||
|
||||
</template>
|
||||
</xy-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
index,
|
||||
destroy,
|
||||
show
|
||||
} from "@/api/activity/activityUser";
|
||||
import {
|
||||
index as activityIndex
|
||||
} from "@/api/activity/index";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
keyword: '',
|
||||
activity_list_id: ""
|
||||
},
|
||||
listActivity: [],
|
||||
total: 0,
|
||||
list: [],
|
||||
table: [{
|
||||
prop: 'name',
|
||||
label: '活动名称',
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
|
||||
}, {
|
||||
prop: 'appid',
|
||||
label: '公众号的APPID',
|
||||
align: 'center',
|
||||
fixed: 'left'
|
||||
}, , {
|
||||
prop: 'mch_id',
|
||||
label: '微信商户的ID',
|
||||
align: 'center',
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
prop: 'created_at',
|
||||
label: '创建信息',
|
||||
width: 160,
|
||||
formatter: (v1, v2, value) => {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
async loadActivity() {
|
||||
const res = await activityIndex({
|
||||
page: 1,
|
||||
page_size: 999
|
||||
})
|
||||
this.listActivity = res.data;
|
||||
},
|
||||
doSearch() {
|
||||
this.select.page = 1;
|
||||
this.load();
|
||||
},
|
||||
add() {
|
||||
this.$refs['addActivity'].isShow = true
|
||||
},
|
||||
pageSizeChange(e) {
|
||||
this.select.page_size = e;
|
||||
this.select.page = 1;
|
||||
this.load();
|
||||
},
|
||||
async load() {
|
||||
const res = await index(this.select)
|
||||
this.total = res.total
|
||||
this.list = res.data
|
||||
},
|
||||
deleteitem(row) {
|
||||
destroy({
|
||||
id: row.id
|
||||
}).then(res => {
|
||||
this.load();
|
||||
this.$Message.success("操作成功");
|
||||
})
|
||||
},
|
||||
pageChange(e) {
|
||||
this.select.page = e
|
||||
this.load()
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.load();
|
||||
this.loadActivity()
|
||||
},
|
||||
created() {
|
||||
let type = parseInt(this.$route.path.split("_")[1]);
|
||||
this.type = this.select.is_auth = type;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.selects {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
&>div {
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,224 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 编辑-->
|
||||
<xy-dialog :is-show.sync="isShow" title="活动编辑" type="form" :form="detail" :rules="rules" @submit="editor"
|
||||
ref="addActivity">
|
||||
|
||||
<template v-slot:name>
|
||||
<div class="xy-table-item">
|
||||
<div class="xy-table-item-label">
|
||||
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>活动名称
|
||||
</div>
|
||||
<div class="xy-table-item-content">
|
||||
<el-input clearable placeholder="请填写活动名称" v-model="detail.name" style="width: 300px;" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:tag>
|
||||
<div class="xy-table-item">
|
||||
<div class="xy-table-item-label">
|
||||
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>活动标识
|
||||
</div>
|
||||
<div class="xy-table-item-content">
|
||||
<el-input clearable placeholder="请填写活动标识" v-model="detail.tag" style="width: 300px;" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<template v-slot:appid>
|
||||
<div class="xy-table-item">
|
||||
<div class="xy-table-item-label">公众号的APPID
|
||||
</div>
|
||||
<div class="xy-table-item-content">
|
||||
<el-input clearable placeholder="请填写公众号的APPID" v-model="detail.appid" style="width: 300px;" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:appsecret>
|
||||
<div class="xy-table-item">
|
||||
<div class="xy-table-item-label">公众号的密钥
|
||||
</div>
|
||||
<div class="xy-table-item-content">
|
||||
<el-input clearable placeholder="请填写公众号的密钥" v-model="detail.appsecret" style="width: 300px;" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:mch_id>
|
||||
<div class="xy-table-item">
|
||||
<div class="xy-table-item-label">微信商户的ID
|
||||
</div>
|
||||
<div class="xy-table-item-content">
|
||||
<el-input clearable placeholder="请填写微信商户的ID" v-model="detail.mch_id" style="width: 300px;" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
<template v-slot:key>
|
||||
<div class="xy-table-item">
|
||||
<div class="xy-table-item-label">微信商户的key
|
||||
</div>
|
||||
<div class="xy-table-item-content">
|
||||
<el-input clearable placeholder="请填写微信商户的key" v-model="detail.key" style="width: 300px;" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<template v-slot:status>
|
||||
<div class="xy-table-item">
|
||||
<div class="xy-table-item-label">状态
|
||||
</div>
|
||||
<div class="xy-table-item-content">
|
||||
<el-select clearable v-model="detail.status">
|
||||
<el-option :value="1" label="启用"></el-option>
|
||||
<el-option :value="0" label="禁用"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</xy-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
save,
|
||||
show
|
||||
} from "@/api/activity/index";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
||||
return {
|
||||
isShow: false,
|
||||
id: "",
|
||||
type: "add",
|
||||
detail: {
|
||||
name: "",
|
||||
tag: "",
|
||||
appid: "",
|
||||
appsecret: "",
|
||||
mch_id: "",
|
||||
key: "",
|
||||
cert_pem: "",
|
||||
key_pem: "",
|
||||
status: 1
|
||||
},
|
||||
rules: {
|
||||
name: [{
|
||||
required: true,
|
||||
message: "活动名称必填"
|
||||
}],
|
||||
tag: [{
|
||||
required: true,
|
||||
message: "活动的标识必填"
|
||||
}],
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
isShow(newVal) {
|
||||
if (newVal) {
|
||||
if (this.type === 'editor') {
|
||||
this.getDetail()
|
||||
}
|
||||
} else {
|
||||
this.id = ''
|
||||
this.type = ''
|
||||
this.$refs['addActivity'].reset()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getDetail() {
|
||||
let res = await show({
|
||||
id: this.id
|
||||
})
|
||||
Object.assign(this.detail, res);
|
||||
},
|
||||
editor() {
|
||||
save(this.detail).then(res => {
|
||||
this.isShow = false
|
||||
this.$Message.success("操作成功");
|
||||
this.$emit('refresh')
|
||||
})
|
||||
},
|
||||
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.contract-add-plan {
|
||||
min-height: 30px;
|
||||
border: 1px solid #dcdee2;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
align-content: center;
|
||||
|
||||
padding: 0 8px;
|
||||
|
||||
&-no-plan {
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
color: #CDD0D5;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-table-item-label {
|
||||
width: 140px;
|
||||
}
|
||||
|
||||
.xy-table-item-price {
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
content: '(元)'
|
||||
}
|
||||
|
||||
::v-deep .el-input__clear {
|
||||
position: relative;
|
||||
right: 30px;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-table-item-price-wan {
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
content: '(万元)'
|
||||
}
|
||||
|
||||
::v-deep .el-input__clear {
|
||||
position: relative;
|
||||
right: 46px;
|
||||
z-index: 2;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,135 @@
|
||||
<template>
|
||||
<div>
|
||||
<lx-header icon="md-apps" style="margin-bottom: 10px; border: 0px; margin-top: 15px" text="活动列表管理">
|
||||
<div slot="content"></div>
|
||||
<slot>
|
||||
<div class="selects">
|
||||
|
||||
<div>
|
||||
<span style="padding: 0 6px;word-break: keep-all;">
|
||||
关键字
|
||||
</span>
|
||||
<Input v-model="select.keyword" placeholder="请输入关键字" style="width: 180px"></Input>
|
||||
</div>
|
||||
|
||||
<Button style="margin-left: 10px" type="primary" @click="select={page:1,keyword:''}">重置
|
||||
</Button>
|
||||
<Button style="margin-left: 10px" type="primary" @click="doSearch">查询</Button>
|
||||
<Button style="margin-left: 10px" type="primary" @click="add">新增</Button>
|
||||
</div>
|
||||
</slot>
|
||||
</lx-header>
|
||||
|
||||
|
||||
<xy-table :list="list" :table-item="table" @delete="deleteitem"
|
||||
@editor="(row)=>{$refs['addActivity'].id = row.id;$refs['addActivity'].isShow = true;$refs['addActivity'].type = 'editor'}">
|
||||
<template v-slot:btns v-if="type==0">
|
||||
|
||||
</template>
|
||||
</xy-table>
|
||||
|
||||
<addActivity ref="addActivity" @refresh="load()"></addActivity>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
index,
|
||||
save,
|
||||
destroy,
|
||||
show
|
||||
} from "@/api/activity/index";
|
||||
|
||||
import addActivity from '@/views/activity/components/addActivity'
|
||||
export default {
|
||||
components: {
|
||||
addActivity
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
keyword: '',
|
||||
},
|
||||
total: 0,
|
||||
list: [],
|
||||
table: [{
|
||||
prop: 'name',
|
||||
label: '活动名称',
|
||||
align: 'left',
|
||||
fixed: 'left',
|
||||
|
||||
}, {
|
||||
prop: 'appid',
|
||||
label: '公众号的APPID',
|
||||
align: 'center',
|
||||
fixed: 'left'
|
||||
}, , {
|
||||
prop: 'mch_id',
|
||||
label: '微信商户的ID',
|
||||
align: 'center',
|
||||
fixed: 'left'
|
||||
},
|
||||
{
|
||||
prop: 'created_at',
|
||||
label: '创建信息',
|
||||
width: 160,
|
||||
formatter: (v1, v2, value) => {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doSearch() {
|
||||
this.select.page = 1;
|
||||
this.load();
|
||||
},
|
||||
add() {
|
||||
this.$refs['addActivity'].isShow = true
|
||||
},
|
||||
pageSizeChange(e) {
|
||||
this.select.page_size = e;
|
||||
this.select.page = 1;
|
||||
this.load();
|
||||
},
|
||||
async load() {
|
||||
const res = await index(this.select)
|
||||
this.total = res.total
|
||||
this.list = res.data
|
||||
},
|
||||
deleteitem(row) {
|
||||
destroy({
|
||||
id: row.id
|
||||
}).then(res => {
|
||||
this.load();
|
||||
this.$Message.success("操作成功");
|
||||
})
|
||||
},
|
||||
pageChange(e) {
|
||||
this.select.page = e
|
||||
this.load()
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.load()
|
||||
},
|
||||
created() {
|
||||
let type = parseInt(this.$route.path.split("_")[1]);
|
||||
this.type = this.select.is_auth = type;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.selects {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
&>div {
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -1,148 +1,148 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const defaultSettings = require('./src/settings.js')
|
||||
|
||||
function resolve(dir) {
|
||||
return path.join(__dirname, dir)
|
||||
}
|
||||
|
||||
const name = defaultSettings.title // page title
|
||||
|
||||
// If your port is set to 80,
|
||||
// use administrator privileges to execute the command line.
|
||||
// For example, Mac: sudo npm run
|
||||
// You can change the port by the following methods:
|
||||
// port = 9528 npm run dev OR npm run dev --port = 9528
|
||||
const port = process.env.port || process.env.npm_config_port || 8000 // dev port
|
||||
|
||||
// All configuration item explanations can be find in https://cli.vuejs.org/config/
|
||||
module.exports = {
|
||||
/**
|
||||
* You will need to set publicPath if you plan to deploy your site under a sub path,
|
||||
* for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
|
||||
* then publicPath should be set to "/bar/".
|
||||
* In most cases please use '/' !!!
|
||||
* Detail: https://cli.vuejs.org/config/#publicpath
|
||||
*/
|
||||
publicPath: '/admin/',
|
||||
outputDir: '/Users/liuxiangyu/Work/z-zhongjia/app/zhongjia-finance-service/public/admin',
|
||||
assetsDir: 'static',
|
||||
css: {
|
||||
loaderOptions: { // 向 CSS 相关的 loader 传递选项
|
||||
less: {
|
||||
javascriptEnabled: true
|
||||
}
|
||||
}
|
||||
},
|
||||
lintOnSave: process.env.NODE_ENV === 'development',
|
||||
productionSourceMap: false,
|
||||
devServer: {
|
||||
port: port,
|
||||
open: true,
|
||||
overlay: {
|
||||
warnings: false,
|
||||
errors: true
|
||||
},
|
||||
//before: require('./mock/mock-server.js'),
|
||||
proxy: {
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: process.env.VUE_APP_BASE_API,
|
||||
changeOrigin: true, //配置跨域
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: process.env.VUE_APP_BASE_API
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
configureWebpack: {
|
||||
// provide the app's title in webpack's name field, so that
|
||||
// it can be accessed in index.html to inject the correct title.
|
||||
name: name,
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve('src')
|
||||
}
|
||||
}
|
||||
},
|
||||
chainWebpack(config) {
|
||||
// it can improve the speed of the first screen, it is recommended to turn on preload
|
||||
config.plugin('preload').tap(() => [{
|
||||
rel: 'preload',
|
||||
// to ignore 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'
|
||||
}])
|
||||
|
||||
// when there are many pages, it will cause too many meaningless requests
|
||||
config.plugins.delete('prefetch')
|
||||
|
||||
// set svg-sprite-loader
|
||||
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()
|
||||
|
||||
// set preserveWhitespace
|
||||
config.module
|
||||
.rule('vue')
|
||||
.use('vue-loader')
|
||||
.loader('vue-loader')
|
||||
.tap(options => {
|
||||
options.compilerOptions.preserveWhitespace = true
|
||||
return options
|
||||
})
|
||||
.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')
|
||||
}
|
||||
)
|
||||
}
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const defaultSettings = require('./src/settings.js')
|
||||
|
||||
function resolve(dir) {
|
||||
return path.join(__dirname, dir)
|
||||
}
|
||||
|
||||
const name = defaultSettings.title // page title
|
||||
|
||||
// If your port is set to 80,
|
||||
// use administrator privileges to execute the command line.
|
||||
// For example, Mac: sudo npm run
|
||||
// You can change the port by the following methods:
|
||||
// port = 9528 npm run dev OR npm run dev --port = 9528
|
||||
const port = process.env.port || process.env.npm_config_port || 8013 // dev port
|
||||
|
||||
// All configuration item explanations can be find in https://cli.vuejs.org/config/
|
||||
module.exports = {
|
||||
/**
|
||||
* You will need to set publicPath if you plan to deploy your site under a sub path,
|
||||
* for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
|
||||
* then publicPath should be set to "/bar/".
|
||||
* In most cases please use '/' !!!
|
||||
* Detail: https://cli.vuejs.org/config/#publicpath
|
||||
*/
|
||||
publicPath: '/admin/',
|
||||
outputDir: '/Users/liuxiangyu/Work/g-guangdian/app/h-h5-service/h5-service/public/admin',
|
||||
assetsDir: 'static',
|
||||
css: {
|
||||
loaderOptions: { // 向 CSS 相关的 loader 传递选项
|
||||
less: {
|
||||
javascriptEnabled: true
|
||||
}
|
||||
}
|
||||
},
|
||||
lintOnSave: process.env.NODE_ENV === 'development',
|
||||
productionSourceMap: false,
|
||||
devServer: {
|
||||
port: port,
|
||||
open: true,
|
||||
overlay: {
|
||||
warnings: false,
|
||||
errors: true
|
||||
},
|
||||
//before: require('./mock/mock-server.js'),
|
||||
proxy: {
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: process.env.VUE_APP_BASE_API,
|
||||
changeOrigin: true, //配置跨域
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: process.env.VUE_APP_BASE_API
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
configureWebpack: {
|
||||
// provide the app's title in webpack's name field, so that
|
||||
// it can be accessed in index.html to inject the correct title.
|
||||
name: name,
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve('src')
|
||||
}
|
||||
}
|
||||
},
|
||||
chainWebpack(config) {
|
||||
// it can improve the speed of the first screen, it is recommended to turn on preload
|
||||
config.plugin('preload').tap(() => [{
|
||||
rel: 'preload',
|
||||
// to ignore 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'
|
||||
}])
|
||||
|
||||
// when there are many pages, it will cause too many meaningless requests
|
||||
config.plugins.delete('prefetch')
|
||||
|
||||
// set svg-sprite-loader
|
||||
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()
|
||||
|
||||
// set preserveWhitespace
|
||||
config.module
|
||||
.rule('vue')
|
||||
.use('vue-loader')
|
||||
.loader('vue-loader')
|
||||
.tap(options => {
|
||||
options.compilerOptions.preserveWhitespace = true
|
||||
return options
|
||||
})
|
||||
.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')
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in new issue