From 96970811d44d7a8d8f3a357373995e8c3718815c 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 14:06:47 +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 --- .../courses/shixunHomework/Listofworks.js | 98 ++++++----- .../shixunHomework/ShixunStudentWork.js | 52 +++--- .../shixunHomework/ShixunWorkReport.js | 35 ++-- .../shixunHomework/Trainingjobsetting.js | 152 +++++++++--------- .../shixunHomework/Workquestionandanswer.js | 70 ++++---- .../react/src/modules/login/EducoderLogin.js | 14 +- public/react/src/modules/user/Interestpage.js | 30 ++++ .../modules/user/LoginRegisterComponent.js | 6 +- 8 files changed, 239 insertions(+), 218 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/Listofworks.js b/public/react/src/modules/courses/shixunHomework/Listofworks.js index 5dd049441..a9c783994 100644 --- a/public/react/src/modules/courses/shixunHomework/Listofworks.js +++ b/public/react/src/modules/courses/shixunHomework/Listofworks.js @@ -1336,10 +1336,8 @@ class Listofworks extends Component { }); } - - // 导出实习报告批量 - internshipreport = (url)=>{ - console.log("internshipreport"); + /// 确认是否下砸 + confirmysl(url,type){ var struy=""; try { struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm'); @@ -1349,70 +1347,66 @@ class Listofworks extends Component { console.log(e); } - axios.get((url),{responseType: 'blob'}).then((response) => { - console.log("1350"); - console.log(response); - if(response.status&&response.status===-1){ - + axios.get(url).then((response) => { + if(response.data.status&&response.data.status===-1){ + console.log("1352"); + console.log(response); - }else if(response.status&&response.status===-2){ + }else if(response.data.status&&response.data.status===-2){ + console.log("1356"); + console.log(response); + }else { + if(type === 1){ + this.internshipreport(url,struy) + }else{ + this.Classstudentachievement(url,struy); + } + } + }).catch((error) => { + console.log(error) + }); + } + // 导出实习报告批量 + internshipreport = (url,struy)=>{ + console.log("internshipreport"); - }else{ - // window.location.href("/api"+url); - // console.log("开始下载zip文件") + 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: type }) - const downloadElement = document.createElement('a') - const href = window.URL.createObjectURL(blob) + 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) // 下载完成移除元素 + 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)=>{ + Classstudentachievement=(url,struy)=>{ 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{ + 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 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.href = href; downloadElement.download =string+struy+".xlsx"; - document.body.appendChild(downloadElement) - downloadElement.click() - document.body.removeChild(downloadElement) // 下载完成移除元素 + document.body.appendChild(downloadElement); + downloadElement.click(); + document.body.removeChild(downloadElement); // 下载完成移除元素 window.URL.revokeObjectURL(href) // 释放掉blob对象 - } }).catch((error) => { console.log(error) }); @@ -1566,8 +1560,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 3ac1b0bd2..992a957cf 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -459,8 +459,16 @@ class ShixunStudentWork extends Component { // 导出实习报告批量 internshipreport = (url) => { console.log("internshipreport"); - // var homeworkid = this.props.match.params.homeworkid; - // let url = "/zip/shixun_report"; + 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).then((response) => { console.log("326"); console.log(response); @@ -474,19 +482,10 @@ class ShixunStudentWork extends Component { 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]); + console.log(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" + downloadElement.download = string+struy+".zip" document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 @@ -501,8 +500,16 @@ class ShixunStudentWork 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"; + // 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); @@ -516,21 +523,10 @@ class ShixunStudentWork extends Component { 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"); - } + console.log(response.headers['content-disposition'].split('=')[1]); downloadElement.href = href - downloadElement.download =string+now+".xlsx"; + downloadElement.download =string+struy+".xlsx"; document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement) // 下载完成移除元素 diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index 9c6ea2421..0d9b4de8f 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -33,40 +33,39 @@ class ShixunWorkReport extends Component { // 导出实习报告批量 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"); + 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.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); + // 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])); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); + console.log(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" + 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) }); diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index f7f7c80e5..97e8d9aa9 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -1611,88 +1611,84 @@ class Trainingjobsetting extends Component { } // 导出实习报告批量 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) - }); + 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"); - // const course_id = this.props.match.params.coursesId; - // let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx"; - 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) - //后台再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) => { - console.log(error) - }); + 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) + }); } diff --git a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js index 5137351d2..63fa30370 100644 --- a/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js +++ b/public/react/src/modules/courses/shixunHomework/Workquestionandanswer.js @@ -323,40 +323,39 @@ class Workquestionandanswer extends Component { // 导出实习报告批量 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"); + 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.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); + // 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])); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]); + console.log(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" + 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) }); @@ -365,41 +364,38 @@ class Workquestionandanswer 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"; - axios.get(url).then((response) => { + // 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.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文件 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"); - } + console.log(response.headers['content-disposition'].split('=')[1]); downloadElement.href = href - downloadElement.download =string+now+".xlsx"; + 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) diff --git a/public/react/src/modules/login/EducoderLogin.js b/public/react/src/modules/login/EducoderLogin.js index 10d792aa2..7d9a0be9d 100644 --- a/public/react/src/modules/login/EducoderLogin.js +++ b/public/react/src/modules/login/EducoderLogin.js @@ -62,6 +62,8 @@ class EducoderLogin extends Component { this.state = { showbool: 3, logini:3, + namezh:"", + passmm:"" } }else { if(props.match.url === "/login"){ @@ -69,6 +71,8 @@ class EducoderLogin extends Component { showbool: 1, loginstatus:true, logini:1, + namezh:"", + passmm:"" } }else if(props.match.url === "/register"){ @@ -76,11 +80,15 @@ class EducoderLogin extends Component { showbool: 1, loginstatus:false, logini:2, + namezh:"", + passmm:"" } }else{ this.state = { showbool: 1, logini:1, + namezh:"", + passmm:"" } } @@ -101,14 +109,16 @@ class EducoderLogin extends Component { }) } - Setshowbool = (e) => { + Setshowbool = (e,name,pass) => { if (e===1) { this.setState({ showbool: 1 }) } else if(e===2) { this.setState({ - showbool: 2 + showbool: 2, + namezh:name, + passmm:pass, }) }else if(e===3){ this.setState({ diff --git a/public/react/src/modules/user/Interestpage.js b/public/react/src/modules/user/Interestpage.js index 0d01ab563..c8ffa266d 100644 --- a/public/react/src/modules/user/Interestpage.js +++ b/public/react/src/modules/user/Interestpage.js @@ -25,6 +25,8 @@ class InterestpageComponent extends Component { gouxuans: 0, gouxuans2:0, gouxuans3:[{id:1,name:"前端开发",bool:false,url:qdkf},{id:2,name:"后端开发",bool:false,url:hdkf},{id:3,name:"移动开发",bool:false,url:ydkf},{id:4,name:"数据库",bool:false,url:sjk},{id:5,name:"云计算和大数据",bool:false,url:ysj},{id:6,name:"运维与测试",bool:false,url:yunwei},{id:7,name:"人工智能",bool:false,url:rgzn},{id:8,name:"其他",bool:false,url:qita}], + namezh:this.props.namezh, + passmm:this.props.passmm, } } Clickteacher=(e)=>{ @@ -63,6 +65,34 @@ class InterestpageComponent extends Component { }) } + //跳转然后登入 + Jumptotheinterestpage=(username,password)=>{ + var url = "/accounts/login.json"; + axios.post(url, { + login: username, + password: password, + }).then((response) => { + if (response === undefined) { + return + } + if (response.status === 200) { + if (response.data.status === 402) { + window.location.href = response.data.url; + } else { + broadcastChannelPostMessage('refreshPage') + this.setState({ + isRender: false + }) + window.location.href = "/" + + } + } + + + }).catch((error) => { + + }) + } render() { const { gouxuans, diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 54185c9ed..5b8fc025b 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -344,8 +344,8 @@ class LoginRegisterComponent extends Component { passwords: "", Agreetotheterms: "", }) - this.props.history.push(result.data.redirect_uri); - //this.props.Setshowbool(2); + // this.props.history.push(result.data.redirect_uri); + this.props.Setshowbool(2,this.state.logins,this.state.passwords); } catch (e) { } @@ -662,7 +662,7 @@ class LoginRegisterComponent extends Component {
    下次自动登录 - this.StudyMakeMoney()} className="mr3 color-grey-9 mt3 font-12">找回密码