Procházet zdrojové kódy

增加接口转发空间

sujunling před 2 roky
rodič
revize
f0c5e502cd

+ 3 - 2
.env.development

@@ -11,8 +11,8 @@ VITE_GLOB_PUBLIC_PATH = /
 # VITE_PROXY = [["/api","http://192.168.2.225/api"]]
 
 # 线上演示环境
-# VITE_PROXY = [["/api","http://117.174.10.73:19200"],["/agent","http://117.174.10.73:31895"],["/iserver","http://221.182.8.141:15000/iserver"],["/onlineIde","http://106.12.170.138:4001/examples"],["/tfDemo","http://106.12.170.138:4001/demo"]]
-VITE_PROXY = [["/api","http://192.168.119.143:9200"],["/agent","http://192.168.119.143:31895"],["/iserver","http://221.182.8.141:15000/iserver"],["/onlineIde","http://106.12.170.138:4001/examples"],["/tfDemo","http://106.12.170.138:4001/demo"]]                                                            
+VITE_PROXY = [["/api","http://117.174.10.73:19200"],["/agent","http://117.174.10.73:31895"],["/twoAndThree","http://192.168.2.208:10090"],["/iserver","http://221.182.8.141:15000/iserver"],["/onlineIde","http://106.12.170.138:4001/examples"],["/tfDemo","http://106.12.170.138:4001/demo"]]
+# VITE_PROXY = [["/api","http://192.168.119.143:9200"],["/agent","http://192.168.119.143:31895"],["/iserver","http://221.182.8.141:15000/iserver"],["/onlineIde","http://106.12.170.138:4001/examples"],["/tfDemo","http://106.12.170.138:4001/demo"]]                                                            
 # 线上测试环境
 # VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-drawio","http://localhost:3000/"]]
 # VITE_PROXY = [["/api","http://222.180.200.114:48080/api"],["/thingskit-drawio","http://localhost:3000/"],["/large-designer", "http://localhost:5555/large-designer/"]]
@@ -31,6 +31,7 @@ VITE_GLOB_DROP_CONSOLE = true
 # Basic interface address SPA
 VITE_GLOB_API_URL=/api
 VITE_GLOB_API_URL2=/agent
+VITE_GLOB_API_URL3=/twoAndThree
 
 # File upload address, optional
 VITE_GLOB_UPLOAD_URL=/api/yt/oss/upload

+ 2 - 0
.env.production

@@ -30,6 +30,8 @@ VITE_GLOB_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
 
 VITE_GLOB_API_URL=http://192.168.119.143:9200
 VITE_GLOB_API_URL2=http://192.168.119.143:31895
+VITE_GLOB_API_URL3=/twoAndThree
+
 
 # File upload address, optional
 # It can be forwarded by nginx or write the actual address directly

+ 8 - 0
build/vite/proxy.ts

@@ -28,6 +28,14 @@ export function createProxy(list: ProxyList = []) {
       rewrite: (path) => path.replace(new RegExp(`^${prefix}`), ''),
       // https is require secure=false
       ...(isHttps ? { secure: false } : {}),
+      // configure: (proxy, options) => {
+      //   proxy.on('proxyReq', (proxyReq, req, res) => {
+      //     console.log(`[Proxy] ${req.method} ${req.url}`);
+      //   });
+      //   proxy.on('proxyRes', (proxyRes, req, res) => {
+      //     console.log(`[Proxy] ${res.statusCode} ${req.method} ${req.url}`);
+      //   });
+      // }
     };
   }
   return ret;

+ 39 - 0
src/api/twoAndThree/menu.ts

@@ -0,0 +1,39 @@
+import { defHttp } from '/@/utils/http/axios';
+import {
+  LoginParams,
+  LoginResultModel,
+  GetUserInfoModel,
+  UserInfoModel,
+  RefreshTokenParams,
+  SmsLoginParams,
+} from './model/userModel';
+import { session } from "/@/utils/Memory.js";
+import md5 from 'js-md5';
+import type { ErrorMessageMode } from '/#/axios';
+import permissions from "/@/mock/role_me_permissions.json";
+import tool from "/@/utils/Tool.js";
+import { getJwtToken } from '/@/utils/auth';
+import moment from 'moment';
+
+enum Api {
+  GetMenuList = '/xld-2And3/findAllMenu',
+}
+
+
+
+const interfaceType = { apiUrl3: true };
+/**
+ * @description: 获取二三维菜单列表
+ */
+
+export const getMenuList2 = (args?: number) => {
+  let url = Api.GetMenuList;
+  try {
+    return defHttp.post({
+      url,
+      ...interfaceType,
+    });
+  } catch (e) {
+
+  }
+};

