forked from mt-fe-group/mt-yd-ui
update vuecli proxy
This commit is contained in:
parent
10e454eb2a
commit
e532989ddf
@ -3,7 +3,8 @@
|
|||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve --mode production",
|
||||||
|
"serve:dev": "vue-cli-service serve --mode development",
|
||||||
"build": "vue-cli-service build",
|
"build": "vue-cli-service build",
|
||||||
"build:prod": "vue-cli-service build --mode production",
|
"build:prod": "vue-cli-service build --mode production",
|
||||||
"build:sit": "vue-cli-service build --mode production.sit",
|
"build:sit": "vue-cli-service build --mode production.sit",
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
window.SITE_CONFIG['version'] = 'v5.0.0';
|
window.SITE_CONFIG['version'] = 'v5.0.0';
|
||||||
window.SITE_CONFIG['nodeEnv'] = '<%= process.env.VUE_APP_NODE_ENV %>';
|
window.SITE_CONFIG['nodeEnv'] = '<%= process.env.VUE_APP_NODE_ENV %>';
|
||||||
window.SITE_CONFIG['apiURL'] = ''; // api请求地址
|
window.SITE_CONFIG['apiURL'] = ''; // api请求地址
|
||||||
window.SITE_CONFIG['projURL'] = '/yd-monitor'; // api请求地址
|
window.SITE_CONFIG['projURL'] = ''; // api请求地址
|
||||||
window.SITE_CONFIG['storeState'] = {}; // vuex本地储存初始化状态(用于不刷新页面的情况下,也能重置初始化项目中所有状态)
|
window.SITE_CONFIG['storeState'] = {}; // vuex本地储存初始化状态(用于不刷新页面的情况下,也能重置初始化项目中所有状态)
|
||||||
window.SITE_CONFIG['contentTabDefault'] = { // 内容标签页默认属性对象
|
window.SITE_CONFIG['contentTabDefault'] = { // 内容标签页默认属性对象
|
||||||
'name': '', // 名称, 由 this.$route.name 自动赋值(默认,名称 === 路由名称 === 路由路径)
|
'name': '', // 名称, 由 this.$route.name 自动赋值(默认,名称 === 路由名称 === 路由路径)
|
||||||
@ -31,25 +31,25 @@
|
|||||||
<!-- 开发环境 -->
|
<!-- 开发环境 -->
|
||||||
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
|
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
|
||||||
<script>
|
<script>
|
||||||
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.28:8080';
|
window.SITE_CONFIG['apiURL'] = 'http://india.mes.picaiba.com/';
|
||||||
</script>
|
</script>
|
||||||
<% } %>
|
<% } %>
|
||||||
<!-- 集成测试环境 -->
|
<!-- 集成测试环境 -->
|
||||||
<% if (process.env.VUE_APP_NODE_ENV === 'prod:sit') { %>
|
<% if (process.env.VUE_APP_NODE_ENV === 'prod:sit') { %>
|
||||||
<script>
|
<script>
|
||||||
window.SITE_CONFIG['apiURL'] = 'http://localhost:8080/renren-admin';
|
window.SITE_CONFIG['apiURL'] = 'http://india.mes.picaiba.com/';
|
||||||
</script>
|
</script>
|
||||||
<% } %>
|
<% } %>
|
||||||
<!-- 验收测试环境 -->
|
<!-- 验收测试环境 -->
|
||||||
<% if (process.env.VUE_APP_NODE_ENV === 'prod:uat') { %>
|
<% if (process.env.VUE_APP_NODE_ENV === 'prod:uat') { %>
|
||||||
<script>
|
<script>
|
||||||
window.SITE_CONFIG['apiURL'] = 'http://localhost:8080/renren-admin';
|
window.SITE_CONFIG['apiURL'] = 'http://india.mes.picaiba.com/';
|
||||||
</script>
|
</script>
|
||||||
<% } %>
|
<% } %>
|
||||||
<!-- 生产环境 -->
|
<!-- 生产环境 -->
|
||||||
<% if (process.env.VUE_APP_NODE_ENV === 'prod') { %>
|
<% if (process.env.VUE_APP_NODE_ENV === 'prod') { %>
|
||||||
<script>
|
<script>
|
||||||
window.SITE_CONFIG['apiURL'] = 'http://localhost:8080/renren-admin';
|
window.SITE_CONFIG['apiURL'] = 'http://india.mes.picaiba.com/';
|
||||||
</script>
|
</script>
|
||||||
<% } %>
|
<% } %>
|
||||||
</head>
|
</head>
|
||||||
|
@ -7,7 +7,9 @@ import isPlainObject from 'lodash/isPlainObject'
|
|||||||
import merge from 'lodash/merge'
|
import merge from 'lodash/merge'
|
||||||
|
|
||||||
const http = axios.create({
|
const http = axios.create({
|
||||||
baseURL: window.SITE_CONFIG['apiURL'],
|
// baseURL: window.SITE_CONFIG['apiURL'],
|
||||||
|
// baseURL: '/api',
|
||||||
|
baseURL: process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor',
|
||||||
timeout: 1000 * 180,
|
timeout: 1000 * 180,
|
||||||
withCredentials: true
|
withCredentials: true
|
||||||
})
|
})
|
||||||
@ -71,7 +73,9 @@ http.interceptors.response.use(response => {
|
|||||||
*/
|
*/
|
||||||
http.adornUrl = (actionName) => {
|
http.adornUrl = (actionName) => {
|
||||||
// 非生产环境 && 开启代理, 接口前缀统一使用[/proxyApi/]前缀做代理拦截!
|
// 非生产环境 && 开启代理, 接口前缀统一使用[/proxyApi/]前缀做代理拦截!
|
||||||
return (process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? '/proxyApi/' : window.SITE_CONFIG.projURL) + actionName
|
// return (process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? window.SITE_CONFIG.projURL : '') + actionName
|
||||||
|
// return (process.env.NODE_ENV !== 'production' ? '/yd-monitor' : '/api') + actionName
|
||||||
|
return actionName
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,7 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
// this.$store.state.sidebarMenuList = window.SITE_CONFIG['menuList']
|
// this.$store.state.sidebarMenuList = window.SITE_CONFIG['menuList']
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
console.log(`window.SITE_CONFIG['menuList']`, window.SITE_CONFIG['menuList'])
|
||||||
this.unhiddenMenuList = this.getUnhiddenRoutesListFrom(window.SITE_CONFIG['menuList'])
|
this.unhiddenMenuList = this.getUnhiddenRoutesListFrom(window.SITE_CONFIG['menuList'])
|
||||||
/** 本地保存一份,store保存一份,感觉 store 都不需要保存... */
|
/** 本地保存一份,store保存一份,感觉 store 都不需要保存... */
|
||||||
this.$store.state.sidebarMenuList = this.unhiddenMenuList
|
this.$store.state.sidebarMenuList = this.unhiddenMenuList
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
<h3>官方微信群</h3>
|
<h3>官方微信群</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>扫码下面的二维码,关注【人人开源】公众号,回复【加群】,即可根据提示加入微信群!</li>
|
<li>扫码下面的二维码,关注【人人开源】公众号,回复【加群】,即可根据提示加入微信群!</li>
|
||||||
<li><img src="https://cdn.renren.io/f5cef202207132229319338.jpg" alt="微信群" /></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -11,8 +11,9 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: true,
|
loading: true,
|
||||||
// url: process.env.VUE_APP_REPORT_DESIGN_URL
|
// url: process.env.VUE_APP_REPORT_DESIGN_URL
|
||||||
url: window.SITE_CONFIG['apiURL'] + '/yd-monitor/ureport/designer'
|
// url: window.SITE_CONFIG['apiURL'] + this.$http.adornUrl('/ureport/designer')
|
||||||
// url: this.$http.adornUrl('/ureport/designer')
|
// url: this.$http.adornUrl('/ureport/designer')
|
||||||
|
url: (process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor') + '/ureport/designer'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -22,7 +22,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: true,
|
loading: true,
|
||||||
// url: process.env.VUE_APP_REPORT_VIEW_URL
|
// url: process.env.VUE_APP_REPORT_VIEW_URL
|
||||||
url: window.SITE_CONFIG['apiURL'] + '/yd-monitor/ureport/preview'
|
// url: window.SITE_CONFIG['apiURL'] + this.$http.adornUrl('/ureport/preview')
|
||||||
|
url: (process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor') + '/ureport/preview'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -230,7 +230,7 @@ export default {
|
|||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: '/yd-monitor/monitoring/workshopSectionEquipment',
|
url: this.$http.adornUrl('/monitoring/workshopSectionEquipment'),
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
data: [id]
|
data: [id]
|
||||||
}).then(({ data }) => {
|
}).then(({ data }) => {
|
||||||
@ -274,7 +274,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleCreateOrUpdate() {
|
handleCreateOrUpdate() {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: '/yd-monitor/monitoring/workshopSection',
|
url: this.$http.adornUrl('/monitoring/workshopSection'),
|
||||||
method: this.dataForm.id ? 'put' : 'post',
|
method: this.dataForm.id ? 'put' : 'post',
|
||||||
data: {
|
data: {
|
||||||
...this.dataForm
|
...this.dataForm
|
||||||
|
@ -66,7 +66,7 @@ export default {
|
|||||||
this.edit = true
|
this.edit = true
|
||||||
// 获取信息,让用户修改排序
|
// 获取信息,让用户修改排序
|
||||||
this.$http({
|
this.$http({
|
||||||
url: '/yd-monitor/monitoring/workshopSectionEquipment/' + id,
|
url: this.$http.adornUrl('/monitoring/workshopSectionEquipment/') + id,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
}).then(({ data: res }) => {
|
}).then(({ data: res }) => {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
@ -102,7 +102,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleSave() {
|
handleSave() {
|
||||||
this.$http({
|
this.$http({
|
||||||
url: '/yd-monitor/monitoring/workshopSectionEquipment',
|
url: this.$http.adornUrl('/monitoring/workshopSectionEquipment'),
|
||||||
method: this.edit ? 'put' : 'post',
|
method: this.edit ? 'put' : 'post',
|
||||||
data: {
|
data: {
|
||||||
...this.dataForm,
|
...this.dataForm,
|
||||||
|
@ -22,7 +22,8 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
this.visible = true
|
this.visible = true
|
||||||
this.url = `${window.SITE_CONFIG['apiURL']}/sys/oss/upload?token=${Cookies.get('token')}`
|
// this.url = `${window.SITE_CONFIG['apiURL']}/sys/oss/upload?token=${Cookies.get('token')}`
|
||||||
|
this.url = (process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor') + `/sys/oss/upload?token=${Cookies.get('token')}`
|
||||||
this.num = 0
|
this.num = 0
|
||||||
this.fileList = []
|
this.fileList = []
|
||||||
},
|
},
|
||||||
|
@ -102,7 +102,8 @@ export default {
|
|||||||
// 获取验证码
|
// 获取验证码
|
||||||
getCaptcha() {
|
getCaptcha() {
|
||||||
this.dataForm.uuid = getUUID()
|
this.dataForm.uuid = getUUID()
|
||||||
this.captchaPath = `${window.SITE_CONFIG['apiURL']}/captcha?uuid=${this.dataForm.uuid}`
|
// this.captchaPath = `${window.SITE_CONFIG['apiURL']}/captcha?uuid=${this.dataForm.uuid}`
|
||||||
|
this.captchaPath = (process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor') + `/captcha?uuid=${this.dataForm.uuid}`
|
||||||
},
|
},
|
||||||
// 表单提交
|
// 表单提交
|
||||||
dataFormSubmitHandle: debounce(
|
dataFormSubmitHandle: debounce(
|
||||||
@ -114,7 +115,9 @@ export default {
|
|||||||
this.$http
|
this.$http
|
||||||
.post(this.$http.adornUrl('/login'), this.dataForm)
|
.post(this.$http.adornUrl('/login'), this.dataForm)
|
||||||
.then(({ data: res }) => {
|
.then(({ data: res }) => {
|
||||||
|
console.log('res', res)
|
||||||
if (res.code !== 0) {
|
if (res.code !== 0) {
|
||||||
|
console.log('res', res)
|
||||||
// this.getCaptcha()
|
// this.getCaptcha()
|
||||||
return this.$message.error(res.msg)
|
return this.$message.error(res.msg)
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,31 @@ module.exports = {
|
|||||||
.loader('svg-sprite-loader')
|
.loader('svg-sprite-loader')
|
||||||
},
|
},
|
||||||
productionSourceMap: false,
|
productionSourceMap: false,
|
||||||
|
configureWebpack: config => {
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
config.performance = {
|
||||||
|
maxEntrypointSize: 2097152, // 大小改为2mb
|
||||||
|
maxAssetSize: 1572864
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
open: true,
|
open: true,
|
||||||
port: 8001,
|
port: 8001,
|
||||||
overlay: {
|
overlay: {
|
||||||
errors: true,
|
errors: true,
|
||||||
warnings: true
|
warnings: true
|
||||||
|
},
|
||||||
|
proxy: {
|
||||||
|
'/api': {
|
||||||
|
target: 'http://india.mes.picaiba.com/'
|
||||||
|
},
|
||||||
|
'/yd-monitor': {
|
||||||
|
target: 'http://192.168.1.20:8080/' // 开发地址
|
||||||
|
},
|
||||||
|
'/ureport': {
|
||||||
|
target: 'http://india.mes.picaiba.com/' // ureporter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user