dev_forum
杨树林 5 years ago
parent 8c97955ab6
commit 8b99e0f41e

@ -112,9 +112,16 @@ 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{
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a onClick={()=>this.experiment(`/api/exercises/${this.props.match.params.Id}/exercise_lists.xlsx`)}>学生成绩</a></li>
<li><a href={`/api/exercises/${this.props.match.params.Id}/export_exercise`} >空白试卷</a></li>
<li><a onClick={()=>this.experiment(`/api/exercises/${this.props.match.params.Id}/export_exercise`)} >空白试卷</a></li>
<li><a onClick={()=>this.experiment(`/api/zip/export_exercises?exercise_id=${this.props.match.params.Id}${this.state.groupyslsval}`)}>学生答题试卷</a></li>
</ul>
</li>:""}

@ -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)
});
}

@ -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){
if(response.data.messages === "100"){
// 已超出文件导出的上限数量100 ),建议:
}else {
// if(type === 1){
// Internshipreportsy(url,struy,".zip",'application/zip');
// }else{
Internshipreportsy(url,struy,".xlsx",'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',response);
// }
//因附件资料超过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()? <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>
<ul className="drop_down_menu" style={{"right":"-0px","left":"unset","height":"auto"}}>
<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.confirmysl(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx?group_id=${this.state.checkedValuesineinfo}&search=${this.state.searchtext}`,2)} >学生成绩</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}`)}>实训报告</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}`)} >学生成绩</a></li>
</ul>
</li>:""}

@ -457,87 +457,26 @@ 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对象
}
}).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);
if(response.data.messages === "100"){
// 已超出文件导出的上限数量100 ),建议:
}else {
//因附件资料超过500M
}
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对象
}else {
window.open(url, '_blank');
}
}).catch((error) => {
console.log(error)
});
}
render() {
let {
data,
@ -722,9 +661,9 @@ class ShixunStudentWork extends Component {
{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>
<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}`)}>实训报告</a>
<li><a onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`)}>实训报告</a>
</li>
<li><a onClick={()=>this.Classstudentachievement(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a>
<li><a onClick={()=>this.confirmysl(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a>
</li>
</ul>
</li> : ""}

@ -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){
}else if(response.status&&response.status===-2){
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
if(response.data.status&&response.data.status===-1){
}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()?<a className=" fr font-14 ml30 mt10 mr20 color-grey-9 ">导出实训报告数据</a>:""}*/}
{this.props.isAdmin() ? <a
className="fr color-blue font-16"
onClick={()=>this.internshipreport(`/zip/shixun_report?homework_common_id=${homeworkid}`)}
onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${homeworkid}`)}
>导出实训报告数据</a> : ""}
</div>

@ -1609,82 +1609,20 @@ 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)
});
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
if(response.data.status&&response.data.status===-1){
// 课堂学生成绩的导出下载
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);
}else if(response.data.status&&response.data.status===-2){
if(response.data.messages === "100"){
// 已超出文件导出的上限数量100 ),建议:
}else {
//因附件资料超过500M
}
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 {
window.open(url, '_blank');
}
}).catch((error) => {
console.log(error)
@ -1831,9 +1769,9 @@ class Trainingjobsetting extends Component {
{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>
<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}`)}>实训报告</a>
<li><a onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`)}>实训报告</a>
</li>
<li><a onClick={()=>this.Classstudentachievement(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a>
<li><a onClick={()=>this.confirmysl(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a>
</li>
</ul>
</li>: ""}

@ -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);
}else if(response.data.status&&response.data.status===-2){
if(response.data.messages === "100"){
// 已超出文件导出的上限数量100 ),建议:
}else {
//因附件资料超过500M
}
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 {
window.open(url, '_blank');
}
}).catch((error) => {
console.log(error)
@ -527,9 +463,9 @@ class Workquestionandanswer extends Component {
<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>
<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}`)}>实训报告</a>
<li><a onClick={()=>this.confirmysl(`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`)}>实训报告</a>
</li>
<li><a onClick={()=>this.Classstudentachievement(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a>
<li><a onClick={()=>this.confirmysl(`/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`)}>学生成绩</a>
</li>
</ul>
</li> : ""}

@ -165,7 +165,7 @@ class EducoderLogin extends Component {
<div style={{"margin-top": "40px","height":"580px"}}>
<LoginRegisterComponent {...this.props} {...this.state}
Setshowbool={(e)=>this.Setshowbool(e)} ></LoginRegisterComponent>
Setshowbool={(e)=>this.Setshowbool(e,name,pass)} ></LoginRegisterComponent>
</div>

@ -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 = "/"
}
// }
}

Loading…
Cancel
Save