Selaa lähdekoodia

URLLIST调整

guicheng 7 kuukautta sitten
vanhempi
commit
bc72a37b6e

+ 181 - 141
src/api/system.ts

@@ -2,218 +2,258 @@
  * @Author: Gui
  * @Date: 2023-03-01 19:20:44
  * @LastEditors: guicheng 1625811865@qq.com
- * @LastEditTime: 2024-04-12 17:40:28
+ * @LastEditTime: 2024-04-18 17:59:27
  * @Description: kxs files
  * @filePath:
  */
 import { http } from "@/utils/http";
 import { dataResult } from "./apiResult";
+import { getGroupUrl } from "@/utils/getUrl/getUrl.js";
+const UrlList = await getGroupUrl();
 
 // <*------用户板块--------*>
 /** 获取用户管理列表 */
-export const getUserList = (data?: object): dataResult => {
-  return http.get(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/user/page",
-    data
-  );
+export const getUserList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.userpage.url,
+    method: UrlList.SkbSystem.userpage.method,
+    params
+  });
 };
 /** 修改用户密码 */
-export const changeUserPassword = (data?: object): dataResult => {
-  return http.put(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/user/password",
-    data
-  );
+export const changeUserPassword = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.userpassword.url,
+    method: UrlList.SkbSystem.userpassword.method,
+    params
+  });
 };
 /** 锁定用户 */
-export const lockUserList = (data?: object): dataResult => {
-  return http.put(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/user/lock",
-    data
-  );
+export const lockUserList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.userlock.url,
+    method: UrlList.SkbSystem.userlock.method,
+    params
+  });
 };
 /** 删除用户 */
-export const deleteUserList = (data?: object): dataResult => {
-  return http.delete(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/user/removeById",
-    data
-  );
+export const deleteUserList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.userremoveById.url,
+    method: UrlList.SkbSystem.userremoveById.method,
+    params
+  });
 };
 /** 新增用户 */
-export const AddUserList = (data?: object): dataResult => {
-  return http.post(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/user/add",
-    data
-  );
+export const AddUserList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.useradd.url,
+    method: UrlList.SkbSystem.useradd.method,
+    params
+  });
 };
 /** 编辑用户 */
-export const editUserList = (data?: object): dataResult => {
-  return http.put(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/user/update",
-    data
-  );
+export const editUserList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.userupdate.url,
+    method: UrlList.SkbSystem.userupdate.method,
+    params
+  });
 };
 
 // <*------角色板块--------*>
 
 /** 获取全部角色管理列表 */
-export const getAllRoleList = (data?: object): dataResult => {
-  return http.get(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/role/list",
-    data
-  );
+export const getAllRoleList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.rolelist.url,
+    method: UrlList.SkbSystem.rolelist.method,
+    params
+  });
 };
 /** 获取角色管理列表 */
-export const getRoleList = (data?: object): dataResult => {
-  return http.get(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/role/page",
-    data
-  );
+export const getRoleList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.rolepage.url,
+    method: UrlList.SkbSystem.rolepage.method,
+    params
+  });
 };
 /** 获取当前角色权限列表 */
-export const getRoleRightList = (data?: object): dataResult => {
-  return http.get(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/menu/getRoleTree",
-    data
-  );
+export const getRoleRightList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.menugetRoleTree.url,
+    method: UrlList.SkbSystem.menugetRoleTree.method,
+    params
+  });
 };
 /** 添加系统角色 */
-export const postRoleList = (data?: object): dataResult => {
-  return http.post(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/role/add",
-    data
-  );
+export const postRoleList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.roleadd.url,
+    method: UrlList.SkbSystem.roleadd.method,
+    params
+  });
 };
 /** 编辑系统角色 */
-export const putRoleList = (data?: object): dataResult => {
-  return http.put(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/role/update",
-    data
-  );
+export const putRoleList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.roleupdate.url,
+    method: UrlList.SkbSystem.roleupdate.method,
+    params
+  });
 };
 /** 删除系统角色 */
