魏熙美 5 lat temu
rodzic
commit
4c62cc73ea

+ 0
- 1
src/components/SelectButton/BuildSelect.jsx Wyświetl plik

@@ -69,4 +69,3 @@ const BuildingSelect = (props) => {
69 69
   )
70 70
 }
71 71
 export default BuildingSelect
72
-

+ 11
- 2
src/components/Wangedit/Wangedit.jsx Wyświetl plik

@@ -1,5 +1,6 @@
1 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 6
  * @param {*} props
@@ -33,7 +34,15 @@ class Wangedit extends React.Component {
33 34
       }
34 35
     }
35 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 46
     this.editor.create()
38 47
     this.editor.customConfig.uploadImgShowBase64 = true
39 48
     this.editor.txt.html(this.props.value)