Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

# Conflicts:
#	public/react/src/modules/courses/exercise/Testpapersettinghomepage.js
dev_winse
hjm 6 years ago
commit adcb1c9164

@ -583,4 +583,8 @@ class ApplicationController < ActionController::Base
def render_parameter_missing def render_parameter_missing
render json: { status: -1, message: '参数缺失' } render json: { status: -1, message: '参数缺失' }
end end
def set_export_cookies
cookies[:fileDownload] = true
end
end end

@ -212,7 +212,7 @@ class HomeworkCommonsController < ApplicationController
else else
respond_to do |format| respond_to do |format|
format.xlsx{ format.xlsx{
cookies[:fileDownload] = true set_export_cookies
student_work_to_xlsx(@work_excel,@homework) student_work_to_xlsx(@work_excel,@homework)
exercise_export_name = "#{current_user.real_name}_#{@course.name}_#{@homework.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}" exercise_export_name = "#{current_user.real_name}_#{@course.name}_#{@homework.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
render xlsx: "#{exercise_export_name.strip}",template: "homework_commons/works_list.xlsx.axlsx",locals: render xlsx: "#{exercise_export_name.strip}",template: "homework_commons/works_list.xlsx.axlsx",locals:
@ -223,8 +223,6 @@ class HomeworkCommonsController < ApplicationController
elsif params[:format] == "zip" elsif params[:format] == "zip"
if @user_course_identity >= Course::STUDENT if @user_course_identity >= Course::STUDENT
tip_exception(403, "无权限操作") tip_exception(403, "无权限操作")
elsif params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else else
if @work_excel.present? if @work_excel.present?
zip_works = @work_excel&.where("work_status > 0") zip_works = @work_excel&.where("work_status > 0")
@ -234,13 +232,17 @@ class HomeworkCommonsController < ApplicationController
end end
if status == 0 if status == 0
respond_to do |format| if params[:export].present? && params[:export]
format.zip{ normal_status(0,"正在下载中")
cookies[:fileDownload] = true else
zipfile = zip_homework_common @homework, zip_works respond_to do |format|
file = decode64(zipfile[0][:base64file]) format.zip{
send_file "#{OUTPUT_FOLDER}/#{file}", filename: filename_for_content_disposition(file), type: 'application/zip' set_export_cookies
} zipfile = zip_homework_common @homework, zip_works
file = decode64(zipfile[0][:base64file])
send_file "#{OUTPUT_FOLDER}/#{file}", filename: filename_for_content_disposition(file), type: 'application/zip'
}
end
end end
else else
normal_status(status, status == -2 ? "500M" : "无附件可下载") normal_status(status, status == -2 ? "500M" : "无附件可下载")

@ -11,7 +11,7 @@ class ZipsController < ApplicationController
if params[:export].present? && params[:export] if params[:export].present? && params[:export]
normal_status(0,"正在下载中") normal_status(0,"正在下载中")
else else
cookies[:fileDownload] = true set_export_cookies
send_file service.zip, filename: filename_, type: 'application/zip' send_file service.zip, filename: filename_, type: 'application/zip'
end end

@ -66,7 +66,7 @@ class CommonWorkDetailIndex extends Component{
this.state = { this.state = {
DownloadType:false, DownloadType:false,
DownloadMessageval:undefined, DownloadMessageval:undefined,
donwloading: false, donwloading:false,
} }
} }
initWorkDetailCommonState = (data) => { initWorkDetailCommonState = (data) => {
@ -106,7 +106,10 @@ class CommonWorkDetailIndex extends Component{
/// 确认是否下载 /// 确认是否下载
confirmysl(url){ confirmysl(url){
axios.get(url + '&export=true' ).then((response) => { axios.get(url+ '&export=true').then((response) => {
if(response===undefined){
return
}
if(response.data.status&&response.data.status===-1){ if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){ }else if(response.data.status&&response.data.status===-2){
@ -187,7 +190,9 @@ class CommonWorkDetailIndex extends Component{
let params = {} let params = {}
if (isListModule) { if (isListModule) {
// TODO // TODO
params =this.child._getRequestParams()!==undefined?this.child._getRequestParams():{}; if(this.child!=undefined) {
params = this.child._getRequestParams() !== undefined ? this.child._getRequestParams() : {};
}
} }
// console.log("普通作业176176176"); // console.log("普通作业176176176");
// console.log(params); // console.log(params);
@ -313,13 +318,13 @@ class CommonWorkDetailIndex extends Component{
<li> <li>
<a href={"javascript:void(0)"} className="color-dark" <a href={"javascript:void(0)"} className="color-dark"
onClick={() => this.confirmysl(exportResultUrl, exportParams)} onClick={() => this.confirmysl(exportResultUrl)}
>导出成绩</a> >导出成绩</a>
</li> </li>
<li> <li>
<a href={"javascript:void(0)"} className="color-dark" <a href={"javascript:void(0)"} className="color-dark"
onClick={() => this.confirmysl(exportUrl, exportParams)} onClick={() => this.confirmysl(exportUrl)}
>导出作品附件</a> >导出作品附件</a>
</li> </li>
</ul> </ul>

@ -425,7 +425,8 @@ class CommonWorkList extends Component{
teacher_comment: arg_teacher_comment.length == 0 ? '' : arg_teacher_comment[0], teacher_comment: arg_teacher_comment.length == 0 ? '' : arg_teacher_comment[0],
order, order,
limit: PAGE_SIZE, limit: PAGE_SIZE,
b_order: orderMap[order] b_order: orderMap[order],
group_id:arg_course_group,
} }
} }
fetchList = () => { fetchList = () => {

@ -33,6 +33,21 @@ class ExerciseDisplay extends Component{
this.state = { this.state = {
exercise_questions: [], exercise_questions: [],
exercise_group_id:[],
page:1,
limit:10,
searchtext:"",
order: "end_at",
}
}
_getRequestParams() {
const { order, exercise_group_id,searchtext, page ,limit} = this.state
return {
page,
search:searchtext,
order,
limit: limit,
group_id:exercise_group_id,
} }
} }
componentDidMount = () => { componentDidMount = () => {
@ -49,6 +64,21 @@ class ExerciseDisplay extends Component{
console.log(error); console.log(error);
}); });
} }
try {
this.props.triggerRef(this);
}catch (e) {
}
}
_getRequestParams() {
const { order, exercise_group_id,searchtext, page ,limit} = this.state
return {
page,
search:searchtext,
order,
limit: limit,
group_id:exercise_group_id,
}
} }
render() { render() {
// let { question_title, question_score, question_type, question_choices, standard_answer, // let { question_title, question_score, question_type, question_choices, standard_answer,

@ -63,17 +63,46 @@ class Exercisesetting extends Component{
choice_random:true, choice_random:true,
time:0, time:0,
publish_timetype:false, publish_timetype:false,
end_timetype:false end_timetype:false,
exercise_group_id:[],
page:1,
limit:10,
searchtext:"",
order: "end_at",
} }
console.log("Exercisesetting"); console.log("Exercisesetting");
console.log("69"); console.log("69");
console.log(props); console.log(props);
} }
_getRequestParams() {
const { order, exercise_group_id,searchtext, page ,limit} = this.state
return {
page,
search:searchtext,
order,
limit: limit,
group_id:exercise_group_id,
}
}
//加载 //加载
componentDidMount=()=>{ componentDidMount=()=>{
this.getSettingInfo(); this.getSettingInfo();
// window.addEventListener('click', this.handleClick); // window.addEventListener('click', this.handleClick);
try {
this.props.triggerRef(this);
}catch (e) {
}
}
_getRequestParams() {
const { order, exercise_group_id,searchtext, page ,limit} = this.state
return {
page,
search:searchtext,
order,
limit: limit,
group_id:exercise_group_id,
}
} }
// handleClick=(e)=>{ // handleClick=(e)=>{

@ -23,15 +23,32 @@ class Exercisestatisticalresult extends Component {
exercise_group_id:[], exercise_group_id:[],
page:1, page:1,
limit:10, limit:10,
searchtext:"",
order: "end_at",
} }
} }
componentDidMount() { componentDidMount() {
let{sort,exercise_group_id,page,limit}=this.state; let{sort,exercise_group_id,page,limit}=this.state;
this.updatefun(sort,exercise_group_id,page,limit) this.updatefun(sort,exercise_group_id,page,limit);
} try {
this.props.triggerRef(this);
}catch (e) {
}
}
_getRequestParams() {
const { order, exercise_group_id,searchtext, page ,limit} = this.state
return {
page,
search:searchtext,
order,
limit: limit,
group_id:exercise_group_id,
}
}
updatefun=(sort,exercise_group_id,page,limit)=>{ updatefun=(sort,exercise_group_id,page,limit)=>{
let ExerciseId=this.props.match.params.Id; let ExerciseId=this.props.match.params.Id;
let url = `/exercises/`+ExerciseId+`/exercise_result.json`; let url = `/exercises/`+ExerciseId+`/exercise_result.json`;

@ -1213,6 +1213,11 @@ class Studentshavecompletedthelist extends Component {
// console.log("2222222222222"); // console.log("2222222222222");
// console.log(this.props.isAdmin()); // console.log(this.props.isAdmin());
// } // }
try {
this.props.triggerRef(this);
}catch (e) {
}
} }
componentWillReceiveProps = (nextProps) => { componentWillReceiveProps = (nextProps) => {
@ -1384,7 +1389,8 @@ class Studentshavecompletedthelist extends Component {
loadingstate: true, loadingstate: true,
}) })
} }
console.log(response);
console.log(1393);
thiss.Generatenewdatasy(response.data.exercise_users, response); thiss.Generatenewdatasy(response.data.exercise_users, response);
} }
}).catch((error) => { }).catch((error) => {
@ -1984,9 +1990,14 @@ class Studentshavecompletedthelist extends Component {
}).then((response) => { }).then((response) => {
// console.log("528"); // console.log("528");
// console.log(JSON.stringify(response)); // console.log(JSON.stringify(response));
if(response===undefined){
return
}
this.setState({ this.setState({
loadingstate: false, loadingstate: false,
}) })
console.log(response);
console.log(1997);
this.Generatenewdatasy(response.data.exercise_users, response); this.Generatenewdatasy(response.data.exercise_users, response);
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -2279,22 +2290,8 @@ class Studentshavecompletedthelist extends Component {
this.Searchdatasys(this.state.order, this.state.commit_status, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit); this.Searchdatasys(this.state.order, this.state.commit_status, this.state.review, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
} }
} };
//搜索学生 文字输入 //搜索学生按钮输入 老师
inputSearchValues = (e) => {
// console.log(e.target.value)
if (e.target.value === "") {
this.setState({
searchtext: undefined,
})
} else {
this.setState({
searchtext: e.target.value,
})
}
}
//搜索学生按钮输入
searchValues = (value) => { searchValues = (value) => {
//点击直接搜索 //点击直接搜索
// if(value === ""){ // if(value === ""){
@ -2313,8 +2310,34 @@ class Studentshavecompletedthelist extends Component {
// console.log(value) // console.log(value)
};
_getRequestParams() {
const { order, checkedValuesineinfo,searchtext, page ,limit} = this.state
return {
page,
search:searchtext,
group_id:checkedValuesineinfo,
limit: limit,
order,
}
} }
//搜索学生 文字输入
inputSearchValues = (e) => {
// console.log(e.target.value)
if (e.target.value === "") {
this.setState({
searchtext: undefined,
})
} else {
this.setState({
searchtext: e.target.value,
})
}
};
//排序 //排序
funordersy = (e) => { funordersy = (e) => {
if (e === "end_at") { if (e === "end_at") {

@ -1,7 +1,7 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import {Checkbox,Input,Table, Pagination,Menu} from "antd"; import {Checkbox,Input,Table, Pagination,Menu} from "antd";
import {Link,NavLink} from 'react-router-dom'; import {Link,NavLink} from 'react-router-dom';
import { WordsBtn ,ActionBtn} from 'educoder'; import { WordsBtn ,ActionBtn,queryString} from 'educoder';
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import '../css/members.css'; import '../css/members.css';
import '../css/busyWork.css'; import '../css/busyWork.css';
@ -19,7 +19,7 @@ import Ecerciseallbackagain from './Ecerciseallbackagain';
const polls_status={1:"未发布",2:"提交中",3:"已截止",4:"已结束"} const polls_status={1:"未发布",2:"提交中",3:"已截止",4:"已结束"}
const start_Value={0:"继续答题",1:"查看答题",2:"开始答题"} const start_Value={0:"继续答题",1:"查看答题",2:"开始答题"}
const qs = require('qs');
//试卷主要设置页面 //试卷主要设置页面
class Testpapersettinghomepage extends Component{ class Testpapersettinghomepage extends Component{
constructor(props) { constructor(props) {
@ -163,8 +163,17 @@ class Testpapersettinghomepage extends Component{
} }
/// 确认是否下载 /// 确认是否下载
confirmysl(url){ confirmysl(url,child){
axios.get(url + '?export=true' ).then((response) => { let params ={}
if(child!=undefined){
params =child._getRequestParams()!==undefined?child._getRequestParams():{};
}
console.log("170");
console.log(params);
axios.get(url+`?${queryString.stringify(params)}`+ '&export=true' ).then((response) => {
if(response===undefined){
return
}
if(response.data.status&&response.data.status===-1){ if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){ }else if(response.data.status&&response.data.status===-2){
@ -184,7 +193,7 @@ class Testpapersettinghomepage extends Component{
} }
}else { }else {
this.props.showNotification(`正在下载中`); this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank'); window.open("/api"+url+`?${queryString.stringify(params)}`, '_blank');
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -218,6 +227,7 @@ class Testpapersettinghomepage extends Component{
// DownloadMessageval:undefined // DownloadMessageval:undefined
// }) // })
// } // }
bindRef = ref => { this.child = ref };
goback=()=>{ goback=()=>{
// let {datalist}=this.state; // let {datalist}=this.state;
// let courseId=this.props.match.params.coursesId; // let courseId=this.props.match.params.coursesId;
@ -236,6 +246,7 @@ class Testpapersettinghomepage extends Component{
let {tab,visible,Commonheadofthetestpaper}=this.state; let {tab,visible,Commonheadofthetestpaper}=this.state;
const isAdmin =this.props.isAdmin(); const isAdmin =this.props.isAdmin();
const isStudent = this.props.isStudent(); const isStudent = this.props.isStudent();
// TODO
return( return(
<div className="newMain clearfix "> <div className="newMain clearfix ">
@ -345,7 +356,7 @@ class Testpapersettinghomepage extends Component{
{isAdmin === true? <li className="li_line drop_down fr color-blue font-15" style={{"paddingLeft":"0px"}}> {isAdmin === true? <li className="li_line drop_down fr color-blue font-15" style={{"paddingLeft":"0px"}}>
导出<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":"-34px","left":"unset","height":"auto"}}> <ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
<li><a onClick={()=>this.confirmysl(`/exercises/${this.props.match.params.Id}/exercise_lists.xlsx`)}>学生成绩</a></li> <li><a onClick={()=>this.confirmysl(`/exercises/${this.props.match.params.Id}/exercise_lists.xlsx`,this.child)}>学生成绩</a></li>
{/*<li><a onClick={()=>this.confirmysl(`/exercises/${this.props.match.params.Id}/export_exercise`)} >空白试卷</a></li>*/} {/*<li><a onClick={()=>this.confirmysl(`/exercises/${this.props.match.params.Id}/export_exercise`)} >空白试卷</a></li>*/}
{/*<li><a onClick={()=>this.confirmysl(`/zip/export_exercises?exercise_id=${this.props.match.params.Id}${this.state.groupyslsval===null||this.state.groupyslsval===undefined?null:this.state.groupyslsval}`)}>学生答题试卷</a></li>*/} {/*<li><a onClick={()=>this.confirmysl(`/zip/export_exercises?exercise_id=${this.props.match.params.Id}${this.state.groupyslsval===null||this.state.groupyslsval===undefined?null:this.state.groupyslsval}`)}>学生答题试卷</a></li>*/}
</ul> </ul>
@ -400,22 +411,22 @@ class Testpapersettinghomepage extends Component{
/> />
{ {
// 教师列表 // 教师列表
parseInt(tab[0])==0 && <Studentshavecompletedthelist {...this.props} {...this.state} setcourse_groupysls={(value)=>this.setcourse_groupysls(value)} current_status = {this.state.current_status}></Studentshavecompletedthelist> parseInt(tab[0])==0 && <Studentshavecompletedthelist {...this.props} {...this.state} triggerRef={this.bindRef} setcourse_groupysls={(value)=>this.setcourse_groupysls(value)} current_status = {this.state.current_status}></Studentshavecompletedthelist>
} }
{/*统计结果*/} {/*统计结果*/}
{ {
parseInt(tab[0])==1 && <Exercisestatisticalresult {...this.props} {...this.state}></Exercisestatisticalresult> parseInt(tab[0])==1 && <Exercisestatisticalresult {...this.props} {...this.state} triggerRef={this.bindRef}></Exercisestatisticalresult>
} }
{ {
parseInt(tab[0])==2 && <ExerciseDisplay {...this.props} {...this.state}></ExerciseDisplay> parseInt(tab[0])==2 && <ExerciseDisplay {...this.props} {...this.state} triggerRef={this.bindRef}></ExerciseDisplay>
} }
{ {
parseInt(tab[0])==3 && <WrappedExercisesetting {...this.props} {...this.state} ></WrappedExercisesetting> parseInt(tab[0])==3 && <WrappedExercisesetting {...this.props} {...this.state} triggerRef={this.bindRef}></WrappedExercisesetting>
} }
</div> </div>
</div> </div>

@ -500,7 +500,9 @@ class DetailCardsEditAndAdd extends Component{
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}> <div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
<li className="fl with40"> <li className="fl with40">
<Checkbox <Checkbox
id={"shixun_input_"+item.shixun_id} value={item.shixun_id} id={"shixun_input_"+item.shixun_id}
value={item.shixun_id}
key={item.shixun_id}
className="fl task-hide edu-txt-left" className="fl task-hide edu-txt-left"
style={{"width":"298px"}} style={{"width":"298px"}}
name="shixun_homework[]" name="shixun_homework[]"

@ -533,7 +533,9 @@ class DetailCardsEditAndEdit extends Component{
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}> <div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
<li className="fl with40"> <li className="fl with40">
<Checkbox <Checkbox
id={"shixun_input_"+item.shixun_id} value={item.shixun_id} id={"shixun_input_"+item.shixun_id}
value={item.shixun_id}
key={item.shixun_id}
className="fl task-hide edu-txt-left" className="fl task-hide edu-txt-left"
style={{"width":"298px"}} style={{"width":"298px"}}
name="shixun_homework[]" name="shixun_homework[]"

Loading…
Cancel
Save