@ -43,7 +43,7 @@
< div class = "ma-auto mt-[21px] flex" >
< div class = "w-[1019px]" >
< div >
< ThumBnail :data = "detail?.coverImages" :type = "detail?.type" > < / ThumBnail >
< ThumBnail :data = "detail?.coverImages" > < / ThumBnail >
< / 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 ? . title } } 描述 < / span > < / d i v
@ -79,41 +79,21 @@
< / 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]" > < / d i v
> < span class = "ml-[10px]" > 相关 { { detail ? . type === 1 ? '图纸' : detail ? . type === 2 ? '文本' : '模型' } } 推荐 < / span > < / d i v
>
< 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 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 = "mb-[10px]" > 图纸 ID: { { detail ? . no } } < / div >
< div class = "mb-[10px]" > 文件大小 : { { detail ? . filesInfo ? . fileSize || 0 } } < / div >
< div class = "mb-[10px]" > 工具 ID: { { detail ? . no } } < / div >
<!-- < div class = "mb-[10px]" > 文件大小 : { { detail ? . filesInfo ? . fileSize || 0 } } < / 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]" > 发布时间 : { { dayjs ( detail ? . createTime ) . format ( 'YYYY-MM-DD HH:mm:ss' ) } } < / div >
< div class = "mb-[10px]" > 图纸 参数: { { detail ? . editTypeName } } < / div >
< div class = "mb-[10px]" > 图纸分类 : { { detail ? . projectTypeName } } < / div >
< div class = "mb-[10px]" > 软件分类 : { { detail ? . editions Name } } < / div >
<!-- < div class = "mb-[10px]" > 工具 参数: { { detail ? . editTypeName } } < / div > -- >
< div class = "mb-[10px]" > 工具标签 : { { detail ? . labels ? . toString ( ) } } < / div >
< div class = "mb-[10px]" > 软件分类 : { { detail ? . category Name } } < / div >
< / div >
< 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%]" / >
@ -190,10 +170,8 @@
import { getDetail , getRelationRecommend , report , getUserInfo , getMainWork , createContent , createUserProject , deleteProject } from '~/api/drawe-detail/index'
import KlNavTab from '~/components/kl-nav-tab/index.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 { onMounted } from 'vue'
import type { ProjectRespVO , ProjectDrawPageRespVO , UserExtendSimpleRespDTO , ProjectDrawMemberRespVO } from '~/api/drawe-detail/types'
import useUserStore from '~/stores/user'
const message = useMessage ( )
const userStore = useUserStore ( )
@ -201,9 +179,6 @@
const route = useRoute ( )
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 res = await get ( { id : id as string } )
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()
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 } ) ,
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 } 金币下载此资源,是否继续? ` , '提示' )
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 ) {
ElMessage . success ( '获取下载权限成功' )
detail . value ! . downloadId = res . data
@ -383,7 +329,7 @@
}
const handleClick = ( id : string | number ) => {
navigateTo ( ` /down-drawe -detail/ ${ id } ` ) // 修改为在新窗口打开
navigateTo ( ` /toolbox -detail/ ${ id } ` ) // 修改为在新窗口打开
}
const handleDownloadFile = ( url : string , name : string ) => {