From 44480e71b27aa9d4cb8441f50c873f1b110e9691 Mon Sep 17 00:00:00 2001
From: hyb <kk_huangyangbo@163.com>
Date: Fri, 30 Jan 2026 07:20:06 +0000
Subject: [PATCH] fix: 修复部分已知问题
---
测试组/Test_platform/Interface_automation/frontend/src/restful/api.js | 59 +++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 45 insertions(+), 14 deletions(-)
diff --git "a/\346\265\213\350\257\225\347\273\204/Test_platform/Interface_automation/frontend/src/restful/api.js" "b/\346\265\213\350\257\225\347\273\204/Test_platform/Interface_automation/frontend/src/restful/api.js"
index 5ccd8e1..9e4ced7 100644
--- "a/\346\265\213\350\257\225\347\273\204/Test_platform/Interface_automation/frontend/src/restful/api.js"
+++ "b/\346\265\213\350\257\225\347\273\204/Test_platform/Interface_automation/frontend/src/restful/api.js"
@@ -10,15 +10,14 @@
axios.interceptors.request.use(
function(config) {
- if (
- !config.url.startsWith("/api/user") ||
- config.url === "/api/user/list" ||
- config.url === "/api/user/login_log"
- ) {
- // 在请求拦截中,每次请求,都会加上一个Authorization头
+ const noAuthUrls = [
+ '/api/user/login',
+ '/api/user/register',
+ '/api/user/groups'
+ ];
+
+ if (!noAuthUrls.includes(config.url)) {
config.headers.Authorization = store.token;
-
- // 取url地址的第四位作为projectId, 如果不存在,默认设置为0
let projectId = window.location.pathname.split("/")[3];
projectId = projectId ? projectId : 0;
config.headers["Project"] = projectId;
@@ -58,12 +57,6 @@
duration: 2000
});
}
- if (status === 403) {
- Message.error({
- message: error.response.data.detail,
- duration: 2000
- });
- }
} catch (e) {
Message.error({
message: "服务器连接超时, 请重试",
@@ -77,6 +70,10 @@
export const login = params => {
return axios.post("/api/user/login", params).then(res => res.data);
+};
+
+export const register = params => {
+ return axios.post("/api/user/register", params).then(res => res.data);
};
export const addProject = params => {
@@ -138,6 +135,12 @@
export const getProjectYapiInfo = pk => {
return axios
.get("/api/lunarlink/project/yapi/" + pk)
+ .then(res => res.data);
+};
+
+export const getGroupList = () => {
+ return axios
+ .get("/api/user/groups")
.then(res => res.data);
};
@@ -521,3 +524,31 @@
}).then(res => res.data);
};
+export const getUserManagementList = (params) => {
+ return axios.get("/api/user/management/", { params }).then(res => res.data);
+};
+
+export const createUser = (data) => {
+ return axios.post("/api/user/management/", data).then(res => res.data);
+};
+
+export const updateUser = (userId, data) => {
+ return axios.patch(`/api/user/management/${userId}/`, data).then(res => res.data);
+};
+
+export const deleteUser = (userId) => {
+ return axios.delete(`/api/user/management/${userId}/`).then(res => res.data);
+};
+
+export const getUserDetail = (userId) => {
+ return axios.get(`/api/user/management/${userId}/`).then(res => res.data);
+};
+
+export const getUserApprovalList = (params) => {
+ return axios.get("/api/user/approval/", { params }).then(res => res.data);
+};
+
+export const approveUser = (userId, data) => {
+ return axios.post(`/api/user/approval/${userId}/approve/`, data).then(res => res.data);
+};
+
--
Gitblit v1.9.1