搜索结果列表页面开发

This commit is contained in:
付民康
2025-03-12 18:41:20 +08:00
commit 7cebe8fc00
739 changed files with 88149 additions and 0 deletions

57
src/api/branch/index.ts Normal file
View File

@@ -0,0 +1,57 @@
import request from '@/utils/request';
import * as types from '@/api/branch/types';
import { reqCatch } from '@/utils/catch';
// 获取分支概览
export function getBranchesOverview(params: types.commonBranchReqType): Promise<types.commonBranchResType> {
return reqCatch(() => request({
url: `/api/v2/internal/projects/${params.repoId}/repository/branch_overview`,
method: 'get',
params: params
}), params);
}
// 获取分支列表
export function getBranches(params: types.commonBranchReqType): Promise<types.commonBranchResType> {
if (!params.view) {
params.view = 'simple';
}
return reqCatch(() => request({
url: `/api/v2/projects/${params.repoId}/repository/branches`,
method: 'get',
params: {
...params,
search: params?.search?.substring(0, 100) || ''
}
}), params);
}
// 创建分支
export function createBranches(data: types.commonBranchReqType): Promise<types.commonBranchResType> {
return reqCatch(() => request({
url: `/api/v2/projects/${data.repoId}/repository/branches`,
method: 'post',
data
}), data);
}
// 删除分支
export function deleteBranches(data: types.commonBranchReqType): Promise<types.commonBranchResType> {
return reqCatch(() => request({
url: `/api/v2/projects/${data.repoId}/repository/branches`,
method: 'delete',
params: data
}), data);
}
// 检测是否为分支
export function checkBranches(params: types.commonBranchReqType): Promise<types.commonBranchResType> {
const { project_id } = params;
delete params.project_id;
return reqCatch(() => request({
url: `/api/v2/projects/${project_id}/repository/branches/check`,
method: 'get',
params
}), params);
}

18
src/api/branch/types.ts Normal file
View File

@@ -0,0 +1,18 @@
import { type errorType, type resCatch } from '@/api/types/common';
import type { repoType } from '@/api/types/common';
export interface createBranchReqType extends repoType{
branch: string,
ref: string,
description?: string;
relatedIds?: string[];
[propName: string]: any;
}
export interface commonBranchReqType {
[propName: string]: any;
}
export interface commonBranchResType extends resCatch {
[propName: string]: any;
}