ow
This commit is contained in:
1 parent
2b963e4bfe
commit
501c92d87c
13 files changed
+2374
-322
No files matched your search
@@ -21,7 +21,7 @@
|
||||
@click="onDownload"></a-button>
|
||||
</a-tooltip>
|
||||
</a-col>
|
||||
<a-col :span="2" v-if="!isDirectorySelected && isSingleItem">
|
||||
<a-col :span="2" v-if="!isDirectorySelected && (isSingleItem || isSameMediaTypeSelected)">
|
||||
<a-tooltip title="共享">
|
||||
<a-button class="nav-btn" :icon="h(ShareAltOutlined)" @click="onShare"></a-button>
|
||||
</a-tooltip>
|
||||
@@ -46,7 +46,7 @@
|
||||
</a-popconfirm>
|
||||
</a-tooltip>
|
||||
</a-col>
|
||||
<a-col :span="2" v-if="!isDirectorySelected && isSingleItem">
|
||||
<a-col :span="2" v-if="!isDirectorySelected && (isSingleItem || isSameMediaTypeSelected)">
|
||||
<a-tooltip :title="publishTooltip">
|
||||
<a-button class="nav-btn" :icon="h(NotificationOutlined)" @click="onPublish"></a-button>
|
||||
</a-tooltip>
|
||||
@@ -109,6 +109,7 @@ import {
|
||||
} from "@ant-design/icons-vue";
|
||||
import { DmsFileUploadViewDisplayData } from "@/data/auto/dmsFileUploadViewDisplayData";
|
||||
import FileUpload from "@/components/basic/FileUpload.vue";
|
||||
import fileTypePolicy from "@/policy/custom/fileTypePolicy";
|
||||
|
||||
const props = defineProps<{
|
||||
selectedItems: DmsFileUploadViewDisplayData[];
|
||||
@@ -180,6 +181,29 @@ const isSingleAudio = computed(() => {
|
||||
return isSingleItem.value && isAudio(selectedOrderKey.value);
|
||||
});
|
||||
|
||||
/**
|
||||
* 识别媒体类型,兼顾本地扩展名判断与全局 fileTypePolicy,
|
||||
* 保证与发布时的类型判断一致。
|
||||
*/
|
||||
const mediaKind = (key: string): "image" | "video" | "audio" | "" => {
|
||||
if (isImage(key) || fileTypePolicy.isImage(key)) return "image";
|
||||
if (isVideo(key) || fileTypePolicy.isVideo(key)) return "video";
|
||||
if (isAudio(key) || fileTypePolicy.isAudio(key)) return "audio";
|
||||
return "";
|
||||
};
|
||||
|
||||
/**
|
||||
* 多选时选中项是否全部属于同一媒体类型(图片/视频/音频)。
|
||||
* 满足时允许批量共享与发布。
|
||||
*/
|
||||
const isSameMediaTypeSelected = computed(() => {
|
||||
const items = props.selectedItems;
|
||||
if (items.length <= 1) return false;
|
||||
const kinds = items.map((x) => mediaKind(x.OrderKey || x.OrgFileName || ""));
|
||||
const kind = kinds[0];
|
||||
return kind !== "" && kinds.every((k) => k === kind);
|
||||
});
|
||||
|
||||
const publishTooltip = computed(() => {
|
||||
if (isImage(selectedOrderKey.value)) return "发布相册";
|
||||
if (isVideo(selectedOrderKey.value)) return "发布影视专辑";
|
||||
|
||||
Reference in new issue
Block a user