feat: 本次提交更新内容如下
图片上传的模块处理完毕
This commit is contained in:
@@ -194,17 +194,15 @@ export default function NewMaterial() {
|
||||
/>
|
||||
<Label className="font-bold mb-2 mt-4">封面图</Label>
|
||||
<div className="flex items-center gap-4">
|
||||
{!coverImage ? (
|
||||
<Button type="button" variant="outline" className="rounded-2xl border-dashed border-2 border-blue-300 bg-white hover:bg-blue-50 h-28 w-28 flex flex-col items-center justify-center p-0" onClick={() => setCoverImage('https://cdn-icons-png.flaticon.com/512/732/732212.png')}>
|
||||
<UploadCloud className="h-8 w-8 mb-2 text-gray-400 mx-auto" />
|
||||
<span className="text-sm text-gray-500">上传封面图</span>
|
||||
</Button>
|
||||
) : (
|
||||
<div className="relative">
|
||||
<img src={coverImage} alt="封面图" className="object-contain rounded-xl mx-auto my-auto w-20 h-20" />
|
||||
<Button type="button" variant="base" size="small" className="absolute top-1 right-1 h-8 px-2 rounded-lg" onClick={() => setCoverImage('')}>删除</Button>
|
||||
</div>
|
||||
)}
|
||||
<UploadImage
|
||||
value={images}
|
||||
onChange={urls => {
|
||||
setCoverImage(urls[0]);
|
||||
setUploadFiles(urls.map(url => ({ url })));
|
||||
}}
|
||||
max={1}
|
||||
accept="image/*"
|
||||
/>
|
||||
</div>
|
||||
<Label htmlFor="url" className="font-bold flex items-center mb-2 mt-4"><span className="text-red-500 mr-1">*</span>链接地址</Label>
|
||||
<Input
|
||||
@@ -237,7 +235,7 @@ export default function NewMaterial() {
|
||||
)}
|
||||
</div>
|
||||
{/* 素材上传分组(仅图片类型和小程序类型) */}
|
||||
{(contentType === 1 || contentType === 5) && (
|
||||
{([1,5].includes(contentType)) && (
|
||||
<div className="mb-6">
|
||||
<div className="text-xs text-gray-400 mb-2 tracking-widest">素材上传(最多上传9张)</div>
|
||||
{contentType === 1 && (
|
||||
@@ -250,7 +248,6 @@ export default function NewMaterial() {
|
||||
}}
|
||||
max={9}
|
||||
accept="image/*"
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
@@ -261,12 +258,15 @@ export default function NewMaterial() {
|
||||
<Label htmlFor="appId" className="font-bold mb-2">AppID</Label>
|
||||
<Input id="appId" placeholder="请输入AppID" className="w-full h-12 rounded-2xl border-gray-300 focus:border-blue-500 focus:ring-2 focus:ring-blue-100 px-4 text-base placeholder:text-gray-300" />
|
||||
<Label className="font-bold mb-2">小程序封面图</Label>
|
||||
<div className="border border-dashed border-gray-300 rounded-2xl p-4 text-center bg-gray-50">
|
||||
<Button type="button" variant="outline" onClick={() => handleUploadImage(new File([], ''))} className="w-full py-4 flex flex-col items-center justify-center rounded-2xl border-2 border-dashed border-blue-300 bg-white hover:bg-blue-50">
|
||||
<UploadCloud className="h-6 w-6 mb-2 text-gray-400" />
|
||||
<span>上传小程序封面图</span>
|
||||
</Button>
|
||||
</div>
|
||||
<UploadImage
|
||||
value={images}
|
||||
onChange={urls => {
|
||||
setImages(urls);
|
||||
setUploadFiles(urls.map(url => ({ url })));
|
||||
}}
|
||||
max={9}
|
||||
accept="image/*"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user