From 6f6e4e4eaf3f0214b826783d8c11cf5bf1fbb703 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 18:09:31 +0800
Subject: [PATCH 01/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../react/src/modules/courses/shixunHomework/Listofworks.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index 37ad51216..c866f7592 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1336,7 +1336,7 @@ class Listofworks extends Component {
});
}
-
+ myBase64
// 导出实习报告批量
internshipreport = (url)=>{
console.log("internshipreport");
@@ -1366,7 +1366,7 @@ class Listofworks extends Component {
//后台再header中传文件名
const name = decodeURI(response.headers['content-disposition'].split('=')[1])
downloadElement.href = href
- downloadElement.download = name
+ // downloadElement.download = name
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
From dec937c5730504de4a460507a36c6fa1229ba999 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 18:13:51 +0800
Subject: [PATCH 02/18] b
---
public/react/src/modules/courses/shixunHomework/Listofworks.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index c866f7592..b04692b44 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1406,7 +1406,7 @@ class Listofworks extends Component {
console.log(name);
console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1]));
downloadElement.href = href
- downloadElement.download = name
+ // downloadElement.download = name
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
From f4fd535e2a8bc8036629d505f84e5b886421d74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 18:15:59 +0800
Subject: [PATCH 03/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../react/src/modules/courses/shixunHomework/Listofworks.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index b04692b44..b5e5b5e35 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1336,7 +1336,9 @@ class Listofworks extends Component {
});
}
- myBase64
+ myBase64(){
+
+ }
// 导出实习报告批量
internshipreport = (url)=>{
console.log("internshipreport");
From 0014df024882f34a976f4d5ebb85a9261956ee95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 18:26:08 +0800
Subject: [PATCH 04/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/shixunHomework/Listofworks.js | 10 +-
.../modules/courses/shixunHomework/base64.js | 103 ++++++++++++++++++
2 files changed, 110 insertions(+), 3 deletions(-)
create mode 100644 public/react/src/modules/courses/shixunHomework/base64.js
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index b5e5b5e35..2df71929c 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -32,7 +32,7 @@ import moment from 'moment';
import 'moment/locale/zh-cn';
import {getImageUrl, toPath} from 'educoder';
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
-
+import Base64 from './base64'
const Search = Input.Search;
const RadioGroup = Radio.Group;
const CheckboxGroup = Checkbox.Group;
@@ -1336,8 +1336,11 @@ class Listofworks extends Component {
});
}
- myBase64(){
-
+ myBase64(strinb){
+ var base = new Base64();
+ var result2 = base.decode(strinb);
+ console.log("解密后的值")//解密后的值
+ console.log(result2)//解密后的值
}
// 导出实习报告批量
internshipreport = (url)=>{
@@ -1409,6 +1412,7 @@ class Listofworks extends Component {
console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1]));
downloadElement.href = href
// downloadElement.download = name
+ this.myBase64(response.headers['content-disposition'].split('=')[1]);
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
diff --git a/public/react/src/modules/courses/shixunHomework/base64.js b/public/react/src/modules/courses/shixunHomework/base64.js
new file mode 100644
index 000000000..4494a50e3
--- /dev/null
+++ b/public/react/src/modules/courses/shixunHomework/base64.js
@@ -0,0 +1,103 @@
+function Base64() {
+
+ // private property
+ _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+
+ // public method for encoding
+ this.encode = function (input) {
+ var output = "";
+ var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
+ var i = 0;
+ input = _utf8_encode(input);
+ while (i < input.length) {
+ chr1 = input.charCodeAt(i++);
+ chr2 = input.charCodeAt(i++);
+ chr3 = input.charCodeAt(i++);
+ enc1 = chr1 >> 2;
+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+ enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
+ enc4 = chr3 & 63;
+ if (isNaN(chr2)) {
+ enc3 = enc4 = 64;
+ } else if (isNaN(chr3)) {
+ enc4 = 64;
+ }
+ output = output +
+ _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
+ _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
+ }
+ return output;
+ }
+
+ // public method for decoding
+ this.decode = function (input) {
+ var output = "";
+ var chr1, chr2, chr3;
+ var enc1, enc2, enc3, enc4;
+ var i = 0;
+ input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
+ while (i < input.length) {
+ enc1 = _keyStr.indexOf(input.charAt(i++));
+ enc2 = _keyStr.indexOf(input.charAt(i++));
+ enc3 = _keyStr.indexOf(input.charAt(i++));
+ enc4 = _keyStr.indexOf(input.charAt(i++));
+ chr1 = (enc1 << 2) | (enc2 >> 4);
+ chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
+ chr3 = ((enc3 & 3) << 6) | enc4;
+ output = output + String.fromCharCode(chr1);
+ if (enc3 != 64) {
+ output = output + String.fromCharCode(chr2);
+ }
+ if (enc4 != 64) {
+ output = output + String.fromCharCode(chr3);
+ }
+ }
+ output = _utf8_decode(output);
+ return output;
+ }
+
+ // private method for UTF-8 encoding
+ _utf8_encode = function (string) {
+ string = string.replace(/\r\n/g,"\n");
+ var utftext = "";
+ for (var n = 0; n < string.length; n++) {
+ var c = string.charCodeAt(n);
+ if (c < 128) {
+ utftext += String.fromCharCode(c);
+ } else if((c > 127) && (c < 2048)) {
+ utftext += String.fromCharCode((c >> 6) | 192);
+ utftext += String.fromCharCode((c & 63) | 128);
+ } else {
+ utftext += String.fromCharCode((c >> 12) | 224);
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+ utftext += String.fromCharCode((c & 63) | 128);
+ }
+
+ }
+ return utftext;
+ }
+
+ // private method for UTF-8 decoding
+ _utf8_decode = function (utftext) {
+ var string = "";
+ var i = 0;
+ var c = c1 = c2 = 0;
+ while ( i < utftext.length ) {
+ c = utftext.charCodeAt(i);
+ if (c < 128) {
+ string += String.fromCharCode(c);
+ i++;
+ } else if((c > 191) && (c < 224)) {
+ c2 = utftext.charCodeAt(i+1);
+ string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
+ i += 2;
+ } else {
+ c2 = utftext.charCodeAt(i+1);
+ c3 = utftext.charCodeAt(i+2);
+ string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
+ i += 3;
+ }
+ }
+ return string;
+ }
+}
\ No newline at end of file
From 0681e86684078245e463af8dab1d5268503a38fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 20:17:31 +0800
Subject: [PATCH 05/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/shixunHomework/Listofworks.js | 1 -
.../modules/courses/shixunHomework/base64.js | 103 ------------------
2 files changed, 104 deletions(-)
delete mode 100644 public/react/src/modules/courses/shixunHomework/base64.js
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index 2df71929c..040ef24a1 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1412,7 +1412,6 @@ class Listofworks extends Component {
console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1]));
downloadElement.href = href
// downloadElement.download = name
- this.myBase64(response.headers['content-disposition'].split('=')[1]);
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
diff --git a/public/react/src/modules/courses/shixunHomework/base64.js b/public/react/src/modules/courses/shixunHomework/base64.js
deleted file mode 100644
index 4494a50e3..000000000
--- a/public/react/src/modules/courses/shixunHomework/base64.js
+++ /dev/null
@@ -1,103 +0,0 @@
-function Base64() {
-
- // private property
- _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
-
- // public method for encoding
- this.encode = function (input) {
- var output = "";
- var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
- var i = 0;
- input = _utf8_encode(input);
- while (i < input.length) {
- chr1 = input.charCodeAt(i++);
- chr2 = input.charCodeAt(i++);
- chr3 = input.charCodeAt(i++);
- enc1 = chr1 >> 2;
- enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
- enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
- enc4 = chr3 & 63;
- if (isNaN(chr2)) {
- enc3 = enc4 = 64;
- } else if (isNaN(chr3)) {
- enc4 = 64;
- }
- output = output +
- _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
- _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
- }
- return output;
- }
-
- // public method for decoding
- this.decode = function (input) {
- var output = "";
- var chr1, chr2, chr3;
- var enc1, enc2, enc3, enc4;
- var i = 0;
- input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
- while (i < input.length) {
- enc1 = _keyStr.indexOf(input.charAt(i++));
- enc2 = _keyStr.indexOf(input.charAt(i++));
- enc3 = _keyStr.indexOf(input.charAt(i++));
- enc4 = _keyStr.indexOf(input.charAt(i++));
- chr1 = (enc1 << 2) | (enc2 >> 4);
- chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
- chr3 = ((enc3 & 3) << 6) | enc4;
- output = output + String.fromCharCode(chr1);
- if (enc3 != 64) {
- output = output + String.fromCharCode(chr2);
- }
- if (enc4 != 64) {
- output = output + String.fromCharCode(chr3);
- }
- }
- output = _utf8_decode(output);
- return output;
- }
-
- // private method for UTF-8 encoding
- _utf8_encode = function (string) {
- string = string.replace(/\r\n/g,"\n");
- var utftext = "";
- for (var n = 0; n < string.length; n++) {
- var c = string.charCodeAt(n);
- if (c < 128) {
- utftext += String.fromCharCode(c);
- } else if((c > 127) && (c < 2048)) {
- utftext += String.fromCharCode((c >> 6) | 192);
- utftext += String.fromCharCode((c & 63) | 128);
- } else {
- utftext += String.fromCharCode((c >> 12) | 224);
- utftext += String.fromCharCode(((c >> 6) & 63) | 128);
- utftext += String.fromCharCode((c & 63) | 128);
- }
-
- }
- return utftext;
- }
-
- // private method for UTF-8 decoding
- _utf8_decode = function (utftext) {
- var string = "";
- var i = 0;
- var c = c1 = c2 = 0;
- while ( i < utftext.length ) {
- c = utftext.charCodeAt(i);
- if (c < 128) {
- string += String.fromCharCode(c);
- i++;
- } else if((c > 191) && (c < 224)) {
- c2 = utftext.charCodeAt(i+1);
- string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
- i += 2;
- } else {
- c2 = utftext.charCodeAt(i+1);
- c3 = utftext.charCodeAt(i+2);
- string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
- i += 3;
- }
- }
- return string;
- }
-}
\ No newline at end of file
From 69a74a86c46a964a49bff718dc255d3e5e033c9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 20:19:16 +0800
Subject: [PATCH 06/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/courses/shixunHomework/Listofworks.js | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index 040ef24a1..f895d5938 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1336,12 +1336,7 @@ class Listofworks extends Component {
});
}
- myBase64(strinb){
- var base = new Base64();
- var result2 = base.decode(strinb);
- console.log("解密后的值")//解密后的值
- console.log(result2)//解密后的值
- }
+
// 导出实习报告批量
internshipreport = (url)=>{
console.log("internshipreport");
From 2b82b1cea155d17729cade645fc4bc6c863712f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 20:29:25 +0800
Subject: [PATCH 07/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/package.json | 2 +
.../public/js/jsFromMiddleLayer/base64.js | 103 ------------------
.../courses/shixunHomework/Listofworks.js | 5 +-
3 files changed, 6 insertions(+), 104 deletions(-)
delete mode 100755 public/react/public/js/jsFromMiddleLayer/base64.js
diff --git a/public/react/package.json b/public/react/package.json
index 54519f009..21f37b76e 100644
--- a/public/react/package.json
+++ b/public/react/package.json
@@ -42,6 +42,7 @@
"immutability-helper": "^2.6.6",
"install": "^0.12.2",
"jest": "20.0.4",
+ "js-base64": "^2.5.1",
"js-file-download": "^0.4.7",
"lodash": "^4.17.5",
"loglevel": "^1.6.1",
@@ -164,6 +165,7 @@
"babel-plugin-import": "^1.11.0",
"concat": "^1.0.3",
"happypack": "^5.0.1",
+ "js-base64": "^2.5.1",
"videojs-for-react": "^0.0.3",
"webpack-bundle-analyzer": "^3.0.3",
"webpack-parallel-uglify-plugin": "^1.1.0"
diff --git a/public/react/public/js/jsFromMiddleLayer/base64.js b/public/react/public/js/jsFromMiddleLayer/base64.js
deleted file mode 100755
index c4df1c0de..000000000
--- a/public/react/public/js/jsFromMiddleLayer/base64.js
+++ /dev/null
@@ -1,103 +0,0 @@
-function Base64() {
-
- // private property
- _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
-
- // public method for encoding
- this.encode = function (input) {
- var output = "";
- var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
- var i = 0;
- input = _utf8_encode(input);
- while (i < input.length) {
- chr1 = input.charCodeAt(i++);
- chr2 = input.charCodeAt(i++);
- chr3 = input.charCodeAt(i++);
- enc1 = chr1 >> 2;
- enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
- enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
- enc4 = chr3 & 63;
- if (isNaN(chr2)) {
- enc3 = enc4 = 64;
- } else if (isNaN(chr3)) {
- enc4 = 64;
- }
- output = output +
- _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
- _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
- }
- return output;
- }
-
- // public method for decoding
- this.decode = function (input) {
- var output = "";
- var chr1, chr2, chr3;
- var enc1, enc2, enc3, enc4;
- var i = 0;
- input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
- while (i < input.length) {
- enc1 = _keyStr.indexOf(input.charAt(i++));
- enc2 = _keyStr.indexOf(input.charAt(i++));
- enc3 = _keyStr.indexOf(input.charAt(i++));
- enc4 = _keyStr.indexOf(input.charAt(i++));
- chr1 = (enc1 << 2) | (enc2 >> 4);
- chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
- chr3 = ((enc3 & 3) << 6) | enc4;
- output = output + String.fromCharCode(chr1);
- if (enc3 != 64) {
- output = output + String.fromCharCode(chr2);
- }
- if (enc4 != 64) {
- output = output + String.fromCharCode(chr3);
- }
- }
- output = _utf8_decode(output);
- return output;
- }
-
- // private method for UTF-8 encoding
- _utf8_encode = function (string) {
- string = string.replace(/\r\n/g,"\n");
- var utftext = "";
- for (var n = 0; n < string.length; n++) {
- var c = string.charCodeAt(n);
- if (c < 128) {
- utftext += String.fromCharCode(c);
- } else if((c > 127) && (c < 2048)) {
- utftext += String.fromCharCode((c >> 6) | 192);
- utftext += String.fromCharCode((c & 63) | 128);
- } else {
- utftext += String.fromCharCode((c >> 12) | 224);
- utftext += String.fromCharCode(((c >> 6) & 63) | 128);
- utftext += String.fromCharCode((c & 63) | 128);
- }
-
- }
- return utftext;
- }
-
- // private method for UTF-8 decoding
- _utf8_decode = function (utftext) {
- var string = "";
- var i = 0;
- var c = c1 = c2 = 0;
- while ( i < utftext.length ) {
- c = utftext.charCodeAt(i);
- if (c < 128) {
- string += String.fromCharCode(c);
- i++;
- } else if((c > 191) && (c < 224)) {
- c2 = utftext.charCodeAt(i+1);
- string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
- i += 2;
- } else {
- c2 = utftext.charCodeAt(i+1);
- c3 = utftext.charCodeAt(i+2);
- string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
- i += 3;
- }
- }
- return string;
- }
-}
\ No newline at end of file
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index f895d5938..017ca3008 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -4,6 +4,7 @@ import {WordsBtn, ActionBtn} from 'educoder';
import TraineetraininginformationModal from './TraineetraininginformationModal';
import ModulationModal from "../coursesPublic/ModulationModal";
import HomeworkModal from "../coursesPublic/HomeworkModal";
+import Base64 from 'js-base64';
import {
Form,
Select,
@@ -32,7 +33,6 @@ import moment from 'moment';
import 'moment/locale/zh-cn';
import {getImageUrl, toPath} from 'educoder';
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
-import Base64 from './base64'
const Search = Input.Search;
const RadioGroup = Radio.Group;
const CheckboxGroup = Checkbox.Group;
@@ -1405,8 +1405,11 @@ class Listofworks extends Component {
console.log(response.headers['content-disposition'].split('=')[1]);
console.log(name);
console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1]));
+ console.log("1409");
+ console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
downloadElement.href = href
// downloadElement.download = name
+
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
From 22c89ddfc33243b01dfb4b728dc025c92ea9c9a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 20:29:59 +0800
Subject: [PATCH 08/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/courses/shixunHomework/Listofworks.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index 017ca3008..893747da6 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -4,7 +4,7 @@ import {WordsBtn, ActionBtn} from 'educoder';
import TraineetraininginformationModal from './TraineetraininginformationModal';
import ModulationModal from "../coursesPublic/ModulationModal";
import HomeworkModal from "../coursesPublic/HomeworkModal";
-import Base64 from 'js-base64';
+import {Base64} from 'js-base64';
import {
Form,
Select,
From 5bdc740aa6dc70779bd10ebdd7969354b390fba0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 21:51:52 +0800
Subject: [PATCH 09/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../modules/courses/Resource/Fileslistitem.js | 4 ++-
.../courses/shixunHomework/Listofworks.js | 30 ++++++++++++++-----
2 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js
index 404214dfc..0ce4fba46 100644
--- a/public/react/src/modules/courses/Resource/Fileslistitem.js
+++ b/public/react/src/modules/courses/Resource/Fileslistitem.js
@@ -27,6 +27,7 @@ class Fileslistitem extends Component{
this.props.Settingtypes(discussMessage.id)
}
showfiles=()=>{
+ debugger
let {discussMessage,coursesId}=this.props
let file_id=discussMessage.id
let url="/files/"+file_id+"/histories.json"
@@ -35,12 +36,13 @@ class Fileslistitem extends Component{
course_id:coursesId
},
}).then((result)=>{
+
if(result.data.attachment_histories.length===0){
let link = document.createElement('a');
document.body.appendChild(link);
link.href = result.data.url;
- link.download = result.data.title;
+ link.download = '';
//兼容火狐浏览器
let evt = document.createEvent("MouseEvents");
evt.initEvent("click", false, false);
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index 893747da6..c3604f314 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1359,14 +1359,16 @@ class Listofworks extends Component {
}else{
// window.location.href("/api"+url);
console.log("开始下载zip文件")
- const type='application/zip'//ZIP文件
+ // const type='application/zip'//ZIP文件
+ const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
+
const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
//后台再header中传文件名
const name = decodeURI(response.headers['content-disposition'].split('=')[1])
downloadElement.href = href
- // downloadElement.download = name
+ downloadElement.download = ''
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
@@ -1387,6 +1389,12 @@ class Listofworks extends Component {
// search: this.state.searchtext,
// }
// },{responseType: 'blob'})
+ // 56S+5Yy65a+85biIX+iuoeeul+aAnee7tOWvvOiuujIwMTnmmKXlraPor77l,oIJfUHl0aG9u5a6e546w6YCJ5oup,.xls
+ // console.log(decodeURIComponent("b178a6c387c1dd2d4097b0dcaa19a043_1562205834"));
+ // console.log(decodeURI("b178a6c387c1dd2d4097b0dcaa19a043_1562205834"));
+ // console.log(Base64.decode("b178a6c387c1dd2d4097b0dcaa19a043_1562205834"));
+ // console.log(Base64.decode("56S-5Yy65a-85biIX-iuoeeul-aAnee7tOWvvOiuujIwMTnmmKXlraPor77loIJfUHl0aG9u5a6e546w6YCJ5oup"));
+
axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("1374");
console.log(response);
@@ -1401,14 +1409,18 @@ class Listofworks extends Component {
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
//后台再header中传文件名
- const name = decodeURI(response.headers['content-disposition'].split('=')[1])
+ // const name = decodeURI(response.headers['content-disposition'].split('=')[1])
console.log(response.headers['content-disposition'].split('=')[1]);
- console.log(name);
- console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1]));
- console.log("1409");
+ // console.log(name);
+ // console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1]));
+ console.log("1409");
console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
+ const string = response.headers['content-disposition'].split('=')[1];
+ var index=string.lastIndexOf("\.");
+ const name=obj.substring(0,index);
+ console.log(Base64.decode(name));
downloadElement.href = href
- // downloadElement.download = name
+ downloadElement.download = Base64.decode(name)+".xlsx";
document.body.appendChild(downloadElement)
downloadElement.click()
@@ -1569,8 +1581,10 @@ class Listofworks extends Component {
{this.props.isAdmin()?
导出
:""}
{this.props.isAdmin() ?
From dfc6d44ae8bd2764363d1991c3c30c2741ea21a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 21:56:57 +0800
Subject: [PATCH 10/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/courses/shixunHomework/Listofworks.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index c3604f314..396995b78 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1417,7 +1417,7 @@ class Listofworks extends Component {
console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
const string = response.headers['content-disposition'].split('=')[1];
var index=string.lastIndexOf("\.");
- const name=obj.substring(0,index);
+ const name=string.substring(0,index);
console.log(Base64.decode(name));
downloadElement.href = href
downloadElement.download = Base64.decode(name)+".xlsx";
From c4df994aa2334898d644c2c5124945e5069bce74 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 22:13:39 +0800
Subject: [PATCH 11/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/shixunHomework/Listofworks.js | 24 +++++++------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index 396995b78..2983b80a4 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1359,16 +1359,15 @@ class Listofworks extends Component {
}else{
// window.location.href("/api"+url);
console.log("开始下载zip文件")
- // const type='application/zip'//ZIP文件
- const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
-
+ const type='application/zip'//ZIP文件
const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
//后台再header中传文件名
- const name = decodeURI(response.headers['content-disposition'].split('=')[1])
+ console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
+ const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href
- downloadElement.download = ''
+ downloadElement.download = string+".zip"
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
@@ -1410,18 +1409,14 @@ class Listofworks extends Component {
const href = window.URL.createObjectURL(blob)
//后台再header中传文件名
// const name = decodeURI(response.headers['content-disposition'].split('=')[1])
- console.log(response.headers['content-disposition'].split('=')[1]);
+ // console.log(response.headers['content-disposition'].split('=')[1]);
// console.log(name);
// console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1]));
- console.log("1409");
+ console.log("1409");
console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
- const string = response.headers['content-disposition'].split('=')[1];
- var index=string.lastIndexOf("\.");
- const name=string.substring(0,index);
- console.log(Base64.decode(name));
+ const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href
- downloadElement.download = Base64.decode(name)+".xlsx";
-
+ downloadElement.download =string+".xlsx";
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
@@ -1581,8 +1576,7 @@ class Listofworks extends Component {
{this.props.isAdmin()?
导出
From af12d95753a60f1e23620eeca0332d09b6cb7307 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 22:59:00 +0800
Subject: [PATCH 12/18] b
---
.../src/modules/courses/shixunHomework/Listofworks.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index 2983b80a4..f06acf8ec 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1415,8 +1415,17 @@ class Listofworks extends Component {
console.log("1409");
console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
+ var now="";
+ try {
+ now = moment().year()+moment().month()+moment().date();
+ console.log("1422");
+ console.log(now);
+
+ } catch (e) {
+ console.log("1432");
+ }
downloadElement.href = href
- downloadElement.download =string+".xlsx";
+ downloadElement.download =string+now+".xlsx";
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
From 3e6d9bb0a12a304314bbb89b696bc2694e35b86e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 23:10:50 +0800
Subject: [PATCH 13/18] b
---
.../courses/shixunHomework/Listofworks.js | 21 +++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index f06acf8ec..ca1bcc1a0 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1351,10 +1351,10 @@ class Listofworks extends Component {
axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("1350");
console.log(response);
- if(response.data.status&&response.data.status===-1){
+ if(response.status&&response.status===-1){
- }else if(response.data.status&&response.data.status===-2){
+ }else if(response.status&&response.status===-2){
}else{
// window.location.href("/api"+url);
@@ -1367,7 +1367,16 @@ class Listofworks extends Component {
console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href
- downloadElement.download = string+".zip"
+ var now="";
+ try {
+ now = moment().year()+""+moment().month()+""+moment().date();
+ console.log("1422");
+ console.log(now);
+
+ } catch (e) {
+ console.log("1432");
+ }
+ downloadElement.download = string+now+".zip"
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
@@ -1397,10 +1406,10 @@ class Listofworks extends Component {
axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("1374");
console.log(response);
- if(response.data.status&&response.data.status===-1){
+ if(response.status&&response.status===-1){
- }else if(response.data.status&&response.data.status===-2){
+ }else if(response.status&&response.status===-2){
}else{
const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
@@ -1417,7 +1426,7 @@ class Listofworks extends Component {
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
var now="";
try {
- now = moment().year()+moment().month()+moment().date();
+ now = moment().year()+""+moment().month()+""+moment().date();
console.log("1422");
console.log(now);
From 3dad6096e59ea3e659ea005ab13aa715315aea20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 23:28:41 +0800
Subject: [PATCH 14/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../react/src/modules/courses/shixunHomework/Listofworks.js | 4 ++--
.../src/modules/courses/shixunHomework/shixunHomework.js | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index ca1bcc1a0..4e0497a24 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1369,7 +1369,7 @@ class Listofworks extends Component {
downloadElement.href = href
var now="";
try {
- now = moment().year()+""+moment().month()+""+moment().date();
+ now = moment().year()+""+moment().month()+""+moment().date()+""+moment().hour()+""+moment().minute()+""+moment().second();
console.log("1422");
console.log(now);
@@ -1426,7 +1426,7 @@ class Listofworks extends Component {
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
var now="";
try {
- now = moment().year()+""+moment().month()+""+moment().date();
+ now = moment().year()+""+moment().month()+""+moment().date()+""+moment().hour()+""+moment().minute()+""+moment().second();
console.log("1422");
console.log(now);
diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js
index 9bf0d12a4..42f5fbf6a 100644
--- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js
+++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js
@@ -1132,7 +1132,7 @@ class ShixunHomework extends Component{
{course_modules&&course_modules.main_category.map((item,key)=>{
return(
- datas&&datas.category_id===null?"": this.moveTos(item.main_category_id)}>{item.main_category_name}:""
+ datas&&datas.category_id===null?"": this.moveTos(item.main_category_id)}>{item.main_category_name}
)
})}
From 6e10c1c123d2f0e4963f3ce8f582ebf79af29531 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Fri, 5 Jul 2019 23:42:01 +0800
Subject: [PATCH 15/18] b
---
.../react/src/modules/courses/shixunHomework/Listofworks.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index 4e0497a24..2ce92df78 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1369,7 +1369,7 @@ class Listofworks extends Component {
downloadElement.href = href
var now="";
try {
- now = moment().year()+""+moment().month()+""+moment().date()+""+moment().hour()+""+moment().minute()+""+moment().second();
+ now = moment().year()+""+moment().month()+1+""+moment().date()+""+moment().hour()+""+moment().minute()+""
console.log("1422");
console.log(now);
@@ -1426,7 +1426,7 @@ class Listofworks extends Component {
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
var now="";
try {
- now = moment().year()+""+moment().month()+""+moment().date()+""+moment().hour()+""+moment().minute()+""+moment().second();
+ now = moment().year()+""+moment().month()+1+""+moment().date()+""+moment().hour()+""+moment().minute()+""
console.log("1422");
console.log(now);
From 680be1bf0a96474ae7e49a4ac5332144ef762b43 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Sat, 6 Jul 2019 00:00:34 +0800
Subject: [PATCH 16/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../courses/shixunHomework/Listofworks.js | 34 +++----------
.../shixunHomework/ShixunStudentWork.js | 46 ++++++++++++++++-
.../shixunHomework/ShixunWorkReport.js | 45 +++++++++++++++--
.../shixunHomework/Trainingjobsetting.js | 47 +++++++++++++++++-
.../shixunHomework/Workquestionandanswer.js | 49 +++++++++++++++++--
5 files changed, 184 insertions(+), 37 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js
index 2ce92df78..db008e2c4 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1358,23 +1358,22 @@ class Listofworks extends Component {
}else{
// window.location.href("/api"+url);
- console.log("开始下载zip文件")
+ // console.log("开始下载zip文件")
const type='application/zip'//ZIP文件
const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
//后台再header中传文件名
- console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
+ // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href
var now="";
try {
- now = moment().year()+""+moment().month()+1+""+moment().date()+""+moment().hour()+""+moment().minute()+""
- console.log("1422");
+ now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
console.log(now);
} catch (e) {
- console.log("1432");
+ console.log("1376");
}
downloadElement.download = string+now+".zip"
document.body.appendChild(downloadElement)
@@ -1389,20 +1388,6 @@ class Listofworks extends Component {
// 课堂学生成绩的导出下载
Classstudentachievement=(url)=>{
console.log("Classstudentachievement");
- // const course_id = this.props.match.params.coursesId;
- // let url = "/courses/"+course_id+"/export_member_scores_excel.xlsx";
- // ,{
- // params: {
- // group_id: this.state.checkedValuesineinfo,
- // search: this.state.searchtext,
- // }
- // },{responseType: 'blob'})
- // 56S+5Yy65a+85biIX+iuoeeul+aAnee7tOWvvOiuujIwMTnmmKXlraPor77l,oIJfUHl0aG9u5a6e546w6YCJ5oup,.xls
- // console.log(decodeURIComponent("b178a6c387c1dd2d4097b0dcaa19a043_1562205834"));
- // console.log(decodeURI("b178a6c387c1dd2d4097b0dcaa19a043_1562205834"));
- // console.log(Base64.decode("b178a6c387c1dd2d4097b0dcaa19a043_1562205834"));
- // console.log(Base64.decode("56S-5Yy65a-85biIX-iuoeeul-aAnee7tOWvvOiuujIwMTnmmKXlraPor77loIJfUHl0aG9u5a6e546w6YCJ5oup"));
-
axios.get((url),{responseType: 'blob'}).then((response) => {
console.log("1374");
console.log(response);
@@ -1417,16 +1402,12 @@ class Listofworks extends Component {
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
//后台再header中传文件名
- // const name = decodeURI(response.headers['content-disposition'].split('=')[1])
- // console.log(response.headers['content-disposition'].split('=')[1]);
- // console.log(name);
- // console.log(decodeURIComponent(response.headers['content-disposition'].split('=')[1]));
- console.log("1409");
- console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
+ // console.log("1409");
+ // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
var now="";
try {
- now = moment().year()+""+moment().month()+1+""+moment().date()+""+moment().hour()+""+moment().minute()+""
+ now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
console.log("1422");
console.log(now);
@@ -1439,7 +1420,6 @@ class Listofworks extends Component {
downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
-
}
}).catch((error) => {
console.log(error)
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
index 109988fa9..5744c8ffe 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
@@ -469,7 +469,27 @@ class ShixunStudentWork extends Component {
}else if(response.data.status&&response.data.status===-2){
}else{
- window.open("/api"+url, '_blank');
+ const type='application/zip'//ZIP文件
+ const blob = new Blob([response.data], { type: type })
+ const downloadElement = document.createElement('a')
+ const href = window.URL.createObjectURL(blob)
+ //后台再header中传文件名
+ // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
+ const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
+ downloadElement.href = href
+ var now="";
+ try {
+ now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
+ console.log(now);
+
+ } catch (e) {
+ console.log("1376");
+ }
+ downloadElement.download = string+now+".zip"
+ document.body.appendChild(downloadElement)
+ downloadElement.click()
+ document.body.removeChild(downloadElement) // 下载完成移除元素
+ window.URL.revokeObjectURL(href) // 释放掉blob对象
}
}).catch((error) => {
@@ -491,7 +511,29 @@ class ShixunStudentWork extends Component {
}else if(response.data.status&&response.data.status===-2){
}else{
- window.open("/api"+url, '_blank');
+ const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
+ const blob = new Blob([response.data], { type: type })
+ const downloadElement = document.createElement('a')
+ const href = window.URL.createObjectURL(blob)
+ //后台再header中传文件名
+ // console.log("1409");
+ // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
+ const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
+ var now="";
+ try {
+ now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
+ console.log("1422");
+ console.log(now);
+
+ } catch (e) {
+ console.log("1432");
+ }
+ downloadElement.href = href
+ downloadElement.download =string+now+".xlsx";
+ document.body.appendChild(downloadElement)
+ downloadElement.click()
+ document.body.removeChild(downloadElement) // 下载完成移除元素
+ window.URL.revokeObjectURL(href) // 释放掉blob对象
}
}).catch((error) => {
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
index d120ec5ad..e8a42bdae 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
@@ -17,6 +17,7 @@ import '../css/members.css';
import "../common/formCommon.css";
import '../css/Courses.css';
import './style.css';
+import moment from "./Trainingjobsetting";
class ShixunWorkReport extends Component {
@@ -28,7 +29,47 @@ class ShixunWorkReport extends Component {
spinning:true
}
}
+ // 导出实习报告批量
+ internshipreport = (url) => {
+ console.log("internshipreport");
+ // var homeworkid = this.props.match.params.homeworkid;
+ // let url = "/zip/shixun_report";
+ axios.get(url).then((response) => {
+ console.log("326");
+ console.log(response);
+ if(response.data.status&&response.data.status===-1){
+
+ }else if(response.data.status&&response.data.status===-2){
+
+ }else{
+ const type='application/zip'//ZIP文件
+ const blob = new Blob([response.data], { type: type })
+ const downloadElement = document.createElement('a')
+ const href = window.URL.createObjectURL(blob)
+ //后台再header中传文件名
+ // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
+ const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
+ downloadElement.href = href
+ var now="";
+ try {
+ now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
+ console.log(now);
+
+ } catch (e) {
+ console.log("1376");
+ }
+ downloadElement.download = string+now+".zip"
+ document.body.appendChild(downloadElement)
+ downloadElement.click()
+ document.body.removeChild(downloadElement) // 下载完成移除元素
+ window.URL.revokeObjectURL(href) // 释放掉blob对象
+ }
+
+ }).catch((error) => {
+ console.log(error)
+ });
+ }
componentDidMount() {
this.setState({
spinning:true
@@ -93,9 +134,7 @@ class ShixunWorkReport extends Component {
{/*{this.props.isAdmin()?导出实训报告数据:""}*/}
{this.props.isAdmin() ? this.internshipreport(`/zip/shixun_report?homework_common_id=${homeworkid}`)}
>导出实训报告数据 : ""}
diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
index 8e857199b..efa418db0 100644
--- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
+++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
@@ -24,6 +24,7 @@ import './style.css';
import '../css/busyWork.css'
import '../poll/pollStyle.css'
import moment from 'moment';
+import 'moment/locale/zh-cn';
import Modals from "../../modals/Modals";
const RadioGroup = Radio.Group;
@@ -1621,7 +1622,27 @@ class Trainingjobsetting extends Component {
}else if(response.data.status&&response.data.status===-2){
}else{
- window.open("/api"+url, '_blank');
+ const type='application/zip'//ZIP文件
+ const blob = new Blob([response.data], { type: type })
+ const downloadElement = document.createElement('a')
+ const href = window.URL.createObjectURL(blob)
+ //后台再header中传文件名
+ // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
+ const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
+ downloadElement.href = href
+ var now="";
+ try {
+ now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
+ console.log(now);
+
+ } catch (e) {
+ console.log("1376");
+ }
+ downloadElement.download = string+now+".zip"
+ document.body.appendChild(downloadElement)
+ downloadElement.click()
+ document.body.removeChild(downloadElement) // 下载完成移除元素
+ window.URL.revokeObjectURL(href) // 释放掉blob对象
}
}).catch((error) => {
@@ -1643,7 +1664,29 @@ class Trainingjobsetting extends Component {
}else if(response.data.status&&response.data.status===-2){
}else{
- window.open("/api"+url, '_blank');
+ const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
+ const blob = new Blob([response.data], { type: type })
+ const downloadElement = document.createElement('a')
+ const href = window.URL.createObjectURL(blob)
+ //后台再header中传文件名
+ // console.log("1409");
+ // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
+ const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
+ var now="";
+ try {
+ now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
+ console.log("1422");
+ console.log(now);
+
+ } catch (e) {
+ console.log("1432");
+ }
+ downloadElement.href = href
+ downloadElement.download =string+now+".xlsx";
+ document.body.appendChild(downloadElement)
+ downloadElement.click()
+ document.body.removeChild(downloadElement) // 下载完成移除元素
+ window.URL.revokeObjectURL(href) // 释放掉blob对象
}
}).catch((error) => {
diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
index 8d88e9fb5..572f1e44f 100644
--- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
+++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
@@ -23,7 +23,8 @@ import {
notification
} from "antd";
import {Link, Switch, Route, Redirect} from 'react-router-dom';
-import moment from 'moment'
+import moment from 'moment';
+import 'moment/locale/zh-cn';
import axios from 'axios';
import '../css/members.css'
import "../common/formCommon.css"
@@ -332,7 +333,27 @@ class Workquestionandanswer extends Component {
}else if(response.data.status&&response.data.status===-2){
}else{
- window.open("/api"+url, '_blank');
+ const type='application/zip'//ZIP文件
+ const blob = new Blob([response.data], { type: type })
+ const downloadElement = document.createElement('a')
+ const href = window.URL.createObjectURL(blob)
+ //后台再header中传文件名
+ // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
+ const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
+ downloadElement.href = href
+ var now="";
+ try {
+ now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
+ console.log(now);
+
+ } catch (e) {
+ console.log("1376");
+ }
+ downloadElement.download = string+now+".zip"
+ document.body.appendChild(downloadElement)
+ downloadElement.click()
+ document.body.removeChild(downloadElement) // 下载完成移除元素
+ window.URL.revokeObjectURL(href) // 释放掉blob对象
}
}).catch((error) => {
@@ -354,7 +375,29 @@ class Workquestionandanswer extends Component {
}else if(response.data.status&&response.data.status===-2){
}else{
- window.open("/api"+url, '_blank');
+ const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
+ const blob = new Blob([response.data], { type: type })
+ const downloadElement = document.createElement('a')
+ const href = window.URL.createObjectURL(blob)
+ //后台再header中传文件名
+ // console.log("1409");
+ // console.log(Base64.decode(response.headers['content-disposition'].split('=')[1]));
+ const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
+ var now="";
+ try {
+ now = moment().year()+""+(moment().month()+1)+""+moment().date()+""+moment().hour()+""+moment().minute()+""
+ console.log("1422");
+ console.log(now);
+
+ } catch (e) {
+ console.log("1432");
+ }
+ downloadElement.href = href
+ downloadElement.download =string+now+".xlsx";
+ document.body.appendChild(downloadElement)
+ downloadElement.click()
+ document.body.removeChild(downloadElement) // 下载完成移除元素
+ window.URL.revokeObjectURL(href) // 释放掉blob对象
}
}).catch((error) => {
From a47fdee32f3b0fb8bca68bea48d8419dc9741a3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Sat, 6 Jul 2019 00:01:14 +0800
Subject: [PATCH 17/18] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/courses/shixunHomework/ShixunWorkReport.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
index e8a42bdae..e8acd93c6 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
@@ -17,7 +17,8 @@ import '../css/members.css';
import "../common/formCommon.css";
import '../css/Courses.css';
import './style.css';
-import moment from "./Trainingjobsetting";
+import moment from 'moment';
+import 'moment/locale/zh-cn';
class ShixunWorkReport extends Component {
From 6666c9ee6994e3502a434322a19d995181584845 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Sat, 6 Jul 2019 00:08:18 +0800
Subject: [PATCH 18/18] b
---
.../src/modules/courses/shixunHomework/ShixunStudentWork.js | 1 +
.../src/modules/courses/shixunHomework/ShixunWorkReport.js | 2 +-
.../src/modules/courses/shixunHomework/Trainingjobsetting.js | 1 +
.../src/modules/courses/shixunHomework/Workquestionandanswer.js | 1 +
4 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
index 5744c8ffe..3ac1b0bd2 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
@@ -32,6 +32,7 @@ import '../css/Courses.css'
import './style.css'
import moment from 'moment';
import 'moment/locale/zh-cn';
+import {Base64} from 'js-base64';
const Search = Input.Search;
const CheckboxGroup = Checkbox.Group;
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
index e8acd93c6..9c6ea2421 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
@@ -19,7 +19,7 @@ import '../css/Courses.css';
import './style.css';
import moment from 'moment';
import 'moment/locale/zh-cn';
-
+import {Base64} from 'js-base64';
class ShixunWorkReport extends Component {
diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
index efa418db0..f7f7c80e5 100644
--- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
+++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
@@ -4,6 +4,7 @@ import HomeworkModal from "../coursesPublic/HomeworkModal";
import {WordsBtn, ActionBtn, handleDateString} from 'educoder';
import PollDetailTabForthRules from '../poll/PollDetailTabForthRules';
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
+import {Base64} from 'js-base64';
import {
Button,
Checkbox,
diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
index 572f1e44f..5137351d2 100644
--- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
+++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
@@ -25,6 +25,7 @@ import {
import {Link, Switch, Route, Redirect} from 'react-router-dom';
import moment from 'moment';
import 'moment/locale/zh-cn';
+import {Base64} from 'js-base64';
import axios from 'axios';
import '../css/members.css'
import "../common/formCommon.css"