caishi 5 years ago
commit d05d3dbe76

@ -7,6 +7,11 @@ let _url_origin = getUrl2()
// let _url_origin = `http://47.96.87.25:48080`;
if (!window.Cropper) {
$.ajaxSetup({
cache: true
});
$('head').append($('<link rel="stylesheet" type="text/css" />')
.attr('href', `${_url_origin}/react/public/js/cropper/cropper.min.css`));
@ -61,7 +66,14 @@ function save_avatar(){
// });
// }
}
/**
props 说明
imageId 源图片标签的id
previewId crop后预览dom的id
imageSrc 源图片src
width 数字格式
height 数字格式
*/
class Cropper extends Component {
state = {
};
@ -70,9 +82,7 @@ class Cropper extends Component {
}
componentDidMount() {
setTimeout(() => {
const image = document.getElementById('image');
const cropper = new window.Cropper(image, {
this.options = {
aspectRatio: 1,
crop(event) {
// console.log(event.detail.x);
@ -84,12 +94,19 @@ class Cropper extends Component {
// console.log(event.detail.scaleY);
},
preview: '.img-preview',
});
}, 3000)
preview: this.props.previewId ? `#${this.props.previewId}` : '.img-preview',
}
setTimeout(() => {
const image = document.getElementById(this.props.imageId || '__image');
this.cropper = new window.Cropper(image, this.options);
}, 1000)
}
renew = (image) => {
this.cropper && this.cropper.destroy();
this.cropper = new window.Cropper(image, this.options);
}
render() {
const { width, height, previewId, imageSrc } = this.props;
@ -98,8 +115,8 @@ class Cropper extends Component {
{/* This rule is very important, please do not ignore this! */}
<style>{`
.wrapper {
width: ${ width || '500px'};
height: ${ height || '500px'};
width: ${ (width+'px') || '500px'};
height: ${ (height+'px') || '500px'};
}
img {
max-width: 100%;
@ -113,7 +130,7 @@ class Cropper extends Component {
`}</style>
<div className="wrapper">
{/* http://localhost:3007/images/footNavLogo.png 图片转了后不对 */}
<img id="image" src={`${imageSrc || "/images/testPicture.jpg"}`}></img>
<img id={this.props.imageId || "__image"} src={`${imageSrc || "/images/testPicture.jpg"}`}></img>
</div>
{/* background: 'aquamarine',
'border-radius': '128px'
@ -124,7 +141,7 @@ class Cropper extends Component {
{/* <img id="showImg" src="http://localhost:3007/images/testPicture.jpg"></img> */}
{/* <div id="canvasWrap"></div> */}
<button onClick={save_avatar.bind(this)}>save </button>
{/* <button onClick={save_avatar.bind(this)}>save </button> */}
</div>
);
}

@ -1,7 +1,9 @@
import React, { Component } from 'react';
import {Link} from 'react-router-dom'
const map={"blue":"blueFull","greyBack":"greyBack","grey":"greyWidthFixed","green":"greenBack"}
const map={"blue":"blueFull","greyBack":"greyBack","grey":"greyWidthFixed","green":"greenBack",
'colorBlue': 'colorBlue', // 蓝字白底
}
class ActionBtn extends Component {
constructor(props) {
super(props);

@ -28,6 +28,7 @@ export { EDU_ADMIN, EDU_BUSINESS, EDU_SHIXUN_MANAGER, EDU_SHIXUN_MEMBER, EDU_CER
, EDU_GAME_MANAGER, EDU_TEACHER, EDU_NORMAL} from './Const'
export { ModalHOC } from './components/ModalHOC'
export { default as Cropper } from './components/Cropper'
export { default as ConditionToolTip } from './components/ConditionToolTip'
export { default as DragValidator } from './components/DragValidator'

@ -616,12 +616,12 @@ a.white-btn.use_scope-btn:hover{
border-radius: 10px;
}
.Navmodal .ant-modal-content .ant-modal-header{
border-radius: 10px 10px 0 0;
/*border-radius: 10px 10px 0 0;*/
}
.ant-modal-content{
-webkit-box-shadow: 0 4px 12px transparent !important;
box-shadow: 0 4px 12px transparent !important;
border-radius: 10px !important;
/*border-radius: 10px !important;*/
}
.Navmodal .ant-modal-body{
@ -677,6 +677,11 @@ a.white-btn.use_scope-btn:hover{
color: #fff!important;
}
.colorBlue {
background-color: #fff;
color: #4CACFF;
border: 1px solid #4CACFF;
}
.greyBack{
/* 不要固定宽度 */
/* width: 64px; */

@ -753,7 +753,7 @@ class Listofworks extends Component {
let {page, limit} = this.state;
let datalist = [];
let columns = this.state.columns;
// var columns2=[];
var columns2=[];
if (teacherdata !== undefined) {
for (var i = 0; i < student_works.length; i++) {
var timedata = moment(student_works[i].update_time).format('YYYY-MM-DD HH:mm');
@ -799,7 +799,7 @@ class Listofworks extends Component {
else if(this.props.isNotMember()===true&&item.title==="学号") {
}else{
columns.push(item);
columns2.push(item);
}
}
@ -817,7 +817,7 @@ class Listofworks extends Component {
else if(this.props.isNotMember()===true&&item.title==="学号") {
}else{
columns.push(item);
columns2.push(item);
}
}
@ -831,7 +831,7 @@ class Listofworks extends Component {
else if(this.props.isNotMember()===true&&item.title==="学号") {
}else{
columns.push(item);
columns2.push(item);
}
}
}
@ -847,7 +847,7 @@ class Listofworks extends Component {
else if(this.props.isNotMember()===true&&item.title==="学号") {
}else{
columns.push(item);
columns2.push(item);
}
}
@ -863,11 +863,11 @@ class Listofworks extends Component {
else if(this.props.isNotMember()===true&&item.title==="学号") {
}else{
columns.push(item);
columns2.push(item);
}
}
}
columns=this.state.columnss;
columns2=this.state.columnss;
}
}
@ -877,7 +877,7 @@ class Listofworks extends Component {
this.setState({
data: datalist,
teacherlist: teacherlist,
columns: columns,
columns: columns2,
loadingstate: false,
})
}
@ -1327,6 +1327,47 @@ class Listofworks extends Component {
});
}
// 导出实习报告批量
internshipreport = ()=>{
console.log("internshipreport");
let url = "/zip/shixun_report";
let homeworkid = this.props.match.params.homeworkid;
axios.get((url),{
params: {
homework_common_id: homeworkid,
work_status: this.state.course_groupyslstwo,
course_group: this.state.checkedValuesineinfo,
search: this.state.searchtext,
}
}).then((response) => {
console.log("1342");
console.log(response);
}).catch((error) => {
console.log(error)
});
}
// 课堂学生成绩的导出下载
Classstudentachievement=()=>{
console.log("Classstudentachievement");
const course_id = this.props.match.params.coursesId;
let url = "/courses/"+course_id+"/export_member_scores_excel.xlsx";
axios.get((url),{
params: {
group_id: this.state.checkedValuesineinfo,
search: this.state.searchtext,
}
}).then((response) => {
console.log("1306");
console.log(response);
}).catch((error) => {
console.log(error)
});
}
render() {
// console.log("Listofworks.js000")
@ -1475,8 +1516,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 href={`/api/student_works/${jobsettingsdata === undefined ? "" :jobsettingsdata.data.category.category_id}/export_shixun_work_report.pdf`} >实训报告</a></li>
<li><a href={`/api/homework_commons/${jobsettingsdata === undefined ? "" :jobsettingsdata.data.category.category_id}/works_list.xlsx`} >学生成绩</a></li>
<li><a onClick={()=>this.internshipreport()}>实训报告</a></li>
<li><a onClick={()=>this.Classstudentachievement()} >学生成绩</a></li>
</ul>
</li>:""}
{this.props.isAdmin() ?

@ -1,6 +1,6 @@
import React, {Component} from "react";
import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn,ActionBtn,markdownToHTML} from 'educoder';
import {WordsBtn, ActionBtn, markdownToHTML} from 'educoder';
import GraduateTopicReply from '../graduation/topics/GraduateTopicReply'
import MemoDetailMDEditortwo from '../../forums/MemoDetailMDEditortwo'
import {
@ -55,7 +55,7 @@ class Workquestionandanswer extends Component {
// radiogroup:1,
//
// });
this.state ={
this.state = {
// namestring:"JFinal是基于Java语言的极速web开发框架其核心设计目标是开发迅速、代码量少、学习简单、功能强大、轻量级、易扩展、`Restful`。在拥有Java语言所有优势的同时再拥有`ruby`、`python`等动态语言的开发效率。\r\n\r\n在本实训中我们将基于JFinal框架搭建一个在线商城。我们会学习到如何合理设计`Model`来进行数据表映射和数据操作、如何设计`Controller`对请求进行合理的处理…… 通过本实训,您不仅能收获到具体框架和技术的使用经验,也能对项目架构设计等知识有所了解或巩固。\r\n\r\n<div align=\"center\">\r\n\t<img src=\"/attachments/download/170838\" />\r\n</div>\r\n\r\n本实训聚焦一个在线商城项目的核心业务逻辑实现。你将在这一过程中收获Java Web项目设计的基本思想也能得到编程能力的一次跃升。",
props: props,
starttimetype: false,
@ -71,7 +71,7 @@ class Workquestionandanswer extends Component {
ealuation: false,
latededuction: undefined,
latedeductiontwo: undefined,
Showupdateinstructions:false,
Showupdateinstructions: false,
database: false,
datasheet: false,
databasetwo: undefined,
@ -79,9 +79,9 @@ class Workquestionandanswer extends Component {
publicwork: undefined,
memo: {id: "94", user_id: 1},
polls_descriptiontest: "作业说明...",
jobdescriptiondisplay:"none",
score_open:false,
code_review:false
jobdescriptiondisplay: "none",
score_open: false,
code_review: false
}
}
@ -92,11 +92,11 @@ class Workquestionandanswer extends Component {
let query = this.props.location.pathname;
const type = query.split('/');
this.setState({
shixuntypes:type[3]
shixuntypes: type[3]
})
}
isupdatas=()=>{
isupdatas = () => {
var homeworkid = this.props.match.params.homeworkid;
this.Gettitleinformation(homeworkid)
}
@ -110,7 +110,7 @@ class Workquestionandanswer extends Component {
// console.log("设置页")
// console.log(JSON.stringify(result))
this.setState({
jobsettingsdata:result,
jobsettingsdata: result,
...result.data
})
}
@ -118,9 +118,9 @@ class Workquestionandanswer extends Component {
console.log(error)
})
}
jobdescriptiondisplaybj =()=>{
jobdescriptiondisplaybj = () => {
this.setState({
Showupdateinstructions:true,
Showupdateinstructions: true,
})
}
@ -134,8 +134,8 @@ class Workquestionandanswer extends Component {
//立即发布
homeworkstart = () => {
let homeworkid=this.props.match.params.homeworkid;
let url="/homework_commons/"+homeworkid+"/publish_groups.json";
let homeworkid = this.props.match.params.homeworkid;
let url = "/homework_commons/" + homeworkid + "/publish_groups.json";
axios.get(url).then((response) => {
@ -146,9 +146,9 @@ class Workquestionandanswer extends Component {
modalname: "立即发布",
modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1,
visible: true,
Topval:"学生将立即收到作业",
Topval: "学生将立即收到作业",
// Botvalleft:"暂不发布",
Botval:`本操作只对"未发布"的分班有效`,
Botval: `本操作只对"未发布"的分班有效`,
starttime: "发布时间:" + moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
endtime: "截止时间:" + endtime,
Cancelname: "暂不发布",
@ -156,8 +156,8 @@ class Workquestionandanswer extends Component {
Cancel: this.homeworkhide,
Saves: this.homeworkstartend,
course_groups: response.data.course_groups,
starttimes:starttime,
typs:"start",
starttimes: starttime,
typs: "start",
})
}
}).catch((error) => {
@ -167,8 +167,8 @@ class Workquestionandanswer extends Component {
}
//立即截止
homeworkends = () => {
let homeworkid=this.props.match.params.homeworkid;
let url="/homework_commons/"+homeworkid+"/end_groups.json";
let homeworkid = this.props.match.params.homeworkid;
let url = "/homework_commons/" + homeworkid + "/end_groups.json";
axios.get(url).then((response) => {
@ -178,9 +178,9 @@ class Workquestionandanswer extends Component {
modalname: "立即截止",
modaltype: response.data.course_groups === null || response.data.course_groups.length === 0 ? 2 : 1,
visible: true,
Topval:"学生将不能再提交作业",
Topval: "学生将不能再提交作业",
// Botvalleft:"暂不截止",
Botval:`本操作只对"提交中"的分班有效`,
Botval: `本操作只对"提交中"的分班有效`,
Cancelname: "暂不截止",
Savesname: "立即截止",
Cancel: this.homeworkhide,
@ -188,7 +188,7 @@ class Workquestionandanswer extends Component {
starttime: undefined,
endtime: undefined,
course_groups: response.data.course_groups,
typs:"end",
typs: "end",
})
}
}).catch((error) => {
@ -198,7 +198,7 @@ class Workquestionandanswer extends Component {
}
// 立即发布
homeworkstartend = (ds,endtime) => {
homeworkstartend = (ds, endtime) => {
var homeworkid = this.props.match.params.homeworkid;
let {course_groupslist} = this.state;
@ -207,13 +207,13 @@ class Workquestionandanswer extends Component {
axios.post(url, {
homework_ids: [homeworkid],
group_ids: course_groupslist,
end_time:endtime,
end_time: endtime,
}).then((result) => {
if (result.status === 200) {
if (result.data.status === 0) {
notification.open({
message:"提示",
description:result.data.message
message: "提示",
description: result.data.message
});
this.homeworkhide();
}
@ -239,8 +239,8 @@ class Workquestionandanswer extends Component {
.then((response) => {
if (response.data.status == 0) {
notification.open({
message:"提示",
description:response.data.message
message: "提示",
description: response.data.message
});
this.homeworkhide()
}
@ -249,77 +249,113 @@ class Workquestionandanswer extends Component {
console.log(error);
});
}
ReleaseNotes=(explanations)=>{
ReleaseNotes = (explanations) => {
var homeworkid = this.props.match.params.homeworkid;
let url=`/homework_commons/${homeworkid}/update_explanation.json`;
let url = `/homework_commons/${homeworkid}/update_explanation.json`;
axios.post((url), {
explanation: explanations
})
.then((result)=>{
if(result){
.then((result) => {
if (result) {
this.props.showNotification(`${result.data.message}`);
this.setState({
Showupdateinstructions:false
Showupdateinstructions: false
})
var homeworkid = this.props.match.params.homeworkid;
// console.log(homeworkid)
this.Gettitleinformation(homeworkid)
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
NOReleaseNotes=()=>{
NOReleaseNotes = () => {
this.setState({
Showupdateinstructions:false,
Showupdateinstructions: false,
})
}
workshowmodel=()=>{
workshowmodel = () => {
this.setState({
showmodel:true
showmodel: true
})
}
hideshowmodel=()=>{
hideshowmodel = () => {
this.setState({
showmodel:false
showmodel: false
})
}
homeworkhide=()=>{
homeworkhide = () => {
this.isupdatas()
this.setState({
modalname:undefined,
modaltype:undefined,
visible:false,
Topval:undefined,
Topvalright:undefined,
Botvalleft:undefined,
Botval:undefined,
starttime:undefined,
endtime:undefined,
Cancelname:undefined,
Savesname:undefined,
Cancel:undefined,
Saves:undefined,
StudentList_value:undefined,
addname:undefined,
addnametype:false,
addnametab:undefined,
typs:undefined,
starttimes:undefined,
modalname: undefined,
modaltype: undefined,
visible: false,
Topval: undefined,
Topvalright: undefined,
Botvalleft: undefined,
Botval: undefined,
starttime: undefined,
endtime: undefined,
Cancelname: undefined,
Savesname: undefined,
Cancel: undefined,
Saves: undefined,
StudentList_value: undefined,
addname: undefined,
addnametype: false,
addnametab: undefined,
typs: undefined,
starttimes: undefined,
})
}
getcourse_groupslist=(id)=>{
getcourse_groupslist = (id) => {
this.setState({
course_groupslist:id
course_groupslist: id
})
}
// 导出实习报告批量
internshipreport = () => {
console.log("internshipreport");
var homeworkid = this.props.match.params.homeworkid;
let url = "/zip/shixun_report";
axios.get((url),{
params: {
homework_common_id: homeworkid,
}
}).then((response) => {
console.log("326");
console.log(response);
}).catch((error) => {
console.log(error)
});
}
// 课堂学生成绩的导出下载
Classstudentachievement = () => {
console.log("Classstudentachievement");
const course_id = this.props.match.params.coursesId;
let url = "/courses/" + course_id + "/export_member_scores_excel.xlsx";
axios.get(url).then((response) => {
console.log("339");
console.log(response);
}).catch((error) => {
console.log(error)
});
}
render() {
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
let {starttimetype, endtimetype, latetimetype, allowlate, latepenaltytype, jobsettingsdata,score_open,Showupdateinstructions
, homework_id} = this.state;
let {
starttimetype, endtimetype, latetimetype, allowlate, latepenaltytype, jobsettingsdata, score_open, Showupdateinstructions
, homework_id
} = this.state;
const radioStyle = {
display: 'block',
height: '30px',
@ -334,14 +370,14 @@ class Workquestionandanswer extends Component {
return (
<div className="newMain clearfix ">
{this.state.showmodel===true?<ShixunWorkModal
{this.state.showmodel === true ? <ShixunWorkModal
{...this.props}
visible={this.state.showmodel}
modalname={"代码查重"}
data={[]}
issCancel={()=>this.hideshowmodel()}
updatas={()=>this.isupdatas()}
/>:""}
issCancel={() => this.hideshowmodel()}
updatas={() => this.isupdatas()}
/> : ""}
{/*立即发布*/}
<HomeworkModal
modaltype={this.state.modaltype}
@ -358,7 +394,7 @@ class Workquestionandanswer extends Component {
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
getcourse_groupslist={(id)=>this.getcourse_groupslist(id)}
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
starttimes={this.state.starttimes}
typs={this.state.typs}
/>
@ -366,11 +402,11 @@ class Workquestionandanswer extends Component {
<div className="educontent mb30">
<p className="clearfix mb20 mt10">
<ActionBtn className=" btn colorgrey fl hovercolorblue "
to={"/courses/"+this.props.match.params.coursesId+"/students"}>{jobsettingsdata === undefined ? "" : jobsettingsdata.data.course_name}</ActionBtn>
to={"/courses/" + this.props.match.params.coursesId + "/students"}>{jobsettingsdata === undefined ? "" : jobsettingsdata.data.course_name}</ActionBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<ActionBtn
className=" btn colorgrey fl hovercolorblue "
to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${jobsettingsdata===undefined?"":jobsettingsdata.data.category.category_id}`}>{jobsettingsdata === undefined ? "" : jobsettingsdata.data.category.category_name}</ActionBtn>
to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${jobsettingsdata === undefined ? "" : jobsettingsdata.data.category.category_id}`}>{jobsettingsdata === undefined ? "" : jobsettingsdata.data.category.category_name}</ActionBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn className="fl">作业详情</WordsBtn>
</p>
@ -382,17 +418,21 @@ class Workquestionandanswer extends Component {
<CoursesListType
typelist={jobsettingsdata === undefined ? [""] : jobsettingsdata.data.homework_status}
/>
<a className="color-grey-9 fr font-16 summaryname ml20 mr20" href={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${jobsettingsdata === undefined ? "" :jobsettingsdata.data.category.category_id}`}>返回</a>
<a className="color-grey-9 fr font-16 mr20" href={`/shixuns/${jobsettingsdata===undefined?"":jobsettingsdata.data.shixun_identifier}/challenges`} target={"_blank"}>实训详情</a>
<a className="color-grey-9 fr font-16 summaryname ml20 mr20"
href={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${jobsettingsdata === undefined ? "" : jobsettingsdata.data.category.category_id}`}>返回</a>
<a className="color-grey-9 fr font-16 mr20"
href={`/shixuns/${jobsettingsdata === undefined ? "" : jobsettingsdata.data.shixun_identifier}/challenges`}
target={"_blank"}>实训详情</a>
</div>
<div className="edu-back-white">
<div className="stud-class-set bor-bottom-greyE ">
<div className=" clearfix edu-back-white poll_list">
{this.props.isAdmin() === true? <Link
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/list`}>作品列表</Link>:
<Link to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/openlist`}>作品列表</Link>
{this.props.isAdmin() === true ? <Link
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/list`}>作品列表</Link> :
<Link
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/openlist`}>作品列表</Link>
// :<Link
// to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/noopenlist`}>作品列表(学生完成)</Link>
}
@ -400,11 +440,12 @@ class Workquestionandanswer extends Component {
<Link
className="active"
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/questions`}>作业问答</Link>
{this.props.isAdmin()?
this.state.code_review===true||jobsettingsdata === undefined ? [""] : jobsettingsdata.data.homework_status[0]==="未发布"?"":<Link
{this.props.isAdmin() ?
this.state.code_review === true || jobsettingsdata === undefined ? [""] : jobsettingsdata.data.homework_status[0] === "未发布" ? "" :
<Link
// to={`/courses/${this.state.props.match.params.coursesId}/${this.state.props.match.params.homeworkid}/student_work`}
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/student_work`}>
代码查重</Link>:""}
代码查重</Link> : ""}
<Link
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/settings`}
@ -430,28 +471,32 @@ class Workquestionandanswer extends Component {
color:#1A0B00 !important;
}
`}</style>
{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>
<ul className="drop_down_menu" style={{"right":"-0px","left":"unset","height":"auto"}}>
<li><a href={`/api/student_works/${jobsettingsdata === undefined ? "" :jobsettingsdata.data.category.category_id}/export_shixun_work_report.pdf`} >实训报告</a></li>
<li><a href={`/api/homework_commons/${jobsettingsdata === undefined ? "" :jobsettingsdata.data.category.category_id}/works_list.xlsx`} >学生成绩</a></li>
<ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}>
<li><a onClick={()=>this.internshipreport()}>实训报告</a>
</li>
<li><a onClick={()=>this.Classstudentachievement()}>学生成绩</a>
</li>
</ul>
</li> : ""}
{this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.end_immediately===true?
<a className="fr color-blue font-16" onClick={this.homeworkends}>立即截止</a>:"" : ""}
{this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.publish_immediately===true?
<a className="fr color-blue font-16" onClick={this.homeworkstart}>立即发布</a> :"": ""}
{this.props.isAdmin() ? jobsettingsdata && jobsettingsdata.data.end_immediately === true ?
<a className="fr color-blue font-16" onClick={this.homeworkends}>立即截止</a> : "" : ""}
{this.props.isAdmin() ? jobsettingsdata && jobsettingsdata.data.publish_immediately === true ?
<a className="fr color-blue font-16" onClick={this.homeworkstart}>立即发布</a> : "" : ""}
{this.props.isAdmin()?
this.state.code_review===true?
{this.props.isAdmin() ?
this.state.code_review === true ?
<a className="fr color-blue font-16" onClick={this.workshowmodel}>代码查重</a>
:"":""}
: "" : ""}
</div>
</div>
{jobsettingsdata === undefined|| jobsettingsdata.data.description===null? "无" : <div className=" clearfix edu-back-white poll_list mt20 mr20 ">
{jobsettingsdata === undefined || jobsettingsdata.data.description === null ? "无" :
<div className=" clearfix edu-back-white poll_list mt20 mr20 ">
<span>
<style>
{
@ -463,7 +508,8 @@ class Workquestionandanswer extends Component {
}
</style>
<div className={"font-16 color-dark fl pl20 "}>
<div dangerouslySetInnerHTML={{__html: markdownToHTML(jobsettingsdata.data.description).replace(/▁/g,"▁▁▁")}}></div>
<div
dangerouslySetInnerHTML={{__html: markdownToHTML(jobsettingsdata.data.description).replace(/▁/g, "▁▁▁")}}></div>
{/* /!*{}}></div>
{/* /!*{jobsettingsdata.data.description}*!/*/}
{/* <textarea>*/}
@ -489,27 +535,31 @@ class Workquestionandanswer extends Component {
<div className=" clearfix edu-back-white poll_list pd10">
<div className="font-16 color-green fl pl20 mt10">作业说明:</div>
{
this.props.isAdmin()&&this.props.isAdmin()===true ?
this.props.isAdmin() && this.props.isAdmin() === true ?
(Showupdateinstructions&& Showupdateinstructions === true?"":
(Showupdateinstructions && Showupdateinstructions === true ? "" :
<Tooltip placement="top" title="编辑"><i
className="color-green font-18 iconfont icon-bianjidaibeijing fr pr20 " onClick={()=>this.jobdescriptiondisplaybj()} ></i></Tooltip>
):""
className="color-green font-18 iconfont icon-bianjidaibeijing fr pr20 "
onClick={() => this.jobdescriptiondisplaybj()}></i></Tooltip>
) : ""
}
</div>
<span>
<div className="font-16 color-dark break_word flex1 " >
{ Showupdateinstructions&& Showupdateinstructions === true?
<div >
<Homeworddescription {...this.props} ReleaseNotes={this.ReleaseNotes} NOReleaseNotes ={this.NOReleaseNotes} description={jobsettingsdata === undefined ?"":jobsettingsdata === null ?"":jobsettingsdata === "null"?"": jobsettingsdata.data.explanation=== undefined?"":jobsettingsdata.data.explanation=== null?"":jobsettingsdata.data.explanation} ></Homeworddescription>
<div className="font-16 color-dark break_word flex1 ">
{Showupdateinstructions && Showupdateinstructions === true ?
<div>
<Homeworddescription {...this.props} ReleaseNotes={this.ReleaseNotes}
NOReleaseNotes={this.NOReleaseNotes}
description={jobsettingsdata === undefined ? "" : jobsettingsdata === null ? "" : jobsettingsdata === "null" ? "" : jobsettingsdata.data.explanation === undefined ? "" : jobsettingsdata.data.explanation === null ? "" : jobsettingsdata.data.explanation}></Homeworddescription>
</div>
:
<div className="pl20 " style={{"padding":"10px 10px 10px 20px"}}>
<div className="pl20 " style={{"padding": "10px 10px 10px 20px"}}>
{jobsettingsdata === undefined ? "无" : jobsettingsdata === null ? "无" : jobsettingsdata === "null" ? "无" :
jobsettingsdata.data.explanation=== undefined?"无" :jobsettingsdata.data.explanation=== null?"无":
<div dangerouslySetInnerHTML={{__html:markdownToHTML(jobsettingsdata.data.explanation).replace(/▁/g,"▁▁▁")}}></div>
jobsettingsdata.data.explanation === undefined ? "无" : jobsettingsdata.data.explanation === null ? "无" :
<div
dangerouslySetInnerHTML={{__html: markdownToHTML(jobsettingsdata.data.explanation).replace(/▁/g, "▁▁▁")}}></div>
}
</div>
@ -518,14 +568,14 @@ class Workquestionandanswer extends Component {
</div>
</span>
</div>
{/* <style>*/}
{/* {*/}
{/* `.mockInputWrapper {*/}
{/* display: flex;*/}
{/* padding: 30px 20px 30px 20px;*/}
{/*}`*/}
{/* }*/}
{/* </style>*/}
{/* <style>*/}
{/* {*/}
{/* `.mockInputWrapper {*/}
{/* display: flex;*/}
{/* padding: 30px 20px 30px 20px;*/}
{/*}`*/}
{/* }*/}
{/* </style>*/}
{/* <div className="edu-back-white mb20 graduateTopic course-message"> */}
{/*<GraduateTopicReply memo={{id: graduation_topic_id, user_id: topicInfo && topicInfo.user_id}} course_id={course_id} {...this.props}></GraduateTopicReply>*/}
{/* </div> */}
@ -535,7 +585,7 @@ class Workquestionandanswer extends Component {
{/* </div>*/}
{/* :""*/}
{/*}*/}
{ homework_id && <CommonReply
{homework_id && <CommonReply
memo={{
id: homework_id,
}}

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import {Tooltip} from 'antd';
import {Tooltip,Modal,Icon,Spin,message} from 'antd';
import '../../paths/ShixunPaths.css';
import DetailCardsEditAndAdd from './DetailCardsEditAndAdd';
import DetailCardsEditAndEdit from './DetailCardsEditAndEdit';
@ -46,7 +46,8 @@ class DetailCards extends Component{
editbuttomtypeadd:false,
showparagraph:false,
showparagraphkey:"",
showparagraphindex:""
showparagraphindex:"",
isSpin:false
}
@ -192,27 +193,60 @@ class DetailCards extends Component{
}
startgameid=(id)=>{
let url = "/shixuns/" + id + "/shixun_exec.json";
axios.get(url).then((response) => {
if (response.data.status === -2) {
this.setState({
Modalstype:true,
Modalstopval:response.data.message,
shixunsreplace:true,
hidestartshixunsreplacevalue:response.data.message+".json"
})
} else if (response.data.status === -1) {
console.log(response)
}else if(response.data.status===-3){
this.setState({
Modalstype:true,
Modalstopval:response.data.message,
shixunsmessage:response.data.message,
startshixunCombattype:true,
})
} else {
window.location.href = "/tasks/" + response.data.game_identifier;
// window.location.href = path
// let path="/tasks/"+response.data.game_identifier;
// this.props.history.push(path);
}
}).catch((error) => {
});
}
hidestartshixunsreplace=(url)=>{
this.setState({
isSpin:true,
})
axios.get(url).then((response) => {
debugger
if(response.status===200){
// let path="/shixuns/"+response.data.shixun_identifier+"/challenges";
// this.props.history.push(path);
message.success('重置成功,正在进入实训!');
this.startgameid(response.data.shixun_identifier);
this.setState({
shixunsreplace:false,
isSpin:false,
startbtn:false,
})
// message.success('重置成功,正在进入实训!');
// this.startshixunCombat();
}}
).catch((error) => {
});
}
cardsModalcancel=()=>{
@ -252,6 +286,12 @@ class DetailCards extends Component{
showparagraph:false
})
}
hidestartshixunCombattype=()=>{
this.setState({
startshixunCombattype:false
})
}
render(){
let { pathCardsList,
dropid,
@ -266,14 +306,14 @@ class DetailCards extends Component{
cardsModalsave,
cardsModalcancel,
delecttype,
editdelectid,
hidestartshixunsreplacevalue,
editbuttomtype,
editbuttomtypeadd,
showparagraph,
showparagraphkey,
showparagraphindex
}=this.state;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
return(
<div>
<Modals
@ -284,6 +324,45 @@ class DetailCards extends Component{
modalSave={delecttype===true?this.delectpathCardseditfun:cardsModalsave}
>
</Modals>
<Modal
keyboard={false}
title="提示"
visible={this.state.startshixunCombattype}
closable={false}
footer={null}
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16 pb20">本实训的开启时间{this.state.shixunsmessage} <br/>开启时间之前不能挑战 </p>
</div>
<div className="task-popup-submit clearfix">
{/*<a onClick={this.hidestartshixunCombattype} className="task-btn fl">取消</a>*/}
<a className="task-btn task-btn-orange fr"
style={{marginRight:'51px'}}
onClick={this.hidestartshixunCombattype}>知道了</a>
</div>
{/*<p className="inviteTipbtn with100 fl">*/}
{/*<a onClick={this.hidestartshixunCombattype}>知道了</a>*/}
{/*</p>*/}
</Modal>
<Modal
keyboard={false}
title="提示"
visible={this.state.shixunsreplace}
closable={false}
footer={null}
>
<Spin indicator={antIcon} spinning={this.state.isSpin}>
<div className="task-popup-content">
<p className="task-popup-text-center font-16 pb20">实训已经更新了正在为您重置!</p>
</div>
<div className="task-popup-submit clearfix">
<a className="task-btn task-btn-orange fr"
style={{marginRight:'51px'}}
onClick={() => this.hidestartshixunsreplace(hidestartshixunsreplacevalue)}>知道了</a>
</div>
</Spin>
</Modal>
<div className="lesson-saved-list">
{
pathCardsList && pathCardsList.map((item,key)=>{

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import Cropper from '../../common/components/Cropper'
import ChangeHeaderPicModal from '../user/account/ChangeHeaderPicModal'
class TestCrop extends Component {
state = {
};
@ -14,6 +14,8 @@ class TestCrop extends Component {
const props = this.props;
return (
<div>
<button onClick={() => { this.refs['changeHeaderPicModal'].setVisible(true)}}>open</button>
<ChangeHeaderPicModal ref="changeHeaderPicModal"></ChangeHeaderPicModal>
<Cropper></Cropper>
</div>
);

@ -928,6 +928,7 @@ class Newshixuns extends Component {
<label className="fl mt10 "><span
className="color-red fl mt3">*</span>&nbsp;&nbsp;</label>
<textarea className="fl task-form-80 task-height-150"
style={{width:'89%'}}
onInput={this.setlanguagewrite}
value={languagewrite}
placeholder="请填写该镜像是基于什么语言示例Python"

@ -12,7 +12,7 @@ import { getImageUrl ,markdownToHTML} from 'educoder'
import { CircularProgress } from 'material-ui/Progress';
import { Modal, Spin, Tooltip ,message} from 'antd';
import { Modal, Spin, Tooltip ,message,Icon} from 'antd';
import 'antd/lib/pagination/style/index.css';
@ -35,7 +35,8 @@ class Challenges extends Component {
shixunsreplace:false,
shixunsmessage:"",
hidestartshixunsreplacevalue:"",
operationstrue:false
operationstrue:false,
isSpin:false,
}
}
@ -154,33 +155,76 @@ class Challenges extends Component {
})
}
}
startgameid=(id)=>{
let url = "/shixuns/" + id + "/shixun_exec.json";
axios.get(url).then((response) => {
if (response.data.status === -2) {
this.setState({
shixunsreplace:true,
hidestartshixunsreplacevalue:response.data.message+".json"
})
} else if (response.data.status === -1) {
console.log(response)
}else if(response.data.status===-3){
this.setState({
shixunsmessage:response.data.message,
startshixunCombattype:true,
})
} else {
window.location.href = "/tasks/" + response.data.game_identifier;
// window.location.href = path
// let path="/tasks/"+response.data.game_identifier;
// this.props.history.push(path);
}
}).catch((error) => {
});
}
hidestartshixunsreplace=(url)=>{
this.setState({
isSpin:true,
})
axios.get(url).then((response) => {
if(response.status===200){
let path="/shixuns/"+response.data.shixun_identifier+"/challenges";
this.props.history.push(path);
// let path="/shixuns/"+response.data.shixun_identifier+"/challenges";
// this.props.history.push(path);
message.success('重置成功,正在进入实训!');
this.startgameid(response.data.shixun_identifier);
this.setState({
shixunsreplace:false
shixunsreplace:false,
isSpin:false,
})
message.success('重置成功,请继续!');
// message.success('重置成功,正在进入实训!');
// this.startshixunCombat();
}}
).catch((error) => {
this.setState({
startbtns:false,
shixunsreplace:false
})
});
}
//编辑实训题目选择题
EditTraining=(type, ids, path)=>{
let { ChallengesDataList } = this.state;
window.location.href = "/shixuns/" + ChallengesDataList.shixun_identifier + "/challenges/" + ids + path;
}
//开始实战按钮
startshixunCombat = (type, ids, path) => {
startshixunCombat = (type, ids, id) => {
let { ChallengesDataList } = this.state;
if(path===null){
let id = this.props.match.params.shixunId;
// let id = this.props.match.params.shixunId;
this.setState({
startbtns: true
})
let url = "/shixuns/" + id + "/shixun_exec.json";
let url = "/shixuns/" + ChallengesDataList.shixun_identifier + "/shixun_exec.json?challenge_id="+id;
axios.get(url).then((response) => {
if (response.data.status === -2) {
@ -190,6 +234,9 @@ class Challenges extends Component {
hidestartshixunsreplacevalue:response.data.message+".json"
})
} else if (response.data.status === -1) {
this.setState({
startbtns: false
})
console.log(response)
}else if(response.data.status===-3){
this.setState({
@ -204,17 +251,18 @@ class Challenges extends Component {
// this.props.history.push(path);
}
}).catch((error) => {
this.setState({
startbtns: false
})
});
}else{
if (type > 4 || type === false) {
window.location.href = path;
} else {
window.location.href = "/shixuns/" + ChallengesDataList.shixun_identifier + "/challenges/" + ids + path;
}
}
// if(path===null){
// }else{
// if (type > 4 || type === false) {
// window.location.href = path;
// } else {
//
// }
// }
}
@ -230,6 +278,7 @@ class Challenges extends Component {
this.updatamakedown("ReactMarkdown")
}
let id = this.props.match.params.shixunId;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
return (
<React.Fragment>
{loadingContent ?
@ -340,10 +389,10 @@ class Challenges extends Component {
{this.props.identity<5?
item.st === 1 ?
<a onClick={() => this.startshixunCombat(this.props.identity, item.challenge_id, "/editquestion")}
<a onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editquestion")}
className="font-16 color05101a">{item.name}</a>
:
<a onClick={() => this.startshixunCombat(this.props.identity, item.challenge_id, "/editcheckpoint")}
<a onClick={() => this.EditTraining(this.props.identity, item.challenge_id, "/editcheckpoint")}
className="font-16 color05101a">{item.name}</a>:<span
// onClick={() => this.startshixunCombat(this.props.identity, item.challenge_id, "/editcheckpoint")}
className="font-16 color05101a">{item.name}</span>
@ -431,7 +480,7 @@ class Challenges extends Component {
{/*判断比较复杂 有排第一不能是灰色按钮*/}
{item.status === 2 ?
<a className="edu-default-btn edu-blueline-btn fr Finish_button mtf3"
onClick={() => this.startshixunCombat(false,undefined, item.open_game)}
onClick={() => this.startshixunCombat(false,undefined, item.challenge_id)}
// onClick={() => this.startshixunCombat(false)}
>已完成</a> : ""
}
@ -440,7 +489,7 @@ class Challenges extends Component {
ChallengesDataList.allow_skip === true && item.status === 1?
<a className="edu-default-btn edu-blueback-btn fr Finish_button"
style={{marginTop: '-2px'}}
onClick={() => this.startshixunCombat(false,undefined, item.open_game)}
onClick={() => this.startshixunCombat(false,undefined, item.challenge_id)}
// onClick={() => this.startshixunCombat(false)}
>直接挑战</a> : ""
}
@ -451,14 +500,14 @@ class Challenges extends Component {
ChallengesDataList.allow_skip === false ? item.status === 1 && newstatus === 2 ?
<Tooltip placement="bottom" title={item.open_game!=""?"直接挑战":"请先完成前序关卡"}>
<a className={item.open_game!=""?"edu-default-btn edu-blueback-btn fr Finish_button":"edu-default-btn edu-greyback-btn fr Finish_button"}
onClick={item.open_game!=""?()=>this.startshixunCombat(false,undefined, item.open_game):""}
onClick={item.open_game!=""?()=>this.startshixunCombat(false,undefined, item.challenge_id):""}
style={{marginTop: '-2px'}}>直接挑战</a>
</Tooltip>
: item.status === 1 && newstatus === 1 ?
<Tooltip placement="bottom" title={this.props.identity<5?"直接挑战":"请先完成前序关卡"}>
<a className={this.props.identity<5&&item.open_game!=""?"edu-default-btn edu-blueback-btn fr Finish_button":"edu-default-btn edu-greyback-btn fr Finish_button"}
onClick={this.props.identity<5&&item.open_game!=""?()=>this.startshixunCombat(false,undefined, item.open_game):""}
onClick={this.props.identity<5&&item.open_game!=""?()=>this.startshixunCombat(false,undefined, item.challenge_id):""}
style={{marginTop: '-2px'}}>直接挑战</a>
</Tooltip> : "" : ""
@ -469,7 +518,7 @@ class Challenges extends Component {
item.status === 0 ?
<Tooltip placement="bottom" title={this.props.identity<5&&item.open_game!=""?"直接挑战":"请先完成前序关卡"}>
<a className={this.props.identity<5&&item.open_game!=""?"edu-default-btn edu-blueback-btn fr Finish_button":"edu-default-btn edu-greyback-btn fr Finish_button"}
onClick={this.props.identity<5&&item.open_game!=""?()=>this.startshixunCombat(false,undefined, item.open_game):""}
onClick={this.props.identity<5&&item.open_game!=""?()=>this.startshixunCombat(false,undefined, item.challenge_id):""}
style={{marginTop: '-2px'}}>直接挑战</a>
</Tooltip>: ""
}
@ -530,12 +579,15 @@ class Challenges extends Component {
closable={false}
footer={null}
>
<Spin indicator={antIcon} spinning={this.state.isSpin}>
<div className="task-popup-content">
<p className="task-popup-text-center font-16 pb20">实训已经更新了正在为您重置!</p>
</div>
<div className="task-popup-submit clearfix">
<a className="task-btn task-btn-orange fr mr51" onClick={()=>this.hidestartshixunsreplace(hidestartshixunsreplacevalue)}>知道了</a>
<a className="task-btn task-btn-orange fr mr51"
onClick={() => this.hidestartshixunsreplace(hidestartshixunsreplacevalue)}>知道了</a>
</div>
</Spin>
</Modal>
</div>
}

@ -0,0 +1,163 @@
import React, { Component } from "react";
import { Modal } from "antd";
import axios from 'axios'
import ModalWrapper from "../../courses/common/ModalWrapper"
import { Cropper } from 'educoder'
const imageId = 'changeHeaderPic'
const previewId = 'changeHeader_imagePreview'
let uploadedImageType;
let uploadedImageName;
let uploadedImageURL;
class ChangeHeaderPicModal extends Component{
constructor(props){
super(props);
this.state={
}
}
init = () => {
var inputImage = document.getElementById('inputImage');
const that = this;
inputImage.onchange = function () {
var files = this.files;
var file;
// cropper &&
if (files && files.length) {
file = files[0];
if (/^image\/\w+/.test(file.type)) {
uploadedImageType = file.type;
uploadedImageName = file.name;
if (uploadedImageURL) {
URL.revokeObjectURL(uploadedImageURL);
}
const image = document.getElementById( imageId );
image.src = uploadedImageURL = URL.createObjectURL(file);
that.refs['cropper'].renew(image)
// cropper.destroy();
// cropper = new Cropper(image, options);
inputImage.value = null;
} else {
// TODO noti
window.alert('Please choose an image file.');
}
}
};
}
componentDidMount() {
}
setVisible = (visible) => {
this.refs['modalWrapper'].setVisible(visible)
if (visible) {
setTimeout(() => {
this.init()
}, 300)
}
}
onSendOk = () => {
}
onOk = () => {
var img_lg = document.getElementById(previewId);
// 截图小的显示框内的内容
window.html2canvas(img_lg).then((canvas) => {
var dataUrl = canvas.toDataURL("image/jpeg");
console.log(dataUrl)
const url = `/users/accounts/${this.props.userLogin || 'kosasa'}/avatar.json`
axios.put(url, {
image: dataUrl
})
.then((response) => {
// {"status":0,"message":"success","avatar_url":"avatars/User/15739"}
if (response.data.status == 0) {
// TODO noti
}
})
.catch(function (error) {
console.log(error);
});
});
}
render(){
const { course_lists } = this.state
const { moduleName } = this.props
return(
<ModalWrapper
ref="modalWrapper"
title={`上传头像`}
{...this.props }
onOk={this.onOk}
okText="保存"
width={552}
className="changeHeaderModal"
>
<style>{`
#changeHeader_imagePreview {
overflow: hidden;
background-color: #fff;
border-radius: 50%;
text-align: center;
width: 120px;
height: 120px;
}
.previewWrap {
flex-direction: column;
justify-content: space-between;
height: 320px;
align-items: center;
margin-left: 36px;
}
.changeHeaderModal .tip {
color: #9B9B9B;
}
.previewWrap .tip {
text-align: center;
margin-top: 2px;
}
#uploadBtn {
color: #4CACFF;
border: 1px solid #4CACFF;
padding: 2px 18px;
cursor: pointer;
}
`}</style>
<div className="df">
<div>
<Cropper
ref="cropper"
imageId={imageId}
previewId="changeHeader_imagePreview"
width={320} height={320}
></Cropper>
<span className="tip">仅支持JPGGIFPNG且文件小于2M</span>
</div>
<div
className="df previewWrap" style ={{flexDirection: 'column'}}
>
<div>
<div id="changeHeader_imagePreview"></div>
<div className="tip">头像预览</div>
</div>
<label id="uploadBtn" for="inputImage">
<input type="file" class="sr-only" id="inputImage" name="file" accept="image/*"></input>
重新上传
</label>
</div>
</div>
</ModalWrapper>
)
}
}
export default ChangeHeaderPicModal;
Loading…
Cancel
Save