-
图纸ID: {{ detail?.id }}
-
文件大小:{{ detail?.filesInfo?.fileSize || 0 }}
+
图纸ID: {{ detail?.id }}
+
文件大小:{{ detail?.filesInfo?.fileSize || 0 }}
-
图纸格式:{{ detail?.formatType?.toString() }}
-
所需金币:{{ detail?.points }}金币
-
发布时间:{{ dayjs(detail?.createTime).format('YYYY-MM-DD HH:mm:ss') }}
-
图纸参数:{{ detail?.editTypeName }}
-
图纸分类:{{ detail?.projectTypeName }}
-
软件分类:{{ detail?.editionsName }}
+
图纸格式:{{ detail?.formatType?.toString() }}
+
所需金币:{{ detail?.points }}金币
+
发布时间:{{ dayjs(detail?.createTime).format('YYYY-MM-DD HH:mm:ss') }}
+
图纸参数:{{ detail?.editTypeName }}
+
图纸分类:{{ detail?.projectTypeName }}
+
软件分类:{{ detail?.editionsName }}

@@ -179,7 +179,7 @@
import ThumBnail from './components/swiper.vue'
import CommentSection from '~/components/comment-section/index.vue'
import { useRoute } from 'vue-router'
- import { ref } from 'vue'
+ import { onMounted } from 'vue'
import type { ProjectRespVO, ProjectDrawPageRespVO, UserExtendSimpleRespDTO, ProjectDrawMemberRespVO } from '~/api/drawe-detail/types'
import useUserStore from '~/stores/user'
const message = useMessage()
@@ -187,15 +187,19 @@
// 获取路由参数
const route = useRoute()
const id = route.params.id as string
+
// 获取详情
// const detail = ref
({} as ProjectRespVO)
- const {data: detail } = await useAsyncData('getDetail', async () => {
+ const {data: detail, refresh: refreshDetail } = await useAsyncData(`getDetail${id}`, async () => {
const res = await getDetail({ id })
return res.data
})
+ console.log('==', detail.value);
+
+
if (!detail.value) {
throw createError({
statusCode: 404,
@@ -219,35 +223,41 @@
// }
// init()
+
+ const [{data:mainWork},{data:userInfo},{data:relationRecommend}] = 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] })
+ ])
// 获取最新发布
- const mainWork = ref([])
- const handleGetMainWork = () => {
- getMainWork({ id: detail.value?.id, limit: 10, memberId: detail.value?.ownedUserId }).then((res) => {
- if (res.code === 0) {
- mainWork.value = res.data
- }
- })
- }
+ // const mainWork = ref([])
+ // const handleGetMainWork = () => {
+ // getMainWork({ id: detail.value?.id, limit: 10, memberId: detail.value?.ownedUserId }).then((res) => {
+ // if (res.code === 0) {
+ // mainWork.value = res.data
+ // }
+ // })
+ // }
// 获取用户信息
- const userInfo = ref({} as UserExtendSimpleRespDTO)
- const handleGetUserInfo = () => {
- getUserInfo({ id: detail.value?.id }).then((res) => {
- if (res.code === 0) {
- userInfo.value = res.data
- }
- })
- }
+ // const userInfo = ref({} as UserExtendSimpleRespDTO)
+ // const handleGetUserInfo = () => {
+ // getUserInfo({ id: detail.value?.id }).then((res) => {
+ // if (res.code === 0) {
+ // userInfo.value = res.data
+ // }
+ // })
+ // }
// 获取关联推荐
- const relationRecommend = ref([])
- const getRelationRecommendList = () => {
- getRelationRecommend({ type: detail.value?.type, projectType: detail.value?.projectType[0] }).then((res) => {
- if (res.code === 0) {
- relationRecommend.value = res.data
- }
- })
- }
+ // const relationRecommend = ref([])
+ // const getRelationRecommendList = () => {
+ // getRelationRecommend({ type: detail.value?.type, projectType: detail.value?.projectType[0] }).then((res) => {
+ // if (res.code === 0) {
+ // relationRecommend.value = res.data
+ // }
+ // })
+ // }
const changeSwiper = (index: number) => {
console.log(index)
@@ -350,7 +360,7 @@
})
if (res.code === 0) {
ElMessage.success(`${detail.value?.favoriteId ? '取消' : '收藏'}成功`)
- // init()
+ refreshDetail()
}
}
diff --git a/yarn.lock b/yarn.lock
index cc2c3ba..fa33d06 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6441,7 +6441,7 @@ svgo@^4.0.0:
picocolors "^1.1.1"
sax "^1.4.1"
-swiper@^11.2.6:
+swiper@^11.2.10, swiper@^11.2.6:
version "11.2.10"
resolved "https://registry.yarnpkg.com/swiper/-/swiper-11.2.10.tgz#ed0b17286b56f7fe8d4b46ed61e6e0bd8daaccad"
integrity sha512-RMeVUUjTQH+6N3ckimK93oxz6Sn5la4aDlgPzB+rBrG/smPdCTicXyhxa+woIpopz+jewEloiEE3lKo1h9w2YQ==