-export const deleteRoleList = (data?: object): dataResult => {
-  return http.delete(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/role/removeById",
-    data
-  );
+export const deleteRoleList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.roleremoveById.url,
+    method: UrlList.SkbSystem.roleremoveById.method,
+    params
+  });
 };
 /** 获取所有角色权限列表 */
-export const getRoleTreeList = (data?: object): dataResult => {
-  return http.get(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/menu/getRoleTree",
-    data
-  );
+export const getRoleTreeList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.menugetRoleTree.url,
+    method: UrlList.SkbSystem.menugetRoleTree.method,
+    params
+  });
 };
 
 // <*------菜单板块--------*>
 
 /** 获取菜单列表 */
-export const getMenuList = (data?: object): dataResult => {
-  return http.get(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/menu/tree",
-    data
-  );
+export const getMenuList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.menutree.url,
+    method: UrlList.SkbSystem.menutree.method,
+    params
+  });
 };
 /** 获取菜单列表 */
-export const putRoleMenuList = (data?: object): dataResult => {
-  return http.put(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/role/menu",
-    data
-  );
+export const putRoleMenuList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.rolemenu.url,
+    method: UrlList.SkbSystem.rolemenu.method,
+    params
+  });
 };
 /** 添加菜单 */
-export const postMenuList = (data?: object): dataResult => {
-  return http.post(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/menu/add",
-    data
-  );
+export const postMenuList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.menuadd.url,
+    method: UrlList.SkbSystem.menuadd.method,
+    params
+  });
 };
 /** 编辑菜单 */
-export const putMenuList = (data?: object): dataResult => {
-  return http.put(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/menu/update",
-    data
-  );
+export const putMenuList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.menuupdate.url,
+    method: UrlList.SkbSystem.menuupdate.method,
+    params
+  });
 };
 /** 删除菜单 */
-export const deleteMenuList = (data?: object): dataResult => {
-  return http.delete(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/menu/removeById",
-    data
-  );
+export const deleteMenuList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.menuremoveById.url,
+    method: UrlList.SkbSystem.menuremoveById.method,
+    params
+  });
 };
 
 // <*------部门板块--------*>
 
 /** 获取全部部门列表 */
-export const getAllDeptList = (data?: object): dataResult => {
-  return http.get(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/dept/list",
-    data
-  );
+export const getAllDeptList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.deptlist.url,
+    method: UrlList.SkbSystem.deptlist.method,
+    params
+  });
 };
 /** 获取部门列表 */
-export const getDeptList = (data?: object): dataResult => {
-  return http.get(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/dept/tree",
-    data
-  );
+export const getDeptList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.depttree.url,
+    method: UrlList.SkbSystem.depttree.method,
+    params
+  });
 };
 /** 删除部门列表 */
-export const deleteDeptList = (data?: object): dataResult => {
-  return http.delete(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/dept/removeById",
-    data
-  );
+export const deleteDeptList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.deptremoveById.url,
+    method: UrlList.SkbSystem.deptremoveById.method,
+    params
+  });
 };
 /** 编辑部门 */
-export const putDeptList = (data?: object): dataResult => {
-  return http.put(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/dept/update",
-    data
-  );
+export const putDeptList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.deptupdate.url,
+    method: UrlList.SkbSystem.deptupdate.method,
+    params
+  });
 };
 /** 添加部门 */
-export const postDeptList = (data?: object): dataResult => {
-  return http.post(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/dept/add",
-    data
-  );
+export const postDeptList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.deptadd.url,
+    method: UrlList.SkbSystem.deptadd.method,
+    params
+  });
 };
 // <*------岗位板块--------*>
 
 /** 获取全部列表 */
-export const getAllPostList = (data?: object): dataResult => {
-  return http.get(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/post/list",
-    data
-  );
+export const getAllPostList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.postlist.url,
+    method: UrlList.SkbSystem.postlist.method,
+    params
+  });
 };
 /** 获取分页岗位列表 */
-export const getPostList = (data?: object): dataResult => {
-  return http.get(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/post/page",
-    data
-  );
+export const getPostList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.postpage.url,
+    method: UrlList.SkbSystem.postpage.method,
+    params
+  });
 };
 /** 删除岗位列表 */
