|
|
@@ -2,7 +2,7 @@
|
|
|
<!-- 通用列表 -->
|
|
|
<PageContainer :title="title">
|
|
|
<template #carousel>
|
|
|
- <Carousel v-if="false" v-bind="carouselConfig" class="main-header-image carousel-light">
|
|
|
+ <Carousel v-if="showCarousel" v-bind="carouselConfig" class="main-header-image carousel-light">
|
|
|
<Slide
|
|
|
v-for="(item, key) in carouselData.content.value"
|
|
|
:key="key"
|
|
|
@@ -65,28 +65,6 @@ const carouselConfig : (typeof Carousel['props']) = {
|
|
|
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
-
|
|
|
-const carouselData = await useSSrSimpleDataLoader('carousel', async () => {
|
|
|
- const res = await $fetch(`/api/ecms/carousel`);
|
|
|
- if (!res.status)
|
|
|
- throw new Error(res.message);
|
|
|
- return res.data;
|
|
|
-});
|
|
|
-const channelId = parseInt(route.query.parent_channel_id as string);
|
|
|
-const channelData = await useSSrSimpleDataLoader('channel' + channelId, async () => {
|
|
|
- const res = await $fetch(`/api/ecms/channel/${channelId}`);
|
|
|
- if (!res.status)
|
|
|
- throw new Error(res.message);
|
|
|
- const data = res.data as IChannel & {
|
|
|
- childs: IChannel[];
|
|
|
- parents: IChannel[];
|
|
|
- };
|
|
|
- return {
|
|
|
- ...data,
|
|
|
- childs: solveChannelData(data.childs),
|
|
|
- };
|
|
|
-});
|
|
|
-
|
|
|
const props = defineProps({
|
|
|
title: {
|
|
|
type: String,
|
|
|
@@ -103,6 +81,14 @@ const props = defineProps({
|
|
|
type: Object as PropType<DropDownNames[]>,
|
|
|
default: null,
|
|
|
},
|
|
|
+ carouselName: {
|
|
|
+ type: String,
|
|
|
+ default: 'banner',
|
|
|
+ },
|
|
|
+ showCarousel: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
showSearch: {
|
|
|
type: Boolean,
|
|
|
default: true,
|
|
|
@@ -179,6 +165,27 @@ const props = defineProps({
|
|
|
default: 0,
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+const carouselData = await useSSrSimpleDataLoader('carousel-' + (props.carouselName || 'default'), async () => {
|
|
|
+ const res = await $fetch(`/api/ecms/carousel?name=${props.carouselName}`);
|
|
|
+ if (!res.status)
|
|
|
+ throw new Error(res.message);
|
|
|
+ return res.data;
|
|
|
+});
|
|
|
+const channelId = parseInt(route.query.parent_channel_id as string);
|
|
|
+const channelData = await useSSrSimpleDataLoader('channel' + channelId, async () => {
|
|
|
+ const res = await $fetch(`/api/ecms/channel/${channelId}`);
|
|
|
+ if (!res.status)
|
|
|
+ throw new Error(res.message);
|
|
|
+ const data = res.data as IChannel & {
|
|
|
+ childs: IChannel[];
|
|
|
+ parents: IChannel[];
|
|
|
+ };
|
|
|
+ return {
|
|
|
+ ...data,
|
|
|
+ childs: solveChannelData(data.childs),
|
|
|
+ };
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|