|
|
@@ -13,7 +13,7 @@ import { Textarea } from '@/client/components/ui/textarea';
|
|
|
import { Switch } from '@/client/components/ui/switch';
|
|
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/client/components/ui/card';
|
|
|
import { Badge } from '@/client/components/ui/badge';
|
|
|
-import { AvatarSelector } from '@/client/admin-shadcn/components/AvatarSelector';
|
|
|
+import AvatarSelector from '@/client/admin-shadcn/components/AvatarSelector';
|
|
|
|
|
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
|
import { advertisementClient } from '@/client/api';
|
|
|
@@ -110,7 +110,7 @@ const Advertisements: React.FC = () => {
|
|
|
defaultValues: {
|
|
|
title: '',
|
|
|
linkUrl: '',
|
|
|
- imageUrl: '',
|
|
|
+ imageFileId: undefined,
|
|
|
positionId: 1,
|
|
|
sortOrder: 0,
|
|
|
isEnabled: 1,
|
|
|
@@ -140,7 +140,7 @@ const Advertisements: React.FC = () => {
|
|
|
updateForm.reset({
|
|
|
title: data.title,
|
|
|
linkUrl: data.linkUrl,
|
|
|
- imageUrl: data.imageUrl,
|
|
|
+ imageFileId: data.imageFileId || undefined,
|
|
|
positionId: data.positionId,
|
|
|
sortOrder: data.sortOrder,
|
|
|
isEnabled: data.isEnabled,
|
|
|
@@ -322,17 +322,16 @@ const Advertisements: React.FC = () => {
|
|
|
|
|
|
<FormField
|
|
|
control={(isCreateForm ? createForm : updateForm).control}
|
|
|
- name="imageUrl"
|
|
|
+ name="imageFileId"
|
|
|
render={({ field }) => (
|
|
|
<FormItem>
|
|
|
- <FormLabel className="flex items-center">
|
|
|
- 图片地址
|
|
|
- <span className="text-red-500 ml-1">*</span>
|
|
|
+ <FormLabel>
|
|
|
+ 图片文件
|
|
|
</FormLabel>
|
|
|
<FormControl>
|
|
|
<AvatarSelector
|
|
|
value={field.value || undefined}
|
|
|
- onChange={(value) => field.onChange(value)}
|
|
|
+ onChange={(value) => field.onChange(value ? Number(value) : undefined)}
|
|
|
maxSize={2}
|
|
|
uploadPath="/advertisements"
|
|
|
uploadButtonText="上传图片"
|