【操盘手端】自动点赞提交

This commit is contained in:
Ghost
2025-04-10 16:40:30 +08:00
parent c7062445ab
commit e3d29f0935
29 changed files with 2863 additions and 1684 deletions

View File

@@ -61,7 +61,9 @@ export function BasicSettings({ formData, onChange, onNext }: BasicSettingsProps
>
<Minus className="h-4 w-4" />
</Button>
<span className="w-12 text-center">{formData.syncCount}</span>
<span className="w-12 text-center bg-primary text-primary-foreground rounded-md px-3 py-1 font-medium">
{formData.syncCount}
</span>
<Button
variant="outline"
size="icon"
@@ -135,4 +137,3 @@ export function BasicSettings({ formData, onChange, onNext }: BasicSettingsProps
</Card>
)
}

View File

@@ -4,7 +4,7 @@ import { useState, useEffect } from "react"
import { Card } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Search, RefreshCw, X, ChevronLeft, ChevronRight } from "lucide-react"
import { Search, RefreshCw, X } from "lucide-react"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import { Checkbox } from "@/components/ui/checkbox"
import { toast } from "@/components/ui/use-toast"
@@ -17,7 +17,6 @@ import {
PaginationNext,
PaginationPrevious,
} from "@/components/ui/pagination"
import { ImeiDisplay } from "@/components/ImeiDisplay"
// 定义类型,避免导入错误
interface Device {
@@ -149,16 +148,6 @@ export function DeviceSelector({ formData, onChange, onNext, onPrev }: DeviceSel
}
}
const handlePrevPage = () => {
setCurrentPage((prev) => Math.max(1, prev - 1))
}
const handleNextPage = () => {
setCurrentPage((prev) => Math.min(Math.ceil(filteredDevices.length / itemsPerPage), prev + 1))
}
const isLastPage = currentPage === Math.ceil(filteredDevices.length / itemsPerPage)
return (
<Card className="p-6">
<div className="space-y-4">
@@ -204,14 +193,15 @@ export function DeviceSelector({ formData, onChange, onNext, onPrev }: DeviceSel
<div className="flex-1 min-w-0">
<div className="flex items-center justify-between mb-1">
<div className="font-medium truncate">{device.name}</div>
<Badge variant={device.status === "online" ? "default" : "secondary"}>
<div
className={`px-2 py-1 rounded-full text-xs ${
device.status === "online" ? "bg-green-100 text-green-800" : "bg-gray-100 text-gray-800"
}`}
>
{device.status === "online" ? "在线" : "离线"}
</Badge>
</div>
<div className="text-sm text-gray-500 flex items-center">
<span className="mr-1">IMEI:</span>
<ImeiDisplay imei={device.imei} containerWidth={160} />
</div>
</div>
<div className="text-sm text-gray-500">IMEI: {device.imei}</div>
<div className="text-sm text-gray-500">: {device.wechatId}</div>
{device.usedInPlans > 0 && (
<div className="text-sm text-orange-500"> {device.usedInPlans} </div>
@@ -221,25 +211,24 @@ export function DeviceSelector({ formData, onChange, onNext, onPrev }: DeviceSel
</Card>
))}
</div>
<Pagination className="mt-4">
<Pagination>
<PaginationContent>
<PaginationPrevious
onClick={handlePrevPage}
onClick={() => setCurrentPage((prev) => Math.max(1, prev - 1))}
disabled={currentPage === 1}
/>
{Array.from({ length: Math.ceil(filteredDevices.length / itemsPerPage) }).map((_, index) => (
<PaginationItem key={index}>
<PaginationLink
onClick={() => setCurrentPage(index + 1)}
isActive={currentPage === index + 1}
>
{index + 1}
{Array.from({ length: Math.ceil(filteredDevices.length / itemsPerPage) }, (_, i) => i + 1).map((page) => (
<PaginationItem key={page}>
<PaginationLink onClick={() => setCurrentPage(page)} isActive={currentPage === page}>
{page}
</PaginationLink>
</PaginationItem>
))}
<PaginationNext
onClick={handleNextPage}
disabled={isLastPage}
onClick={() =>
setCurrentPage((prev) => Math.min(Math.ceil(filteredDevices.length / itemsPerPage), prev + 1))
}
disabled={currentPage === Math.ceil(filteredDevices.length / itemsPerPage)}
/>
</PaginationContent>
</Pagination>
@@ -279,32 +268,7 @@ export function DeviceSelector({ formData, onChange, onNext, onPrev }: DeviceSel
</Button>
</div>
<div className="flex justify-center items-center space-x-2 mt-4">
<Button
variant="outline"
size="icon"
onClick={handlePrevPage}
disabled={currentPage === 1}
>
<ChevronLeft className="h-4 w-4" />
</Button>
<div className="text-sm text-gray-500">
{currentPage} / {Math.ceil(filteredDevices.length / itemsPerPage)}
</div>
<Button
variant="outline"
size="icon"
onClick={handleNextPage}
disabled={isLastPage}
>
<ChevronRight className="h-4 w-4" />
</Button>
</div>
</div>
</Card>
)
}