魏熙美 5 лет назад
Родитель
Сommit
4c62cc73ea
2 измененных файлов: 11 добавлений и 3 удалений
  1. 0
    1
      src/components/SelectButton/BuildSelect.jsx
  2. 11
    2
      src/components/Wangedit/Wangedit.jsx

+ 0
- 1
src/components/SelectButton/BuildSelect.jsx Просмотреть файл

69
   )
69
   )
70
 }
70
 }
71
 export default BuildingSelect
71
 export default BuildingSelect
72
-

+ 11
- 2
src/components/Wangedit/Wangedit.jsx Просмотреть файл

1
 import React from 'react';
1
 import React from 'react';
2
-import E from 'wangeditor'
2
+import E from 'wangeditor';
3
+import { fetch, apis } from '../../utils/request';
3
 
4
 
4
 /**
5
 /**
5
  * @param {*} props
6
  * @param {*} props
33
       }
34
       }
34
     }
35
     }
35
     this.editor.customConfig.zIndex = 100
36
     this.editor.customConfig.zIndex = 100
36
-    this.editor.customConfig.uploadImgShowBase64 = true   
37
+    this.editor.customConfig.uploadImgMaxLength = 1
38
+    this.editor.customConfig.customUploadImg = function (files, insert) {
39
+      if (!files.length) return
40
+      
41
+      const data = new FormData()
42
+      data.append('file', files[0])
43
+
44
+      fetch(apis.image.upload)({data}).then(insert)
45
+    }
37
     this.editor.create()
46
     this.editor.create()
38
     this.editor.customConfig.uploadImgShowBase64 = true
47
     this.editor.customConfig.uploadImgShowBase64 = true
39
     this.editor.txt.html(this.props.value)
48
     this.editor.txt.html(this.props.value)