75 lines
1.8 KiB
Vue
75 lines
1.8 KiB
Vue
<script setup lang="ts">
|
|
import PlanetBaseInfo from '@/components/PlanetBaseInfo.vue'
|
|
import PlanetComment from '@/components/PlanetComment.vue'
|
|
import PlanetQuestionComment from '@/components/PlanetQuestionComment.vue'
|
|
import PublishContent from '@/components/PublishContent.vue'
|
|
import { useUserStore } from '@/stores/user'
|
|
import request from '@/utils/request'
|
|
import { FolderPlus, ImagePlus } from 'lucide-vue-next'
|
|
import { NModal } from 'naive-ui'
|
|
import { ref, watchEffect } from 'vue'
|
|
import { useRoute } from 'vue-router'
|
|
|
|
const route = useRoute()
|
|
const userStore = useUserStore()
|
|
|
|
// 社区详情接口返回的数据类型
|
|
interface CommunityDetail {
|
|
id: string
|
|
communityName: string
|
|
coverImage: string
|
|
memberCount: number
|
|
contentCount: number
|
|
createDays: number
|
|
score: number
|
|
}
|
|
|
|
const communityDetail = ref<CommunityDetail>()
|
|
const loading = ref(false)
|
|
|
|
// 获取社区详情
|
|
async function getCommunityDetail() {
|
|
try {
|
|
loading.value = true
|
|
const res = await request.get('/community/detail', {
|
|
params: {
|
|
communityId: route.query.communityId,
|
|
tenantId: route.query.tenantId,
|
|
},
|
|
})
|
|
if (res.code === 200) {
|
|
communityDetail.value = res.data
|
|
}
|
|
}
|
|
catch (err) {
|
|
console.error('获取社区详情失败:', err)
|
|
}
|
|
finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
// 监听路由参数变化,重新获取数据
|
|
watchEffect(() => {
|
|
if (route.query.communityId && route.query.tenantId) {
|
|
getCommunityDetail()
|
|
}
|
|
})
|
|
|
|
const router = useRouter()
|
|
</script>
|
|
|
|
<template>
|
|
<main p="x4 y10" text="center teal-700 dark:gray-200">
|
|
<div text-4xl>
|
|
<div i-carbon-warning inline-block />
|
|
</div>
|
|
<div>Not found</div>
|
|
<div>
|
|
<button text-sm btn m="3 t8" @click="router.back()">
|
|
Back
|
|
</button>
|
|
</div>
|
|
</main>
|
|
</template>
|