mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-12 22:29:59 +08:00
feat: Change api config from function to constant. (#544)
Co-authored-by: EdwinBetanc0urt <EdwinBetanco0urt@outlook.com>
This commit is contained in:
parent
486afc8aa7
commit
273b10141f
@ -6,11 +6,13 @@
|
|||||||
"adempiere": {
|
"adempiere": {
|
||||||
"api": {
|
"api": {
|
||||||
"url": "http://localhost:8085",
|
"url": "http://localhost:8085",
|
||||||
"service": "/adempiere-api"
|
"service": "/adempiere-api",
|
||||||
|
"fullPath": "http://localhost:8085/adempiere-api"
|
||||||
},
|
},
|
||||||
"images": {
|
"images": {
|
||||||
"url": "http://localhost:8085",
|
"url": "http://localhost:8085",
|
||||||
"service": "/adempiere-api"
|
"service": "/adempiere-api/img",
|
||||||
|
"fullPath": "http://localhost:8085/adempiere-api/img"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { getConfig } from '@/utils/ADempiere/config'
|
import { config } from '@/utils/ADempiere/config'
|
||||||
/**
|
/**
|
||||||
* Instance for connection to API RESTful with axios
|
* Instance for connection to API RESTful with axios
|
||||||
* @author EdwinBetanc0urt <EdwinBetanc0urt@oulook.com>
|
* @author EdwinBetanc0urt <EdwinBetanc0urt@oulook.com>
|
||||||
@ -25,8 +25,8 @@ export function ApiRest({
|
|||||||
})
|
})
|
||||||
return request.interceptors
|
return request.interceptors
|
||||||
}
|
}
|
||||||
var config = getConfig()
|
|
||||||
const apiRestAddress = config.adempiere.api.url + config.adempiere.api.service
|
const apiRestAddress = config.adempiere.api.fullPath
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const request = axios.create({
|
const request = axios.create({
|
||||||
baseURL: apiRestAddress,
|
baseURL: apiRestAddress,
|
||||||
|
@ -1,5 +1,2 @@
|
|||||||
// Get Config based on default or local
|
// Get Config based on default or local
|
||||||
export function getConfig() {
|
export const config = require('../../../config/default.json')
|
||||||
const config = require('../../../config/default.json')
|
|
||||||
return config
|
|
||||||
}
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
// This file allows generate util functions for handle arrays, resources and all
|
// This file allows generate util functions for handle arrays, resources and all
|
||||||
// related to upload to server side and downdload from server side to client side.
|
// related to upload to server side and downdload from server side to client side.
|
||||||
// Please add the necessary functions here:
|
// Please add the necessary functions here:
|
||||||
import { getConfig } from '@/utils/ADempiere/config'
|
import { config } from '@/utils/ADempiere/config'
|
||||||
|
|
||||||
// Merge two arrays and return merged array
|
// Merge two arrays and return merged array
|
||||||
export function mergeByteArray(currentArray, arrayToMerge) {
|
export function mergeByteArray(currentArray, arrayToMerge) {
|
||||||
const mergedArray = new currentArray.constructor(currentArray.length + arrayToMerge.length)
|
const mergedArray = new currentArray.constructor(currentArray.length + arrayToMerge.length)
|
||||||
@ -58,9 +59,8 @@ export function getImagePath({
|
|||||||
height = 300,
|
height = 300,
|
||||||
operation = 'fit'
|
operation = 'fit'
|
||||||
}) {
|
}) {
|
||||||
var config = getConfig()
|
const url = config.adempiere.images.fullPath
|
||||||
const url = config.adempiere.images.url + config.adempiere.images.service
|
const urn = `/?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}`
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user