Browse Source

+ 文件预览列表

chen.cheng 11 months ago
parent
commit
74f54e9ead

+ 15 - 0
common/EnumConst.js

@@ -6,3 +6,18 @@ export const ICON_CFG = {
   file_icon: '/profile/upload/2024/08/17/file_icon_20240817121536A002.svg',
   login_bg: '/profile/upload/2024/08/17/head-bg_20240817230007A002.png',
 };
+
+export const FILE_ICON = {
+  doc: '/profile/upload/2024/08/20/word_20240820110735A012.svg',
+  docx: '/profile/upload/2024/08/20/word_20240820110735A012.svg',
+  xls: '/profile/upload/2024/08/20/excel_20240820110613A006.svg',
+  xlsx: '/profile/upload/2024/08/20/excel_20240820110613A006.svg',
+  txt: '/profile/upload/2024/08/20/text_20240820110711A010.svg',
+  text: '/profile/upload/2024/08/20/text_20240820110711A010.svg',
+  ppt: '/profile/upload/2024/08/20/ppt_20240820110657A009.svg',
+  pptx: '/profile/upload/2024/08/20/ppt_20240820110657A009.svg',
+  pdf: '/profile/upload/2024/08/20/pdf_20240820110643A008.svg',
+  png: '/profile/upload/2024/08/20/image_20240820110632A007.svg',
+  mp4: '/profile/upload/2024/08/20/video_20240820110721A011.svg',
+  defIcon: '/profile/upload/2024/08/17/file_icon_20240817121536A002.svg'
+};

+ 2 - 1
manifest.json

@@ -107,7 +107,8 @@
             "subPackages" : true
         },
         "usingComponents" : true,
-        "mergeVirtualHostAttributes" : true
+        "mergeVirtualHostAttributes" : true,
+        "lazyCodeLoading": "requiredComponents"
     },
     "mp-alipay" : {
         "usingComponents" : true,

+ 13 - 1
pages.json

@@ -27,7 +27,7 @@
         {
           "path": "pages/detail/index",
           "style": {
-            "navigationBarTitleText": "最新资讯"
+            "navigationBarTitleText": ""
           }
         }
       ]
@@ -67,6 +67,18 @@
           }
         }
       ]
+    },
+    {
+      "root": "pasb",
+      "name": "sub-5",
+      "pages": [
+        {
+          "path": "pages/meeting-info/index",
+          "style": {
+            "navigationBarTitleText": "大会介绍"
+          }
+        }
+      ]
     }
   ],
   "globalStyle": {

+ 1 - 0
pages/tabbar/index/index.vue

@@ -82,6 +82,7 @@ export default {
       const res = await fetchContentInfo({
         pageNum: 1,
         pageSize: 99,
+        contentType: 1,
       });
       this.indexList = res.rows.map(item => {
         return {

+ 1 - 2
pasb/pages/detail/index.scss

@@ -1,8 +1,7 @@
 .content-info-container {
   width: 90%;
   margin: 20rpx auto;
-  padding: 0;
-
+  padding: 0 0 100rpx 0;
   .title-container {
     width: 100%;
 

+ 3 - 0
pasb/pages/detail/index.vue

@@ -80,6 +80,9 @@ export default {
       } = await fetchContentDetail(this.queryParams.id);
       this.content = content;
       this.title = title;
+      uni.setNavigationBarTitle({
+        title
+      })
       this.date = uni.$u.timeFormat(createTime, 'yyyy-mm-dd');
     },
   },

+ 4 - 3
pasb/pages/file/index.vue

@@ -2,16 +2,16 @@
   <view class="file-info-container">
     <view class="u-page">
       <u-list
+          v-if="indexList.length>0"
           @scrolltolower="scrolltolower"
       >
         <u-list-item
             v-for="(item, index) in indexList"
             :key="index"
-
         >
           <view class="file-info-item" @click="onItemClick(item)">
             <view class="file-info-item-img">
-              <image :src="getImageUrl(ICON_CFG.file_icon)" mode="aspectFill" />
+              <image :src="fileIcon(item.fileExt)" mode="aspectFill" />
             </view>
             <view class="file-info-item-content">
               <view class="file-info-item-title">{{ item.title }}</view>
@@ -29,7 +29,7 @@
 
 import { fetchFileList } from '@/common/api';
 import { ICON_CFG } from '@/common/EnumConst';
-import { getImageUrl, viewFileFn } from '@/util';
+import { fileIcon, getImageUrl, viewFileFn } from '@/util';
 
 let page = 1;
 export default {
@@ -48,6 +48,7 @@ export default {
     this.loadmore();
   },
   methods: {
+    fileIcon,
     getImageUrl,
     onItemClick(item) {
       viewFileFn(getImageUrl(item.uri), item.title, `.${item.fileExt}`);

+ 6 - 0
pasb/pages/meeting-info/index.scss

@@ -0,0 +1,6 @@
+@import "common/common.scss";
+.meeting-info-container {
+
+}
+
+

+ 67 - 0
pasb/pages/meeting-info/index.vue

@@ -0,0 +1,67 @@
+<template>
+  <view class="meeting-info-container">
+    <view class="search-content">
+      <u-search placeholder="请输入关键字" v-model="keyword" @custom="onSearch" @search="onSearch"></u-search>
+    </view>
+    <view class="u-page">
+      <item-list :ds="indexList" :onItemClick="onContentClick" />
+    </view>
+  </view>
+</template>
+
+<script>
+import { fetchContentInfo } from '@/common/api';
+import ItemList from '@/components/ItemList/index.vue';
+import { getImageUrl } from '@/util';
+
+export default {
+  components: {
+    ItemList,
+  },
+  data() {
+    return {
+      keyword: '',
+      indexList: [],
+    };
+  },
+  onLoad() {
+    this.loadmore();
+  },
+  methods: {
+    onContentClick(item) {
+      uni.navigateTo({
+        url: `/pasb/pages/detail/index?id=${item.id}`,
+      });
+    },
+    async loadmore(keyword = '') {
+      const res = await fetchContentInfo({
+        pageNum: 1,
+        pageSize: 99,
+        contentType: 3,
+        title: keyword,
+      });
+      this.indexList = res.rows.map(item => {
+        return {
+          id: item.id,
+          imgUrl: getImageUrl(item.thumbnail),
+          title: item.title,
+          date: item.createTime,
+        };
+      });
+    },
+    onSearch(val) {
+      this.loadmore(val);
+    },
+  },
+  onShareAppMessage() {
+    return {
+      title: 'First UI组件库',
+    };
+  },
+};
+</script>
+
+<style lang="scss" src="./index.scss">
+
+
+</style>

+ 10 - 0
util/index.js

@@ -1,3 +1,5 @@
+import { FILE_ICON } from '@/common/EnumConst';
+
 export const getImageUrl = (uri) => {
   return `${process.env.UNI_FILE_PREFIX}${uri}`;
 };
@@ -81,3 +83,11 @@ export const authLogin = (callback) => {
   }
   callback(user);
 };
+
+export const fileIcon = (fileSuffix) => {
+  let icon = '';
+  if (FILE_ICON[fileSuffix]) {
+    return getImageUrl(FILE_ICON[fileSuffix]);
+  }
+  return getImageUrl(FILE_ICON.defIcon);
+};