feat: 增加本地代理配置
This commit is contained in:
parent
9ad47327c0
commit
efef8a31c4
77
src/App.vue
77
src/App.vue
@ -1,77 +0,0 @@
|
|||||||
<!--
|
|
||||||
* @Author: your name
|
|
||||||
* @Date: 2020-05-26 10:06:34
|
|
||||||
* @LastEditTime: 2020-05-26 17:05:42
|
|
||||||
* @LastEditors: Please set LastEditors
|
|
||||||
* @Description: In User Settings Edit
|
|
||||||
* @FilePath: /x-product-workspace/packages/x-project-app/src/App.vue
|
|
||||||
-->
|
|
||||||
<template>
|
|
||||||
<div id="app">
|
|
||||||
<component :is="layout">
|
|
||||||
<router-view />
|
|
||||||
</component>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { mapMutations } from 'vuex'
|
|
||||||
import { SET_USER_INFO } from '@/store/auth.store'
|
|
||||||
import { initUserRole } from '@/utils/userRole'
|
|
||||||
|
|
||||||
import BlackLayout from '@/layouts/black.layout'
|
|
||||||
import DefaultLayout from '@/layouts/default.layout'
|
|
||||||
import NoSidebarLayout from '@/layouts/no-sidebar.layout'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
BlackLayout,
|
|
||||||
DefaultLayout,
|
|
||||||
NoSidebarLayout
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
layout() {
|
|
||||||
return this.$route.meta.layout || 'DefaultLayout'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.setUserInfo({
|
|
||||||
'loginName': 'admin',
|
|
||||||
'id': '1',
|
|
||||||
'phone': '17729389320',
|
|
||||||
'email': '17728389320@163.com',
|
|
||||||
'enableStatus': 'ENABLED',
|
|
||||||
'headPortrait': null,
|
|
||||||
'userName': '赵站洋',
|
|
||||||
'credentialNo': '110101199003076675',
|
|
||||||
'gender': 'male'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
// 页面加载时初始化用户角色信息
|
|
||||||
this.$nextTick(() => {
|
|
||||||
initUserRole(this).catch((err) => {
|
|
||||||
console.error('初始化用户角色信息失败:', err)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
...mapMutations('authModule', {
|
|
||||||
setUserInfo: SET_USER_INFO
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
#app {
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
color: $--app-font-color;
|
|
||||||
background-color: $--app-bg-Color;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -56,10 +56,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="search-field">
|
<div class="search-field">
|
||||||
<span class="field-label">平台</span>
|
<span class="field-label">平台</span>
|
||||||
<el-select v-model="searchPanelValue.platform" placeholder="请选择" clearable>
|
<!-- <el-select v-model="searchPanelValue.platform" placeholder="请选择" clearable>
|
||||||
<el-option label="选项1" value="1" />
|
<el-option label="选项1" value="1" />
|
||||||
<el-option label="选项2" value="2" />
|
<el-option label="选项2" value="2" />
|
||||||
</el-select>
|
</el-select> -->
|
||||||
|
<el-input v-model="searchPanelValue.platform" placeholder="请输入" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-row">
|
<div class="search-row">
|
||||||
@ -660,7 +661,7 @@ export default {
|
|||||||
xAxisData.push(value.toFixed(1))
|
xAxisData.push(value.toFixed(1))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
xAxisData = this.getDefaultXAxisData(xAxisValue)
|
// xAxisData = this.getDefaultXAxisData(xAxisValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,75 +0,0 @@
|
|||||||
import Vue from 'vue'
|
|
||||||
|
|
||||||
import XDateFormatPlugin from './dayjs/x-date-format'
|
|
||||||
import XLodashPlugin from './lodash/x-lodash'
|
|
||||||
import XBomeventPlugin from './bomevent/x-bomevent'
|
|
||||||
import XRequestPlugin from './request/x-request'
|
|
||||||
|
|
||||||
import { SET_TOKEN } from '../store/auth.store'
|
|
||||||
import store from '../store'
|
|
||||||
|
|
||||||
const plugins = [XDateFormatPlugin, XLodashPlugin, XBomeventPlugin]
|
|
||||||
|
|
||||||
plugins.forEach((plugin) => {
|
|
||||||
Vue.use(plugin)
|
|
||||||
})
|
|
||||||
|
|
||||||
Vue.use(XRequestPlugin, {
|
|
||||||
baseURL: process.env.VUE_APP_BASE_DOMAIN,
|
|
||||||
headers: {
|
|
||||||
'Accept-Language': 'zh-CN'
|
|
||||||
},
|
|
||||||
needShowMessage: true,
|
|
||||||
businessErrorCatch: function(failRes, response, needShowMessage) {
|
|
||||||
// 通用业务错误处理
|
|
||||||
// console.log(failRes, response, needShowMessage)
|
|
||||||
if (failRes.code === 'error' && needShowMessage) {
|
|
||||||
Vue.prototype.$message({
|
|
||||||
message: failRes.message,
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
errorCatch: function(err, needShowMessage) {
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// 添加request拦截器
|
|
||||||
Vue.addInterceptorsRequest('REQUEST_PARAMS_INTERCEPTOR', (e) => {
|
|
||||||
e.headers['xdaptimestamp'] = new Date().getTime()
|
|
||||||
|
|
||||||
const authStore = store.state.authModule
|
|
||||||
if (authStore.token) {
|
|
||||||
e.headers['xdaptoken'] = authStore.token
|
|
||||||
}
|
|
||||||
e.headers['xdaptenantid'] = process.env.VUE_APP_TENANT_ID
|
|
||||||
|
|
||||||
return e
|
|
||||||
})
|
|
||||||
|
|
||||||
// 添加response拦截器
|
|
||||||
Vue.addInterceptorsResponse('RESPONSE_SUCCESS_MSG_INTERCEPTOR', (e) => {
|
|
||||||
const token = e && e.headers && e.headers.xdaptoken
|
|
||||||
if (token) {
|
|
||||||
store.commit(`authModule/${SET_TOKEN}`, token)
|
|
||||||
}
|
|
||||||
if (e.data.code) {
|
|
||||||
if (e && e.status === 200 && e.data.code === 'ok' && !e.config.disableSuccessMsg) {
|
|
||||||
if (e.data.interval) {
|
|
||||||
Vue.prototype.$message({
|
|
||||||
message: e.data.message,
|
|
||||||
type: 'success',
|
|
||||||
durationTime: e.data.interval
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
Vue.prototype.$message({
|
|
||||||
message: e.data.message,
|
|
||||||
type: 'success'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return e
|
|
||||||
})
|
|
||||||
114
vue.config.js
114
vue.config.js
@ -1,114 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: your name
|
|
||||||
* @Date: 2020-05-27 09:29:16
|
|
||||||
* @LastEditTime: 2020-05-27 11:00:29
|
|
||||||
* @LastEditors: your name
|
|
||||||
* @Description: In User Settings Edit
|
|
||||||
* @FilePath: /x-product-workspace/packages/x-project-app/vue.config.js
|
|
||||||
*/
|
|
||||||
'use strict'
|
|
||||||
'use strict'
|
|
||||||
const path = require('path')
|
|
||||||
|
|
||||||
const resolve = (dir) => {
|
|
||||||
return path.join(__dirname, './', dir)
|
|
||||||
}
|
|
||||||
|
|
||||||
const isProd = () => {
|
|
||||||
return process.env.NODE_ENV === 'production'
|
|
||||||
}
|
|
||||||
module.exports = {
|
|
||||||
publicPath: process.env.VUE_APP_PUBLIC_PATH,
|
|
||||||
assetsDir: 'public',
|
|
||||||
lintOnSave: isProd(),
|
|
||||||
productionSourceMap: false,
|
|
||||||
transpileDependencies: [
|
|
||||||
'@x-ui/x-dcloud-ui',
|
|
||||||
'@x-apaas/x-lib-rule-engine',
|
|
||||||
'@x-apaas/x-dcloud-page-web',
|
|
||||||
'x-extension'
|
|
||||||
],
|
|
||||||
runtimeCompiler: true,
|
|
||||||
// webpack-dev-server 相关配置
|
|
||||||
devServer: {
|
|
||||||
open: process.platform === 'darwin',
|
|
||||||
host: '0.0.0.0',
|
|
||||||
port: '8081',
|
|
||||||
disableHostCheck: false,
|
|
||||||
https: false,
|
|
||||||
hotOnly: false,
|
|
||||||
overlay: {
|
|
||||||
warnings: false,
|
|
||||||
errors: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
css: {
|
|
||||||
loaderOptions: {
|
|
||||||
sass: {
|
|
||||||
prependData: `
|
|
||||||
@import "@/assets/scss/variable.scss";
|
|
||||||
`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
pwa: {
|
|
||||||
iconPaths: {
|
|
||||||
favicon32: './favicon.ico',
|
|
||||||
favicon16: './favicon.ico',
|
|
||||||
appleTouchIcon: './favicon.ico',
|
|
||||||
maskIcon: './favicon.ico',
|
|
||||||
msTileImage: './favicon.ico'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
configureWebpack: () => ({
|
|
||||||
name: 'vue-cli3-template',
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
// vue动态值
|
|
||||||
vue$: 'vue/dist/vue.esm.js',
|
|
||||||
|
|
||||||
// vue快速路径
|
|
||||||
'@': resolve('src')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: []
|
|
||||||
}),
|
|
||||||
chainWebpack: (config) => {
|
|
||||||
// webpack-html-plugin
|
|
||||||
// config.plugin('html').tap((options) => {
|
|
||||||
// options[0].title = '得帆云 MDM平台'
|
|
||||||
// options[0].minify = {
|
|
||||||
// removeComments: true,
|
|
||||||
// collapseWhitespace: true,
|
|
||||||
// removeAttributeQuotes: true,
|
|
||||||
// useShortDoctype: true,
|
|
||||||
// removeEmptyAttributes: true,
|
|
||||||
// removeStyleLinkTypeAttributes: true,
|
|
||||||
// keepClosingSlash: true,
|
|
||||||
// minifyJS: true,
|
|
||||||
// minifyCSS: true,
|
|
||||||
// minifyURLs: true
|
|
||||||
// }
|
|
||||||
// return options
|
|
||||||
// })
|
|
||||||
|
|
||||||
//
|
|
||||||
const svgRule = config.module.rule('svg')
|
|
||||||
svgRule.uses.clear()
|
|
||||||
|
|
||||||
// svgRule.use("vue-svg-loader").loader("vue-svg-loader");
|
|
||||||
// svgRule.exclude.add(/node_modules/);
|
|
||||||
svgRule
|
|
||||||
.test(/\.svg$/)
|
|
||||||
.include.add(resolve('./src/assets/icon'))
|
|
||||||
.add(resolve('./node_modules/@x-ui/x-dcloud-ui/lib/assets/icon'))
|
|
||||||
.add(resolve('./node_modules/@x-apaas/x-dcloud-page-web/lib/assets/icon'))
|
|
||||||
.end()
|
|
||||||
.use('svg-sprite-loader')
|
|
||||||
.loader('svg-sprite-loader')
|
|
||||||
.options({
|
|
||||||
symbolId: 'svg-[name]'
|
|
||||||
})
|
|
||||||
config.resolve.symlinks(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user