merge dev-shenjianbin into master

Merge branch 'master' of https://gitcode.com/hk_openRepo/OpenRepo_Portal into dev-shenjianbin

Created-by: MaxShen
Commit-by: MaxShen
Merged-by: MaxShen
Description: 打通接口请求
Merge branch 'master' of https://gitcode.com/hk_openRepo/OpenRepo_Portal into dev-shenjianbin

See merge request: hk_openRepo/OpenRepo_Portal!21
This commit is contained in:
MaxShen
2025-03-18 15:44:57 +08:00
3 changed files with 11 additions and 5 deletions

View File

@@ -5,10 +5,10 @@ VITE_ENV = 'development'
VITE_HOST = 'https://test.gitcode.net' VITE_HOST = 'https://test.gitcode.net'
# 接口地址 # 接口地址
VITE_API_HOST = '/official' VITE_API_HOST = '/gateway/official'
# devPress接口地址 # devPress接口地址
VITE_DEV_API_HOST = '/official' VITE_DEV_API_HOST = '/gateway/official'
# devPress地址 # devPress地址
VITE_DEV_HOST = 'https://test.gitcode.net' VITE_DEV_HOST = 'https://test.gitcode.net'

View File

@@ -7,6 +7,7 @@ import { useGlobalInfoStore } from '@/stores/Global';
import { cutParamsInUrl, getSignUtmSource } from './index'; import { cutParamsInUrl, getSignUtmSource } from './index';
import { Message } from 'vue-devui/message'; import { Message } from 'vue-devui/message';
import degradeInterceptor from './degradeInterceptor'; import degradeInterceptor from './degradeInterceptor';
import { useAccountStore } from '@/stores/user';
const handleError = dealWarning(); const handleError = dealWarning();
@@ -67,9 +68,14 @@ const refreshToken = async () => axios.request({
}); });
const proxyService = (params: any, customConfigs?: CustomConfigs) => { const proxyService = (params: any, customConfigs?: CustomConfigs) => {
const account = useAccountStore();
const service = axios.create({ const service = axios.create({
baseURL: params.apiType === 'devApi' ? baseDevURL : baseURL, baseURL: params.apiType === 'devApi' ? baseDevURL : baseURL,
timeout: 15000, timeout: 15000,
headers: {
'DP_TOKEN': account.accountInfo.access_token,
'DP_REFRESH_TOKEN': account.accountInfo.refresh_token,
},
withCredentials: true withCredentials: true
}); });
/** user api相关请求白名单 */ /** user api相关请求白名单 */

View File

@@ -38,10 +38,10 @@ export default (config: any) => {
}, },
proxy: { proxy: {
// 配置跨域代理 // 配置跨域代理
'/official': { '/gateway': {
target: 'http://222.20.126.217:9527', // 目标服务器地址 target: 'http://223.76.236.155:20011', // 目标服务器地址
changeOrigin: true, // 允许跨域 changeOrigin: true, // 允许跨域
rewrite: (path) => path.replace(/^\/official/, '/official'), // 重写路径 rewrite: (path) => path.replace(/^\/gateway/, '/gateway'), // 重写路径
} }
} }
}, },