Selaa lähdekoodia

📦 按要求修改

快乐的梦鱼 2 viikkoa sitten
vanhempi
commit
9fdb6279e4

+ 1 - 0
server/api/ecms/article/[id].ts

@@ -11,6 +11,7 @@ export interface IArticle {
   desc: string;
   image: string,
   video?: string,
+  document_file?: string,
   images: string;
   seotitle: string;
   keywords: string;

+ 0 - 1
src/App.vue

@@ -12,7 +12,6 @@
     <main>
       <NuxtPage />
     </main>
-    <LinkInfos showType="list" />
     <Footer>
     </Footer>
   </a-config-provider>

+ 1 - 1
src/assets/scss/main.scss

@@ -325,7 +325,7 @@ nav.main-nav {
 }
 .main-header-image {
   width: 100%;
-  height: 400px;
+  height: 400px!important;
   object-fit: cover;
 }
 

+ 6 - 4
src/components/LinkInfos.vue

@@ -87,22 +87,24 @@ const linkInfos = ref([
     flex-wrap: wrap;
     align-items: center;
     justify-content: center;
-    gap: 36px;
-    padding: 20px 0;
+    gap: 56px;
+    padding: 10px 0 46px 0;
     width: auto;
     left: unset;
     right: unset;
     bottom: unset;
 
     > div {
+      gap: 10px;
+      font-size: 16px;
 
       &:hover {
         background-color: transparent;
       }
 
       > img {
-        width: 120px;
-        height: 120px;
+        width: 170px;
+        height: 170px;
         object-fit: contain;
       }
     }

+ 30 - 23
src/components/content/CommonListPage.vue

@@ -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">

+ 3 - 0
src/pages/index.vue

@@ -260,6 +260,9 @@
             </div>
           </div>
         </div>
+
+        <!-- 友情链接 -->
+        <LinkInfos showType="list" />
       </div>
     </div>
 

+ 2 - 0
src/pages/inheritor/artifact.vue

@@ -10,6 +10,8 @@
     :tagsData="tagsData"
     :defaultSelectTag="tagsData[0]?.id"
     detailsPage="/inheritor/details/artifact"
+    :showCarousel="true"
+    carouselName="banner-intangible"
   />
 </template>
 

+ 2 - 0
src/pages/inheritor/inheritor.vue

@@ -17,6 +17,8 @@
     :detailsParams="{
       groupTitle: '非遗传承人',
     }"
+    :showCarousel="true"
+    carouselName="banner-intangible"
   >
     <template #contentPre>
       <HeaderBox>

+ 29 - 23
src/pages/inheritor/intangible.vue

@@ -17,6 +17,8 @@
     :detailsParams="{
       groupTitle: '非遗项目',
     }"
+    :showCarousel="true"
+    carouselName="banner-intangible"
   >
     <template #contentPre>
       <HeaderBox>
@@ -96,31 +98,35 @@ const statsItemLoader =  useSimpleDataLoader(async () => {
 });
 
 onMounted(async () => {
-  tagsData.value = tagsData.value.concat((await CommonContent.getCategoryList(4)).map((item) => ({
-    id: item.id,
-    name: item.title,
-  })));
-  const levels = await CommonContent.getCategoryList(2);
-  dropdownNames.value.push({ 
-    options: [{
-      id: 0, 
-      name: '全部'
-    }].concat(levels.map((item) => ({
+  try {
+    tagsData.value = tagsData.value.concat((await CommonContent.getCategoryList(4)).map((item) => ({
       id: item.id,
       name: item.title,
-    }))),
-    defaultSelectedValue: route.query.level ? Number(route.query.level) : 0,
-  });
-  dropdownNames.value.push({ 
-    options: [{
-      id: 0, 
-      name: '全部'
-    }].concat((await CommonContent.getCategoryList(1)).map((item) => ({
-      id: item.id,
-      name: item.title,
-    }))),
-    defaultSelectedValue: 0,
-  });
+    })));
+    const levels = await CommonContent.getCategoryList(2);
+    dropdownNames.value.push({ 
+      options: [{
+        id: 0, 
+        name: '全部'
+      }].concat(levels.map((item) => ({
+        id: item.id,
+        name: item.title,
+      }))),
+      defaultSelectedValue: route.query.level ? Number(route.query.level) : 0,
+    });
+    dropdownNames.value.push({ 
+      options: [{
+        id: 0, 
+        name: '全部'
+      }].concat((await CommonContent.getCategoryList(1)).map((item) => ({
+        id: item.id,
+        name: item.title,
+      }))),
+      defaultSelectedValue: 0,
+    });
+  } catch (error) {
+    console.error('error', error);
+  }
 })
 </script>
 

+ 2 - 0
src/pages/inheritor/seminar.vue

@@ -6,6 +6,8 @@
     :pageSize="8"
     :load="loadData"
     :loadDetail="loadDetail"
+    :showCarousel="true"
+    carouselName="banner-intangible"
   />
 </template>
 

+ 8 - 2
src/pages/page/[id].vue

@@ -71,6 +71,11 @@
                   <div class="content" v-html="articlesData.content.value.content">
                   </div>
                   <video v-if="articlesData.content.value.video" :src="articlesData.content.value.video" controls></video>
+                  <iframe 
+                    v-if="articlesData.content.value.document_file" :src="articlesData.content.value.document_file"
+                    class="w-100"
+                    style="height: 80vh;"
+                  ></iframe>
                   <a-empty v-if="isEmpty"
                     description="暂无内容"
                   />
@@ -109,7 +114,7 @@ const carouselData = await useSSrSimpleDataLoader('carousel', async () => {
 const articlesData = await useSSrSimpleDataLoader('articles' + articleId, async () => {
   const res = await $fetch(`/api/ecms/article/${articleId}`, {
     method: 'GET',
-  });
+  });  
   if (!res.status)
     throw new Error(res.message);
   return res.data;
@@ -118,7 +123,8 @@ const articlesData = await useSSrSimpleDataLoader('articles' + articleId, async
 const isEmpty = computed(() => articlesData.content.value 
   && !articlesData.content.value.content 
   && !articlesData.content.value.image 
-  && !articlesData.content.value.video);
+  && !articlesData.content.value.video
+  && !articlesData.content.value.document_file);
 
 watch(() => route.query.id, async (newVal, oldVal) => {
   if (newVal !== oldVal) {