From 5b9ce7fa7567030bf10a9050495c63e247db99fe Mon Sep 17 00:00:00 2001 From: daihh Date: Thu, 2 Jun 2022 22:27:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=BA=E7=AB=8B=E8=87=AA=E5=B7=B1=E7=9A=84?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- src/utils/tools.js | 16 ++++++++++++++-- vue.config.js | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.env.development b/.env.development index c5518361..c00eb3dd 100644 --- a/.env.development +++ b/.env.development @@ -14,7 +14,7 @@ VUE_APP_BOE_WEB_URL = 'https://u.boe.com' VUE_APP_BOE_MOBILE_URL = 'http://192.168.0.10:8082/mobile' # File路径的基础url -VUE_APP_FILE_BASE_URL = 'http://192.168.0.10:9090/cdn/upload' +VUE_APP_FILE_BASE_URL = '/cdn/upload' # 登录地址 VUE_APP_LOGIN_URL='/pc/login' diff --git a/src/utils/tools.js b/src/utils/tools.js index 05cd64b6..4376b1ac 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -5,6 +5,18 @@ export const deepCopy = (obj) => { return JSON.parse(JSON.stringify(obj)); }; +/**文件的基础路径*/ +export function getFileBaseUrl() { + const protocol='https:'==window.location.protocol; + let configPath=process.env.VUE_APP_FILE_BASE_URL; + if(configPath.startsWith('http')){ + return configPath; + }else{ + let domain = window.location.host; + return protocol+='//'+domain+configPath; + } +} + /** * 获取url协议 * @param {Object} type @@ -207,8 +219,8 @@ export function testType(type) { //此方法移到tools中 /** * 头像文字 - * @param {*} text - * @returns + * @param {*} text + * @returns */ export function userAvatarText(text){ if(text){ diff --git a/vue.config.js b/vue.config.js index f69b259d..c56782db 100644 --- a/vue.config.js +++ b/vue.config.js @@ -113,7 +113,7 @@ module.exports = { proxy: { '/systemapi': { // 目标代理服务器地址 - target: 'http://192.168.0.10:9090', + target: 'http://localhost:9090', changeOrigin: true, logLevel:'debug', secure: false,