mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-13 23:20:12 +08:00
Change environment variables (#534)
* Change environment variables * change baseUrl Co-authored-by: elsiosanchez <elsiosanches@gmial.com>
This commit is contained in:
parent
cc352c6a24
commit
6d55b7cb52
17
src/api/ADempiere/config.json
Normal file
17
src/api/ADempiere/config.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"adempiereApi": {
|
||||||
|
"images": {
|
||||||
|
"protocol": "http:",
|
||||||
|
"baseUrl": "//localhost",
|
||||||
|
"port": 9527
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"adempiereStore": {
|
||||||
|
"images": {
|
||||||
|
"protocol": "http:",
|
||||||
|
"baseUrl": "//0.0.0.0:",
|
||||||
|
"port": 8085
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"service": "/adempiere-api"
|
||||||
|
}
|
@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
const apiRestAddress = process.env.VUE_APP_API_REST_ADDRESS || 'http://localhost'
|
|
||||||
const apiRestPort = process.env.VUE_APP_API_REST_PORT || '8085'
|
|
||||||
|
|
||||||
export const API_REST_ADDRESS = `${apiRestAddress}:${apiRestPort}/adempiere-api`
|
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Instance for connection to API RESTful with axios
|
* Instance for connection to API RESTful with axios
|
||||||
* @author EdwinBetanc0urt <EdwinBetanc0urt@oulook.com>
|
* @author elsiosanchez <elsiosanches@gmail.com>
|
||||||
* @param {string} url to resource request
|
* @param {string} url to resource request
|
||||||
* @param {string} method rest, 'get' and 'post' (as default)
|
* @param {string} method rest, 'get' and 'post' (as default)
|
||||||
* @param {object} data body to send post request
|
* @param {object} data body to send post request
|
||||||
@ -23,11 +23,11 @@ export function ApiRest({
|
|||||||
})
|
})
|
||||||
return request.interceptors
|
return request.interceptors
|
||||||
}
|
}
|
||||||
const { API_REST_ADDRESS } = require('@/api/ADempiere/constants.js')
|
const config = require('@/api/ADempiere/config.json')
|
||||||
|
const apiRestAddress = config.adempiereStore.images.protocol + config.adempiereStore.images.baseUrl + config.adempiereStore.images.port + config.service
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
|
|
||||||
const request = axios.create({
|
const request = axios.create({
|
||||||
baseURL: API_REST_ADDRESS,
|
baseURL: apiRestAddress,
|
||||||
// timeout: 10000, // 10s
|
// timeout: 10000, // 10s
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json;charset=UTF-8'
|
'Content-Type': 'application/json;charset=UTF-8'
|
||||||
|
@ -25,7 +25,7 @@ export function buildImageFromArray({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a base 64 image from arrayBuffer
|
* Build a base 64 image from arrayBuffer
|
||||||
* @author EdwinBetanc0urt <EdwinBetanc0urt@oulook.com>
|
* @author elsiosanchez <Elsiosanches@gmail.com>
|
||||||
* @param {array} arrayBuffer
|
* @param {array} arrayBuffer
|
||||||
* @param {string} contentType
|
* @param {string} contentType
|
||||||
* @returns {string} image as base64 encoded
|
* @returns {string} image as base64 encoded
|
||||||
@ -43,7 +43,7 @@ export function buildImageFromArrayBuffer({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get path to get file
|
* Get path to get file
|
||||||
* @author EdwinBetanc0urt <EdwinBetanc0urt@oulook.com>
|
* @author elsiosanchez <Elsiosanches@gmail.com>
|
||||||
* @param {string} file
|
* @param {string} file
|
||||||
* @param {number} width
|
* @param {number} width
|
||||||
* @param {number} height
|
* @param {number} height
|
||||||
@ -57,7 +57,8 @@ export function getImagePath({
|
|||||||
operation = 'fit'
|
operation = 'fit'
|
||||||
}) {
|
}) {
|
||||||
// TODO: Evaluate path url 'http://domain:port/adempiere-api', 'adempiere-api' is part of urn
|
// TODO: Evaluate path url 'http://domain:port/adempiere-api', 'adempiere-api' is part of urn
|
||||||
const { API_REST_ADDRESS: url } = require('@/api/ADempiere/constants.js')
|
const config = require('@/api/ADempiere/config.json')
|
||||||
|
const url = config.adempiereStore.images.protocol + config.adempiereStore.images.baseUrl + config.adempiereStore.images.port + config.service
|
||||||
const urn = `/img?action=${operation}&width=${width}&height=${height}&url=${file}`
|
const urn = `/img?action=${operation}&width=${width}&height=${height}&url=${file}`
|
||||||
const uri = `${url}${urn}`
|
const uri = `${url}${urn}`
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user