Ryuiso vor 1 Monat
Ursprung
Commit
cde81de771

+ 2 - 1
jk-rag-platform/.claude/settings.local.json

@@ -104,7 +104,8 @@
       "Bash(rm -rf node_modules/.vite)",
       "Bash(rm -rf node_modules/.vite)",
       "Bash(find . -name \"*.vite\" -type d -exec rm -rf {} +)",
       "Bash(find . -name \"*.vite\" -type d -exec rm -rf {} +)",
       "Bash(curl -s -o /dev/null -w \"%{http_code}\" http://localhost:3100/)",
       "Bash(curl -s -o /dev/null -w \"%{http_code}\" http://localhost:3100/)",
-      "Bash(ls -la *.md)"
+      "Bash(ls -la *.md)",
+      "Bash(npx stylelint:*)"
     ]
     ]
   }
   }
 }
 }

+ 0 - 4
jk-rag-platform/src/components/common/AppCard/AppCardApiDoc.scss

@@ -248,10 +248,6 @@
     // API Tabs
     // API Tabs
     .api-tabs {
     .api-tabs {
         margin-top: $spacing-3;
         margin-top: $spacing-3;
-
-        .ant-tabs-tab {
-            font-size: $font-sm;
-        }
     }
     }
 }
 }
 
 

+ 64 - 7
jk-rag-platform/src/components/common/AppCard/index.scss

@@ -357,10 +357,35 @@
         pointer-events: auto;
         pointer-events: auto;
     }
     }
 
 
+    // Dropdown 容器样式(左侧按钮)
+    .card-operation-dropdown {
+        display: inline-flex;
+
+        .ant-btn {
+            min-width: 90px;
+            max-width: 160px;
+            height: 40px;
+            background: $bg-tertiary;
+            border: 1px solid $border-base;
+            border-radius: $radius-lg;
+            font-size: $font-md;
+            font-weight: $font-weight-medium;
+            color: $text-primary;
+            transition: $transition-base;
+
+            &:hover {
+                background: $border-base;
+                border-color: $border-dark;
+                color: $text-primary;
+            }
+        }
+    }
+
+    // 左侧按钮(更多操作 / API 接入)- 直接样式
     .card-operation-btn {
     .card-operation-btn {
-        flex: 0 0 auto;  // 不伸缩
-        width: auto;
-        min-width: 100px;
+        flex: 0 0 auto;
+        min-width: 90px;
+        max-width: 160px;
         height: 40px;
         height: 40px;
         background: $bg-tertiary;
         background: $bg-tertiary;
         border: 1px solid $border-base;
         border: 1px solid $border-base;
@@ -369,7 +394,6 @@
         font-weight: $font-weight-medium;
         font-weight: $font-weight-medium;
         color: $text-primary;
         color: $text-primary;
         transition: $transition-base;
         transition: $transition-base;
-        margin-right: $spacing-2;  // 与立即使用按钮的间距
         display: inline-flex;
         display: inline-flex;
         align-items: center;
         align-items: center;
         justify-content: center;
         justify-content: center;
@@ -386,10 +410,11 @@
         }
         }
     }
     }
 
 
+    // 右侧按钮(立即使用)
     .card-use-btn {
     .card-use-btn {
-        flex: 0 0 auto;  // 不伸缩
-        width: auto;
-        min-width: 120px;
+        flex: 0 0 auto;
+        min-width: 90px;
+        max-width: 160px;
         height: 40px;
         height: 40px;
         background: linear-gradient(135deg, $primary-color 0%, $primary-light 100%);
         background: linear-gradient(135deg, $primary-color 0%, $primary-light 100%);
         border: none;
         border: none;
@@ -419,6 +444,38 @@
             height: 18px;
             height: 18px;
         }
         }
     }
     }
+
+    // 响应式:窄屏时调整按钮尺寸
+    @media (max-width: $screen-md) {
+        padding: $spacing-3;
+
+        .card-operation-dropdown .ant-btn,
+        .card-operation-btn,
+        .card-use-btn {
+            min-width: 80px;
+            max-width: 140px;
+            height: 36px;
+            font-size: $font-sm;
+
+            svg {
+                width: 16px;
+                height: 16px;
+            }
+        }
+    }
+
+    @media (max-width: $screen-sm) {
+        padding: $spacing-2;
+
+        .card-operation-dropdown .ant-btn,
+        .card-operation-btn,
+        .card-use-btn {
+            min-width: 70px;
+            max-width: 120px;
+            height: 32px;
+            font-size: $font-xs;
+        }
+    }
 }
 }
 
 
 // 注意:.app-card-grid 已在全局 global.scss 中定义,此处不需要重复
 // 注意:.app-card-grid 已在全局 global.scss 中定义,此处不需要重复

