优化工具箱详情页面及API接口类型
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
import * as useDollarFetchRequest from '~/composables/useDollarFetchRequest'
|
import * as useDollarFetchRequest from '~/composables/useDollarFetchRequest'
|
||||||
import * as useFetchRequest from '~/composables/useFetchRequest'
|
import * as useFetchRequest from '~/composables/useFetchRequest'
|
||||||
import type { TcreateReq, TpageReq, TpageRes } from './types'
|
import type { TcreateReq, TpageReq, TpageRes, ProjectResourceRespVO } from './types'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建工具箱
|
* 新建工具箱
|
||||||
@ -24,7 +24,7 @@ export const page = (params: any) => {
|
|||||||
* 获得工具箱
|
* 获得工具箱
|
||||||
*/
|
*/
|
||||||
export const get = (params: { id: string }) => {
|
export const get = (params: { id: string }) => {
|
||||||
return useFetchRequest.get<IResponse<TcreateReq>>('/prod-api/app-api/business/resource/get', {
|
return useFetchRequest.get<IResponse<ProjectResourceRespVO>>('/prod-api/app-api/business/resource/get', {
|
||||||
query: params,
|
query: params,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ export interface TcreateReq {
|
|||||||
projectType: number[]
|
projectType: number[]
|
||||||
categoryId?: number
|
categoryId?: number
|
||||||
sourceType?: number
|
sourceType?: number
|
||||||
|
categoryName?: string
|
||||||
files: {
|
files: {
|
||||||
id: number
|
id: number
|
||||||
title: string
|
title: string
|
||||||
@ -61,3 +62,55 @@ export interface TpageItem {
|
|||||||
commentsPoint: number
|
commentsPoint: number
|
||||||
ownedUserId: string
|
ownedUserId: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProjectResourceRespVO {
|
||||||
|
id: number
|
||||||
|
title: string
|
||||||
|
labels: string[]
|
||||||
|
createAddress: string
|
||||||
|
createIp: string
|
||||||
|
projectType: number[]
|
||||||
|
categoryId: number
|
||||||
|
categoryName: string
|
||||||
|
favoriteId?: number
|
||||||
|
downloadId?: number
|
||||||
|
sourceType: number
|
||||||
|
ownedUserIdInfo: {
|
||||||
|
id: number
|
||||||
|
nickName: string
|
||||||
|
avatar: string
|
||||||
|
}
|
||||||
|
files: {
|
||||||
|
id: number
|
||||||
|
title: string
|
||||||
|
fileId: number
|
||||||
|
drawId: number
|
||||||
|
type: number
|
||||||
|
url: string
|
||||||
|
sort: number
|
||||||
|
size: number
|
||||||
|
}[]
|
||||||
|
coverImages: {
|
||||||
|
id: number
|
||||||
|
title: string
|
||||||
|
fileId: number
|
||||||
|
drawId: number
|
||||||
|
type: number
|
||||||
|
url: string
|
||||||
|
sort: number
|
||||||
|
size: number
|
||||||
|
}[]
|
||||||
|
points: number
|
||||||
|
createTime: string
|
||||||
|
updateTime: string
|
||||||
|
status: number
|
||||||
|
recommend: boolean
|
||||||
|
iconUrl: string
|
||||||
|
hotPoint: number
|
||||||
|
description: string
|
||||||
|
previewPoint: number
|
||||||
|
previewUrl: string
|
||||||
|
previewImageUrl: string
|
||||||
|
commentsPoint: number
|
||||||
|
ownedUserId: string
|
||||||
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
<div class="ma-auto mt-[21px] flex">
|
<div class="ma-auto mt-[21px] flex">
|
||||||
<div class="w-[1019px]">
|
<div class="w-[1019px]">
|
||||||
<div>
|
<div>
|
||||||
<ThumBnail :data="detail?.coverImages" :type="detail?.type"></ThumBnail>
|
<ThumBnail :data="detail?.coverImages"></ThumBnail>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-[20px] mt-[34px] flex items-center text-[16px] text-[#333333] font-normal">
|
<div class="mb-[20px] mt-[34px] flex items-center text-[16px] text-[#333333] font-normal">
|
||||||
<div class="h-[24px] w-[4px] rounded-[1px] bg-[#1A65FF]"></div><span class="ml-[10px]">{{ detail?.title }}描述</span></div
|
<div class="h-[24px] w-[4px] rounded-[1px] bg-[#1A65FF]"></div><span class="ml-[10px]">{{ detail?.title }}描述</span></div
|
||||||
@ -79,41 +79,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 关联项目 -->
|
|
||||||
<div class="mb-[20px] mt-[34px] flex items-center text-[16px] text-[#333333] font-normal">
|
|
||||||
<div class="h-[24px] w-[4px] rounded-[1px] bg-[#1A65FF]"></div>
|
|
||||||
<span class="ml-[10px]">关联{{ detail?.type === 1 ? '图纸' : detail?.type === 2 ? '文本' : '模型' }}</span>
|
|
||||||
</div>
|
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col v-for="(item, index) in detail?.relationDraws" :key="index" :span="12">
|
|
||||||
<CardPicture :item-info="item" />
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-empty v-if="!detail?.relationDraws?.length" description="暂无数据"></el-empty>
|
|
||||||
<!-- 关联模型 -->
|
|
||||||
<div class="mb-[20px] mt-[34px] flex items-center text-[16px] text-[#333333] font-normal">
|
|
||||||
<div class="h-[24px] w-[4px] rounded-[1px] bg-[#1A65FF]"></div
|
|
||||||
><span class="ml-[10px]">相关{{ detail?.type === 1 ? '图纸' : detail?.type === 2 ? '文本' : '模型' }}推荐</span></div
|
|
||||||
>
|
|
||||||
<el-row :gutter="20">
|
|
||||||
<el-col v-for="(item, index) in relationRecommend" :key="index" :span="12">
|
|
||||||
<CardPicture :item-info="item" />
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<!-- 评论 -->
|
<!-- 评论 -->
|
||||||
<CommentSection :relation-id="detail!.id" :project-id="detail!.projectId" />
|
<!-- <CommentSection :relation-id="detail!.id" :project-id="detail!.projectId" /> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-[22px]">
|
<div class="ml-[22px]">
|
||||||
<div class="box-border min-h-[269px] w-[397px] border border-[#EEEEEE] rounded-[12px] border-solid bg-[#FFFFFF] pa-[22px]">
|
<div class="box-border min-h-[269px] w-[397px] border border-[#EEEEEE] rounded-[12px] border-solid bg-[#FFFFFF] pa-[22px]">
|
||||||
<div class="mb-[10px]">图纸ID: {{ detail?.no }}</div>
|
<div class="mb-[10px]">工具ID: {{ detail?.no }}</div>
|
||||||
<div class="mb-[10px]">文件大小:{{ detail?.filesInfo?.fileSize || 0 }} </div>
|
<!-- <div class="mb-[10px]">文件大小:{{ detail?.filesInfo?.fileSize || 0 }} </div> -->
|
||||||
<!-- <div class="mb-10px">图纸版本:{{ detail.editionsName }} </div> -->
|
<!-- <div class="mb-10px">图纸版本:{{ detail.editionsName }} </div> -->
|
||||||
<div class="mb-[10px]">图纸格式:{{ detail?.formatType?.toString() }}</div>
|
<!-- <div class="mb-[10px]">工具格式:{{ detail?.formatType?.toString() }}</div> -->
|
||||||
<div class="mb-[10px]">所需金币:{{ detail?.points }}金币</div>
|
<div class="mb-[10px]">所需金币:{{ detail?.points }}金币</div>
|
||||||
<div class="mb-[10px]">发布时间:{{ dayjs(detail?.createTime).format('YYYY-MM-DD HH:mm:ss') }}</div>
|
<div class="mb-[10px]">发布时间:{{ dayjs(detail?.createTime).format('YYYY-MM-DD HH:mm:ss') }}</div>
|
||||||
<div class="mb-[10px]">图纸参数:{{ detail?.editTypeName }}</div>
|
<!-- <div class="mb-[10px]">工具参数:{{ detail?.editTypeName }}</div> -->
|
||||||
<div class="mb-[10px]">图纸分类:{{ detail?.projectTypeName }}</div>
|
<div class="mb-[10px]">工具标签:{{ detail?.labels?.toString() }}</div>
|
||||||
<div class="mb-[10px]">软件分类:{{ detail?.editionsName }}</div>
|
<div class="mb-[10px]">软件分类:{{ detail?.categoryName }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-[20px] w-[398px] border border-[#EEEEEE] border-rd-[10px_10px_0px_0px] border-solid bg-[#FFFFFF]">
|
<div class="mt-[20px] w-[398px] border border-[#EEEEEE] border-rd-[10px_10px_0px_0px] border-solid bg-[#FFFFFF]">
|
||||||
<img src="~/assets/images/banner.png" alt="" srcset="" class="w-[100%]" />
|
<img src="~/assets/images/banner.png" alt="" srcset="" class="w-[100%]" />
|
||||||
@ -190,10 +170,8 @@
|
|||||||
import { getDetail, getRelationRecommend, report, getUserInfo, getMainWork, createContent, createUserProject, deleteProject } from '~/api/drawe-detail/index'
|
import { getDetail, getRelationRecommend, report, getUserInfo, getMainWork, createContent, createUserProject, deleteProject } from '~/api/drawe-detail/index'
|
||||||
import KlNavTab from '~/components/kl-nav-tab/index.vue'
|
import KlNavTab from '~/components/kl-nav-tab/index.vue'
|
||||||
import ThumBnail from './components/swiper.vue'
|
import ThumBnail from './components/swiper.vue'
|
||||||
import CommentSection from '~/components/comment-section/index.vue'
|
// import CommentSection from '~/components/comment-section/index.vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import { onMounted } from 'vue'
|
|
||||||
import type { ProjectRespVO, ProjectDrawPageRespVO, UserExtendSimpleRespDTO, ProjectDrawMemberRespVO } from '~/api/drawe-detail/types'
|
|
||||||
import useUserStore from '~/stores/user'
|
import useUserStore from '~/stores/user'
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
@ -201,9 +179,6 @@
|
|||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const id = route.params.id as string
|
const id = route.params.id as string
|
||||||
|
|
||||||
// 获取详情
|
|
||||||
// const detail = ref<ProjectRespVO>({} as ProjectRespVO)
|
|
||||||
|
|
||||||
const { data: detail, refresh: refreshDetail } = await useAsyncData(`toolbox-getDetail${id}`, async () => {
|
const { data: detail, refresh: refreshDetail } = await useAsyncData(`toolbox-getDetail${id}`, async () => {
|
||||||
const res = await get({ id: id as string })
|
const res = await get({ id: id as string })
|
||||||
return res.data
|
return res.data
|
||||||
@ -219,40 +194,11 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取面包屑
|
|
||||||
// const { data: breadList } = await useAsyncData(`breadList-detail-${route.params.id}}`, async () => {
|
|
||||||
// const res = await getDictTree({ type: 1, id: detail.value?.projectType?.[0] })
|
|
||||||
// const all = [
|
|
||||||
// {
|
|
||||||
// id: -1,
|
|
||||||
// name: detail.value?.type === 1 ? '图纸库' : detail.value?.type === 3 ? '模型库' : '文本库',
|
|
||||||
// isChildren: false,
|
|
||||||
// },
|
|
||||||
// ]
|
|
||||||
// const arr = [...res.data, ...all]
|
|
||||||
// return arr.reverse()
|
|
||||||
// })
|
|
||||||
|
|
||||||
// const init = () => {
|
|
||||||
// getDetail({ id }).then((res) => {
|
|
||||||
// if (res.code === 0) {
|
|
||||||
// detail.value = res.data
|
|
||||||
// // 获取推荐信息
|
|
||||||
// getRelationRecommendList()
|
|
||||||
// // 获取用户信息
|
|
||||||
// handleGetUserInfo()
|
|
||||||
// // 最新发布
|
|
||||||
// handleGetMainWork()
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// init()
|
// init()
|
||||||
|
|
||||||
const [{ data: mainWork }, { data: userInfo }, { data: relationRecommend }] = await Promise.all([
|
const [{ data: mainWork }, { data: userInfo }] = await Promise.all([
|
||||||
getMainWork({ id: detail.value?.id, limit: 10, memberId: detail.value?.ownedUserId }),
|
getMainWork({ id: detail.value?.id, limit: 10, memberId: detail.value?.ownedUserId }),
|
||||||
getUserInfo({ id: detail.value?.id }),
|
getUserInfo({ id: detail.value?.id }),
|
||||||
getRelationRecommend({ type: detail.value?.type, projectType: detail.value?.projectType[0] }),
|
|
||||||
])
|
])
|
||||||
|
|
||||||
// 获取最新发布
|
// 获取最新发布
|
||||||
@ -318,7 +264,7 @@
|
|||||||
|
|
||||||
const res = await message.confirm(`是否花费${detail.value?.points}金币下载此资源,是否继续?`, '提示')
|
const res = await message.confirm(`是否花费${detail.value?.points}金币下载此资源,是否继续?`, '提示')
|
||||||
if (res) {
|
if (res) {
|
||||||
createUserProject({ relationId: detail.value?.id, type: getType(detail.value?.type as number) }).then((res) => {
|
createUserProject({ relationId: detail.value?.id, type: 2 }).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
ElMessage.success('获取下载权限成功')
|
ElMessage.success('获取下载权限成功')
|
||||||
detail.value!.downloadId = res.data
|
detail.value!.downloadId = res.data
|
||||||
@ -383,7 +329,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleClick = (id: string | number) => {
|
const handleClick = (id: string | number) => {
|
||||||
navigateTo(`/down-drawe-detail/${id}`) // 修改为在新窗口打开
|
navigateTo(`/toolbox-detail/${id}`) // 修改为在新窗口打开
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDownloadFile = (url: string, name: string) => {
|
const handleDownloadFile = (url: string, name: string) => {
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mb-[20px] mt-[34px] flex items-center text-[16px] text-[#333333] font-normal">
|
<div class="mb-[20px] mt-[34px] flex items-center text-[16px] text-[#333333] font-normal">
|
||||||
<div class="h-[24px] w-[4px] rounded-[1px] bg-[#1A65FF]"></div>
|
<div class="h-[24px] w-[4px] rounded-[1px] bg-[#1A65FF]"></div>
|
||||||
<span class="ml-[10px]">{{ props.type === 1 ? '图纸' : props.type === 2 ? '文本' : '模型' }}</span>
|
<span class="ml-[10px]">工具</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-border h-[126px] w-[1019px] border border-[#EEEEEE] rounded-[6px] border-solid bg-[#FFFFFF] pa-[23px]">
|
<div class="box-border h-[126px] w-[1019px] border border-[#EEEEEE] rounded-[6px] border-solid bg-[#FFFFFF] pa-[23px]">
|
||||||
<div thumbsSlider="" class="swiper mySwiper">
|
<div thumbsSlider="" class="swiper mySwiper">
|
||||||
|
|||||||
Reference in New Issue
Block a user