hjm 5 years ago
commit 2904571e36

@ -30,13 +30,13 @@ class Fileslistitem extends Component{
downloadfiles=(url,name)=>{ downloadfiles=(url,name)=>{
const aLink = document.createElement('a'); const aLink = document.createElement('a');
document.body.appendChild(aLink);
aLink.style.display='none'; aLink.style.display='none';
aLink.download =name; console.log(name)
aLink.setAttribute('download',name)
aLink.href = url; aLink.href = url;
document.body.appendChild(aLink);
aLink.click(); aLink.click();
document.body.removeChild(aLink); // document.body.removeChild(aLink);
} }
showfiles=(value)=>{ showfiles=(value)=>{
let {discussMessage,coursesId}=this.props let {discussMessage,coursesId}=this.props
@ -49,7 +49,7 @@ class Fileslistitem extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.data.attachment_histories.length===0){ if(result.data.attachment_histories.length===0){
this.downloadfiles(result.data.url,filesname) this.downloadfiles(result.data.url,result.data.title)
}else{ }else{
this.setState({ this.setState({
Showoldfiles:true, Showoldfiles:true,

@ -21,6 +21,7 @@ class PollListItem extends Component{
const IsAdmin =this.props.isAdmin(); const IsAdmin =this.props.isAdmin();
const isStudent = this.props.isStudent(); const isStudent = this.props.isStudent();
const isNotMember = this.props.isNotMember();
let t= item.end_time ? moment(item.end_time) - moment() : 0; let t= item.end_time ? moment(item.end_time) - moment() : 0;
return( return(
@ -42,7 +43,7 @@ class PollListItem extends Component{
<Link to={`/courses/${coursesId}/polls/${item.id}/detail`} className="fl font-16 font-bd mt2 color-grey-3 task-hide" style={{"maxWidth":"600px"}} title={item.polls_name}>{item.polls_name}</Link> <Link to={`/courses/${coursesId}/polls/${item.id}/detail`} className="fl font-16 font-bd mt2 color-grey-3 task-hide" style={{"maxWidth":"600px"}} title={item.polls_name}>{item.polls_name}</Link>
} }
{ {
item.lock_status === 0 ? <Tooltip title="私有属性,非课堂成员不能访问"><i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl"></i></Tooltip>:"" item.lock_status === 0 ? <Tooltip title={`${courseType.user_permission == 0 ? "私有属性,非课堂成员不能访问" : "私有属性"}`}><i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl"></i></Tooltip>:""
} }
<CoursesListType typelist={[polls_status[`${item.polls_status}`]]} typesylename={""}></CoursesListType> <CoursesListType typelist={[polls_status[`${item.polls_status}`]]} typesylename={""}></CoursesListType>
{ {

@ -0,0 +1,21 @@
import {Base64} from 'js-base64';
import axios from 'axios';
// 导出实习报告批量zip 、xlsx 类型
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);
const string = Base64.decode(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)
});
}

@ -5,6 +5,7 @@ import TraineetraininginformationModal from './TraineetraininginformationModal';
import ModulationModal from "../coursesPublic/ModulationModal"; import ModulationModal from "../coursesPublic/ModulationModal";
import HomeworkModal from "../coursesPublic/HomeworkModal"; import HomeworkModal from "../coursesPublic/HomeworkModal";
import {Base64} from 'js-base64'; import {Base64} from 'js-base64';
import {Internshipreportsy} from './Httpdownloads'
import { import {
Form, Form,
Select, Select,
@ -1336,10 +1337,8 @@ class Listofworks extends Component {
}); });
} }
/// 确认是否下载
// 导出实习报告批量 confirmysl(url,type){
internshipreport = (url)=>{
console.log("internshipreport");
var struy=""; var struy="";
try { try {
struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm'); struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
@ -1349,74 +1348,72 @@ class Listofworks extends Component {
console.log(e); console.log(e);
} }
axios.get((url),{responseType: 'blob'}).then((response) => { axios.get(url).then((response) => {
console.log("1350"); if(response !== undefined){
if(response.data.status&&response.data.status===-1){
console.log("1352");
console.log(response); console.log(response);
if(response.status&&response.status===-1){
}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){
Internshipreportsy(url,struy,".zip",'application/zip');
}else{ }else{
// window.location.href("/api"+url); Internshipreportsy(url,struy,".xlsx",'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
// 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) => { }).catch((error) => {
console.log(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() { render() {
// console.log("Listofworks.js000") // console.log("Listofworks.js000")
@ -1566,8 +1563,8 @@ class Listofworks extends Component {
{this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding":"0 20px"}}> {this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding":"0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i> 导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-0px","left":"unset","height":"auto"}}> <ul className="drop_down_menu" style={{"right":"-0px","left":"unset","height":"auto"}}>
<li><a onClick={()=>this.internshipreport(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}&work_status=${this.state.course_groupyslstwo}&course_group=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)}>实训报告</a></li> <li><a onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}&work_status=${this.state.course_groupyslstwo}&course_group=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`,1)}>实训报告</a></li>
<li><a onClick={()=>this.Classstudentachievement(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?group_id=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`)} >学生成绩</a></li> <li><a onClick={()=>this.confirmysl(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?group_id=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`,2)} >学生成绩</a></li>
</ul> </ul>
</li>:""} </li>:""}

@ -459,8 +459,16 @@ class ShixunStudentWork extends Component {
// 导出实习报告批量 // 导出实习报告批量
internshipreport = (url) => { internshipreport = (url) => {
console.log("internshipreport"); console.log("internshipreport");
// var homeworkid = this.props.match.params.homeworkid; console.log("internshipreport");
// let url = "/zip/shixun_report"; 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) => { axios.get(url).then((response) => {
console.log("326"); console.log("326");
console.log(response); console.log(response);
@ -474,19 +482,10 @@ class ShixunStudentWork extends Component {
const blob = new Blob([response.data], { type: type }) const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) 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]); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
console.log(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href downloadElement.href = href
var now=""; downloadElement.download = string+struy+".zip"
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) document.body.appendChild(downloadElement)
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素 document.body.removeChild(downloadElement) // 下载完成移除元素
@ -501,8 +500,16 @@ class ShixunStudentWork extends Component {
// 课堂学生成绩的导出下载 // 课堂学生成绩的导出下载
Classstudentachievement = (url) => { Classstudentachievement = (url) => {
console.log("Classstudentachievement"); console.log("Classstudentachievement");
// const course_id = this.props.match.params.coursesId; // console.log();
// let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx"; 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) => { axios.get(url).then((response) => {
console.log("1374"); console.log("1374");
console.log(response); console.log(response);
@ -516,21 +523,10 @@ class ShixunStudentWork extends Component {
const blob = new Blob([response.data], { type: type }) const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) 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]); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
var now=""; console.log(response.headers['content-disposition'].split('=')[1]);
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.href = href
downloadElement.download =string+now+".xlsx"; downloadElement.download =string+struy+".xlsx";
document.body.appendChild(downloadElement) document.body.appendChild(downloadElement)
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素 document.body.removeChild(downloadElement) // 下载完成移除元素

@ -33,40 +33,39 @@ class ShixunWorkReport extends Component {
// 导出实习报告批量 // 导出实习报告批量
internshipreport = (url) => { internshipreport = (url) => {
console.log("internshipreport"); console.log("internshipreport");
// var homeworkid = this.props.match.params.homeworkid; var struy="";
// let url = "/zip/shixun_report"; try {
axios.get(url).then((response) => { struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
console.log("326"); 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); 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{ }else{
// window.location.href("/api"+url);
// console.log("开始下载zip文件")
const type='application/zip'//ZIP文件 const type='application/zip'//ZIP文件
const blob = new Blob([response.data], { type: type }) const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) 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]); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
console.log(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href downloadElement.href = href
var now=""; downloadElement.download = string+struy+".zip"
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) document.body.appendChild(downloadElement)
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素 document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象 window.URL.revokeObjectURL(href) // 释放掉blob对象
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });

@ -1612,40 +1612,39 @@ class Trainingjobsetting extends Component {
// 导出实习报告批量 // 导出实习报告批量
internshipreport = (url) => { internshipreport = (url) => {
console.log("internshipreport"); console.log("internshipreport");
// var homeworkid = this.props.match.params.homeworkid; var struy="";
// let url = "/zip/shixun_report"; try {
axios.get(url).then((response) => { struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
console.log("326"); 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); 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{ }else{
// window.location.href("/api"+url);
// console.log("开始下载zip文件")
const type='application/zip'//ZIP文件 const type='application/zip'//ZIP文件
const blob = new Blob([response.data], { type: type }) const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) 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]); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
console.log(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href downloadElement.href = href
var now=""; downloadElement.download = string+struy+".zip"
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) document.body.appendChild(downloadElement)
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素 document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象 window.URL.revokeObjectURL(href) // 释放掉blob对象
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -1654,41 +1653,38 @@ class Trainingjobsetting extends Component {
// 课堂学生成绩的导出下载 // 课堂学生成绩的导出下载
Classstudentachievement = (url) => { Classstudentachievement = (url) => {
console.log("Classstudentachievement"); console.log("Classstudentachievement");
// const course_id = this.props.match.params.coursesId; // console.log();
// let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx"; var struy="";
axios.get(url).then((response) => { 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("1374");
console.log(response); 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{ }else{
const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
const blob = new Blob([response.data], { type: type }) const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) 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]); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
var now=""; console.log(response.headers['content-disposition'].split('=')[1]);
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.href = href
downloadElement.download =string+now+".xlsx"; downloadElement.download =string+struy+".xlsx";
document.body.appendChild(downloadElement) document.body.appendChild(downloadElement)
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素 document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象 window.URL.revokeObjectURL(href) // 释放掉blob对象
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -323,40 +323,39 @@ class Workquestionandanswer extends Component {
// 导出实习报告批量 // 导出实习报告批量
internshipreport = (url) => { internshipreport = (url) => {
console.log("internshipreport"); console.log("internshipreport");
// var homeworkid = this.props.match.params.homeworkid; var struy="";
// let url = "/zip/shixun_report"; try {
axios.get(url).then((response) => { struy = moment().format('YYYY-MM-DD')+"-"+moment().format('hh-mm');
console.log("326"); 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); 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{ }else{
// window.location.href("/api"+url);
// console.log("开始下载zip文件")
const type='application/zip'//ZIP文件 const type='application/zip'//ZIP文件
const blob = new Blob([response.data], { type: type }) const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) 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]); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
console.log(response.headers['content-disposition'].split('=')[1]);
downloadElement.href = href downloadElement.href = href
var now=""; downloadElement.download = string+struy+".zip"
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) document.body.appendChild(downloadElement)
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素 document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象 window.URL.revokeObjectURL(href) // 释放掉blob对象
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -365,41 +364,38 @@ class Workquestionandanswer extends Component {
// 课堂学生成绩的导出下载 // 课堂学生成绩的导出下载
Classstudentachievement = (url) => { Classstudentachievement = (url) => {
console.log("Classstudentachievement"); console.log("Classstudentachievement");
// const course_id = this.props.match.params.coursesId; // console.log();
// let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx"; var struy="";
axios.get(url).then((response) => { 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("1374");
console.log(response); 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{ }else{
const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件 const type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' //excel文件
const blob = new Blob([response.data], { type: type }) const blob = new Blob([response.data], { type: type })
const downloadElement = document.createElement('a') const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob) 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]); const string = Base64.decode(response.headers['content-disposition'].split('=')[1]);
var now=""; console.log(response.headers['content-disposition'].split('=')[1]);
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.href = href
downloadElement.download =string+now+".xlsx"; downloadElement.download =string+struy+".xlsx";
document.body.appendChild(downloadElement) document.body.appendChild(downloadElement)
downloadElement.click() downloadElement.click()
document.body.removeChild(downloadElement) // 下载完成移除元素 document.body.removeChild(downloadElement) // 下载完成移除元素
window.URL.revokeObjectURL(href) // 释放掉blob对象 window.URL.revokeObjectURL(href) // 释放掉blob对象
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -62,6 +62,8 @@ class EducoderLogin extends Component {
this.state = { this.state = {
showbool: 3, showbool: 3,
logini:3, logini:3,
namezh:"",
passmm:""
} }
}else { }else {
if(props.match.url === "/login"){ if(props.match.url === "/login"){
@ -69,6 +71,8 @@ class EducoderLogin extends Component {
showbool: 1, showbool: 1,
loginstatus:true, loginstatus:true,
logini:1, logini:1,
namezh:"",
passmm:""
} }
}else if(props.match.url === "/register"){ }else if(props.match.url === "/register"){
@ -76,11 +80,15 @@ class EducoderLogin extends Component {
showbool: 1, showbool: 1,
loginstatus:false, loginstatus:false,
logini:2, logini:2,
namezh:"",
passmm:""
} }
}else{ }else{
this.state = { this.state = {
showbool: 1, showbool: 1,
logini:1, logini:1,
namezh:"",
passmm:""
} }
} }
@ -101,14 +109,16 @@ class EducoderLogin extends Component {
}) })
} }
Setshowbool = (e) => { Setshowbool = (e,name,pass) => {
if (e===1) { if (e===1) {
this.setState({ this.setState({
showbool: 1 showbool: 1
}) })
} else if(e===2) { } else if(e===2) {
this.setState({ this.setState({
showbool: 2 showbool: 2,
namezh:name,
passmm:pass,
}) })
}else if(e===3){ }else if(e===3){
this.setState({ this.setState({

@ -25,6 +25,8 @@ class InterestpageComponent extends Component {
gouxuans: 0, gouxuans: 0,
gouxuans2: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}], 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)=>{ Clickteacher=(e)=>{
@ -63,6 +65,33 @@ 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 {
this.setState({
isRender: false
})
window.location.href = "/"
}
}
}).catch((error) => {
})
}
render() { render() {
const { const {
gouxuans, gouxuans,

@ -344,8 +344,8 @@ class LoginRegisterComponent extends Component {
passwords: "", passwords: "",
Agreetotheterms: "", Agreetotheterms: "",
}) })
this.props.history.push(result.data.redirect_uri); // this.props.history.push(result.data.redirect_uri);
//this.props.Setshowbool(2); this.props.Setshowbool(2,this.state.logins,this.state.passwords);
} catch (e) { } catch (e) {
} }
@ -662,7 +662,7 @@ class LoginRegisterComponent extends Component {
<div className="left_right mt25 font-12 " style={{color: '#676767'}}> <div className="left_right mt25 font-12 " style={{color: '#676767'}}>
<Checkbox onChange={this.onAutoLoginChange} checked={autoLogin}>下次自动登录</Checkbox> <Checkbox onChange={this.onAutoLoginChange} checked={autoLogin}>下次自动登录</Checkbox>
<a onClick={this.StudyMakeMoney} <a onClick={()=>this.StudyMakeMoney()}
className="mr3 color-grey-9 mt3 font-12">找回密码</a> className="mr3 color-grey-9 mt3 font-12">找回密码</a>
</div> </div>

Loading…
Cancel
Save