-export const deletePostList = (data?: object): dataResult => {
-  return http.delete(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/post/removeById",
-    data
-  );
+export const deletePostList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.postremoveById.url,
+    method: UrlList.SkbSystem.postremoveById.method,
+    params
+  });
 };
 /** 编辑岗位 */
-export const putPostList = (data?: object): dataResult => {
-  return http.put(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/post/update",
-    data
-  );
+export const putPostList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.postupdate.url,
+    method: UrlList.SkbSystem.postupdate.method,
+    params
+  });
 };
 /** 添加岗位 */
-export const postPostList = (data?: object): dataResult => {
-  return http.post(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/post/add",
-    data
-  );
+export const postPostList = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.postadd.url,
+    method: UrlList.SkbSystem.postadd.method,
+    params
+  });
+};
+// <*------公共参数--------*>
+
+/** 修改公共参数 */
+export const paramUpdate = (params?: object): dataResult => {
+  return http.Request({
+    url: UrlList.SkbSystem.paramupdate.url,
+    method: UrlList.SkbSystem.paramupdate.method,
+    params
+  });
 };

+ 8 - 6
src/api/user.ts

@@ -2,13 +2,15 @@
  * @Author: Gui
  * @Date: 2023-03-01 19:20:44
  * @LastEditors: guicheng 1625811865@qq.com
- * @LastEditTime: 2024-04-12 14:45:18
+ * @LastEditTime: 2024-04-16 16:41:07
  * @Description: kxs files
  * @filePath:
  */
 import { http } from "@/utils/http";
 import { baseUrlApi } from "./utils";
 import encryptByDES from "@/utils/encryptByDES";
+import { getGroupUrl } from "@/utils/getUrl/getUrl.js";
+const UrlList = await getGroupUrl();
 
 export type UserResult = {
   status: String;
@@ -44,7 +46,6 @@ export type RefreshTokenResult = {
     expires: Date;
   };
 };
