Commit bad6a312 by wuqian

cn去掉/upload/factory

parent 30d52ef5
...@@ -60,6 +60,12 @@ export function getFilePath() { ...@@ -60,6 +60,12 @@ export function getFilePath() {
import.meta.env.VITE_API_BASE_URL + import.meta.env.VITE_API_BASE_UPLOAD_URL import.meta.env.VITE_API_BASE_URL + import.meta.env.VITE_API_BASE_UPLOAD_URL
) )
} }
export function getFileCnPath() {
if (!/(http|https):\/\/([^/]+)/i.test(import.meta.env.BASE_URL)) {
return location.origin
}
return import.meta.env.VITE_API_BASE_URL
}
export function getWsUrl() { export function getWsUrl() {
if (location.protocol === 'https:') { if (location.protocol === 'https:') {
return 'wss://' + location.host return 'wss://' + location.host
...@@ -68,5 +74,6 @@ export function getWsUrl() { ...@@ -68,5 +74,6 @@ export function getWsUrl() {
} }
} }
export const filePath = getFilePath() export const filePath = getFilePath()
export const FileCnPath = getFileCnPath()
export default axios export default axios
...@@ -244,7 +244,7 @@ import type { FormRules } from 'element-plus' ...@@ -244,7 +244,7 @@ import type { FormRules } from 'element-plus'
import { useValue } from '@/utils/hooks/useValue' import { useValue } from '@/utils/hooks/useValue'
import { changePasswordApi } from '@/api/auth' import { changePasswordApi } from '@/api/auth'
import { getLogisticUSApi, getLogisticCNApi } from '@/api/common' import { getLogisticUSApi, getLogisticCNApi } from '@/api/common'
import { filePath } from '@/api/axios' import { filePath, FileCnPath } from '@/api/axios'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
interface MenuItem { interface MenuItem {
index: string index: string
...@@ -530,7 +530,7 @@ const getLogistic = () => { ...@@ -530,7 +530,7 @@ const getLogistic = () => {
// 中国物流 // 中国物流
getLogisticCNApi(content.value).then((res) => { getLogisticCNApi(content.value).then((res) => {
if (res.code === 200) { if (res.code === 200) {
window.open(filePath + res.data.documentUrl, '_blank') window.open(FileCnPath + res.data.documentUrl, '_blank')
} }
}) })
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment