xiaohaizhao 1 месяц назад
Родитель
Сommit
d1c85bd0e5

+ 2 - 1
.gitignore

@@ -1,2 +1,3 @@
 dist
-node_modules
+node_modules
+.claude

+ 6 - 9
src/MAR/archivesMag/modules/workManage/add.vue

@@ -41,18 +41,15 @@
           </a-col>
           <a-col :span="24">
             <a-form-item label="文件类型" name="filetype" :rules="[{ required: true, message: '请选择文件类型',trigger:'change'}]">
-              <a-select
-                ref="select"
+              <a-radio-group
                 v-model:value="form.filetype"
-                placeholder="选择文件类型"
-                style="width: 150px"
                 @change="form.attinfos = ''"
               >
-                <a-select-option value="视频">视频</a-select-option>
-                <a-select-option value="图文">图文</a-select-option>
-                <a-select-option value="音频">音频</a-select-option>
-                <a-select-option value="ppt">PPT</a-select-option>
-              </a-select>
+                <a-radio value="视频">视频</a-radio>
+                <a-radio value="图文">图文</a-radio>
+                <a-radio value="音频">音频</a-radio>
+                <a-radio value="ppt">PPT</a-radio>
+              </a-radio-group>
             </a-form-item>
           </a-col>
           <a-col :span="24">

+ 6 - 9
src/MAR/archivesMag/modules/workManage/edit.vue

@@ -52,19 +52,16 @@
           </a-col>
           <a-col :span="24">
             <a-form-item label="文件类型" name="filetype" :rules="[{ required: true, message: '请选择文件类型',trigger:'change'}]">
-              <a-select
+              <a-radio-group
                 disabled
-                ref="select"
                 v-model:value="form.filetype"
-                placeholder="选择文件类型"
-                style="width: 150px"
                 @change="form.attinfos = []"
               >
-                <a-select-option value="视频">视频</a-select-option>
-                <a-select-option value="图文">图文</a-select-option>
-                <a-select-option value="音频">音频</a-select-option>
-                <a-select-option value="ppt">PPT</a-select-option>
-              </a-select>
+                <a-radio value="视频">视频</a-radio>
+                <a-radio value="图文">图文</a-radio>
+                <a-radio value="音频">音频</a-radio>
+                <a-radio value="ppt">PPT</a-radio>
+              </a-radio-group>
             </a-form-item>
           </a-col>
           <a-col :span="24">

+ 25 - 2
src/MAR/assetsStore/detail/index.vue

@@ -3,7 +3,7 @@
     <detail-template
       :headData="mainAreaData"
       :title="mainData.title"
-      :tabs="[`${mainData.type == 1 ? '图片管理' : mainData.type == 2 ? '视频管理' : mainData.type == 3 ? '图文管理' : '文档管理'}`, '详细信息']"
+      :tabs="[`${mainData.type == 1 ? '图片管理' : mainData.type == 2 ? '视频管理' : mainData.type == 3 ? '富文本内容' : '文档管理'}`, '详细信息']"
       ownertable="sat_sharematerial"
       :disable="utils.isDisabled(mainData.status, ['发布'])"
       :delParam="{
@@ -85,12 +85,15 @@
         </a-descriptions>
       </template>
       <template #tab0>
+        <!-- 富文本类型显示内容,其他类型显示文件管理 -->
+        <div v-if="mainData.type == 3" id="rich-text-content"></div>
         <photoWall
+          v-else
           :attinfos="mainData.attinfos_pic"
           :fileType="mainData.type"
           :disabled="mainData.status == '发布'"
           ownertable="sat_sharematerial"
-          :ownerid="mainData.sat_sharematerialid"
+          :ownerid="mainData.sat_share_materialid"
         />
       </template>
       <template #tab1>
@@ -150,9 +153,29 @@ const mianData = async () => {
     },
   });
   res.data.attinfos = utils.fileList(res.data.attinfos);
+  // 根据 type 筛选对应的文件类型
+  if (res.data.type == 1) {
+    res.data.attinfos_pic = res.data.attinfos.filter(v => v.fileType === 'image');
+  } else if (res.data.type == 2) {
+    res.data.attinfos_pic = res.data.attinfos.filter(v => v.fileType === 'video');
+  } else if (res.data.type == 3) {
+    // 富文本类型,不显示文件
+    res.data.attinfos_pic = [];
+  } else {
+    res.data.attinfos_pic = res.data.attinfos.filter(v => v.fileType !== 'image' && v.fileType !== 'video');
+  }
   mainData.value = res.data;
   console.log("mainData", mainData.value);
   changeDataStructure(res.data);