-
 /** 登录 */
 export const getLogin = (data?: object) => {
   console.log(data);
@@ -55,10 +56,11 @@ export const getLogin = (data?: object) => {
 };
 /** 获取当前用户树形菜单 */
 export const getUserMenu = () => {
-  return http.get(
-    "http://test.apigateway.shuangkebang.com/v1/skb/sysServer/menu",
-    {}
-  );
+  return http.Request({
+    url: UrlList.SkbSystem.menugetUserMenu.url,
+    method: UrlList.SkbSystem.menugetUserMenu.method,
+    params: {}
+  });
 };
 
 /** 刷新token */

+ 2 - 2
src/store/modules/user.ts

@@ -98,8 +98,8 @@ export const useUserStore = defineStore({
                 if (res.status === 1) {
                   console.log(1);
                   setUserinfo({
-                    SysAdminId: token.user_info.user_id,
-                    username: token.user_info.username,
+                    SysAdminId: token.user_id,
+                    username: token.username,
                     // 一个用户可能有多个角色
                     roles: 1,
                     routeList: formateRouter(res.data)

+ 2 - 2
src/utils/getUrl/getUrl.js

@@ -64,7 +64,7 @@ const getURL = () => {
 const getAllPlate = () => {
   return new Promise(async (resolve, reject) => {
     postRequest(
-      "http://test.config.kexiaoshuang.com/api/apiinfo/groupsforadmin",
+      "http://test.skbconfig.kexiaoshuang.com/api/apiinfo/groupsforadmin",
       {
         key: "kxs#2024"
       }
@@ -99,7 +99,7 @@ const getGroupUrl = async (checkPlate = []) => {
       );
     }, 5000);
     postRequest(
-      "http://test.config.kexiaoshuang.com/api/apiinfo/listforadmin",
+      "http://test.skbconfig.kexiaoshuang.com/api/apiinfo/listforadmin",
       parameters
     )
       .then(async res => {

+ 33 - 3
src/utils/http/index.ts

@@ -2,7 +2,7 @@
  * @Author: Gui
  * @Date: 2023-03-01 19:20:44
  * @LastEditors: guicheng 1625811865@qq.com
- * @LastEditTime: 2024-04-12 15:23:17
+ * @LastEditTime: 2024-04-16 16:39:24
  * @Description: kxs files
  * @filePath:
  */
@@ -208,6 +208,13 @@ class PureHttp {
     } as PureHttpRequestConfig;
     // 单独处理自定义请求/响应回掉
     return new Promise((resolve, reject) => {
+      console.log(
+        "[ 请求地址 ] >",
+        url +
+        "?scope=server&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer"
+      );
+      console.log("[ 加密前 ] >", param);
+      console.log("[ 加密后 ] >", encryptByDES(JSON.stringify(param)));
       PureHttp.axiosInstance
         .request(config)
         .then((response: undefined) => {
@@ -279,11 +286,11 @@ class PureHttp {
     }
   }
   /** 单独抽离的post工具函数 */
-  public Richpost<T, P>(
+  public Richpost<T>(
     url: string,
     params?: AxiosRequestConfig<T>,
     config?: PureHttpRequestConfig
-  ): Promise<P> {
+  ): any {
     const param = { data: encryptByDES(JSON.stringify(params)) };
     return this.request("post", url, param, config);
   }
@@ -307,8 +314,11 @@ class PureHttp {
       }
     }
     if (legal) {
+      console.log("[ 请求地址 ] >", url);
+      console.log("[ 加密前 ] >", params);
       const paramter = { value: encryptByDES(JSON.stringify(params)) };
       const param = { params: paramter };
+      console.log("[ 加密后 ] >", paramter);
       return this.request("get", url, param, config);
     } else {
       ElMessage({
@@ -361,6 +371,26 @@ class PureHttp {
       config
     );
   }
+  public Request(param: any): dataResult {
+    const method = param.method.toUpperCase();
+    switch (method) {
+      case "GET":
+        return this.get(param.url, param.params, param.config);
+        break;
+      case "POST":
+        return this.post(param.url, param.params, param.config);
+        break;
+      case "DELETE":
+        return this.delete(param.url, param.params, param.config);
+        break;
+      case "PUT":
+        return this.put(param.url, param.params, param.config);
+        break;
+      case "RICHPOST":
+        return this.Richpost(param.url, param.params, param.config);
+        break;
+    }
+  }
 }
 
 export const http = new PureHttp();

+ 1 - 1
src/views/admin/dept/index.vue

@@ -128,7 +128,7 @@ defineExpose({
             :icon="useRenderIcon(Delete)"
           ) 删除
 
-  el-dialog(v-model='dialogUpdateVisible' width="40%" :close-on-click-modal="false" :title="dialogType == 1 ?'添加部门' : '修改部门'" :close-on-click-modal="false")
+  el-dialog(v-model='dialogUpdateVisible' width="40%" :close-on-click-modal="false" :title="dialogType == 1 ?'添加部门' : '修改部门'" )
     el-form(:model='UpdateForm' 
       label-position="left"
       label-width="100px")

+ 1 - 1
src/views/admin/menu/index.vue

@@ -99,7 +99,7 @@ defineExpose({
             :icon="useRenderIcon(Delete)"
           ) 删除
 
-  el-dialog(v-model='dialogUpdateVisible' width="40%" :close-on-click-modal="false" :title="dialogType == 1 ?'添加菜单' : '修改菜单'" :close-on-click-modal="false")
+  el-dialog(v-model='dialogUpdateVisible' width="40%" :close-on-click-modal="false" :title="dialogType == 1 ?'添加菜单' : '修改菜单'" )
     el-form(:model='UpdateForm' 
       label-position="left"
       label-width="100px")

+ 1 - 1
src/views/admin/post/index.vue

@@ -126,7 +126,7 @@ defineExpose({
             :icon="useRenderIcon(Delete)"
           ) 删除
 
-  el-dialog(v-model='dialogUpdateVisible' width="40%" :close-on-click-modal="false" :title="dialogType == 1 ?'添加岗位' : '修改岗位'" :close-on-click-modal="false")
+  el-dialog(v-model='dialogUpdateVisible' width="40%" :close-on-click-modal="false" :title="dialogType == 1 ?'添加岗位' : '修改岗位'" )
     el-form(:model='UpdateForm' 
       label-position="left"
       label-width="100px")