快乐的梦鱼 3 weken geleden
bovenliggende
commit
a4fc78c605

+ 1 - 1
src/api/RequestModules.ts

@@ -175,7 +175,7 @@ export function reportError<T extends DataModel>(instance: RequestCoreInstance<T
 export class AppServerRequestModule<T extends DataModel> extends RequestCoreInstance<T> {
   constructor() {
     super(WebFetchImplementer);
-    this.config.baseUrl = ApiCofig.serverProd;
+    this.config.baseUrl = 'https://mn.wenlvti.net/api',//ApiCofig.serverProd;
     this.config.errCodes = []; //
     this.config.requestInceptor = requestInceptor;
     this.config.responseDataHandler = responseDataHandler;

+ 65 - 0
src/api/introduction/IndexContent.ts

@@ -0,0 +1,65 @@
+import { DataModel, transformArrayDataModel } from '@imengyu/js-request-transform';
+import { CommonContentApi } from '../CommonContent';
+
+export class IndexStats extends DataModel<IndexStats> {
+  constructor() {
+    super(IndexStats, "内容详情");
+    this.setNameMapperCase('Camel', 'Snake');
+    this._convertTable = {
+      crData: { clientSide: 'forceArray' },
+      minnanCr: { clientSide: 'forceArray' },
+      historyData: { clientSide: 'forceArray' },
+      inheritorData: { clientSide: 'forceArray' },
+      ichData: { clientSide: 'forceArray' },
+      ichCenter: { clientSide: 'forceArray' },
+      villageData: { clientSide: 'forceArray' }
+    }
+  }
+
+  crData: any;
+  minnanCr: any;
+  historyData: any;
+  inheritorData: any;
+  ichData: any;
+  ichCenter: any;
+  villageData: any;
+}
+export class IndexBanner extends DataModel<IndexBanner> {
+  constructor() {
+    super(IndexBanner, "首页轮播");
+    this.setNameMapperCase('Camel', 'Snake');
+    this._convertTable = {}
+  }
+
+  id = '';
+  title = '';
+  image = '';
+  typeText = '';
+  sceneText = '';
+  openTypeText = '';
+  statusText = '';
+}
+
+
+export class IndexContentApi extends CommonContentApi {
+
+  constructor() {
+    super(undefined, 3, "闽南文化概况", 288);
+  }
+
+  async getStats() {
+    return (await this.get('/volunteer/statistics/webData', '闽南文化首页数据统计', {
+    }, IndexStats)).data as IndexStats
+  }
+  async getBanner() {
+    return transformArrayDataModel<IndexBanner>(
+      IndexBanner,
+      (await this.get('/content/banner_function/getotherBanner', '首页轮播图列表', {
+        open_type: 3,
+      })).data as any, 
+      '首页轮播图列表'
+    );
+  }
+}
+
+export default new IndexContentApi();

BIN
src/assets/images/box-spec.png


+ 41 - 2
src/assets/scss/main.scss

@@ -805,6 +805,8 @@ footer {
   margin-bottom: 20px;
 }
 
+/* 小组件 */
+
 .no-news {
   text-align: center;
   font-size: 18px;
@@ -822,6 +824,28 @@ footer {
   outline: none;
   flex-shrink: 0;
 }
+.stats-item {
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  padding: 10px 0;
+  flex: 1;
+
+  &:not(:last-child) {
+    margin-right: 20px;
+    border-right: 1px solid var(--color-border);
+  }
+
+  h3 {
+    font-size: 44px;
+    font-weight: bold;
+    color: var(--color-primary);
+  }
+  span {
+    font-size: 14px;
+  }
+}
 
 @media (max-width: 992px) {
   .featured-image {
@@ -846,6 +870,14 @@ footer {
     }
   }
 }
+@media (max-width: 1190px) {
+  header .logo .col span {
+    width: 40px;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+  }
+}
 
 .swiper-slide {
   img {
@@ -853,13 +885,20 @@ footer {
   }
 }
 
-@media (max-width: 768px) { 
+@media (max-width: 956px) { 
   header { 
     .inner {
       padding: 0 30px;
     }
     .logo {
       font-size: 20px;
+      
+      .col span {
+        width: unset;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
+      }
     }
     .mobile-menu-toggle {
       display: unset;
@@ -901,7 +940,7 @@ footer {
   }
 }
 
-@media (max-width: 576px) {
+@media (max-width: 676px) {
   .featured-grid {
     grid-template-columns: 1fr;
   }

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

@@ -134,8 +134,8 @@
     </div>
     <!-- 分页 -->
     <Pagination
-      :currentPage="newsLoader.page.value"
-      :totalPages="newsLoader.totalPages.value"
+      :currPage="newsLoader.page.value"
+      :allPage="newsLoader.totalPages.value"
       @update:currentPage="handleChangePage"
     />
   </div>
@@ -150,7 +150,6 @@ import SimpleInput from '../controls/SimpleInput.vue';
 import SimplePageContentLoader from '@/components/content/SimplePageContentLoader.vue';
 import Pagination from './SimplePagination.vue';
 import TitleDescBlock from './TitleDescBlock.vue';
-import IconSearch from '../icons/IconSearch.vue';
 import ImageTitleBlock from './ImageTitleBlock.vue';
 
 export interface DropdownCommonItem {

+ 1 - 0
src/components/content/CommonListPage.vue

@@ -41,6 +41,7 @@
       </a-breadcrumb>
     </template>
     <template #content>
+      <slot name="contentPre"></slot>
       <CommonListBlock v-bind="props"></CommonListBlock>
     </template>
   </PageContainer>

+ 22 - 0
src/pages/inheritor/components/HeaderBox.vue

@@ -0,0 +1,22 @@
+<template>
+  <div class="header-box">
+    <slot />
+  </div>
+</template>
+
+<style lang="scss">
+.header-box {
+  position: relative;
+  display: flex;
+  flex-direction: row;
+  width: 100%;
+  height: 150px;
+  padding: 20px;
+  border: 45px solid transparent;
+  border-image-source: url('@/assets/images/box-spec.png');
+  border-image-slice: 45;
+  border-image-repeat: stretch;
+  background-size: 100% 100%;
+  background-clip: padding-box;
+}
+</style>

+ 3 - 3
src/pages/inheritor/details/intangible.vue

@@ -185,9 +185,9 @@ async function loadData(id: number) {
   d.contentProps = {
     tabs: [
       { id: 0, text: '简介', visible: true },
-      { id: 1, text: '相册', visible: d.images.length > 0  },
-      { id: 2, text: '音频', visible: Boolean(d.audio) },
-      { id: 3, text: '视频', visible: Boolean(d.video) },
+      { id: 1, text: '相册', visible: false && d.images.length > 0  },
+      { id: 2, text: '音频', visible: false && Boolean(d.audio) },
+      { id: 3, text: '视频', visible: false && Boolean(d.video) },
       { id: 4, text: '非遗作品', visible: Boolean(d.worksList && (d.worksList as any[]).length > 0) },
       { id: 5, text: '非遗传习中心', visible: Boolean(d.ichSitesList && (d.ichSitesList as any[]).length > 0) },
       { id: 6, text: '非遗传承人', visible: Boolean(d.inheritorsList && (d.inheritorsList as any[]).length > 0) },

+ 17 - 1
src/pages/inheritor/inheritor.vue

@@ -17,7 +17,16 @@
     :detailsParams="{
       groupTitle: '非遗传承人',
     }"
-  />
+  >
+    <template #contentPre>
+      <HeaderBox>
+        <div v-for="item in statsItemLoader.content.value" :key="item.id" class="stats-item">
+          <h3>{{ item.total }}</h3>
+          <span>{{ item.title }}</span>
+        </div>
+      </HeaderBox>
+    </template>
+  </CommonListPage>
 </template>
 
 <script setup lang="ts">
@@ -26,6 +35,9 @@ import InheritorContent from '@/api/inheritor/InheritorContent';
 import type { DropDownNames } from '@/components/content/CommonListPage.vue';
 import { onMounted, ref } from 'vue';
 import { useRoute } from 'vue-router';
+import IndexContent from '~/api/introduction/IndexContent';
+import { useSimpleDataLoader } from '~/composeable/SimpleDataLoader';
+import HeaderBox from './components/HeaderBox.vue';
 
 async function loadDetail(id: number, item: any) {
   item = await InheritorContent.getContentDetail(id);
@@ -78,6 +90,10 @@ const tagsData = ref([
   { id: 0, name: '全部' },
 ]);
 const route = useRoute();
+const statsItemLoader =  useSimpleDataLoader(async () => {
+  const stats = (await IndexContent.getStats());
+  return stats.inheritorData.filter((item: any) => item.title != '未定级' && item.total > 0);
+});
 
 onMounted(async () => {
   tagsData.value = tagsData.value.concat((await CommonContent.getCategoryList(4)).map((item) => ({

+ 18 - 1
src/pages/inheritor/intangible.vue

@@ -17,7 +17,16 @@
     :detailsParams="{
       groupTitle: '非遗项目',
     }"
-  />
+  >
+    <template #contentPre>
+      <HeaderBox>
+        <div v-for="item in statsItemLoader.content.value" :key="item.id" class="stats-item">
+          <h3>{{ item.total }}</h3>
+          <span>{{ item.level_text }}</span>
+        </div>
+      </HeaderBox>
+    </template>
+  </CommonListPage>
 </template>
 
 <script setup lang="ts">
@@ -26,6 +35,9 @@ import ProjectsContent from '@/api/inheritor/ProjectsContent';
 import type { DropDownNames } from '@/components/content/CommonListPage.vue';
 import { onMounted, ref } from 'vue';
 import { useRoute } from 'vue-router';
+import HeaderBox from './components/HeaderBox.vue';
+import { useSimpleDataLoader } from '~/composeable/SimpleDataLoader';
+import IndexContent from '~/api/introduction/IndexContent';
 
 async function loadDetail(id: number, _item: any) {
   const item = await ProjectsContent.getContentDetail(id);
@@ -78,6 +90,11 @@ const tagsData = ref([
 ]);
 const route = useRoute();
 
+const statsItemLoader =  useSimpleDataLoader(async () => {
+  const stats = (await IndexContent.getStats());
+  return stats.ichData.filter((item: any) => item.level_text != '未定级');
+});
+
 onMounted(async () => {
   tagsData.value = tagsData.value.concat((await CommonContent.getCategoryList(4)).map((item) => ({
     id: item.id,