85 lines
2.5 KiB
Vue
85 lines
2.5 KiB
Vue
<template>
|
|
<!-- 导航 -->
|
|
<KlNavTab active="交流频道" />
|
|
<div class="ma-auto mt-[30px] w-[1440px] flex">
|
|
<LeftContent v-model="pageReq.channelId" v-model:channelIdList="channelIdList"></LeftContent>
|
|
<!-- <RightContent v-model="pageRes" v-model:lun-tan-res="lunTanRes" v-model:page-no="pageReq.pageNo" @update-page-no="handleUpdatePageNo"></RightContent> -->
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import KlNavTab from '~/components/kl-nav-tab/index.vue'
|
|
import LeftContent from './components/LeftContent.vue'
|
|
import RightContent from './components/RightContent.vue'
|
|
import { page, getChannelLunTanDetail, list } from '~/api/channel/index'
|
|
import { reactive, watch, ref } from 'vue'
|
|
import type { TpageRes, ChannelRespVO } from '~/api/channel/types'
|
|
|
|
const pageReq = reactive({
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
channelId: '', // 频道ID
|
|
})
|
|
const pageRes = reactive<TpageRes>({
|
|
list: [],
|
|
total: 0,
|
|
})
|
|
|
|
// 获取频道列表
|
|
const { data: channelIdList } = await useAsyncData(`prod-api/app-api/business/channel/list-${Date.now()}`, async () => {
|
|
const res = await list()
|
|
return res.data as any[]
|
|
})
|
|
|
|
// console.log(channelIdList)
|
|
|
|
// 获取第一个论坛详情
|
|
// if (!channelIdList.value?.length) return
|
|
// const { data: lunTanRes, execute } = await useAsyncData(`prod-api/app-api/business/channel/detail-${Date.now()}`, async () => {
|
|
// const res = await getChannelLunTanDetail({
|
|
// id: channelIdList.value?.[0].channelId,
|
|
// })
|
|
// return res.data as ChannelRespVO
|
|
// })
|
|
|
|
// const {data:pageRes, refresh:getPage} = await useAsyncData(`prod-api/app-api/business/posts/page-${Date.now()}`, async () => {
|
|
// const res = await page(pageReq)
|
|
// return res.data as TpageRes
|
|
// })
|
|
// 获得频道帖子分页
|
|
// const getPage = () => {
|
|
// page(pageReq).then((res) => {
|
|
// pageRes.list = res.data.list
|
|
// pageRes.total = res.data.total
|
|
// })
|
|
// }
|
|
// getPage()
|
|
|
|
// const handleUpdatePageNo = (pageNo: number) => {
|
|
// pageReq.pageNo = pageNo
|
|
// getPage()
|
|
// }
|
|
|
|
// 获取论坛详情
|
|
// const lunTanRes = ref({} as ChannelRespVO)
|
|
// const getLunTanDetaiil = (val: string) => {
|
|
// getChannelLunTanDetail({
|
|
// id: val,
|
|
// }).then((res) => {
|
|
// lunTanRes.value = res.data
|
|
// })
|
|
// }
|
|
|
|
watch(
|
|
() => channelIdList.value,
|
|
(val) => {
|
|
if (val) {
|
|
navigateTo(`/channel/${val[0].channelId}/1`)
|
|
}
|
|
},
|
|
{ immediate: true }
|
|
)
|
|
</script>
|
|
|
|
<style lang="scss" scoped></style>
|