ソースを参照

Merge branch 'master' of http://git.ycjcjy.com/pet_identity/pc-admin

李志伟 2 年 前
コミット
a936a4e952
共有4 個のファイルを変更した23 個の追加1 個の削除を含む
  1. 1
    1
      config/config.js
  2. 16
    0
      src/components/rich-editor/index.jsx
  3. 5
    0
      src/services/image.js
  4. 1
    0
      src/utils/request.js

+ 1
- 1
config/config.js ファイルの表示

@@ -8,7 +8,7 @@ const { REACT_APP_ENV } = process.env;
8 8
 
9 9
 export default defineConfig({
10 10
   define: {
11
-    API_BASE: 'http://resumework-service.njyunzhi.com',
11
+    API_BASE: 'https://pet-certificate-online.njyunzhi.com',
12 12
   },
13 13
   base: '/admin/',  // 路由跳转必须加 admin
14 14
   publicPath: './', // 静态文件相对路径

+ 16
- 0
src/components/rich-editor/index.jsx ファイルの表示

@@ -1,4 +1,5 @@
1 1
 import React, { forwardRef, useRef, useEffect, useMemo, useImperativeHandle } from 'react'
2
+import { uploadImage } from '@/services/image'
2 3
 
3 4
 export default forwardRef((props, ref) => {
4 5
   const editorRef = useRef()
@@ -8,7 +9,15 @@ export default forwardRef((props, ref) => {
8 9
     window.tinymce.init({
9 10
       selector: `#${id}`,
10 11
       menubar: false,
12
+<<<<<<< HEAD
11 13
       branding:false,
14
+=======
15
+      language: 'zh_CN',
16
+      plugins: 'image',
17
+      image_description: false,   // 禁用图片描述
18
+      image_dimensions: false,  // 禁用图片宽高设置
19
+      toolbar: 'blocks fontfamily fontsize bold italic backcolor alignleft aligncenter alignright alignjustify image outdent indent undo redo removeformat',
20
+>>>>>>> e802d9d3811cf3d0cfc27f187e96c8dee54bfb7e
12 21
       setup: (editor) => {
13 22
         editor.on('change', () => {
14 23
           props.onChange(editor.getContent());
@@ -17,6 +26,13 @@ export default forwardRef((props, ref) => {
17 26
       },
18 27
       init_instance_callback: (editor) => {
19 28
         editorRef.current = editor;
29
+      },
30
+      images_upload_handler: (blobInfo, progress) => {
31
+        return new Promise((resolve, reject) => {
32
+          const formData = new FormData();
33
+          formData.append('file', blobInfo.blob(), blobInfo.filename());
34
+          uploadImage(formData).then(resolve)
35
+        })
20 36
       }
21 37
     });
22 38
   // eslint-disable-next-line react-hooks/exhaustive-deps

+ 5
- 0
src/services/image.js ファイルの表示

@@ -0,0 +1,5 @@
1
+import request from '@/utils/request';
2
+
3
+export function uploadImage(formdata) {
4
+  return request('/image', { method: 'post', data: formdata })  
5
+}

+ 1
- 0
src/utils/request.js ファイルの表示

@@ -30,6 +30,7 @@ function requestInterceptor(url, options) {
30 30
     url: `${prefix}${url}`,
31 31
     options: {
32 32
       ...options,
33
+      // mode: 'same-origin', // no-cors, *cors, same-origin
33 34
       headers: {
34 35
         ...headers,
35 36
         ...token,