Refactor code structure and remove redundant changes

This commit is contained in:
wangqiao
2025-08-15 16:45:15 +08:00
commit 99df1d1f81
220 changed files with 33086 additions and 0 deletions

88
api/upnew/index.ts Normal file
View File

@ -0,0 +1,88 @@
import { post, get } from '@/utils/axios'
import { TcreateReq, pageReq, pageRes, recommendTopReq, recommendTopRes, parentRes, ProjectDictNodeVO } from './types'
/**
* 新建图纸
* @param params
* @returns
*/
export const create = (params: TcreateReq) => {
return post<IResponse<boolean>>({
url: '/prod-api/app-api/business/app/project/create',
data: params,
})
}
/**
* 获取具有上下级的字典信息
* @param params
* @returns
*/
export const parent = (params: { type: string | number; parentId: number }) => {
return get<IResponse<parentRes[]>>({
url: '/prod-api/app-api/business/app/dict/parent',
params,
})
}
/**
* 获取具有上下级的字典信息
* @param params
* @returns
*/
export const indexTabs = () => {
return get<IResponse<parentRes[]>>({
url: '/prod-api/app-api/business/project/index/index-tab3',
})
}
/**
* 模糊查询获取标签内容
* @param params
* @returns
*/
export const keywords = (params: { type: string | number; keywords: string }) => {
return get<IResponse<boolean>>({
url: '/prod-api/app-api/business/app/dict/label-keywords',
params,
})
}
/**
* 获取格式类型字典信息
* @param params
* @returns
*/
export const labels = (params: { type: string | number }) => {
return get<IResponse<boolean>>({
url: '/prod-api/app-api/business/app/dict/labels',
params,
})
}
/**
* 获得项目表内容信息分页
* @param params
* @returns
*/
export const page = (params: pageReq) => {
return get<IResponse<pageRes>>({
url: '/prod-api/app-api/business/app/project-draw/page',
params,
})
}
/**
* 获得项目表内容信息分页
* @param params
* @returns
*/
export const recommendTop = (params: recommendTopReq) => {
return get<IResponse<recommendTopRes[]>>({
url: '/prod-api/app-api/business/app/project-draw/recommend-top',
params,
})
}
/**
* 首页-标签
*/
export const homeLabel = () => {
return get<IResponse<ProjectDictNodeVO[]>>({
url: '/prod-api/app-api/business/app/dict/index-tab',
})
}

160
api/upnew/types.ts Normal file
View File

@ -0,0 +1,160 @@
// 定义 files 数组中每个元素的类型
export interface FileItem {
id: number
title: string
drawId: number
type: number
url: string
sort: number
}
// 定义整个 JSON 对象的类型
export interface TcreateReq {
activeName: string
id: number | string
type: any[]
isDomestic: number | string
province: string // 省份编码
city: string // 城市编码
county: string // 区县编码
draws: TcreateDrawsReq[]
}
export interface TcreateDrawsReq {
id: number | string
projectId: number | string
title: string
description: string
ownedUserId: string
editions: string
labels: any[]
type: number
source: number | string
editType: boolean | string
status: any
createAddress: string
createIp: string
files: FileItem[]
province: string // 省份编码
city: string // 城市编码
county: string // 区县编码
points: number | undefined // 金币
projectType: any[] // 项目类型
formatType: any[] // 格式类型
coverImages: any[] // 封面图片
otherFiles: any[] // 附件信息
renderings: any[] // 效果图
}
export interface pageReq {
pageNo?: number
pageSize?: number
projectId?: number | string
title?: string
ownedUserId?: string
editions?: string
labels?: any[]
type?: number // 类型: 1 图纸 2 文本 3 模型
source?: number | string
editType?: boolean | string
status?: any
createAddress?: string
createIp?: string
projectType?: string
}
export interface pageRes {
list: {
id?: number
projectId?: number
title?: string
editions?: string[]
ownedUserIdInfo?: any
type?: number
createTime?: string
projectType?: string[]
status?: number
recommend?: boolean
points?: number
iconUrl?: string
previewPoint?: number
commentsPoint?: number
hotPoint?: number
}[]
total: number
}
export interface recommendTopReq {
/** 类型: 1 图纸 2 文本 3 模型 */
type: number
/** 项目分类 */
projectType: number
/** 是否国内 0 国外 1 国内 */
isDomestic: number
}
export interface recommendTopRes {
/** 主键 */
id: number
/** 项目id */
projectId: number
/** 标题 */
title: string
/** 版本 */
editions: any[]
/** 类型: 1 图纸 2 文本 3 模型 */
type: number
/** 创建时间 */
createTime: string
/** 项目分类 */
projectType: any[]
/** 状态 */
status: number
/** 是否推荐 */
recommend: boolean
/** 金币 */
points: number
/** 封面图片 */
iconUrl: string
/** 热度 */
hotPoint: number
}
/**
* 获取具有上下级的字典信息
*/
export interface parentRes {
/** 主键 */
id: number
/** 名称 */
name: string
/** 父级id */
parentId: number
/** 类型 */
type: number
/** 是否子级 */
isChildren: boolean
}
/**
* 首页-标签
*/
export interface ProjectDictNodeVO {
id: string
parentId: string
name: string
isChildren: boolean
sort: number
children: {
id: string
parentId: string
name: string
isChildren: boolean
sort: number
children: {
id: string
parentId: string
name: string
isChildren: boolean
sort: number
}[]
}[]
}