|
@@ -16,33 +16,46 @@ const request = extend({
|
|
|
requestType: "form",
|
|
|
timeout: 10000,
|
|
|
//prefix: 'https://www.baidu.com',
|
|
|
- credentials: 'omit'
|
|
|
});
|
|
|
// 返回各应用实际的接口api地址
|
|
|
-const domainUrl = matchProductApiUrl()
|
|
|
-if (!import.meta.env.DEV) {
|
|
|
- request.extendOptions({ prefix: domainUrl})
|
|
|
-}
|
|
|
-console.log('api地址',domainUrl)
|
|
|
+// if (!import.meta.env.DEV) {
|
|
|
+// const domainUrl = matchProductApiUrl()
|
|
|
+// request.extendOptions({ prefix: domainUrl})
|
|
|
+// }
|
|
|
+
|
|
|
request.interceptors.request.use(
|
|
|
(url, options) => {
|
|
|
// console.log(9999,storeData.proxy,storeData.platformApi,options)
|
|
|
// 内容平台的前缀为cbs-app
|
|
|
const platformApi = options.isContentCenter ? '/cbs-app' : storeData.platformApi
|
|
|
const _prefix = storeData.proxy + platformApi;
|
|
|
- // 只有后台才去设置
|
|
|
- if (storeData.platformType === "WEB" && (apiRouter as any)[url]) {
|
|
|
- url = (apiRouter as any)[url];
|
|
|
+ /**
|
|
|
+ * 只有后台才去设置
|
|
|
+ * 暂时没有用到,先注释掉(2024.1.19)
|
|
|
+ */
|
|
|
+ // if (storeData.platformType === "WEB" && (apiRouter as any)[url]) {
|
|
|
+ // url = (apiRouter as any)[url];
|
|
|
+ // }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 区分开发环境和非开发环境
|
|
|
+ *
|
|
|
+ */
|
|
|
+ if (!import.meta.env.DEV) {
|
|
|
+ const domainUrl = matchProductApiUrl()
|
|
|
+ url = domainUrl + url
|
|
|
+ } else {
|
|
|
+ url = _prefix + url
|
|
|
}
|
|
|
+
|
|
|
const Authorization = getToken();
|
|
|
const authHeaders: any = {};
|
|
|
// 内容平台的接口不需要传token,需要传签名
|
|
|
if (Authorization && !options.isContentCenter) {
|
|
|
authHeaders.Authorization = Authorization;
|
|
|
}
|
|
|
- console.log(6666,_prefix + url)
|
|
|
return {
|
|
|
- url: _prefix + url,
|
|
|
+ url: url,
|
|
|
options: {
|
|
|
...options,
|
|
|
params: cleanDeep(options.params),
|