From 8b99e0f41ec98a453cf52eef19635a4b0fbd53d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Sun, 7 Jul 2019 19:46:31 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../exercise/Testpapersettinghomepage.js | 17 ++-
.../courses/shixunHomework/Httpdownloads.js | 6 +-
.../courses/shixunHomework/Listofworks.js | 89 +++-------------
.../shixunHomework/ShixunStudentWork.js | 83 ++-------------
.../shixunHomework/ShixunWorkReport.js | 50 +++------
.../shixunHomework/Trainingjobsetting.js | 100 ++++--------------
.../shixunHomework/Workquestionandanswer.js | 92 +++-------------
.../react/src/modules/login/EducoderLogin.js | 2 +-
public/react/src/modules/user/Interestpage.js | 55 ++++++++--
9 files changed, 139 insertions(+), 355 deletions(-)
diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js
index 977ae20df..b84db0170 100644
--- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js
+++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js
@@ -112,10 +112,17 @@ class Testpapersettinghomepage extends Component{
experiment=(url)=>{
axios.get(url).then((response) => {
- if(response.status === 200){
- window.open(url, '_blank');
-
- }
+ if(response.data.status&&response.data.status===-1){
+
+ }else if(response.data.status&&response.data.status===-2){
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
+ }else {
+ //因附件资料超过500M
+ }
+ }else {
+ window.open(url, '_blank');
+ }
}).catch((error) => {
console.log(error)
});
@@ -262,7 +269,7 @@ class Testpapersettinghomepage extends Component{
导出
:""}
diff --git a/public/react/src/modules/courses/shixunHomework/Httpdownloads.js b/public/react/src/modules/courses/shixunHomework/Httpdownloads.js
index 84b1d090b..11bd91f6b 100644
--- a/public/react/src/modules/courses/shixunHomework/Httpdownloads.js
+++ b/public/react/src/modules/courses/shixunHomework/Httpdownloads.js
@@ -3,7 +3,8 @@ import axios from 'axios';
// 导出实习报告批量zip 、xlsx 类型
-export function Internshipreportsy (url,struy,types,stingtype,response){
+export function Internshipreportsy (url,struy,types,stingtype){
+ axios.get((url),{responseType: 'blob'}).then((response) => {
const blob = new Blob([response.data], { type: stingtype });
const downloadElement = document.createElement('a');
const href = window.URL.createObjectURL(blob);
@@ -14,4 +15,7 @@ export function Internshipreportsy (url,struy,types,stingtype,response){
downloadElement.click();
document.body.removeChild(downloadElement) ;// 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象
+ }).catch((error) => {
+ console.log(error)
+ });
}
\ 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 832d5eaa4..db023b97d 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworks.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js
@@ -1338,80 +1338,23 @@ class Listofworks extends Component {
}
/// 确认是否下载
- confirmysl(url,type){
- var struy="";
- try {
- struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
- struy=struy.replace(/-/g,"");
- }catch (e) {
- console.log(1347);
- console.log(e);
- }
-
+ confirmysl(url){
axios.get(url).then((response) => {
- if(response !== undefined){
- if(response.data.status&&response.data.status===-1){
-
- }else if(response.data.status&&response.data.status===-2){
-
- }else {
- // if(type === 1){
- // Internshipreportsy(url,struy,".zip",'application/zip');
- // }else{
- Internshipreportsy(url,struy,".xlsx",'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',response);
- // }
- }
- }
- }).catch((error) => {
+ if(response.data.status&&response.data.status===-1){
+
+ }else if(response.data.status&&response.data.status===-2){
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
+ }else {
+ //因附件资料超过500M
+ }
+ }else {
+ window.open(url, '_blank');
+ }
+ }).catch((error) => {
console.log(error)
- });
+ });
}
- // 导出实习报告批量
- // internshipreport = (url,struy,types,stingtype)=>{
- // console.log("internshipreport");
- //
- // axios.get((url),{responseType: 'blob'}).then((response) => {
- // console.log("1350");
- // console.log(response);
- // const type='application/zip'//ZIP文件
- // const blob = new Blob([response.data], { type: stingtype });
- // const downloadElement = document.createElement('a');
- // const href = window.URL.createObjectURL(blob);
- // const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- // console.log(response.headers['content-disposition'].split('=')[1]);
- // downloadElement.href = href;
- // downloadElement.download = string+struy+types;
- // document.body.appendChild(downloadElement);
- // downloadElement.click();
- // document.body.removeChild(downloadElement) ;// 下载完成移除元素
- // window.URL.revokeObjectURL(href) // 释放掉blob对象
- // }).catch((error) => {
- // console.log(error)
- // });
- // }
- // // 课堂学生成绩的导出下载
- // Classstudentachievement=(url,struy)=>{
- // console.log("Classstudentachievement");
- // axios.get((url),{responseType: 'blob'}).then((response) => {
- // console.log("1374");
- // console.log(response);
- // 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);
- // const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- // console.log(response.headers['content-disposition'].split('=')[1]);
- // downloadElement.href = href;
- // downloadElement.download =string+struy+".xlsx";
- // document.body.appendChild(downloadElement);
- // downloadElement.click();
- // document.body.removeChild(downloadElement); // 下载完成移除元素
- // window.URL.revokeObjectURL(href) // 释放掉blob对象
- // }).catch((error) => {
- // console.log(error)
- // });
- // }
-
render() {
// console.log("Listofworks.js000")
@@ -1560,8 +1503,8 @@ class Listofworks extends Component {
{this.props.isAdmin()?
导出
:""}
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
index 992a957cf..de7aab180 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js
@@ -457,86 +457,25 @@ class ShixunStudentWork extends Component {
})
}
// 导出实习报告批量
- internshipreport = (url) => {
- console.log("internshipreport");
- console.log("internshipreport");
- var struy="";
- try {
- struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
- struy=struy.replace(/-/g,"");
- }catch (e) {
- console.log(1347);
- console.log(e);
- }
-
+ /// 确认是否下载
+ confirmysl(url){
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)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download = string+struy+".zip"
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
+ }else {
+ //因附件资料超过500M
+ }
+ }else {
+ window.open(url, '_blank');
}
-
}).catch((error) => {
console.log(error)
});
}
- // 课堂学生成绩的导出下载
- Classstudentachievement = (url) => {
- console.log("Classstudentachievement");
- // console.log();
- var struy="";
- try {
- struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
- struy=struy.replace(/-/g,"");
- }catch (e) {
- console.log(1397);
- console.log(e);
- }
-
- axios.get(url).then((response) => {
- console.log("1374");
- console.log(response);
- if(response.data.status&&response.data.status===-1){
-
-
- }else if(response.data.status&&response.data.status===-2){
-
- }else{
- 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)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download =string+struy+".xlsx";
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
-
- }
- }).catch((error) => {
- console.log(error)
- });
- }
render() {
let {
@@ -722,9 +661,9 @@ class ShixunStudentWork extends Component {
{this.props.isAdmin() ?
导出
: ""}
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
index 0d9b4de8f..2f6bc8856 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js
@@ -30,46 +30,26 @@ class ShixunWorkReport extends Component {
spinning:true
}
}
- // 导出实习报告批量
- internshipreport = (url) => {
- console.log("internshipreport");
- var struy="";
- try {
- struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
- struy=struy.replace(/-/g,"");
- }catch (e) {
- console.log(1347);
- console.log(e);
- }
-
- axios.get((url),{responseType: 'blob'}).then((response) => {
- console.log("1350");
- console.log(response);
- if(response.status&&response.status===-1){
-
+ /// 确认是否下载
+ confirmysl(url){
+ axios.get(url).then((response) => {
+ if(response.data.status&&response.data.status===-1){
- }else if(response.status&&response.status===-2){
-
- }else{
- // window.location.href("/api"+url);
- // 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)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download = string+struy+".zip"
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
+ }else if(response.data.status&&response.data.status===-2){
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
+ }else {
+ //因附件资料超过500M
+ }
+ }else {
+ window.open(url, '_blank');
}
}).catch((error) => {
console.log(error)
});
}
+
+
componentDidMount() {
this.setState({
spinning:true
@@ -134,7 +114,7 @@ class ShixunWorkReport extends Component {
{/*{this.props.isAdmin()?导出实训报告数据:""}*/}
{this.props.isAdmin() ? this.internshipreport(`/zip/shixun_report?homework_common_id=${homeworkid}`)}
+ onClick={()=>this.confirmysl(`/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 97e8d9aa9..466f2e9b7 100644
--- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
+++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js
@@ -1609,86 +1609,24 @@ class Trainingjobsetting extends Component {
showmodel:false
})
}
- // 导出实习报告批量
- internshipreport = (url) => {
- console.log("internshipreport");
- var struy="";
- try {
- struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
- struy=struy.replace(/-/g,"");
- }catch (e) {
- console.log(1347);
- console.log(e);
- }
-
- axios.get((url),{responseType: 'blob'}).then((response) => {
- console.log("1350");
- console.log(response);
- if(response.status&&response.status===-1){
-
-
- }else if(response.status&&response.status===-2){
-
- }else{
- // window.location.href("/api"+url);
- // 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)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download = string+struy+".zip"
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
- }
- }).catch((error) => {
- console.log(error)
- });
- }
- // 课堂学生成绩的导出下载
- Classstudentachievement = (url) => {
- console.log("Classstudentachievement");
- // console.log();
- var struy="";
- try {
- struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
- struy=struy.replace(/-/g,"");
- }catch (e) {
- console.log(1397);
- console.log(e);
- }
-
-
- axios.get((url),{responseType: 'blob'}).then((response) => {
- console.log("1374");
- console.log(response);
- if(response.status&&response.status===-1){
-
-
- }else if(response.status&&response.status===-2){
-
- }else{
- 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)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download =string+struy+".xlsx";
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
- }
- }).catch((error) => {
- console.log(error)
- });
+ /// 确认是否下载
+ confirmysl(url){
+ axios.get(url).then((response) => {
+ if(response.data.status&&response.data.status===-1){
+
+ }else if(response.data.status&&response.data.status===-2){
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
+ }else {
+ //因附件资料超过500M
+ }
+ }else {
+ window.open(url, '_blank');
+ }
+ }).catch((error) => {
+ console.log(error)
+ });
}
@@ -1831,9 +1769,9 @@ class Trainingjobsetting extends Component {
{this.props.isAdmin() ?
导出
: ""}
diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
index 63fa30370..0bd32271a 100644
--- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
+++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js
@@ -319,83 +319,19 @@ class Workquestionandanswer extends Component {
})
}
+ /// 确认是否下载
+ confirmysl(url){
+ axios.get(url).then((response) => {
+ if(response.data.status&&response.data.status===-1){
- // 导出实习报告批量
- internshipreport = (url) => {
- console.log("internshipreport");
- var struy="";
- try {
- struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
- struy=struy.replace(/-/g,"");
- }catch (e) {
- console.log(1347);
- console.log(e);
- }
-
- axios.get((url),{responseType: 'blob'}).then((response) => {
- console.log("1350");
- console.log(response);
- if(response.status&&response.status===-1){
-
-
- }else if(response.status&&response.status===-2){
-
- }else{
- // window.location.href("/api"+url);
- // 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)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download = string+struy+".zip"
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
- }
- }).catch((error) => {
- console.log(error)
- });
- }
-
- // 课堂学生成绩的导出下载
- Classstudentachievement = (url) => {
- console.log("Classstudentachievement");
- // console.log();
- var struy="";
- try {
- struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
- struy=struy.replace(/-/g,"");
- }catch (e) {
- console.log(1397);
- console.log(e);
- }
-
-
- axios.get((url),{responseType: 'blob'}).then((response) => {
- console.log("1374");
- console.log(response);
- if(response.status&&response.status===-1){
-
-
- }else if(response.status&&response.status===-2){
-
- }else{
- 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)
- const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
- console.log(response.headers['content-disposition'].split('=')[1]);
- downloadElement.href = href
- downloadElement.download =string+struy+".xlsx";
- document.body.appendChild(downloadElement)
- downloadElement.click()
- document.body.removeChild(downloadElement) // 下载完成移除元素
- window.URL.revokeObjectURL(href) // 释放掉blob对象
+ }else if(response.data.status&&response.data.status===-2){
+ if(response.data.messages === "100"){
+ // 已超出文件导出的上限数量(100 ),建议:
+ }else {
+ //因附件资料超过500M
+ }
+ }else {
+ window.open(url, '_blank');
}
}).catch((error) => {
console.log(error)
@@ -527,9 +463,9 @@ class Workquestionandanswer extends Component {
导出
: ""}
diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js
index 7d9a0be9d..9dcdbfcf2 100644
--- a/public/react/src/modules/login/EducoderLogin.js
+++ b/public/react/src/modules/login/EducoderLogin.js
@@ -165,7 +165,7 @@ class EducoderLogin extends Component {
this.Setshowbool(e)} >
+ Setshowbool={(e)=>this.Setshowbool(e,name,pass)} >
diff --git a/public/react/src/modules/user/Interestpage.js b/public/react/src/modules/user/Interestpage.js
index 1a3d19e86..97a52bae9 100644
--- a/public/react/src/modules/user/Interestpage.js
+++ b/public/react/src/modules/user/Interestpage.js
@@ -31,6 +31,42 @@ class InterestpageComponent extends Component {
passmm:this.props.passmm,
}
}
+
+ componentWillReceiveProps(nextProps) {
+ // console.log("46");
+ // console.log(nextProps);
+ // console.log(this.props);
+ if (nextProps.namezh != this.props.namezh) {
+ // console.log("50");
+ // console.log(nextProps.user);
+ if (nextProps.namezh !== undefined) {
+ // console.log("53");
+ // console.log(nextProps.user);
+ this.setState({
+ namezh: nextProps.namezh,
+ })
+ }
+
+
+ }
+ if (nextProps.passmm != this.props.passmm) {
+ // console.log("50");
+ // console.log(nextProps.user);
+ if (nextProps.passmm !== undefined) {
+ // console.log("53");
+ // console.log(nextProps.user);
+ this.setState({
+ passmm: nextProps.passmm,
+ })
+ }
+
+
+ }
+
+
+ }
+
+
Clickteacher=(e)=>{
console.log(e);
if(e === "teacher"){
@@ -98,6 +134,8 @@ class InterestpageComponent extends Component {
//跳转然后登入
Jumptotheinterestpage=()=>{
+ console.log(this.state.login);
+ console.log(this.state.password);
var url = "/accounts/login.json";
axios.post(url, {
login: this.props.login,
@@ -107,16 +145,15 @@ class InterestpageComponent extends Component {
return
}
if (response.status === 200) {
- if (response.data.status === 402) {
- window.location.href = response.data.url;
- } else {
- broadcastChannelPostMessage('refreshPage')
- this.setState({
- isRender: false
- })
+ // if (response.data.status === 402) {
+ // window.location.href = response.data.url;
+ // } else {
+ // broadcastChannelPostMessage('refreshPage')
+ // this.setState({
+ // isRender: false
+ // })
window.location.href = "/"
-
- }
+ // }
}