Refactor code structure and remove redundant changes
This commit is contained in:
118
api/drawe-detail/index.ts
Normal file
118
api/drawe-detail/index.ts
Normal file
@ -0,0 +1,118 @@
|
||||
import { get, post, Delete } from '@/utils/axios'
|
||||
import { ProjectRespVO, PageResultProjectCommentResVO, ProjectDrawPageRespVO, UserExtendSimpleRespDTO, ProjectDrawMemberRespVO } from './types'
|
||||
|
||||
/**
|
||||
* 获取图纸详情
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const getDetail = (params: { id?: number | string }) => {
|
||||
return get<IResponse<ProjectRespVO>>({
|
||||
url: '/prod-api/app-api/business/app/project-draw/preview',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评论列表
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const getCommentList = (params: { relationId?: number | string; pageNum?: number; pageSize?: number }) => {
|
||||
return get<IResponse<PageResultProjectCommentResVO>>({
|
||||
url: '/prod-api/app-api/business/app/project-comment/page',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 发表评论
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const createComment = (params: { relationId?: number | string; content?: string; projectId?: number | string }) => {
|
||||
return post<IResponse<boolean>>({
|
||||
url: '/prod-api/app-api/business/app/project-comment/create',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前类型top数据
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const getRelationRecommend = (params: { type?: number | string; projectType?: number | string }) => {
|
||||
return get<IResponse<ProjectDrawPageRespVO[]>>({
|
||||
url: '/prod-api/app-api/business/app/project-draw/top-list',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 举报
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const report = (params: { id?: number | string; title?: string; comments?: string; files?: any; projectId: any; drawId: any }) => {
|
||||
return post<IResponse<boolean>>({
|
||||
url: '/prod-api/app-api/business/project-report/create',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图纸发布人信息
|
||||
* @return {Promise}
|
||||
*/
|
||||
export const getUserInfo = (params: { id?: number | string }) => {
|
||||
return get<IResponse<UserExtendSimpleRespDTO>>({
|
||||
url: '/prod-api/app-api/business/app/project-draw/preview-user-info',
|
||||
params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前用户的主要作品内容
|
||||
*/
|
||||
export const getMainWork = (params: { id?: number | string; limit: number; memberId?: number | string }) => {
|
||||
return get<IResponse<ProjectDrawMemberRespVO[]>>({
|
||||
url: '/prod-api/app-api/business/app/project-draw/preview-user-projects',
|
||||
params,
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 创建内容信息
|
||||
*/
|
||||
export const createContent = (params: { projectId: any; drawId: any }) => {
|
||||
return post<IResponse<boolean>>({
|
||||
url: '/prod-api/app-api/business/project-member-favorites/create',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建用户项目、工具箱下载
|
||||
*/
|
||||
export const createUserProject = (params: { relationId: any; type: any }) => {
|
||||
return post<IResponse<string>>({
|
||||
url: '/prod-api/app-api/business/project-member-file/create',
|
||||
data: params,
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 删除项目订单用户收藏信息
|
||||
*/
|
||||
export const deleteProject = (params: { id: any }) => {
|
||||
return Delete<IResponse<boolean>>({
|
||||
url: '/prod-api/app-api/business/project-member-favorites/delete',
|
||||
data: params,
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工具箱信息
|
||||
*/
|
||||
export const deleteTool = (params: { id: any }) => {
|
||||
return Delete<IResponse<boolean>>({
|
||||
url: '/prod-api/app-api/business/project-resource/delete',
|
||||
data: params,
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
})
|
||||
}
|
||||
149
api/drawe-detail/types.ts
Normal file
149
api/drawe-detail/types.ts
Normal file
@ -0,0 +1,149 @@
|
||||
export interface ProjectRespVO {
|
||||
id: number
|
||||
title: string
|
||||
description: string
|
||||
ownedUserId: string
|
||||
status: number
|
||||
createTime: string
|
||||
isDomestic: number
|
||||
ownedUserIdInfo?: any
|
||||
area: string
|
||||
country: string
|
||||
province: string
|
||||
city: string
|
||||
county: string
|
||||
address: string
|
||||
editions: string
|
||||
labels: string[]
|
||||
type: number
|
||||
projectId: number
|
||||
projectType: string[]
|
||||
formatType: string[]
|
||||
source: number
|
||||
editType: boolean
|
||||
points: number
|
||||
downloadId: string
|
||||
files: OtherFiles[]
|
||||
coverImages: CoverImages[]
|
||||
renderings: Renderings[]
|
||||
otherFiles: OtherFiles[]
|
||||
checked: boolean
|
||||
recommend: boolean
|
||||
hotPoint: number
|
||||
editTypeName: string
|
||||
editionsName: string
|
||||
projectTypeName: string
|
||||
favoriteId?: string
|
||||
relationDraws: RelationDraws[]
|
||||
filesInfo: {
|
||||
fileSize: string
|
||||
count: number
|
||||
}
|
||||
}
|
||||
|
||||
interface RelationDraws {
|
||||
id: number
|
||||
projectId: number
|
||||
title: string
|
||||
description: string
|
||||
ownedUserId: string
|
||||
type: number
|
||||
points: number
|
||||
coverImages: CoverImages[]
|
||||
ownedUserIdInfo?: any
|
||||
recommend: boolean
|
||||
hotPoint: number
|
||||
commentsPoint: number
|
||||
previewPoint: number
|
||||
}
|
||||
|
||||
interface Renderings {
|
||||
id: number
|
||||
title: string
|
||||
relationId: number
|
||||
type: number
|
||||
url: string
|
||||
}
|
||||
|
||||
interface CoverImages {
|
||||
id: number
|
||||
title: string
|
||||
relationId: number
|
||||
type: number
|
||||
url: string
|
||||
}
|
||||
interface OtherFiles {
|
||||
id: number
|
||||
title: string
|
||||
relationId: number
|
||||
type: number
|
||||
url: string
|
||||
size: number
|
||||
}
|
||||
|
||||
export interface PageResultProjectCommentResVO {
|
||||
list: ProjectCommentResVO[]
|
||||
total: number
|
||||
}
|
||||
|
||||
interface ProjectCommentResVO {
|
||||
id: number
|
||||
projectId: number
|
||||
relationId: number
|
||||
content: string
|
||||
url: string
|
||||
creator: number
|
||||
creatorInfo: {
|
||||
avatar: string
|
||||
name: string
|
||||
nickName: string
|
||||
createTime: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface ProjectDrawPageRespVO {
|
||||
id: number
|
||||
projectId: number
|
||||
title: string
|
||||
description: string
|
||||
ownedUserId: string
|
||||
editions?: string[]
|
||||
type: number
|
||||
createTime: string
|
||||
projectType: string[]
|
||||
status: number
|
||||
recommend: boolean
|
||||
points: number
|
||||
iconUrl: string
|
||||
hotPoint: number
|
||||
commentsPoint: number
|
||||
previewPoint: number
|
||||
}
|
||||
|
||||
export interface UserExtendSimpleRespDTO {
|
||||
id: number
|
||||
avatar: string
|
||||
memberId: number
|
||||
nickname: string
|
||||
isDomestic: number
|
||||
area: string
|
||||
country: string
|
||||
province: string
|
||||
city: string
|
||||
county: string
|
||||
labels: string[]
|
||||
description: string
|
||||
files: any[]
|
||||
fansCount: number
|
||||
projectCount: number
|
||||
}
|
||||
|
||||
export interface ProjectDrawMemberRespVO {
|
||||
id: number
|
||||
projectId: number
|
||||
title: string
|
||||
description: string
|
||||
ownedUserId: string
|
||||
type: number
|
||||
createTime: string
|
||||
}
|
||||
Reference in New Issue
Block a user