// @ts-nocheck import React, { useState, useEffect, useCallback } from 'react'; import { imUserAPI } from '@/api'; const PRIMARY = '#5B5FED'; const AppServices: React.FC = () => { const [loading, setLoading] = useState(true); const [items, setItems] = useState([]); const [total, setTotal] = useState(0); const [page, setPage] = useState(1); const [search, setSearch] = useState(''); const [category, setCategory] = useState(''); const [toast, setToast] = useState<{ msg: string; type: 'success' | 'error' } | null>(null); const showToast = (msg: string, type: 'success' | 'error' = 'success') => { setToast({ msg, type }); setTimeout(() => setToast(null), 2500); }; const load = useCallback(async () => { setLoading(true); try { const res = await imUserAPI.appServices({ category: category || undefined, search: search || undefined, page, page_size: 12 }); if (res?.success) { setItems(res.data.items || []); setTotal(res.data.total || 0); } else { showToast('加载应用服务失败', 'error'); } } catch (e) { showToast('加载应用服务失败', 'error'); } finally { setLoading(false); } }, [category, search, page]); useEffect(() => { load(); }, [load]); const categories = [ { key: '', name: '全部' }, { key: 'customer_service', name: '客服助手' }, { key: 'data_analysis', name: '数据分析' }, { key: 'coding', name: '编程辅助' }, { key: 'writing', name: '内容创作' }, { key: 'education', name: '教育培训' }, { key: 'marketing', name: '营销推广' }, { key: 'hr', name: '人力资源' }, { key: 'finance', name: '财务法务' }, ]; return (

应用服务

浏览平台已上架的 AI 应用服务,按需接入你的工作流。由七虎AI 大脑统一驱动,覆盖客服、分析、创作等多类场景。

{toast && (
{toast.msg}
)} {/* 搜索 + 分类筛选 */}
{ setSearch(e.target.value); setPage(1); }} placeholder="搜索应用名称 / 描述…" style={{ flex: '1 1 260px', minWidth: '200px', padding: '9px 14px', border: '1px solid #E5E7EB', borderRadius: '8px', fontSize: '14px', outline: 'none' }} />
{categories.map((c) => ( ))}
{loading ? (
加载中…
) : items.length === 0 ? (
暂无已发布的应用服务
) : (
{items.map((app) => (
{app.icon ? : '🤖'}
{app.name}
{app.type_name} {app.category_name}

{app.description || '暂无描述'}

{app.published_at ? '上架于 ' + new Date(app.published_at).toLocaleDateString('zh-CN') : ''}
))}
)} {total > 12 && (
第 {page} 页 / 共 {Math.ceil(total / 12)} 页({total} 个)
)}
); }; const pageBtn: React.CSSProperties = { padding: '8px 16px', background: '#F0F2F8', border: '1px solid #E5E7EB', borderRadius: '8px', color: '#1A1F36', fontSize: '14px', cursor: 'pointer' }; export default AppServices;