Procházet zdrojové kódy

🎨 修改细节问题

快乐的梦鱼 před 4 týdny
rodič
revize
814b6c46e0

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

@@ -245,6 +245,7 @@ $small-banner-height: 445px;
 
     div {
       text-align: center;
+      cursor: pointer;
     }
 
     h5 {

+ 16 - 1
src/assets/scss/news.scss

@@ -336,10 +336,25 @@
     }
   }
 }
+@media (max-width: 1200px) {
+  .news-detail .carousel {
+    width: 300px;
+  }
+}
+@media (max-width: 1000px) {
+  .news-detail .carousel {
+    width: 40%;
+  }
+}
+@media (max-width: 768px) {
+  .news-detail .carousel {
+    width: 60%;
+  }
+}
 
 @media (min-width: 808px) {
   .news-detail .carousel {
-    width: 50%;
+    width: 300px;
     float: right;
     margin: 0;
     margin-left: 20px;

+ 16 - 3
src/components/content/CommonListBlock.vue

@@ -25,7 +25,7 @@
       <div class="col-sm-12 col-md-6 col-lg-6 d-flex flex-row justify-content-end align-items-start" style="gap:5px">
         <Dropdown
           v-for="(drop, k) in dropDownNames" :key="k" 
-          :selectedValue="dropDownValues[k] || drop.defaultSelectedValue"
+          :selectedValue="dropDownValues[k]"
           :options="drop.options" 
           labelKey="name"
           valueKey="id"
@@ -274,12 +274,25 @@ const newsLoader = useSimplePagerDataLoader(props.pageSize, (page, size) => prop
 //子分类
 const selectedTag = ref(props.defaultSelectTag);
 
+watch(() => props.dropDownNames, () => {
+  loadDropValues();
+})
 watch(selectedTag, () => {
   newsLoader.loadData(undefined, true);
 })
-onMounted(() => {
+
+function loadDropValues() {
+  dropDownValues.value = [];
+  for (const element of props.dropDownNames)
+    dropDownValues.value.push(element.defaultSelectedValue);
   newsLoader.loadData(undefined, true);
-});
+}
+
+onMounted(() => {
+  setTimeout(() => {
+    loadDropValues();
+  }, 400);
+})
 
 defineExpose({
   reload() {

+ 38 - 16
src/views/HomeView.vue

@@ -23,6 +23,27 @@
       </template>
     </Carousel>
 
+    <!-- 数据统计 -->
+    <section class="main-section">
+      <div class="content">
+        <div class="title">
+          <h2>数据统计</h2>
+        </div>
+
+        <SimplePageContentLoader :loader="statsData">
+          <div v-for="(stat,key) in statsData.content.value" :key="key" class="main-stats">
+            <h4>{{ stat.title }}</h4>
+            <div class="descs">
+              <div v-for="(data, key2) in stat.datas" :key="key2" @click="data.onClick">
+                <h5>{{ data.value }}</h5>
+                <p>{{ data.title }}</p>
+              </div>
+            </div>
+          </div>
+        </SimplePageContentLoader>
+      </div>
+    </section>
+
     <!-- 精选推荐非遗 -->
     <section class="main-section main-background main-background-type1">
       <div class="content">
@@ -38,7 +59,7 @@
               :image="item.image"
               :title="item.title"
               :desc="item.desc"
-              @click="router.push({ name: 'news-detail', query: { id: item.id } })"
+              @click="router.push({ name: 'intangible-detail', query: { id: item.id } })"
             />
           </div>
         </SimplePageContentLoader>
@@ -166,7 +187,6 @@
                 :key="index"
                 class="item"
                 :class="index % 2 === 0 ? 'top' : 'bottom'"
-                @click="router.push({ name: 'news-detail', query: { id: item.id } })"
               >
                 <div class="time">
                   {{ DataDateUtils.formatDate(item.publishAt, 'YYYY-MM') }}
@@ -281,8 +301,7 @@ const newsData = useSimpleDataLoader<GetContentListItem[]>(async () => {
 });
 const statsData = useSimpleDataLoader(async () => {
   const data = (await IndexContent.getStats());
-  console.log(data);
-  
+
   return [
     {
       title: '非遗项目',
@@ -290,7 +309,10 @@ const statsData = useSimpleDataLoader(async () => {
       datas: data.ichData.map((item: any) => {
         return {
           title: item.level_text,
-          value: item.total
+          value: item.total,
+          onClick: () => {
+            router.push({ path: '/inheritor/projects', query: { level: item.level_text } });
+          },
         }
       })
     },
@@ -300,11 +322,14 @@ const statsData = useSimpleDataLoader(async () => {
       datas: data.inheritorData.map((item: any) => {
         return {
           title: item.title,
-          value: item.total
+          value: item.total,
+          onClick: () => {
+            router.push({ path: '/inheritor/inheritor', query: { level: item.title } });
+          },
         }
       })
     },
-    {
+    /*{
       title: '不可移动文物',
       type: '3',
       datas: data.crData.map((item: any) => {
@@ -343,15 +368,17 @@ const statsData = useSimpleDataLoader(async () => {
           value: item.total
         }
       })
-    },
-  ]
-
+    },*/
+  ];
 });
 const recordData = useSimpleDataLoader<GetContentListItem[]>(async () => {
   return (await CommonContent.getContentList(new GetContentListParams()
+    .setSelfValues({
+      order: 'publish_at',
+    })
    .setModelId(18)
    .setMainBodyColumnId(316)
-  , 1, 9)).list
+  , 1, 50)).list
 });
 </script>
 
@@ -542,11 +569,6 @@ const recordData = useSimpleDataLoader<GetContentListItem[]>(async () => {
       background-color: $box-color;
       padding: 10px;
       border-radius: 5px;
-      cursor: pointer;
-
-      &:hover {
-        transform: scale(1.05);
-      }
 
       .title {
         font-size: 1.1rem;

+ 9 - 9
src/views/InheritorView.vue

@@ -23,7 +23,7 @@
           <div v-for="(stat,key) in statsData.content.value" :key="key" class="main-stats">
             <h4>{{ stat.title }}</h4>
             <div class="descs">
-              <div v-for="(data, key2) in stat.datas" :key="key2">
+              <div v-for="(data, key2) in stat.datas" :key="key2" @click="data.onClick">
                 <h5>{{ data.value }}</h5>
                 <p>{{ data.title }}</p>
               </div>
@@ -131,13 +131,11 @@
 <script setup lang="ts">
 import { Carousel, Slide, Pagination, Navigation } from 'vue3-carousel'
 import { onMounted, ref } from 'vue';
-import LawsTest from '@/assets/images/inheritor/LawsTest.jpg'
 import Image1 from '@/assets/images/inheritor/Image1.jpg'
 import Image2 from '@/assets/images/inheritor/Image2.jpg'
 import Image3 from '@/assets/images/inheritor/Image3.jpg'
 import Image4 from '@/assets/images/inheritor/Image4.jpg'
 import Image5 from '@/assets/images/inheritor/Image5.jpg'
-import Image6 from '@/assets/images/inheritor/Image6.jpg'
 import Image7 from '@/assets/images/inheritor/Image7.jpg'
 import Image8 from '@/assets/images/inheritor/Image8.jpg'
 import Image9 from '@/assets/images/inheritor/Image9.jpg'
@@ -147,13 +145,10 @@ import LeftRightBox from '@/components/parts/LeftRightBox.vue';
 import ThreeImageList from '@/components/parts/ThreeImageList.vue';
 import { usePageAction } from '@/composeable/PageAction';
 import { useSimpleDataLoader } from '@/composeable/SimpleDataLoader';
-import PolicyContent from '@/api/introduction/PolicyContent';
 import CommonContent, { GetColumListParams, GetContentListParams } from '@/api/CommonContent';
-import DateUtils from '@/common/utils/DateUtils';
 import SimplePageContentLoader from '@/components/content/SimplePageContentLoader.vue';
 import { NO_CONTENT_STRING } from '@/common/ConstStrings';
 import IndexContent from '@/api/introduction/IndexContent';
-import { Item } from 'ant-design-vue/es/menu';
 
 const { navTo } = usePageAction();
 
@@ -264,7 +259,6 @@ const carousel3Config = ref({
   wrapAround: true,
   autoplay: 3000,
 });
-const carousel3Ref = ref<any>(null);
 
 onMounted(() => {
   if (window.innerWidth <= 435) {
@@ -286,7 +280,10 @@ const statsData = useSimpleDataLoader(async () => {
       datas: data.ichData.map((item: any) => {
         return {
           title: item.level_text,
-          value: item.total
+          value: item.total,
+          onClick: () => {
+            navTo('/inheritor/projects', { level: item.level_text });
+          },
         }
       })
     },
@@ -296,7 +293,10 @@ const statsData = useSimpleDataLoader(async () => {
       datas: data.inheritorData.map((item: any) => {
         return {
           title: item.title,
-          value: item.total
+          value: item.total,
+          onClick: () => {
+            navTo('/inheritor/inheritor', { level: item.title });
+          },
         }
       })
     },

+ 21 - 17
src/views/details/TabDetailView.vue

@@ -28,29 +28,33 @@
           />
           <!-- 基础信息 -->
           <div v-if="currentTabId==0">
-            <!-- 轮播 -->
-            <Carousel 
-              :itemsToShow="1"
-              wrapAround
-              :autoPlay="5000"
-              class="carousel float"
-            >
-              <Slide v-for="(image, key) in loader.content.value.images" :key="key">
-                <img :src="image" />
-              </Slide>
-              <template #addons>
-                <Navigation />
-                <Pagination />
-              </template>
-            </Carousel>
-            <slot name="extraInfo" :content="loader.content.value" />
             <SimpleRichHtml 
               class="news-content"
               :contents="[
                 loader.content.value.intro,
                 loader.content.value.content,
               ]" 
-            />
+            >
+              <template #prepend>
+                <!-- 轮播 -->
+                <Carousel 
+                  :itemsToShow="1"
+                  wrapAround
+                  :autoPlay="5000"
+                  class="carousel float"
+                >
+                  <Slide v-for="(image, key) in loader.content.value.images" :key="key">
+                    <img :src="image" />
+                  </Slide>
+                  <template #addons>
+                    <Navigation />
+                    <Pagination />
+                  </template>
+                </Carousel>
+                <!-- 额外内容 -->
+                <slot name="extraInfo" :content="loader.content.value" />
+              </template>
+            </SimpleRichHtml>
           </div>
           <!-- 图片 -->
           <div v-else-if="currentTabId==1">

+ 5 - 12
src/views/inheritor/inheritor.vue

@@ -7,8 +7,6 @@
     :pageSize="8"
     :load="loadData"
     :loadDetail="loadDetail"
-    :tagsData="tagsData"
-    :defaultSelectTag="tagsData[0].id"
     detailsPage="/inheritor/intangible-detail"
   />
 </template>
@@ -19,6 +17,7 @@ import InheritorContent from '@/api/inheritor/InheritorContent';
 import IndexContent from '@/api/introduction/IndexContent';
 import type { DropDownNames } from '@/components/content/CommonListPage.vue';
 import { onMounted, ref } from 'vue';
+import { useRoute } from 'vue-router';
 
 async function loadDetail(id: number, item: any) {
   item = await InheritorContent.getContentDetail(id);
@@ -65,25 +64,19 @@ async function loadData(
 }
 
 const dropdownNames = ref<DropDownNames[]>([]);
-//子分类
-const tagsData = ref([
-  { id: 0, name: '全部' },
-]);
+const route = useRoute();
 
 onMounted(async () => {
-  // tagsData.value = tagsData.value.concat((await IndexContent.getCategoryList(4)).map((item) => ({
-  //   id: item.id,
-  //   name: item.title,
-  // })));
+  const levels = await IndexContent.getCategoryList(2);
   dropdownNames.value.push({ 
     options: [{
       id: 0, 
       name: '全部'
-    }].concat((await IndexContent.getCategoryList(2)).map((item) => ({
+    }].concat(levels.map((item) => ({
       id: item.id,
       name: item.title,
     }))),
-    defaultSelectedValue: 0,
+    defaultSelectedValue: (route.query.level ? levels.find(p => p.title == route.query.level)?.id : undefined) ?? 0,
   });
   dropdownNames.value.push({ 
     options: [{

+ 5 - 2
src/views/inheritor/projects.vue

@@ -18,6 +18,7 @@ import CommonContent, { GetContentListParams } from '@/api/CommonContent';
 import ProjectsContent from '@/api/inheritor/ProjectsContent';
 import type { DropDownNames } from '@/components/content/CommonListPage.vue';
 import { onMounted, ref } from 'vue';
+import { useRoute } from 'vue-router';
 
 async function loadDetail(id: number, _item: any) {
   const item = await ProjectsContent.getContentDetail(id);
@@ -68,21 +69,23 @@ const dropdownNames = ref<DropDownNames[]>([]);
 const tagsData = ref([
   { id: 0, name: '全部' },
 ]);
+const route = useRoute();
 
 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((await CommonContent.getCategoryList(2)).map((item) => ({
+    }].concat(levels.map((item) => ({
       id: item.id,
       name: item.title,
     }))),
-    defaultSelectedValue: 0,
+    defaultSelectedValue: (route.query.level ? levels.find(p => p.title == route.query.level)?.id : undefined) ?? 0,
   });
   dropdownNames.value.push({ 
     options: [{