+ 33 - 16
jk-rag-platform/src/components/common/AppCard/index.tsx

@@ -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

+ 3 - 3
jk-rag-platform/src/mock/index.ts

@@ -768,10 +768,10 @@ export const getAppsByPageType = (
             return apps.filter(app => app.creatorId === currentUser.id);
             return apps.filter(app => app.creatorId === currentUser.id);
 
 
         case 'maintainerApps':
         case 'maintainerApps':
-            // 我可以维护的应用(创建者或维护者
+            // 我可以维护的应用(只显示非创建者身份的应用,即别人创建但授权给我维护的
             return apps.filter(app =>
             return apps.filter(app =>
-                app.creatorId === currentUser.id ||
-                (app.maintainers && app.maintainers.includes(currentUser.id))
+                app.creatorId !== currentUser.id &&
+                app.maintainers && app.maintainers.includes(currentUser.id)
             );
             );
 
 
         case 'professional':
         case 'professional':

+ 7 - 3
jk-rag-platform/src/pages/appCenter/appPlazaList/index.tsx

@@ -145,6 +145,9 @@ const AppPlazaList: React.FC = () => {
 
 
             <div className='app-card-grid'>
             <div className='app-card-grid'>
                 {paginatedApps.map((app) => {
                 {paginatedApps.map((app) => {
+                    const isCreator = app.creatorId === mockCurrentUser.id;
+                    const isMaintainer = !isCreator && app.maintainers?.includes(mockCurrentUser.id);
+
                     return (
                     return (
                         <AppCard
                         <AppCard
                             key={app.id}
                             key={app.id}
@@ -159,12 +162,13 @@ const AppPlazaList: React.FC = () => {
                             showCreateTime={true}  // 所有页面常态显示创建时间
                             showCreateTime={true}  // 所有页面常态显示创建时间
                             createTime={app.createTime ? app.createTime.split(' ')[0] : ''}
                             createTime={app.createTime ? app.createTime.split(' ')[0] : ''}
                             showOperations={true}  // 显示悬停操作按钮
                             showOperations={true}  // 显示悬停操作按钮
-                            isCreator={app.creatorId === mockCurrentUser.id}
+                            isCreator={isCreator}
+                            isMaintainer={isMaintainer}
                             onView={() => handlePlay(app.id)}
                             onView={() => handlePlay(app.id)}
                             onApi={() => handleApi(app.id)}
                             onApi={() => handleApi(app.id)}
                             onApiDirect={() => handleApi(app.id)}  // API 调用(非创建者)
                             onApiDirect={() => handleApi(app.id)}  // API 调用(非创建者)
-                            onEdit={app.creatorId === mockCurrentUser.id ? () => handleEdit(app.id) : undefined}
-                            onDelete={app.creatorId === mockCurrentUser.id ? () => handleDelete(app.id) : undefined}
+                            onEdit={(isCreator || isMaintainer) ? () => handleEdit(app.id) : undefined}
+                            onDelete={isCreator ? () => handleDelete(app.id) : undefined}
                             onShare={() => handleShare(app.id)}
                             onShare={() => handleShare(app.id)}
                             onFavorite={() => handleFavorite(app.id)}
                             onFavorite={() => handleFavorite(app.id)}
                         />
                         />

+ 3 - 1
jk-rag-platform/src/pages/appCenter/categoryApps/index.tsx

@@ -170,6 +170,7 @@ const CategoryAppsList: React.FC = () => {
             <div className='app-card-grid'>
             <div className='app-card-grid'>
                 {paginatedApps.map((app) => {
                 {paginatedApps.map((app) => {
                     const isCreator = app.creatorId === mockCurrentUser.id;
                     const isCreator = app.creatorId === mockCurrentUser.id;
+                    const isMaintainer = !isCreator && app.maintainers?.includes(mockCurrentUser.id);
 
 
                     return (
                     return (
                         <AppCard
                         <AppCard
@@ -186,10 +187,11 @@ const CategoryAppsList: React.FC = () => {
                             createTime={app.createTime ? app.createTime.split(' ')[0] : ''}
                             createTime={app.createTime ? app.createTime.split(' ')[0] : ''}
                             showOperations={true}  // 显示悬停操作按钮
                             showOperations={true}  // 显示悬停操作按钮
                             isCreator={isCreator}
                             isCreator={isCreator}
+                            isMaintainer={isMaintainer}
                             onView={() => handlePlay(app.id)}
                             onView={() => handlePlay(app.id)}
                             onApi={() => handleApi(app.id)}
                             onApi={() => handleApi(app.id)}
                             onApiDirect={() => handleApi(app.id)}  // API 调用(非创建者)
                             onApiDirect={() => handleApi(app.id)}  // API 调用(非创建者)
-                            onEdit={isCreator ? () => handleEdit(app.id) : undefined}
+                            onEdit={(isCreator || isMaintainer) ? () => handleEdit(app.id) : undefined}
                             onDelete={isCreator ? () => handleDelete(app.id) : undefined}
                             onDelete={isCreator ? () => handleDelete(app.id) : undefined}
                             onShare={() => handleShare(app.id)}
                             onShare={() => handleShare(app.id)}
                             onFavorite={() => handleFavorite(app.id)}
                             onFavorite={() => handleFavorite(app.id)}

+ 0 - 11
jk-rag-platform/src/pages/knowledgeLib/list/style.scss

@@ -48,17 +48,6 @@
     }
     }
 }
 }
 
 
-// ===== 下载下拉菜单样式 =====
-.ant-dropdown-menu-item {
-    display: flex;
-    align-items: center;
-    gap: $spacing-2;
-
-    .anticon {
-        font-size: 16px;
-    }
-}
-
 // ===== 响应式适配 =====
 // ===== 响应式适配 =====
 @media (max-width: $screen-md) {
 @media (max-width: $screen-md) {
     // 操作按钮缩小
     // 操作按钮缩小

+ 4 - 2
jk-rag-platform/src/pages/questionAnswer/list/index.tsx

@@ -202,12 +202,13 @@ const QuestionAnswerList: React.FC = () => {
                 {paginatedApps.map((app) => {
                 {paginatedApps.map((app) => {
                     // 判断是否为创建者
                     // 判断是否为创建者
                     const isCreator = app.creatorId === mockCurrentUser.id;
                     const isCreator = app.creatorId === mockCurrentUser.id;
+                    // 判断是否为维护者(非创建者)
+                    const isMaintainer = !isCreator && app.maintainers?.includes(mockCurrentUser.id);
 
 
                     return (
                     return (
                         <AppCard
                         <AppCard
                             key={app.id}
                             key={app.id}
                             {...app}  // 直接使用原始数据,不使用 processAppData
                             {...app}  // 直接使用原始数据,不使用 processAppData
-                            isCreator={isCreator}
                             showCreator={pageConfig.showCreator}
                             showCreator={pageConfig.showCreator}
                             showActions={true}  // 显示悬停操作按钮(分享/收藏)
                             showActions={true}  // 显示悬停操作按钮(分享/收藏)
                             showCertification={pageConfig.showCertification}
                             showCertification={pageConfig.showCertification}
@@ -221,10 +222,11 @@ const QuestionAnswerList: React.FC = () => {
                             showVisible={pageConfig.showVisible}
                             showVisible={pageConfig.showVisible}
                             showOperations={true}  // 显示悬停操作按钮
                             showOperations={true}  // 显示悬停操作按钮
                             isCreator={isCreator}
                             isCreator={isCreator}
+                            isMaintainer={isMaintainer}
                             onView={() => handlePlay(app.id)}
                             onView={() => handlePlay(app.id)}
                             onApi={() => handleApi(app.id)}
                             onApi={() => handleApi(app.id)}
                             onApiDirect={() => handleApi(app.id)}  // API 调用(非创建者)
                             onApiDirect={() => handleApi(app.id)}  // API 调用(非创建者)
-                            onEdit={isCreator ? () => handleEdit(app.id) : undefined}
+                            onEdit={(isCreator || isMaintainer) ? () => handleEdit(app.id) : undefined}
                             onDelete={isCreator ? () => handleDelete(app.id) : undefined}
                             onDelete={isCreator ? () => handleDelete(app.id) : undefined}
                             onShare={() => handleShare(app.id)}
                             onShare={() => handleShare(app.id)}
                             onFavorite={() => handleFavorite(app.id)}
                             onFavorite={() => handleFavorite(app.id)}

Datei-Diff unterdrückt, da er zu groß ist
+ 783 - 104
jk-rag-platform/src/styles/global.scss


Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.