|
@@ -40,6 +40,7 @@ export interface AppCardProps {
|
|
|
appId?: string;
|
|
appId?: string;
|
|
|
isCollect?: boolean;
|
|
isCollect?: boolean;
|
|
|
isCreator?: boolean;
|
|
isCreator?: boolean;
|
|
|
|
|
+ isMaintainer?: boolean; // 是否为维护者(非创建者)
|
|
|
|
|
|
|
|
// 显示控制
|
|
// 显示控制
|
|
|
showCreator?: boolean;
|
|
showCreator?: boolean;
|
|
@@ -99,6 +100,7 @@ const AppCard: React.FC<AppCardProps> = (props) => {
|
|
|
appId,
|
|
appId,
|
|
|
isCollect = false,
|
|
isCollect = false,
|
|
|
isCreator = false,
|
|
isCreator = false,
|
|
|
|
|
+ isMaintainer = false,
|
|
|
|
|
|
|
|
// 显示控制
|
|
// 显示控制
|
|
|
showCreator = true,
|
|
showCreator = true,
|
|
@@ -147,7 +149,7 @@ const AppCard: React.FC<AppCardProps> = (props) => {
|
|
|
// 构建操作菜单项
|
|
// 构建操作菜单项
|
|
|
const operationItems: MenuProps['items'] = React.useMemo(() => {
|
|
const operationItems: MenuProps['items'] = React.useMemo(() => {
|
|
|
const items: any[] = [];
|
|
const items: any[] = [];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (onApi) {
|
|
if (onApi) {
|
|
|
items.push({
|
|
items.push({
|
|
|
key: 'api',
|
|
key: 'api',
|
|
@@ -157,7 +159,8 @@ const AppCard: React.FC<AppCardProps> = (props) => {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (isCreator && onEdit) {
|
|
|
|
|
|
|
+ // 创建者或维护者都可以编辑
|
|
|
|
|
+ if ((isCreator || isMaintainer) && onEdit) {
|
|
|
items.push({
|
|
items.push({
|
|
|
key: 'edit',
|
|
key: 'edit',
|
|
|
label: '编辑',
|
|
label: '编辑',
|
|
@@ -166,6 +169,7 @@ const AppCard: React.FC<AppCardProps> = (props) => {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 只有创建者可以删除
|
|
|
if (isCreator && onDelete) {
|
|
if (isCreator && onDelete) {
|
|
|
items.push({
|
|
items.push({
|
|
|
key: 'delete',
|
|
key: 'delete',
|
|
@@ -175,9 +179,9 @@ const AppCard: React.FC<AppCardProps> = (props) => {
|
|
|
onClick: () => onDelete(),
|
|
onClick: () => onDelete(),
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return items;
|
|
return items;
|
|
|
- }, [onApi, onEdit, onDelete, isCreator]);
|
|
|
|
|
|
|
+ }, [onApi, onEdit, onDelete, isCreator, isMaintainer]);
|
|
|
|
|
|
|
|
// 事件处理
|
|
// 事件处理
|
|
|
const handleShareClick = () => {
|
|
const handleShareClick = () => {
|
|
@@ -339,22 +343,35 @@ const AppCard: React.FC<AppCardProps> = (props) => {
|
|
|
{/* 悬停操作按钮层 */}
|
|
{/* 悬停操作按钮层 */}
|
|
|
{showOperations && (
|
|
{showOperations && (
|
|
|
<div className='card-hover-actions'>
|
|
<div className='card-hover-actions'>
|
|
|
- {/* 创建者显示【更多操作】,非创建者显示【API 文档】和【立即使用】 */}
|
|
|
|
|
- {isCreator ? (
|
|
|
|
|
- <Dropdown
|
|
|
|
|
- menu={{ items: operationItems }}
|
|
|
|
|
- trigger={['click']}
|
|
|
|
|
- placement='topLeft'
|
|
|
|
|
- className='card-operation-dropdown'
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ {/* 创建者/维护者显示【更多操作】+【立即使用】,非创建者显示【API 接入】+【立即使用】 */}
|
|
|
|
|
+ {(isCreator || isMaintainer) ? (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <Dropdown
|
|
|
|
|
+ menu={{ items: operationItems }}
|
|
|
|
|
+ trigger={['click']}
|
|
|
|
|
+ placement='topLeft'
|
|
|
|
|
+ className='card-operation-dropdown'
|
|
|
|
|
+ >
|
|
|
|
|
+ <Button
|
|
|
|
|
+ className='card-operation-btn'
|
|
|
|
|
+ icon={<Menu size={18} />}
|
|
|
|
|
+ size='large'
|
|
|
|
|
+ >
|
|
|
|
|
+ 更多操作
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </Dropdown>
|
|
|
<Button
|
|
<Button
|
|
|
- className='card-operation-btn'
|
|
|
|
|
- icon={<Menu size={18} />}
|
|
|
|
|
|
|
+ className='card-use-btn'
|
|
|
|
|
+ icon={<ArrowRight size={18} />}
|
|
|
size='large'
|
|
size='large'
|
|
|
|
|
+ onClick={(e) => {
|
|
|
|
|
+ e.stopPropagation();
|
|
|
|
|
+ handleViewClick();
|
|
|
|
|
+ }}
|
|
|
>
|
|
>
|
|
|
- 更多操作
|
|
|
|
|
|
|
+ 立即使用
|
|
|
</Button>
|
|
</Button>
|
|
|
- </Dropdown>
|
|
|
|
|
|
|
+ </>
|
|
|
) : (
|
|
) : (
|
|
|
<>
|
|
<>
|
|
|
<Button
|
|
<Button
|