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

dev_daiao
daiao 6 years ago
commit da2939d068

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

@ -212,7 +212,7 @@ class HomeworkCommonsController < ApplicationController
else
respond_to do |format|
format.xlsx{
cookies[:fileDownload] = true
set_export_cookies
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')}"
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"
if @user_course_identity >= Course::STUDENT
tip_exception(403, "无权限操作")
elsif params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
if @work_excel.present?
zip_works = @work_excel&.where("work_status > 0")
@ -234,13 +232,17 @@ class HomeworkCommonsController < ApplicationController
end
if status == 0
respond_to do |format|
format.zip{
cookies[:fileDownload] = true
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'
}
if params[:export].present? && params[:export]
normal_status(0,"正在下载中")
else
respond_to do |format|
format.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
else
normal_status(status, status == -2 ? "500M" : "无附件可下载")

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

@ -66,7 +66,7 @@ class CommonWorkDetailIndex extends Component{
this.state = {
DownloadType:false,
DownloadMessageval:undefined,
donwloading: false,
donwloading:false,
}
}
initWorkDetailCommonState = (data) => {
@ -106,7 +106,10 @@ class CommonWorkDetailIndex extends Component{
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url+ '&export=true').then((response) => {
if(response===undefined){
return
}
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){
@ -187,7 +190,9 @@ class CommonWorkDetailIndex extends Component{
let params = {}
if (isListModule) {
// 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(params);
@ -311,15 +316,15 @@ class CommonWorkDetailIndex 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 href={"javascript:void(0)"} className="color-dark"
onClick={() => this.confirmysl(exportResultUrl, exportParams)}
onClick={() => this.confirmysl(exportResultUrl)}
>导出成绩</a>
</li>
<li>
<a href={"javascript:void(0)"} className="color-dark"
onClick={() => this.confirmysl(exportUrl, exportParams)}
onClick={() => this.confirmysl(exportUrl)}
>导出作品附件</a>
</li>
</ul>

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

@ -44,7 +44,7 @@ class TabRightComponents extends Component{
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '?export=true' ).then((response) => {
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){

@ -33,6 +33,21 @@ class ExerciseDisplay extends Component{
this.state = {
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 = () => {
@ -49,6 +64,21 @@ class ExerciseDisplay extends Component{
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() {
// let { question_title, question_score, question_type, question_choices, standard_answer,

@ -63,17 +63,46 @@ class Exercisesetting extends Component{
choice_random:true,
time:0,
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("69");
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=()=>{
this.getSettingInfo();
// 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)=>{

@ -23,15 +23,32 @@ class Exercisestatisticalresult extends Component {
exercise_group_id:[],
page:1,
limit:10,
searchtext:"",
order: "end_at",
}
}
componentDidMount() {
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)=>{
let ExerciseId=this.props.match.params.Id;
let url = `/exercises/`+ExerciseId+`/exercise_result.json`;

@ -1213,6 +1213,11 @@ class Studentshavecompletedthelist extends Component {
// console.log("2222222222222");
// console.log(this.props.isAdmin());
// }
try {
this.props.triggerRef(this);
}catch (e) {
}
}
componentWillReceiveProps = (nextProps) => {
@ -1384,7 +1389,8 @@ class Studentshavecompletedthelist extends Component {
loadingstate: true,
})
}
console.log(response);
console.log(1393);
thiss.Generatenewdatasy(response.data.exercise_users, response);
}
}).catch((error) => {
@ -1984,9 +1990,14 @@ class Studentshavecompletedthelist extends Component {
}).then((response) => {
// console.log("528");
// console.log(JSON.stringify(response));
if(response===undefined){
return
}
this.setState({
loadingstate: false,
})
console.log(response);
console.log(1997);
this.Generatenewdatasy(response.data.exercise_users, response);
}).catch((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);
}
}
//搜索学生 文字输入
inputSearchValues = (e) => {
// console.log(e.target.value)
if (e.target.value === "") {
this.setState({
searchtext: undefined,
})
} else {
this.setState({
searchtext: e.target.value,
})
}
}
//搜索学生按钮输入
};
//搜索学生按钮输入 老师
searchValues = (value) => {
//点击直接搜索
// if(value === ""){
@ -2313,8 +2310,34 @@ class Studentshavecompletedthelist extends Component {
// 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) => {
if (e === "end_at") {

@ -1,7 +1,7 @@
import React,{ Component } from "react";
import {Checkbox,Input,Table, Pagination,Menu} from "antd";
import {Link,NavLink} from 'react-router-dom';
import { WordsBtn ,ActionBtn} from 'educoder';
import { WordsBtn ,ActionBtn,queryString} from 'educoder';
import CoursesListType from '../coursesPublic/CoursesListType';
import '../css/members.css';
import '../css/busyWork.css';
@ -19,7 +19,7 @@ import Ecerciseallbackagain from './Ecerciseallbackagain';
const polls_status={1:"未发布",2:"提交中",3:"已截止",4:"已结束"}
const start_Value={0:"继续答题",1:"查看答题",2:"开始答题"}
const qs = require('qs');
//试卷主要设置页面
class Testpapersettinghomepage extends Component{
constructor(props) {
@ -163,8 +163,17 @@ class Testpapersettinghomepage extends Component{
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
confirmysl(url,child){
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){
}else if(response.data.status&&response.data.status===-2){
@ -184,7 +193,7 @@ class Testpapersettinghomepage extends Component{
}
}else {
this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank');
window.open("/api"+url+`?${queryString.stringify(params)}`, '_blank');
}
}).catch((error) => {
console.log(error)
@ -218,6 +227,7 @@ class Testpapersettinghomepage extends Component{
// DownloadMessageval:undefined
// })
// }
bindRef = ref => { this.child = ref };
goback=()=>{
// let {datalist}=this.state;
// let courseId=this.props.match.params.coursesId;
@ -236,6 +246,7 @@ class Testpapersettinghomepage extends Component{
let {tab,visible,Commonheadofthetestpaper}=this.state;
const isAdmin =this.props.isAdmin();
const isStudent = this.props.isStudent();
// TODO
return(
<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"}}>
导出<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.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(`/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>
@ -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>

@ -896,7 +896,7 @@ class GraduationTaskssettingapp extends Component{
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '?export=true' ).then((response) => {
if(response === undefined){
return
}

@ -645,7 +645,7 @@ class GraduationTaskssettinglist extends Component{
b_order:b_order,
search:search,
}
axios.get(url,{
axios.get(url + '?export=true',{
params
}).then((response) => {
if(response === undefined){

@ -199,7 +199,7 @@ class GraduationTasksquestions extends Component{
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '?export=true').then((response) => {
if(response === undefined){
return
}

@ -322,7 +322,7 @@ onBoardsNew=()=>{
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '?export=true').then((response) => {
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){

@ -127,7 +127,7 @@ class studentsList extends Component{
}
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '&export=true').then((response) => {
if(response === undefined){
return
}

@ -75,7 +75,7 @@ class PollDetailIndex extends Component{
/// 确认是否下载
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '?export=true' ).then((response) => {
if(response.data.status&&response.data.status===-1){
}else if(response.data.status&&response.data.status===-2){

@ -2214,7 +2214,7 @@ class Listofworksstudentone extends Component {
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '&export=true').then((response) => {
if(response === undefined){
return
}

@ -539,7 +539,7 @@ class ShixunStudentWork extends Component {
}
confirmysl(url){
axios.get(url).then((response) => {
axios.get(url + '?export=true').then((response) => {
if(response === undefined){
return
}

@ -1766,12 +1766,12 @@ class Trainingjobsetting extends Component {
daochushixunbaogao=()=>{
let url =`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`;
this.confirmysl(url);
this.confirmysl(url + '&export=true');
}
daochuzuoye =() =>{
let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`;
this.confirmysl(url);
this.confirmysl(url + '?export=true');
}
confirmysl(url){

@ -339,12 +339,12 @@ class Workquestionandanswer extends Component {
daochushixunbaogao=()=>{
let url =`/zip/shixun_report?homework_common_id=${this.props.match.params.homeworkid}`;
this.confirmysl(url);
this.confirmysl(url + '&export=true');
}
daochuzuoye =() =>{
let url = `/homework_commons/${this.props.match.params.homeworkid}/works_list.xlsx`;
this.confirmysl(url);
this.confirmysl(url + '?export=true');
}
confirmysl(url){

@ -500,7 +500,9 @@ class DetailCardsEditAndAdd extends Component{
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
<li className="fl with40">
<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"
style={{"width":"298px"}}
name="shixun_homework[]"

@ -533,7 +533,9 @@ class DetailCardsEditAndEdit extends Component{
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
<li className="fl with40">
<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"
style={{"width":"298px"}}
name="shixun_homework[]"

Loading…
Cancel
Save