feat: 添加文件类型扩展名常量和优化表格列显示
- 在 `constants.ts` 中添加图像、视频和文档的文件扩展名常量 - 更新 `add-raw-material-drawer/index.vue` 和 `table/index.vue` 组件,引入新的文件扩展名常量 - 在 `table/index.vue` 中新增“标签”列,并优化“名称”列的宽度和图标显示逻辑
This commit is contained in:
@ -5,21 +5,22 @@ const { Column } = Table;
|
||||
const { TextArea } = Input;
|
||||
const { Option } = Select;
|
||||
|
||||
import CommonSelect from '@/components/common-select';
|
||||
// import CommonSelect from '@/components/common-select';
|
||||
import ImgLazyLoad from '@/components/img-lazy-load';
|
||||
import TextOverTips from '@/components/text-over-tips';
|
||||
// import TextOverTips from '@/components/text-over-tips';
|
||||
|
||||
import axios from 'axios';
|
||||
import { formatFileSize, getVideoInfo, getFileExtension } from '@/utils/tools';
|
||||
import { getRawMaterialTagsList, postBatchRawMaterial, posRawMaterialTags } from '@/api/all/generationWorkshop';
|
||||
import { getFilePreSignedUrl } from '@/api/all/common';
|
||||
import {
|
||||
imageExtensions,
|
||||
videoExtensions,
|
||||
documentExtensions,
|
||||
} from '@/views/material-center/components/raw-material/constants';
|
||||
|
||||
import icon1 from '@/assets/img/media-account/icon-delete.png';
|
||||
import icon2 from '../../img/icon-no-text.png';
|
||||
import axios from 'axios';
|
||||
|
||||
const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp'];
|
||||
const videoExtensions = ['.mp4', '.mov', '.avi', '.flv', '.wmv', '.m4v'];
|
||||
const documentExtensions = ['.txt', '.doc', '.docx', '.pdf', '.xls', '.xlsx'];
|
||||
|
||||
enum EnumUploadStatus {
|
||||
done = 'done',
|
||||
@ -319,7 +320,7 @@ export default defineComponent({
|
||||
title="文件名称"
|
||||
dataIndex="name"
|
||||
key="name"
|
||||
width={385}
|
||||
width={380}
|
||||
ellipsis={true}
|
||||
customRender={({ text, record }) => {
|
||||
return (
|
||||
|
||||
@ -33,8 +33,13 @@
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'name'" #customRender="{ record }">
|
||||
<div class="flex items-center">
|
||||
<HoverImagePreview :src="record.cover">
|
||||
<ImgLazyLoad :width="64" :height="64" :src="record.cover" class="!rounded-6px mr-16px" />
|
||||
<HoverImagePreview :src="record.type === RawMaterialType.Text ? icon2 : record.cover">
|
||||
<ImgLazyLoad
|
||||
:height="64"
|
||||
:src="record.type === RawMaterialType.Text ? icon2 : record.cover"
|
||||
:width="64"
|
||||
class="!rounded-6px mr-16px"
|
||||
/>
|
||||
</HoverImagePreview>
|
||||
<div class="flex-1 flex flex-col overflow-hidden">
|
||||
<TextOverTips :context="record.name" :line="1" class="cts mb-4px regular" />
|
||||
@ -45,6 +50,17 @@
|
||||
<template v-else-if="column.dataIndex === 'type'" #customRender="{ record }">
|
||||
{{ TABS_LIST.find((item) => item.value === record.type)?.label ?? '-' }}
|
||||
</template>
|
||||
<template v-else-if="column.dataIndex === 'tags'" #customRender="{ record }">
|
||||
<div class="flex flex-wrap gap-4px">
|
||||
<Tag
|
||||
v-for="tag in record.tags"
|
||||
:key="tag.id"
|
||||
class="mr-0 h-22px lh-22px rounded-4px bg-#F2F3F5 max-w-76px px-8px"
|
||||
>
|
||||
<TextOverTips :context="tag.name" :line="1" class="cts !color-#55585F" />
|
||||
</Tag>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="column.dataIndex === 'size'" #customRender="{ record }">
|
||||
<span class="cts num">{{ formatFileSize(record.size) }}</span>
|
||||
</template>
|
||||
@ -72,11 +88,11 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { Button, Tooltip, Table, Image } from 'ant-design-vue';
|
||||
import { Button, Tooltip, Table, Tag } from 'ant-design-vue';
|
||||
const { Column } = Table;
|
||||
import { formatTableField, exactFormatTime, formatFileSize, downloadByUrl } from '@/utils/tools';
|
||||
import { slsWithCatch } from '@/utils/stroage.ts';
|
||||
import { TABS_LIST, ORIGIN_LIST } from '../../constants';
|
||||
import { TABS_LIST, ORIGIN_LIST, RawMaterialType } from '../../constants';
|
||||
|
||||
import TextOverTips from '@/components/text-over-tips';
|
||||
// import ShareModal from '@/views/material-center/components/finished-products/manuscript/components/share-manuscript-modal/share-modal.vue';
|
||||
@ -84,9 +100,7 @@ import HoverImagePreview from '@/components/hover-image-preview';
|
||||
import ImgLazyLoad from '@/components/img-lazy-load';
|
||||
|
||||
import icon1 from '@/assets/img/media-account/icon-delete.png';
|
||||
// import icon2 from '@/assets/img/creative-generation-workshop/icon-photo.png';
|
||||
// import icon3 from '@/assets/img/creative-generation-workshop/icon-video.png';
|
||||
// import icon4 from '@/assets/img/error-img.png';
|
||||
import icon2 from '../../img/icon-no-text.png';
|
||||
|
||||
const emits = defineEmits(['sorterChange', 'delete', 'select', 'selectAll']);
|
||||
const router = useRouter();
|
||||
|
||||
@ -5,6 +5,10 @@ export enum RawMaterialType {
|
||||
Text = 2,
|
||||
}
|
||||
|
||||
export const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.bmp'];
|
||||
export const videoExtensions = ['.mp4', '.mov', '.avi', '.flv', '.wmv', '.m4v'];
|
||||
export const documentExtensions = ['.txt', '.doc', '.docx', '.pdf', '.xls', '.xlsx'];
|
||||
|
||||
export const TABS_LIST = [
|
||||
{
|
||||
label: '全部',
|
||||
@ -55,6 +59,11 @@ export const TABLE_COLUMNS = [
|
||||
dataIndex: 'type',
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
title: '标签',
|
||||
dataIndex: 'tags',
|
||||
width: 190,
|
||||
},
|
||||
{
|
||||
title: '来源',
|
||||
dataIndex: 'origin',
|
||||
@ -83,5 +92,5 @@ export const TABLE_COLUMNS = [
|
||||
dataIndex: 'operation',
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
}
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user