|
|
@@ -12,6 +12,7 @@ import { Badge } from '@/client/components/ui/badge';
|
|
|
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/client/components/ui/dialog';
|
|
|
import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@/client/components/ui/form';
|
|
|
import { DataTablePagination } from '@/client/admin-shadcn/components/DataTablePagination';
|
|
|
+import FileSelector from '@/client/admin-shadcn/components/FileSelector';
|
|
|
import { useForm } from 'react-hook-form';
|
|
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
|
import { toast } from 'sonner';
|
|
|
@@ -42,6 +43,7 @@ export const UsersPage = () => {
|
|
|
const [editingUser, setEditingUser] = useState<any>(null);
|
|
|
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
|
|
const [userToDelete, setUserToDelete] = useState<number | null>(null);
|
|
|
+ const [isAvatarSelectorOpen, setIsAvatarSelectorOpen] = useState(false);
|
|
|
|
|
|
const [isCreateForm, setIsCreateForm] = useState(true);
|
|
|
|
|
|
@@ -439,6 +441,26 @@ export const UsersPage = () => {
|
|
|
)}
|
|
|
/>
|
|
|
|
|
|
+ <FormField
|
|
|
+ control={createForm.control}
|
|
|
+ name="avatarFileId"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>头像</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <Button
|
|
|
+ type="button"
|
|
|
+ variant="outline"
|
|
|
+ onClick={() => setIsAvatarSelectorOpen(true)}
|
|
|
+ >
|
|
|
+ 选择头像
|
|
|
+ </Button>
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+
|
|
|
<FormField
|
|
|
control={createForm.control}
|
|
|
name="isDisabled"
|
|
|
@@ -560,6 +582,26 @@ export const UsersPage = () => {
|
|
|
)}
|
|
|
/>
|
|
|
|
|
|
+ <FormField
|
|
|
+ control={updateForm.control}
|
|
|
+ name="avatarFileId"
|
|
|
+ render={({ field }) => (
|
|
|
+ <FormItem>
|
|
|
+ <FormLabel>头像</FormLabel>
|
|
|
+ <FormControl>
|
|
|
+ <Button
|
|
|
+ type="button"
|
|
|
+ variant="outline"
|
|
|
+ onClick={() => setIsAvatarSelectorOpen(true)}
|
|
|
+ >
|
|
|
+ 选择头像
|
|
|
+ </Button>
|
|
|
+ </FormControl>
|
|
|
+ <FormMessage />
|
|
|
+ </FormItem>
|
|
|
+ )}
|
|
|
+ />
|
|
|
+
|
|
|
<FormField
|
|
|
control={updateForm.control}
|
|
|
name="isDisabled"
|