From 71b872aa44de6266a344646d0e535895620d57a7 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 05 一月 2020 22:45:06 +0800
Subject: [PATCH] 2020-01-05

---
 src/tabviews/tableshare/fileupload/index.jsx |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/tabviews/tableshare/fileupload/index.jsx b/src/tabviews/tableshare/fileupload/index.jsx
index e9c02bd..682498f 100644
--- a/src/tabviews/tableshare/fileupload/index.jsx
+++ b/src/tabviews/tableshare/fileupload/index.jsx
@@ -57,24 +57,25 @@
     }
   }
 
-  shardupload = (file, shardSize, shardCount, i) => {
+  shardupload = (file, shardSize, shardCount, i, fileList) => {
     let start = i * shardSize
     let end = Math.min(file.size, start + shardSize)
     let form = new FormData()
 
-    form.append('data', file.slice(start, end)) //slice鏂规硶鐢ㄤ簬鍒囧嚭鏂囦欢鐨勪竴閮ㄥ垎
+    form.append('file', file.slice(start, end)) //slice鏂规硶鐢ㄤ簬鍒囧嚭鏂囦欢鐨勪竴閮ㄥ垎
+    form.append('RootPath', 'Content/images/upload/')
     form.append('name', file.name)
     form.append('total', shardCount)
     form.append('index', i + 1)
 
     if (i < shardCount) {
       i++
-      Api.getFileUpload(file).then(res => {
+      Api.getFileUpload(form).then(res => {
         if (res) {
           this.setState({
             percent: Math.floor(100 * (i / shardCount))
           })
-          this.shardupload(file, shardSize, shardCount, i)
+          this.shardupload(file, shardSize, shardCount, i, fileList)
         }
       })
     } else {
@@ -92,8 +93,8 @@
   }
 
   beforeUpload = (file, fileList) => {
-    let shardSize = 200 * 1024 * 1024
-    // console.log(file)
+    let shardSize = 2 * 1024 * 1024
+    // let shardSize = 3 * 1024
 
     if (file.size > shardSize) {
       this.setState({
@@ -101,7 +102,7 @@
         percent: 0
       })
       let shardCount = Math.ceil(file.size / shardSize)
-      this.shardupload(file, shardSize, shardCount, 0)
+      this.shardupload(file, shardSize, shardCount, 0, fileList)
       return false
     } else {
       return true

--
Gitblit v1.8.0