+ 2 - 0
src/hooks/setting/index.ts

@@ -8,6 +8,7 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
     VITE_GLOB_APP_TITLE,
     VITE_GLOB_API_URL,
     VITE_GLOB_API_URL2,
+    VITE_GLOB_API_URL3,
     VITE_GLOB_APP_SHORT_NAME,
     VITE_GLOB_API_URL_PREFIX,
     VITE_GLOB_UPLOAD_URL,
@@ -31,6 +32,7 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
     title: VITE_GLOB_APP_TITLE,
     apiUrl: VITE_GLOB_API_URL,
     apiUrl2: VITE_GLOB_API_URL2,
+    apiUrl3: VITE_GLOB_API_URL3,
     shortName: VITE_GLOB_APP_SHORT_NAME,
     urlPrefix: VITE_GLOB_API_URL_PREFIX,
     twoThree: VITE_GLOB_LIGONG_ADMIN,

+ 2 - 0
src/utils/env.ts

@@ -25,6 +25,7 @@ export function getAppEnvConfig() {
     VITE_GLOB_APP_TITLE,
     VITE_GLOB_API_URL,
     VITE_GLOB_API_URL2,
+    VITE_GLOB_API_URL3,
     VITE_GLOB_APP_SHORT_NAME,
     VITE_GLOB_API_URL_PREFIX,
     VITE_GLOB_UPLOAD_URL,
@@ -47,6 +48,7 @@ export function getAppEnvConfig() {
     VITE_GLOB_APP_TITLE,
     VITE_GLOB_API_URL,
     VITE_GLOB_API_URL2,
+    VITE_GLOB_API_URL3,
     VITE_GLOB_APP_SHORT_NAME,
     VITE_GLOB_API_URL_PREFIX,
     VITE_GLOB_UPLOAD_URL,

+ 5 - 2
src/utils/http/axios/index.ts

@@ -40,7 +40,7 @@ const transform: AxiosTransform = {
 
   // 请求之前处理config
   beforeRequestHook: (config, options) => {
-    const { apiUrl, apiUrl2, joinPrefix, joinParamsToUrl, formatDate, joinTime = true } = options;
+    const { apiUrl, apiUrl2, apiUrl3, joinPrefix, joinParamsToUrl, formatDate, joinTime = true } = options;
     if (joinPrefix) {
       config.url = `${urlPrefix}${config.url}`;
     }
@@ -48,6 +48,8 @@ const transform: AxiosTransform = {
     if (apiUrl && isString(apiUrl)) {
       if (config.apiUrl2) {
         config.url = `${apiUrl2}${config.url}`;
+      } else if (config.apiUrl3) {
+        config.url = `${apiUrl3}${config.url}`;
       } else {
         config.url = `${apiUrl}${config.url}`;
       }
@@ -97,7 +99,7 @@ const transform: AxiosTransform = {
   requestInterceptors: (config, options) => {
     // 请求之前处理config
     const token = getJwtToken();
-    if (token && (config as Recordable)?.requestOptions?.withToken !== false &&config.url != '/agent/callProvider') {
+    if (token && (config as Recordable)?.requestOptions?.withToken !== false && config.url != '/agent/callProvider') {
       // jwt token
       // config.headers['X-Authorization'] = options.authenticationScheme ? `${options.authenticationScheme} ${token}` : token;
       config.headers['Authorization'] = options.authenticationScheme ? `${options.authenticationScheme} ${token}` : token;
@@ -193,6 +195,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
           // 接口地址
           apiUrl: globSetting.apiUrl,
           apiUrl2: globSetting.apiUrl2,
+          apiUrl3: globSetting.apiUrl3,
           //  是否加入时间戳
           joinTime: true,
           // 忽略重复请求

+ 1 - 0
types/axios.d.ts

@@ -15,6 +15,7 @@ export interface RequestOptions {
   // Interface address, use the default apiUrl if you leave it blank
   apiUrl?: string;
   apiUrl2?: string;
+  apiUrl3?: string;
   // Error message prompt type
   errorMessageMode?: ErrorMessageMode;
   // Whether to add a timestamp

+ 2 - 0
types/config.d.ts

@@ -142,6 +142,7 @@ export interface GlobConfig {
   apiUrl: string;
 
   apiUrl2: string;
+  apiUrl3: string;
   // Upload url
   uploadUrl?: string;
   //  Service interface url prefix
@@ -167,6 +168,7 @@ export interface GlobEnvConfig {
   // Service interface url
   VITE_GLOB_API_URL: string;
   VITE_GLOB_API_URL2: string;
+  VITE_GLOB_API_URL3: string;
   // Service interface url prefix
   VITE_GLOB_API_URL_PREFIX?: string;
   // Project abbreviation