sync: soul-admin 页面 | 原因: 前端页面修改
This commit is contained in:
@@ -3,7 +3,8 @@ import { Card, CardContent } from '@/components/ui/card'
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table'
|
||||
import { RefreshCw } from 'lucide-react'
|
||||
import { Pagination } from '@/components/ui/Pagination'
|
||||
import { get } from '@/api/client'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { get, post } from '@/api/client'
|
||||
|
||||
interface MatchRecord {
|
||||
id: string; userId: string; matchedUserId: string; matchType: string
|
||||
@@ -17,6 +18,7 @@ export function TeamRecruitTab() {
|
||||
const [page, setPage] = useState(1)
|
||||
const [pageSize, setPageSize] = useState(10)
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [inserting, setInserting] = useState(false)
|
||||
|
||||
async function load() {
|
||||
setIsLoading(true)
|
||||
@@ -31,6 +33,22 @@ export function TeamRecruitTab() {
|
||||
useEffect(() => { load() }, [page])
|
||||
|
||||
const totalPages = Math.ceil(total / pageSize) || 1
|
||||
const insertTest = async () => {
|
||||
setInserting(true)
|
||||
try {
|
||||
const phone = `139${Date.now().toString().slice(-8)}`
|
||||
const res = await post<{ success?: boolean; message?: string }>('/api/db/match-records/test', {
|
||||
matchType: 'team',
|
||||
phone,
|
||||
})
|
||||
alert(res?.message || '测试记录已插入')
|
||||
await load()
|
||||
} catch (e) {
|
||||
alert('插入失败: ' + (e instanceof Error ? e.message : '网络错误'))
|
||||
} finally {
|
||||
setInserting(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -39,10 +57,15 @@ export function TeamRecruitTab() {
|
||||
<p className="text-gray-400">团队招募匹配记录,共 {total} 条</p>
|
||||
<p className="text-gray-500 text-xs mt-1">用户通过「团队招募」提交联系方式到存客宝</p>
|
||||
</div>
|
||||
<button type="button" onClick={load} disabled={isLoading}
|
||||
className="flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50">
|
||||
<RefreshCw className={`w-4 h-4 ${isLoading ? 'animate-spin' : ''}`} /> 刷新
|
||||
</button>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button onClick={insertTest} disabled={inserting} className="bg-[#38bdac] hover:bg-[#2da396] text-white">
|
||||
{inserting ? '插入中...' : '插入测试数据'}
|
||||
</Button>
|
||||
<button type="button" onClick={load} disabled={isLoading}
|
||||
className="flex items-center gap-2 px-4 py-2 rounded-lg border border-gray-600 text-gray-300 hover:bg-gray-700/50 transition-colors disabled:opacity-50">
|
||||
<RefreshCw className={`w-4 h-4 ${isLoading ? 'animate-spin' : ''}`} /> 刷新
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Card className="bg-[#0f2137] border-gray-700/50 shadow-xl">
|
||||
|
||||
Reference in New Issue
Block a user