feat(doctor): 添加图片上传字段并修正最大图片数量限制
- 在表单数据中添加 image 字段 - 将图片上传数量上限从 20 张调整为5 张 - 更新图片上传提示信息 - 修正图片删除后 image 字段的默认值为空字符串 - 在表单中增加 image 隐藏输入项以支持数据提交
This commit is contained in:
@@ -41,7 +41,8 @@ const AddClinicOrder = () => {
|
|||||||
diagnosis: '',
|
diagnosis: '',
|
||||||
treatmentPlan: '',
|
treatmentPlan: '',
|
||||||
decoctionInstructions: '',
|
decoctionInstructions: '',
|
||||||
content: ''
|
content: '',
|
||||||
|
image: '' // 添加image字段
|
||||||
})
|
})
|
||||||
|
|
||||||
// 判断是编辑还是新增模式
|
// 判断是编辑还是新增模式
|
||||||
@@ -79,9 +80,9 @@ const AddClinicOrder = () => {
|
|||||||
|
|
||||||
// 选择并上传图片
|
// 选择并上传图片
|
||||||
const handleChooseImage = () => {
|
const handleChooseImage = () => {
|
||||||
if (fileList.length >= 20) {
|
if (fileList.length >= 5) { // 修正最大图片数量为5
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: '最多只能上传20张图片',
|
title: '最多只能上传5张图片',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -119,7 +120,7 @@ const AddClinicOrder = () => {
|
|||||||
if (newFileList.length === 0) {
|
if (newFileList.length === 0) {
|
||||||
setFormData(prev => ({
|
setFormData(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
image: undefined
|
image: ''
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
const imageData: UploadedImageData[] = newFileList.map(f => ({
|
const imageData: UploadedImageData[] = newFileList.map(f => ({
|
||||||
@@ -541,6 +542,9 @@ const AddClinicOrder = () => {
|
|||||||
<Form.Item name="content" initialValue={formData.content} required>
|
<Form.Item name="content" initialValue={formData.content} required>
|
||||||
<Input type="hidden"/>
|
<Input type="hidden"/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item name="image" initialValue={formData.image}>
|
||||||
|
<Input type="hidden"/>
|
||||||
|
</Form.Item>
|
||||||
</CellGroup>
|
</CellGroup>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
@@ -557,4 +561,4 @@ const AddClinicOrder = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AddClinicOrder;
|
export default AddClinicOrder;
|
||||||
Reference in New Issue
Block a user