feat: 钉钉、企业微信webbook

This commit is contained in:
2026-07-20 15:05:34 +08:00
parent 316bbabcd1
commit 2e7bc80a11
46 changed files with 6852 additions and 7 deletions

View File

@@ -8,11 +8,17 @@ const props = withDefaults(
multiple?: boolean;
maxCount?: number;
disabled?: boolean;
/**
* 限制可选择的文件类型(透传给 image-gallery-picker,按 xk_file_type.value 过滤)
* 例如图片:[1];文件:[6];语音:[3]
*/
acceptTypes?: number[];
}>(),
{
multiple: false,
maxCount: 1,
disabled: false,
acceptTypes: () => [] as number[],
},
);
@@ -41,6 +47,7 @@ function onSelect(urls: string[]) {
v-model:open="galleryOpen"
:multiple="multiple"
:max-count="maxCount"
:accept-types="acceptTypes"
@select="onSelect"
/>
</div>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, watch } from 'vue';
import { computed, ref, watch } from 'vue';
import { Empty, Input, Modal, Pagination, Spin, Tabs } from 'ant-design-vue';
@@ -14,10 +14,18 @@ const props = withDefaults(
open: boolean;
multiple?: boolean;
maxCount?: number;
/**
* 限制可选择的文件类型(按 xk_file_type.value 过滤)
* - 不传:显示全部类型(默认行为,保持向后兼容)
* - 传数组:只展示指定类型 tab,且自动锁定到第一个匹配的类型
* 例如图片:[1];图片+视频:[1, 2];文件:[6]
*/
acceptTypes?: number[];
}>(),
{
multiple: false,
maxCount: 1,
acceptTypes: () => [] as number[],
},
);
@@ -44,6 +52,39 @@ const {
typesLoading,
} = useFileGalleryFilter('file-picker-active-type');
/**
* 实际渲染的 tabs(按 acceptTypes 过滤)
* - acceptTypes 为空:返回 tabs 原始值(含「全部」+ 所有类型)
* - acceptTypes 非空:只保留匹配的类型 tab(不含「全部」,强制选具体类型)
*/
const visibleTabs = computed(() => {
if (!props.acceptTypes || props.acceptTypes.length === 0) {
return tabs.value;
}
return tabs.value.filter(
(tab) => tab.value !== -1 && props.acceptTypes.includes(Number(tab.value)),
);
});
/**
* acceptTypes 变化时锁定到第一个匹配的类型(避免停留在「全部」导致看到非目标类型文件)
*/
watch(
() => props.acceptTypes,
(arr) => {
if (!arr || arr.length === 0) {
return;
}
if (arr.includes(activeType.value)) {
return;
}
setActiveType(arr[0]!);
page.value = 1;
void load();
},
{ immediate: true },
);
let searchTimer: ReturnType<typeof setTimeout> | null = null;
async function load() {
@@ -155,7 +196,7 @@ function itemIcon(item: FileGalleryItem) {
@cancel="handleCancel"
>
<Tabs :active-key="String(activeType)" size="small" @change="onTabChange">
<Tabs.TabPane v-for="tab in tabs" :key="String(tab.value)">
<Tabs.TabPane v-for="tab in visibleTabs" :key="String(tab.value)">
<template #tab>
<span class="tab-label">
<MIcon v-if="tab.icon" :icon="tab.icon" size="12" />