qinzhipeng_v 5 lat temu
rodzic
commit
c4e1c80246
2 zmienionych plików z 15 dodań i 24 usunięć
  1. 0 1
      package.json
  2. 15 23
      src/views/Platform/useCasePage.vue

+ 0 - 1
package.json

@@ -20,7 +20,6 @@
     "element-ui": "^2.9.1",
     "file-saver": "^2.0.2",
     "html2canvas": "^1.0.0-rc.3",
-    "isomorphic-fetch": "^2.2.1",
     "jodit": "^3.2.58",
     "js-cookie": "2.2.0",
     "jspdf": "^1.5.3",

+ 15 - 23
src/views/Platform/useCasePage.vue

@@ -155,7 +155,6 @@
 import { createFolderData, queryAllFolderData, queryCasesData, deleteFolderData, deleteCaseData, updateFolderData, caseUpdateFolderName, updateXmindUrl, uploadCaseByXmind } from '@/api/caseProject.js'
 import { mockUrl } from '@/apiConfig/api'
 // import fetch from "isomorphic-fetch"
-require('isomorphic-fetch')
 // import FileSaver from 'file-saver'
 import axios from 'axios'
 // import XLSX from 'xlsx'
@@ -633,29 +632,22 @@ export default {
         var formData_s = new FormData()
         formData_s.append('file', f)
         this.grid_xmind.push({ 'name': f.name, 'url': 'http://pt-starfile.didistatic.com/static/starfile/node/hjvKFStkqD1574316045070.xmind' })
-        // url (必须), init对象 (可选)
-        fetch('http://star.xiaojukeji.com/upload/img.node', formData_s, { credentials: 'include' }).then(function(res) {
-          console.log(res)
-          return res.json()
-        }).catch(err => {
-          console.log(err)
+        axios.post('http://star.xiaojukeji.com/upload/img.node', formData_s, { withCredentials: false, headers: { 'Content-Type': 'multipart/form-data' }}).then(res => {
+          console.log(res.url)
+          if (res.url) {
+            this.grid_xmind.push({ 'name': f.name, 'url': 'http:' + res.url })
+            var xmind_code = {
+              id: this.startId,
+              xmindUrl: JSON.stringify(this.grid_xmind),
+              modifier: this.userInformation
+            }
+            updateXmindUrl(xmind_code).then(res => {
+              if (res.code === 200) {
+                this.$message({ type: 'success', message: '导入成功' })
+              }
+            })
+          }
         })
-        // axios.post('http://star.xiaojukeji.com/upload/img.node', formData_s, { withCredentials: true, headers: { 'Content-Type': 'multipart/form-data' }}).then(res => {
-        //   console.log(res.url)
-        //   if (res.url) {
-        //     this.grid_xmind.push({ 'name': f.name, 'url': 'http:' + res.url })
-        //     var xmind_code = {
-        //       id: this.startId,
-        //       xmindUrl: JSON.stringify(this.grid_xmind),
-        //       modifier: this.userInformation
-        //     }
-        //     updateXmindUrl(xmind_code).then(res => {
-        //       if (res.code === 200) {
-        //         this.$message({ type: 'success', message: '导入成功' })
-        //       }
-        //     })
-        //   }
-        // })
       } else {
         this.$message({ type: 'error', message: '导入失败,不支持文件类型(只支持xmind)' })
       }