From 5377f4dc74e86a9be5759c0b82ab8267c5c321ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sun, 30 Jun 2019 22:18:17 +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
---
public/react/config/webpack.config.dev.js | 30 ++--
public/react/src/Loading.js | 34 ++--
.../courses/exercise/ExerciseListItem.js | 2 +-
.../tasks/GraduationTasksSubmitedit.js | 2 +-
.../graduation/tasks/GraduationTasksedit.js | 149 ++++++++++++------
.../graduation/tasks/GraduationTasksnew.js | 90 +++++++----
.../tasks/GraduationTaskssetting.js | 4 +-
.../graduation/topics/GraduateTopicItem.js | 2 +-
.../shixunHomework/Listofworksstudentone.js | 12 +-
.../shixunreport/Shixunechart.js | 28 ++--
10 files changed, 226 insertions(+), 127 deletions(-)
diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js
index ceddbd81b..dfd54f38b 100644
--- a/public/react/config/webpack.config.dev.js
+++ b/public/react/config/webpack.config.dev.js
@@ -114,21 +114,21 @@ module.exports = {
// First, run the linter.
// It's important to do this before Babel processes the JS.
// 上线然后要注释回来
- // {
- // test: /\.(js|jsx|mjs)$/,
- // enforce: 'pre',
- // use: [
- // {
- // options: {
- // formatter: eslintFormatter,
- // eslintPath: require.resolve('eslint'),
- //
- // },
- // loader: require.resolve('eslint-loader'),
- // },
- // ],
- // include: paths.appSrc,
- // },
+ {
+ test: /\.(js|jsx|mjs)$/,
+ enforce: 'pre',
+ use: [
+ {
+ options: {
+ formatter: eslintFormatter,
+ eslintPath: require.resolve('eslint'),
+
+ },
+ loader: require.resolve('eslint-loader'),
+ },
+ ],
+ include: paths.appSrc,
+ },
{
// "oneOf" will traverse all following loaders until one will
// match the requirements. When no loader matches it will fall
diff --git a/public/react/src/Loading.js b/public/react/src/Loading.js
index a524ccf63..07ab19a4a 100644
--- a/public/react/src/Loading.js
+++ b/public/react/src/Loading.js
@@ -1,16 +1,18 @@
-import React, { Component } from 'react';
-
-import { BrowserRouter as Router, Route, Link } from "react-router-dom";
-
-class Loading extends Component {
- render() {
- // Loading
- return (
-
-
-
- );
- }
-}
-
-export default Loading;
+import React, { Component } from 'react';
+
+import { BrowserRouter as Router, Route, Link } from "react-router-dom";
+
+import { Spin } from 'antd';
+
+class Loading extends Component {
+ render() {
+ // Loading
+ return (
+
+
+
+ );
+ }
+}
+
+export default Loading;
diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js
index afa0669d4..f11509fc8 100644
--- a/public/react/src/modules/courses/exercise/ExerciseListItem.js
+++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js
@@ -116,7 +116,7 @@ class ExerciseListItem extends Component{
{
item.lock_status === 0 ?
-
+
:""
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js
index 63865c577..be8586d66 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js
@@ -613,7 +613,7 @@ class GraduationTasksSubmitedit extends Component{
{item.delete===true?
this.onAttachmentRemove(item)}
+ onClick={()=>this.onAttachmentRemove(item.id)}
aria-hidden="true">
:""}
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js
index 660ef1c71..9be6b9b06 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js
@@ -2,7 +2,7 @@ import React,{Component} from "React";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
-import { WordsBtn,getUrl } from 'educoder';
+import { WordsBtn,getUrl ,bytesToSize} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
import '../../css/Courses.css';
@@ -40,27 +40,28 @@ class GraduationTasksedit extends Component{
axios.get(url).then((result)=>{
// console.log(result)
- let newfilelist=[];
- if(result.data.attachments.length!=0){
- for(var list of result.data.attachments){
- newfilelist.push({
- uid:list.id,
- name:list.title,
- status: 'done',
- url:list.url,
- })
- }
-
- }
+ // let newfilelist=[];
+ // if(result.data.attachments.length!=0){
+ // for(var list of result.data.attachments){
+ // newfilelist.push({
+ // uid:list.id,
+ // name:list.title,
+ // status: 'done',
+ // url:list.url,
+ // })
+ // }
+ //
+ // }
let namelength=result.data.task_name.length;
let sixlength=title_num-namelength
this.setState({
- fileList:newfilelist,
+ // fileList:newfilelist,
description:result.data.description,
tasktype:result.data.task_type,
name:result.data.task_name,
data:result.data,
- title_num:sixlength
+ title_num:sixlength,
+ attachments:result.data.attachments,
})
@@ -100,36 +101,36 @@ class GraduationTasksedit extends Component{
// 附件相关 START
handleChange = (info) => {
let fileList = info.fileList;
- console.log(fileList)
+ // console.log(fileList)
// for(var list of fileList ){
// console.log(fileList)
// }
this.setState({ fileList });
}
- onAttachmentRemove = (file) => {
- // confirm({
- // title: '确定要删除这个附件吗?',
- // okText: '确定',
- // cancelText: '取消',
- // // content: 'Some descriptions',
- // onOk: () => {
- // this.deleteAttachment(file)
- // },
- // onCancel() {
- // console.log('Cancel');
- // },
- // });
- // return false;
-
- this.setState({
- Modalstype:true,
- Modalstopval:'确定要删除这个附件吗?',
- ModalSave: ()=>this.deleteAttachment(file),
- ModalCancel:this.cancelAttachment
- })
- return false;
- }
+ // onAttachmentRemove = (file) => {
+ // // confirm({
+ // // title: '确定要删除这个附件吗?',
+ // // okText: '确定',
+ // // cancelText: '取消',
+ // // // content: 'Some descriptions',
+ // // onOk: () => {
+ // // this.deleteAttachment(file)
+ // // },
+ // // onCancel() {
+ // // console.log('Cancel');
+ // // },
+ // // });
+ // // return false;
+ //
+ // this.setState({
+ // Modalstype:true,
+ // Modalstopval:'确定要删除这个附件吗?',
+ // ModalSave: ()=>this.deleteAttachment(file),
+ // ModalCancel:this.cancelAttachment
+ // })
+ // return false;
+ // }
cancelAttachment=()=>{
this.setState({
@@ -141,10 +142,11 @@ class GraduationTasksedit extends Component{
})
}
- deleteAttachment = (file) => {
+ onAttachmentRemove = (file) => {
this.cancelAttachment();
- const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
+ // const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
+ const url = `/attachments/${file}.json`
axios.delete(url, {
})
.then((response) => {
@@ -268,7 +270,7 @@ class GraduationTasksedit extends Component{
}
render(){
const { getFieldDecorator } = this.props.form;
- let {title_num,pageType,name,description,Loadtype,
+ let {title_num,pageType,name,description,Loadtype,attachments,
Modalstype,Modalstopval,ModalCancel,ModalSave,shixunsreplace} =this.state;
let {coursedata}=this.props;
@@ -279,7 +281,7 @@ class GraduationTasksedit extends Component{
width: 600,
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
- // showUploadList: false,
+ showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
@@ -418,8 +420,65 @@ class GraduationTasksedit extends Component{
(单个文件150M以内)
-
-
+ {attachments&&attachments.map((item,key)=>{
+
+ return(
+
+
+
+
+
+ {item.title}
+
+
+
+ {item.filesize}
+
+
+ {item.delete===true?
+
this.onAttachmentRemove(item.id)}
+ aria-hidden="true">
+ :""}
+
+ )
+ })}
+
+ {this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{
+ return(
+
+
+
+
+
+ {item.name}
+
+
+ {item.response===undefined?"":bytesToSize(item.size)}
+
+ this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}>
+
+ )
+ })}
{/*{attachments&&attachments.map((item,key)=>{*/}
{/*return(*/}
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js
index e6185188a..585986fb2 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksnew.js
@@ -2,7 +2,7 @@ import React, {Component} from "React";
import {Form, Select, Input, Button, Checkbox, Upload, Icon, message, Modal} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
-import {WordsBtn, getUrl} from 'educoder';
+import {WordsBtn, getUrl,bytesToSize} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
import '../../css/Courses.css';
@@ -133,29 +133,29 @@ class GraduationTasksnew extends Component {
this.setState({fileList});
}
- onAttachmentRemove = (file) => {
- // confirm({
- // title: '确定要删除这个附件吗?',
- // okText: '确定',
- // cancelText: '取消',
- // // content: 'Some descriptions',
- // onOk: () => {
- // this.deleteAttachment(file)
- // },
- // onCancel() {
- // console.log('Cancel');
- // },
- // });
- // return false;
-
- this.setState({
- Modalstype: true,
- Modalstopval: '确定要删除这个附件吗?',
- ModalSave: () => this.deleteAttachment(file),
- ModalCancel: this.cancelAttachment
- })
- return false;
- }
+ // onAttachmentRemove = (file) => {
+ // // confirm({
+ // // title: '确定要删除这个附件吗?',
+ // // okText: '确定',
+ // // cancelText: '取消',
+ // // // content: 'Some descriptions',
+ // // onOk: () => {
+ // // this.deleteAttachment(file)
+ // // },
+ // // onCancel() {
+ // // console.log('Cancel');
+ // // },
+ // // });
+ // // return false;
+ //
+ // this.setState({
+ // Modalstype: true,
+ // Modalstopval: '确定要删除这个附件吗?',
+ // ModalSave: () => this.deleteAttachment(file),
+ // ModalCancel: this.cancelAttachment
+ // })
+ // return false;
+ // }
cancelAttachment = () => {
this.setState({
@@ -166,8 +166,9 @@ class GraduationTasksnew extends Component {
})
}
- deleteAttachment = (file) => {
- const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
+ onAttachmentRemove = (file) => {
+ // const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
+ const url = `/attachments/${file}.json`
axios.delete(url, {})
.then((response) => {
if (response.data) {
@@ -256,7 +257,7 @@ class GraduationTasksnew extends Component {
multiple: true,
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
- // showUploadList: false,
+ showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
@@ -385,7 +386,7 @@ class GraduationTasksnew extends Component {
-
+
+ {this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{
+ return(
+
+
+
+
+
+ {item.name}
+
+
+ {item.response===undefined?"":bytesToSize(item.size)}
+
+ this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}>
+
+ )
+ })}
+
diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js
index 5c57602e5..9917e18f6 100644
--- a/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js
+++ b/public/react/src/modules/courses/graduation/tasks/GraduationTaskssetting.js
@@ -327,13 +327,13 @@ class GraduationTaskssettingapp extends Component{
}else{
if(endtimetype===true){
this.setState({
- crosscomment:e.target.checked,
+ crosscomment:checked,
commenttime:newcommenttime
})
}else{
this.setState({
end_time:newlatetime,
- crosscomment:e.target.checked,
+ crosscomment:checked,
commenttime:newcommenttime
})
}
diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js
index 7ccfae974..5a3efaa63 100644
--- a/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js
+++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicItem.js
@@ -86,7 +86,7 @@ class GraduateTopicItem extends Component{
{
discussMessage.private_icon===true?
-
+
:""
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
index 8659bc472..7636db4e3 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
@@ -40,6 +40,7 @@ class Listofworksstudentone extends Component {
props: props,
data: [],
datas: [],
+ view_report:false,
page: 1,
pages: 1,
limit: 20,
@@ -305,6 +306,7 @@ class Listofworksstudentone extends Component {
work_efficiency: result.data.work_efficiency,
code_review: result.data.code_review,
challenges_count:result.data.challenges_count,
+ view_report:result.data.view_report,
})
if (result.data.student_works === undefined || result.data.student_works === null || JSON.stringify(result.data.student_works) === "[]") {
this.seacthdata(result.data);
@@ -359,6 +361,7 @@ class Listofworksstudentone extends Component {
end_immediately: result.data.end_immediately,
code_review: result.data.code_review,
challenges_count:result.data.challenges_count,
+ view_report:result.data.view_report,
})
if (result.data.student_works === undefined || result.data.student_works === null || JSON.stringify(result.data.student_works) === "[]") {
this.seacthdata(result.data);
@@ -707,6 +710,7 @@ class Listofworksstudentone extends Component {
end_immediately: result.data.end_immediately,
code_review: result.data.code_review,
challenges_count:result.data.challenges_count,
+ view_report:result.data.view_report,
})
this.seacthdata(result.data);
}
@@ -810,10 +814,10 @@ class Listofworksstudentone extends Component {
设置
-
查看实训报告
-
+ :""}
{/*查看实训报告*/}
{
teacherdata === undefined ? ""
@@ -941,10 +945,10 @@ class Listofworksstudentone extends Component {
设置
-
查看实训报告
-
+ :""}
{
teacherdata === undefined ? ""
: teacherdata.commit_des === null || teacherdata.commit_des === undefined ? "" :
diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js b/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js
index dcb10a301..dff7c6859 100644
--- a/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js
+++ b/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js
@@ -80,7 +80,7 @@ function startechart(data){
{
name:'',
type:'scatter',
- data:data.echart_data.efficiency_list,
+ data:data.echart_data===undefined?"":data.echart_data.efficiency_list,
itemStyle:{
normal:{color:'#2e65ad'}
},
@@ -106,9 +106,9 @@ function startechart(data){
data : [
{
name: data.username,
- xAxis:data.echart_data.myself_eff[0],
- yAxis:data.echart_data.myself_eff[1],
- value:data.echart_data.myself_eff[1],
+ xAxis:data.echart_data===undefined?"":data.echart_data.myself_eff[0],
+ yAxis:data.echart_data===undefined?"":data.echart_data.myself_eff[1],
+ value:data.echart_data===undefined?"":data.echart_data.myself_eff[1],
}
],
itemStyle: {
@@ -132,7 +132,7 @@ function startechart(data){
{
name:'二班',
type:'scatter',
- data: data.echart_data.myself_eff,
+ data: data.echart_data===undefined?"":data.echart_data.myself_eff,
itemStyle:{
color:'#c23531'
}}
@@ -141,7 +141,7 @@ function startechart(data){
var ablChart = echarts.init(document.getElementById('shixun_overall_ablility_chart'));
- var dataBJ = data.echart_data.consume_list;
+ var dataBJ = data.echart_data===undefined?"":data.echart_data.consume_list;
var itemStyle = {
@@ -188,7 +188,7 @@ function startechart(data){
formatter: function (obj) {
var value = obj.value;
if(obj.name ==data.username){
- return "姓名:"+data.username + "
"+'学号: '+data.user_id + "
"+'得分:'+ data.echart_data.myself_object[1];
+ return "姓名:"+data.username + "
"+'学号: '+data.user_id + "
"+'得分:'+ data.echart_data===undefined?"":data.echart_data.myself_object[1];
}
}
@@ -241,9 +241,9 @@ function startechart(data){
data : [
{
name: data.username,
- xAxis: data.echart_data.myself_object[0],
- yAxis:data.echart_data.myself_object[1],
- value:data.echart_data.myself_object[1]
+ xAxis: data.echart_data===undefined?"":data.echart_data.myself_object[0],
+ yAxis:data.echart_data===undefined?"":data.echart_data.myself_object[1],
+ value:data.echart_data===undefined?"":data.echart_data.myself_object[1]
}
],
itemStyle: {
@@ -256,7 +256,7 @@ function startechart(data){
{
name: '能力1',
type: 'scatter',
- data: data.echart_data.myself_object,
+ data: data.echart_data===undefined?"":data.echart_data.myself_object,
itemStyle:itemStyle1,
symbolSize: function (val){
return Math.round(val[2]);
@@ -367,8 +367,8 @@ class Shixunechart extends Component {
{data&&data.username}
{data&&data.user_id}
- {data&&data.echart_data.myself_eff[1]}
- {data&&data.echart_data.myself_eff[0]}
+ {data&&data.echart_data===undefined?"":data&&data.echart_data.myself_eff[1]}
+ {data&&data.echart_data===undefined?"":data&&data.echart_data.myself_eff[0]}
@@ -393,7 +393,7 @@ class Shixunechart extends Component {
{data&&data.username}
{data&&data.user_id}
- {data&&data.echart_data.myself_object[1]}
+ {data&&data.echart_data===undefined?"":data&&data.echart_data.myself_object[1]}