+  // 富文本类型显示内容
+  if (mainData.value.type == 3) {
+    nextTick(() => {
+      const contentDiv = document.getElementById('rich-text-content');
+      if (contentDiv && mainData.value.content) {
+        contentDiv.innerHTML = mainData.value.content;
+      }
+    });
+  }
 
   baseInfo.value = [
     { label: "标题", value: mainData.value.title },

+ 1 - 1
src/MAR/assetsStore/index.vue

@@ -6,7 +6,7 @@
     </template>
     <template #tb_cell="{data}">
       <template v-if="data.column.dataIndex === 'type'">
-        {{ data.record.type == 1 ? '图片' : data.record.type == 2 ? '视频' : data.record.type == 3 ? '图文' : '文档' }}
+        {{ data.record.type == 1 ? '图片' : data.record.type == 2 ? '视频' : data.record.type == 3 ? '富文本' : '文档' }}
       </template>
       <template v-if="data.column.dataIndex === 'attinfos'">
         <a-image style="width:100px;height: 100px" :src="data.record.attinfos.filter(item => item.usetype=='avatar')[0].cover" :preview="{src:data.record.attinfos.filter(item => item.usetype=='avatar')[0].url}" v-if="data.record.attinfos.filter(item => item.usetype=='avatar').length"></a-image>

+ 39 - 13
src/components/photoWall/index.vue

@@ -106,7 +106,7 @@
             style="display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; cursor: pointer;"
             @click="downloadFile(item)"
           >
-            <FileOutlined :style="{ fontSize: (baseSize > 100 ? '48px' : '36px'), color: '#1890ff' }" />
+            <component :is="getFileIcon(item)" :style="{ fontSize: (baseSize > 100 ? '48px' : '36px'), color: '#1890ff' }" />
             <div style="font-size: 12px; color: #666; margin-top: 8px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 90%;">
               {{ item.document || '文件' }}
             </div>
@@ -125,7 +125,7 @@ import { ref, reactive, defineProps, watch, computed } from "vue";
 import Api from "@/api/api";
 import Up from "@/api/upload";
 import utils from "@/utils/utils";
-import { DeleteOutlined, FileOutlined } from "@ant-design/icons-vue";
+import { DeleteOutlined, FileOutlined, FileTextOutlined, PlayCircleOutlined } from "@ant-design/icons-vue";
 import { Empty } from "ant-design-vue";
 
 const simpleImage = Empty.PRESENTED_IMAGE_SIMPLE;
@@ -219,6 +219,24 @@ function isImageFile(item) {
   return item.fileType.toLowerCase() === 'image';
 }
 
+// 根据文件类型返回对应图标组件
+function getFileIcon(item) {
+  if (!item) return FileTextOutlined;
+  const type = (item.fileType || '').toLowerCase();
+  if (type === 'image') return FileOutlined;
+  if (type === 'video') return PlayCircleOutlined;
+  // 根据文件扩展名判断文档类型
+  const filename = item.document || item.filename || '';
+  if (filename) {
+    const ext = filename.toLowerCase().split('.').pop();
+    const videoExts = ['mp4', 'webm', 'ogg', 'mov', 'avi'];
+    const imageExts = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
+    if (videoExts.includes(ext)) return PlayCircleOutlined;
+    if (imageExts.includes(ext)) return FileOutlined;
+  }
+  return FileTextOutlined;
+}
+
 // 格式化文件大小
 function getFileSize(size) {
   if (!size) return '未知大小';
@@ -319,12 +337,12 @@ function beforeUpload(file) {
             list.value[file.sequence] = getList.data
               .filter((v) => v.attachmentid == attachmentid)
               .map((v) => {
-                v = Object.assign(v, v.attinfos[0]);
-                delete v.attinfos;
-                v.cover = props.coverType
-                  ? v.subfiles.find((s) => s.type == props.coverType).url ||
-                    v.url
-                  : v.url;
+                if (v.attinfos && v.attinfos.length) {
+                  v = Object.assign(v, v.attinfos[0]);
+                  delete v.attinfos;
+                }
+                const subfile = v.subfiles && v.subfiles.length ? v.subfiles.find((s) => s.type == props.coverType) : null;
+                v.cover = props.coverType && subfile ? subfile.url : v.url;
                 return v;
               })[0];
           });
@@ -342,15 +360,23 @@ watch(
 );
 function init(attinfos, pic = props.pic) {
   if(!attinfos.length) return;
-  list.value = pic ? attinfos : attinfos.filter((v) => v.fileType == "image");
+  const fileType = Number(props.fileType);
+  if (pic) {
+    list.value = attinfos;
+  } else if (fileType === 1) {
+    list.value = attinfos.filter((v) => v.fileType == "image");
+  } else if (fileType === 2) {
+    list.value = attinfos.filter((v) => v.fileType == "video");
+  } else {
+    list.value = attinfos;
+  }
   list.value = list.value.map((v) => {
-    if (pic) {
+    if (pic && v.attinfos && v.attinfos.length) {
       v = Object.assign(v, v.attinfos[0]);
       delete v.attinfos;
     }
-    v.cover = props.coverType
-      ? v.subfiles.find((s) => s.type == props.coverType).url || v.url
-      : v.url;
+    const subfile = v.subfiles && v.subfiles.length ? v.subfiles.find((s) => s.type == props.coverType) : null;
+    v.cover = props.coverType && subfile ? subfile.url : v.url;
     return v;
   });
   if (