caishi 5 years ago
commit 240535e751

@ -110,13 +110,15 @@ class Cropper extends Component {
render() { render() {
const { width, height, previewId, imageSrc } = this.props; const { width, height, previewId, imageSrc } = this.props;
return ( return (
<div> <div>
{/* This rule is very important, please do not ignore this! */} {/* This rule is very important, please do not ignore this! */}
<style>{` <style>{`
.wrapper { .wrapper {
width: ${ (width+'px') || '500px'}; width: ${ width ? (width+'px') : '500px'};
height: ${ (height+'px') || '500px'}; height: ${ height ? (height+'px') : '500px'};
border: 1px solid #eee;
} }
img { img {
max-width: 100%; max-width: 100%;
@ -129,8 +131,11 @@ class Cropper extends Component {
} }
`}</style> `}</style>
<div className="wrapper"> <div className="wrapper">
{/* http://localhost:3007/images/footNavLogo.png 图片转了后不对 */} {/* http://localhost:3007/images/footNavLogo.png 图片转了后不对
<img id={this.props.imageId || "__image"} src={`${imageSrc || "/images/testPicture.jpg"}`}></img> || "/images/testPicture.jpg"
|| "/images/shixun0.jpg"
*/}
<img id={this.props.imageId || "__image"} src={`${imageSrc }`}></img>
</div> </div>
{/* background: 'aquamarine', {/* background: 'aquamarine',
'border-radius': '128px' 'border-radius': '128px'

@ -176,8 +176,8 @@ class Fileslists extends Component{
let list=result.data.data; let list=result.data.data;
this.setState({ this.setState({
total_count:list.total_count, total_count:list.total_count,
public_count:list.public_count, publish_count:list.publish_count,
private_count:list.private_count, unpublish_count:list.unpublish_count,
files:list.files, files:list.files,
filesId:list.id, filesId:list.id,
name:list.name, name:list.name,
@ -625,13 +625,12 @@ class Fileslists extends Component{
}) })
} }
render(){ render(){
let { searchValue, let { searchValue,
checkBoxValues, checkBoxValues,
checkAllValue, checkAllValue,
total_count, total_count,
public_count, publish_count,
private_count, unpublish_count,
files, files,
sorttype, sorttype,
Modalstype, Modalstype,
@ -766,8 +765,8 @@ class Fileslists extends Component{
secondRowLeft={ secondRowLeft={
<div style={{"display":"inline-block", "marginTop": "22px"}}> <div style={{"display":"inline-block", "marginTop": "22px"}}>
<span> {total_count} 个资源</span> <span> {total_count} 个资源</span>
<span style={{"marginLeft":"16px"}}>已发布{public_count}</span> <span style={{"marginLeft":"16px"}}>已发布{publish_count}</span>
<span style={{"marginLeft":"16px"}}>未发布{private_count}</span> <span style={{"marginLeft":"16px"}}>未发布{unpublish_count}</span>
</div> </div>
} }
onPressEnter={this.onPressEnter} onPressEnter={this.onPressEnter}

@ -151,7 +151,6 @@ class AccessoryModal extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.data.status===0){ if(result.data.status===0){
debugger
this.props.Cancel() this.props.Cancel()
this.props.setupdate() this.props.setupdate()
@ -199,7 +198,6 @@ class AccessoryModal extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.data.status===0){ if(result.data.status===0){
debugger
this.props.Cancel() this.props.Cancel()
this.props.setupdate() this.props.setupdate()

@ -175,7 +175,6 @@ class Selectsetting extends Component{
} }
savecouseShixunModal=()=>{ savecouseShixunModal=()=>{
debugger
let {fileList,is_public,unified_setting,description,datatime,course_groups}=this.state; let {fileList,is_public,unified_setting,description,datatime,course_groups}=this.state;
let newfileList=[]; let newfileList=[];

@ -2192,7 +2192,6 @@ class Studentshavecompletedthelist extends Component {
} }
funtaskstatustwo = (checkedValues, data) => { funtaskstatustwo = (checkedValues, data) => {
debugger
// console.log(checkedValues); // console.log(checkedValues);
if (JSON.stringify(checkedValues) === "[]") { if (JSON.stringify(checkedValues) === "[]") {
// console.log(checkedValues); // console.log(checkedValues);

@ -211,7 +211,6 @@ class studentsList extends Component{
} }
onCheckAllChange = (e, item, index) => { onCheckAllChange = (e, item, index) => {
const that = this; const that = this;
debugger;
const checkAllArray = that.state.checkAllArray.slice(0) const checkAllArray = that.state.checkAllArray.slice(0)
checkAllArray[index] = !checkAllArray[index] checkAllArray[index] = !checkAllArray[index]
that.setState({checkAllArray}) that.setState({checkAllArray})

@ -48,6 +48,7 @@ class PollDetailTabForthRules extends Component{
selectedCourse:[], selectedCourse:[],
flagPageEdit:this.props.flagPageEdit flagPageEdit:this.props.flagPageEdit
} }
} }
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
if (JSON.stringify(this.props.rules) != JSON.stringify(prevProps.rules) ) { if (JSON.stringify(this.props.rules) != JSON.stringify(prevProps.rules) ) {

@ -67,6 +67,7 @@ class Listofworks extends Component {
order: "update_time", order: "update_time",
b_order:"desc", b_order:"desc",
search: null, search: null,
allow_late:false,
task_status: [], task_status: [],
course_group_info: [], course_group_info: [],
teacherdata: undefined, teacherdata: undefined,
@ -220,7 +221,7 @@ class Listofworks extends Component {
<span> <span>
{ {
record.efficiencyscore&& record.efficiencyscore=== "--"?( record.efficiencyscore&& record.efficiencyscore=== "--"?(
record.submitstate==="按时提交"? this.state.allow_late&&this.state.allow_late===false?
<Tooltip placement="bottom" title={<div> <Tooltip placement="bottom" title={<div>
<div>作业截止时系统根据学生在课堂成员中的效率表现自动评分</div> <div>作业截止时系统根据学生在课堂成员中的效率表现自动评分</div>
</div>}> </div>}>
@ -229,7 +230,7 @@ class Listofworks extends Component {
</span> </span>
</Tooltip> </Tooltip>
: :
record.submitstate==="延时提交"? this.state.allow_late&&this.state.allow_late===true?
<Tooltip placement="bottom" title={<div> <Tooltip placement="bottom" title={<div>
<div>补交结束时系统根据学生在课堂成员中的效率表现自动评分</div> <div>补交结束时系统根据学生在课堂成员中的效率表现自动评分</div>
</div>}> </div>}>
@ -472,7 +473,7 @@ class Listofworks extends Component {
<span> <span>
{ {
record.efficiencyscore&& record.efficiencyscore=== "--"?( record.efficiencyscore&& record.efficiencyscore=== "--"?(
record.submitstate==="按时提交"? this.state.allow_late&&this.state.allow_late===false?
<Tooltip placement="bottom" title={<div> <Tooltip placement="bottom" title={<div>
<div>作业截止时系统根据学生在课堂成员中的效率表现自动评分</div> <div>作业截止时系统根据学生在课堂成员中的效率表现自动评分</div>
</div>}> </div>}>
@ -481,7 +482,7 @@ class Listofworks extends Component {
</span> </span>
</Tooltip> </Tooltip>
: :
record.submitstate==="延时提交"? this.state.allow_late&&this.state.allow_late===true?
<Tooltip placement="bottom" title={<div> <Tooltip placement="bottom" title={<div>
<div>补交结束时系统根据学生在课堂成员中的效率表现自动评分</div> <div>补交结束时系统根据学生在课堂成员中的效率表现自动评分</div>
</div>}> </div>}>
@ -653,6 +654,7 @@ class Listofworks extends Component {
this.setState({ this.setState({
teacherdata: result.data, teacherdata: result.data,
task_status: result.data.task_status, task_status: result.data.task_status,
allow_late:result.data.allow_late,
course_group_info: result.data.course_group_info, course_group_info: result.data.course_group_info,
loadingstate: false, loadingstate: false,
jobsettingsdata: result, jobsettingsdata: result,
@ -713,6 +715,7 @@ class Listofworks extends Component {
course_group_info: result.data.course_group_info, course_group_info: result.data.course_group_info,
loadingstate: false, loadingstate: false,
jobsettingsdata: result, jobsettingsdata: result,
allow_late:result.data.allow_late,
publish_immediately: result.data.publish_immediately, publish_immediately: result.data.publish_immediately,
work_efficiency: result.data.work_efficiency, work_efficiency: result.data.work_efficiency,
end_immediately: result.data.end_immediately, end_immediately: result.data.end_immediately,
@ -1322,6 +1325,10 @@ class Listofworks extends Component {
axios.get(url).then((response) => { axios.get(url).then((response) => {
this.props.showNotification(`${response.data.message}`); this.props.showNotification(`${response.data.message}`);
this.setState({
loadingstate: true
})
this.Startsorting(this.state.order, this.state.course_groupyslstwo, this.state.checkedValuesineinfo, this.state.searchtext, 1, this.state.limit);
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -1340,10 +1347,18 @@ class Listofworks extends Component {
course_group: this.state.checkedValuesineinfo, course_group: this.state.checkedValuesineinfo,
search: this.state.searchtext, search: this.state.searchtext,
} }
}).then((response) => { },{responseType: 'blob'}).then((response) => {
console.log("1342"); console.log("1342");
console.log(response); console.log(response);
var blob = new Blob([response.data])
var downloadElement = document.createElement('a');
var href = window.URL.createObjectURL(blob); //创建下载的链接
downloadElement.href = href;
downloadElement.download = '实习报告.pdf'; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
window.URL.revokeObjectURL(href); //释放掉blob对象
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -1359,10 +1374,18 @@ class Listofworks extends Component {
group_id: this.state.checkedValuesineinfo, group_id: this.state.checkedValuesineinfo,
search: this.state.searchtext, search: this.state.searchtext,
} }
}).then((response) => { },{responseType: 'blob'}).then((response) => {
console.log("1306"); console.log("1306");
console.log(response); console.log(response);
var blob = new Blob([response.data])
var downloadElement = document.createElement('a');
var href = window.URL.createObjectURL(blob); //创建下载的链接
downloadElement.href = href;
downloadElement.download = '课堂学生成绩.xlsx'; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
window.URL.revokeObjectURL(href); //释放掉blob对象
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
@ -1458,7 +1481,7 @@ class Listofworks extends Component {
</p> </p>
</div> </div>
<div className="educontent mb30"> <div className="educontent mb30">
<p className=" fl color-black summaryname"> <p className=" fl color-black summaryname" style={{heigth:"33px"}}>
{teacherdata === undefined ? "" : teacherdata.homework_name} {teacherdata === undefined ? "" : teacherdata.homework_name}
</p> </p>
<CoursesListType <CoursesListType

@ -855,7 +855,7 @@ class Listofworksstudentone extends Component {
</p> </p>
</div> </div>
<div className="educontent mb30" style={{width: "1250px"}}> <div className="educontent mb30" style={{width: "1250px"}}>
<p className=" fl color-black summaryname"> <p className=" fl color-black summaryname" style={{heigth:"33px"}}>
{teacherdata === undefined ? "" : teacherdata.homework_name} {teacherdata === undefined ? "" : teacherdata.homework_name}
</p> </p>
<CoursesListType <CoursesListType
@ -1009,7 +1009,7 @@ class Listofworksstudentone extends Component {
</p> </p>
</div> </div>
<div className="educontent mb30"> <div className="educontent mb30">
<p className=" fl color-black summaryname"> <p className=" fl color-black summaryname" style={{heigth:"33px"}}>
{jobsettingsdata === undefined ? "" : jobsettingsdata.data.homework_name} {jobsettingsdata === undefined ? "" : jobsettingsdata.data.homework_name}
</p> </p>
<CoursesListType <CoursesListType

@ -571,7 +571,7 @@ class ShixunStudentWork extends Component {
</p> </p>
</div> </div>
<div className="educontent mb30"> <div className="educontent mb30">
<p className=" fl color-black summaryname"> <p className=" fl color-black summaryname" style={{heigth:"33px"}}>
{data&&data.homework_name} {data&&data.homework_name}
</p> </p>
<CoursesListType <CoursesListType
@ -659,7 +659,7 @@ class ShixunStudentWork extends Component {
{data&&data? {data&&data?
<div> <div>
<ul className="clearfix" style={{padding: '20px 40px 10px 40px'}}> <ul className="clearfix" style={{padding: '20px 16px 10px'}}>
<li className="clearfix "> <li className="clearfix ">
<span className="fl mr10 color-grey-8 ">查重时间{data&&data.last_review_time}</span> <span className="fl mr10 color-grey-8 ">查重时间{data&&data.last_review_time}</span>
@ -715,7 +715,7 @@ class ShixunStudentWork extends Component {
</ul> </ul>
<div id="graduation_work_list" style={{padding: '0px 40px 10px 40px'}}> <div id="graduation_work_list" style={{padding: '0px 16px 10px'}}>
<div className="clearfix"> <div className="clearfix">
<span className="fl color-grey-6 font-12"> <span className="fl color-grey-6 font-12">
@ -755,11 +755,12 @@ class ShixunStudentWork extends Component {
{datalist === undefined ? "" : <Table {datalist === undefined ? "" : <Table
dataSource={datalist} dataSource={datalist}
columns={columns} columns={columns}
pagination={{ //分页 pagination={ datalist.length<11?false:{ //分页
total: datalist.length===0?0:data&&data.all_reviews_count, //数据总数量 total: datalist.length===0?0:data&&data.all_reviews_count, //数据总数量
pageSize: 10, //显示几条一页 pageSize: 10, //显示几条一页
current:page, current:page,
}} }}
onChange={this.TablePagination} onChange={this.TablePagination}
/>} />}
</div> </div>

@ -358,7 +358,7 @@ class ShixunhomeWorkItem extends Component{
` `
} }
</style> </style>
{this.props.isAdmin?<div className={this.props.isClassManagement?"homepagePostSetting homepagePostSettingname":"homepagePostSetting homepagePostSettingbox"} style={{"right":"-2px","top":"44px","display":"block"}}> {this.props.isAdmin?<div className={this.props.isAdminOrTeacher()?"homepagePostSetting homepagePostSettingname":"homepagePostSetting homepagePostSettingbox"} style={{"right":"-2px","top":"44px","display":"block"}}>
<a className="btn colorblue font-16" href={"/shixuns/"+discussMessage.shixun_identifier+"/challenges"} target={"_blank"}>实训详情</a> <a className="btn colorblue font-16" href={"/shixuns/"+discussMessage.shixun_identifier+"/challenges"} target={"_blank"}>实训详情</a>
{this.props.isAdminOrTeacher()?<a onClick={()=>this.editname(discussMessage.name,discussMessage.homework_id)} className={"btn colorblue ml20 font-16"}>重命名</a>:""} {this.props.isAdminOrTeacher()?<a onClick={()=>this.editname(discussMessage.name,discussMessage.homework_id)} className={"btn colorblue ml20 font-16"}>重命名</a>:""}
<WordsBtn className="btn colorblue ml20 font-16" to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/settings`} > 设置</WordsBtn> <WordsBtn className="btn colorblue ml20 font-16" to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/settings`} > 设置</WordsBtn>

@ -31,7 +31,9 @@ class ShixunWorkModal extends Component{
response.data.group_list.map((item,key)=>{ response.data.group_list.map((item,key)=>{
newgroup_list.push(item) newgroup_list.push(item)
}) })
if( response.data.ungroup_list!== undefined || response.data.ungroup_list !== null){ if(response.data.ungroup_list===undefined){
}else{
newgroup_list.push(response.data.ungroup_list) newgroup_list.push(response.data.ungroup_list)
} }
this.setState({ this.setState({
@ -255,31 +257,10 @@ class ShixunWorkModal extends Component{
<Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit} value={group_ids}> <Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit} value={group_ids}>
{ {
group_list===undefined?course_groups.ungroup_list.work_count===0?"": group_list===undefined?"":
group_list&&group_list.length===0?"":group_list.map((item,key)=>{
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE">
<li className="fl task-hide" style={{width: '240px'}}>
<Checkbox
className="fl task-hide edu-txt-left"
name="shixun_homework[]"
value={course_groups.ungroup_list.id}
>
<label style={{"textAlign": "left", "color": "#05101A"}}
className="task-hide color-grey-name" title="frerere">{course_groups.ungroup_list.name}</label>
</Checkbox>
</li>
<li className="fl" style={{width: '100px'}}>
{course_groups.ungroup_list.work_count}
</li>
<li className="fl" style={{width: '160px'}}>
{course_groups.ungroup_list.last_review_time}
</li>
</div>
:
group_list&&group_list.length===0?"":group_list[0]===undefined?"":group_list.map((item,key)=>{
return( return(
item.work_count===0?"":<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 task-hide" style={{width: '240px'}}> <li className="fl task-hide" style={{width: '240px'}}>
<Checkbox <Checkbox
className="fl task-hide edu-txt-left" className="fl task-hide edu-txt-left"
@ -319,3 +300,27 @@ class ShixunWorkModal extends Component{
} }
} }
export default ShixunWorkModal; export default ShixunWorkModal;
// course_groups.ungroup_list.work_count===0?"":
//
// <div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE">
// <li className="fl task-hide" style={{width: '240px'}}>
// <Checkbox
// className="fl task-hide edu-txt-left"
// name="shixun_homework[]"
// value={course_groups.ungroup_list.id}
// >
// <label style={{"textAlign": "left", "color": "#05101A"}}
// className="task-hide color-grey-name" title="frerere">{course_groups.ungroup_list.name}</label>
// </Checkbox>
// </li>
// <li className="fl" style={{width: '100px'}}>
// {course_groups.ungroup_list.work_count}
// </li>
// <li className="fl" style={{width: '160px'}}>
// {course_groups.ungroup_list.last_review_time}
// </li>
// </div>
//
// :

@ -162,28 +162,33 @@ class Trainingjobsetting extends Component {
}) })
}else { }else {
for(var i=0;i<result.data.group_settings.length;i++) { for(var i=0;i<result.data.group_settings.length;i++) {
array.push({ if(result.data.group_settings[i].publish_time === null &&result.data.group_settings[i].end_time === null){
}else {
array.push({
course_group_id: result.data.group_settings[i].group_id,
course_group_name: result.data.group_settings[i].group_name,
publish_time: result.data.group_settings[i].publish_time,
end_time: result.data.group_settings[i].end_time,
publish_flag: "",
end_flag: "",
class_flag: "",
course_search: "",
open: false
})
}
}
}
for(var i=0;i<result.data.group_settings.length;i++){
arrays.push({
course_group_id:result.data.group_settings[i].group_id, course_group_id:result.data.group_settings[i].group_id,
course_group_name:result.data.group_settings[i].group_name, course_group_name:result.data.group_settings[i].group_name,
publish_time:result.data.group_settings[i].publish_time, publish_time:result.data.group_settings[i].publish_time,
end_time:result.data.group_settings[i].end_time, end_time:result.data.group_settings[i].end_time,
publish_flag:"", course_choosed:0,
end_flag:"",
class_flag:"",
course_search:"",
open:false
}) })
}
}
for(var i=0;i<result.data.group_settings.length;i++){
arrays.push({
course_group_id:result.data.group_settings[i].group_id,
course_group_name:result.data.group_settings[i].group_name,
publish_time:result.data.group_settings[i].publish_time,
end_time:result.data.group_settings[i].end_time,
course_choosed:0,
})
if(result.data.group_settings[i].group_id instanceof Array ) { if(result.data.group_settings[i].group_id instanceof Array ) {
rulesdatas.push({ rulesdatas.push({
@ -741,8 +746,10 @@ class Trainingjobsetting extends Component {
//占比分 //占比分
if(challenge_settingsdata.length>0){ if(challenge_settingsdata.length>0){
var Proportion=100; var Proportion=100;
var oushution=0;
//获取占用分后的值 //获取占用分后的值
Proportion=Proportion-latedeductiontwos; Proportion=Proportion-latedeductiontwos;
oushution=Proportion;
var srorelength=0; var srorelength=0;
//计算选中用户 //计算选中用户
for (var k=0;k<challenge_settingsdata.length;k++){ for (var k=0;k<challenge_settingsdata.length;k++){
@ -762,10 +769,17 @@ class Trainingjobsetting extends Component {
//计算平均值 //计算平均值
Proportion= Proportion/srorelength; Proportion= Proportion/srorelength;
var intkk=0; var intkk=0;
if(srbool==true){ var intkks=0;
if(srbool==true){
// 奇数
var exams = Math.round(Proportion) var exams = Math.round(Proportion)
var intk = srorelength*exams; var intk = srorelength*exams;
intkk=100 - intk; intkk=oushution - intk;
}else {
// 偶数
var examsy = Math.round(Proportion)
intkks=oushution - (examsy*srorelength);
} }
var mact=0; var mact=0;
@ -774,8 +788,13 @@ class Trainingjobsetting extends Component {
for (var i=0;i<challenge_settingsdata.length;i++){ for (var i=0;i<challenge_settingsdata.length;i++){
if(challenge_settingsdata[i].checked === true) { if(challenge_settingsdata[i].checked === true) {
if(srbool===false){ if(srbool===false){
challenge_settingsdata[i].challenge_score = Math.round(Proportion); mact=mact+1;
if(mact===srorelength){
challenge_settingsdata[i].challenge_score = Math.round(Proportion)+intkks;
}else {
challenge_settingsdata[i].challenge_score = Math.round(Proportion);
}
}else{ }else{
mact=mact+1; mact=mact+1;
if(mact===srorelength){ if(mact===srorelength){
@ -1468,6 +1487,13 @@ class Trainingjobsetting extends Component {
starttimes:undefined, starttimes:undefined,
}) })
} }
cancelBox=()=>{
this.setState({
modalsType: false,
modalsTopval: "",
loadtype: false,
})
}
//编辑 //编辑
editSetting = () => { editSetting = () => {
try { try {
@ -1540,7 +1566,8 @@ class Trainingjobsetting extends Component {
handclass: undefined, handclass: undefined,
unit_e_tip: "", unit_e_tip: "",
}) })
this.refs.targetElementTrainingjobsetting.scrollIntoView() this.refs.targetElementTrainingjobsetting.scrollIntoView();
this.getTrainingjobsetting();
} }
rulesCheckInfo=(rules)=>{ rulesCheckInfo=(rules)=>{
@ -1580,6 +1607,38 @@ class Trainingjobsetting extends Component {
showmodel:false showmodel:false
}) })
} }
// 导出实习报告批量
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("1593");
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("1607");
console.log(response);
}).catch((error) => {
console.log(error)
});
}
render() { render() {
@ -1656,7 +1715,7 @@ class Trainingjobsetting extends Component {
</div> </div>
<div className="educontent mb30"> <div className="educontent mb30">
<p className=" fl color-black summaryname mt5"> <p className=" fl color-black summaryname mt5" style={{heigth:"33px"}}>
{jobsettingsdata === undefined ? "" : jobsettingsdata.data.homework_name} {jobsettingsdata === undefined ? "" : jobsettingsdata.data.homework_name}
</p> </p>
@ -1698,10 +1757,35 @@ class Trainingjobsetting extends Component {
{/*<Link className="ml30" to={`/courses/${this.state.props.match.params.coursesId}/shixun_homeworks/${this.state.props.match.params.homeworkid}/shixun_work_report`}>*/} {/*<Link className="ml30" to={`/courses/${this.state.props.match.params.coursesId}/shixun_homeworks/${this.state.props.match.params.homeworkid}/shixun_work_report`}>*/}
{/*<a className="color-blue">查看实训报告</a>*/} {/*<a className="color-blue">查看实训报告</a>*/}
{/*</Link>*/} {/*</Link>*/}
{this.props.isAdmin() ? <a <style>{`
className="fr color-blue font-16" .drop_down_menu li a {
href={`/api/homework_commons/${this.props.match.params.coursesId}/works_list.xlsx`} padding: 0px;
>导出</a> : ""} font-size: 14px;
}
.drop_down_menu {
width: 93px;
}
.drop_down_menu li {
overflow: visible;
width: 93px;
}
.drop_down_menu, .drop_down_normal {
padding-top: 10px;
padding-bottom: 8px;
}
a:hover {
color:#1A0B00 !important;
}
`}</style>
{this.props.isAdmin() ? <li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding": "0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}>
<li><a onClick={()=>this.internshipreport()}>实训报告</a>
</li>
<li><a onClick={()=>this.Classstudentachievement()}>学生成绩</a>
</li>
</ul>
</li>: ""}
{this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.end_immediately===true? {this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.end_immediately===true?
<a className="fr color-blue font-16" onClick={this.homeworkends}>立即截止</a> : "": ""} <a className="fr color-blue font-16" onClick={this.homeworkends}>立即截止</a> : "": ""}
{this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.publish_immediately===true? {this.props.isAdmin() ?jobsettingsdata&&jobsettingsdata.data.publish_immediately===true?
@ -1997,7 +2081,7 @@ class Trainingjobsetting extends Component {
提交 提交
</Button> </Button>
{/*<a className="defalutSubmitbtn fl mr20">提交</a>*/} {/*<a className="defalutSubmitbtn fl mr20">提交</a>*/}
<a className="defalutCancelbtn fl" onClick={this.cancelEdit}>取消</a> <a className="defalutCancelbtn fl" onClick={()=>this.cancelEdit()}>取消</a>
</div> </div>
: "" : ""
} }

@ -412,7 +412,7 @@ class Workquestionandanswer extends Component {
</p> </p>
</div> </div>
<div className="educontent mb30"> <div className="educontent mb30">
<p className=" fl color-black summaryname"> <p className=" fl color-black summaryname" style={{heigth:"33px"}}>
{jobsettingsdata === undefined ? "" : jobsettingsdata.data.homework_name} {jobsettingsdata === undefined ? "" : jobsettingsdata.data.homework_name}
</p> </p>
<CoursesListType <CoursesListType

@ -227,7 +227,6 @@ class Trialapplication extends Component {
postregistered = () => { postregistered = () => {
//提交按钮 //提交按钮
debugger
if (this.state.user_phone_binded === false) { if (this.state.user_phone_binded === false) {
if (this.state.Phonenumberisnotcobool === false) { if (this.state.Phonenumberisnotcobool === false) {

@ -75,9 +75,11 @@ export function TPMIndexHOC(WrappedComponent) {
// header里面需要有user // header里面需要有user
initCommonState(user) { initCommonState(user) {
// 更新头像后,需要改变参数,不然会被图片缓存影响到
const newUser = Object.assign({}, {...user}, { image_url: `${user.image_url}?t=${new Date().getTime()}`});
this.setState({ this.setState({
user, user: newUser,
current_user: user current_user: newUser
}) })
} }
showShixun = () => { showShixun = () => {
@ -230,7 +232,7 @@ export function TPMIndexHOC(WrappedComponent) {
/** /**
课堂权限相关方法暂时写这里了 ----------------------------------------END 课堂权限相关方法暂时写这里了 ----------------------------------------END
*/ */
fetchUser() { fetchUser = () => {
let url = `/users/get_user_info.json` let url = `/users/get_user_info.json`
let courseId; let courseId;
let query = this.props.location.pathname; let query = this.props.location.pathname;
@ -289,7 +291,8 @@ export function TPMIndexHOC(WrappedComponent) {
isStudent: this.isStudent, isStudent: this.isStudent,
isAdminOrStudent: this.isAdminOrStudent, isAdminOrStudent: this.isAdminOrStudent,
isNotMember: this.isNotMember, isNotMember: this.isNotMember,
isUserid:this.state.coursedata&&this.state.coursedata.userid isUserid:this.state.coursedata&&this.state.coursedata.userid,
fetchUser: this.fetchUser
} }
return ( return (
<div> <div>

@ -479,48 +479,43 @@ class Challenges extends Component {
{/*判断比较复杂 有排第一不能是灰色按钮*/} {/*判断比较复杂 有排第一不能是灰色按钮*/}
{item.status === 2 ? {item.status === 2 ?
<a className="edu-default-btn edu-blueline-btn fr Finish_button mtf3" <a className={"edu-default-btn edu-blueline-btn fr Finish_button mtf3"}
onClick={() => this.startshixunCombat(false,undefined, item.challenge_id)} onClick={()=>this.startshixunCombat(false,undefined, item.challenge_id)}
// onClick={() => this.startshixunCombat(false)} // onClick={() => this.startshixunCombat(false)}
title={"查看挑战关卡"}
>已完成</a> : "" >已完成</a> : ""
} }
{ {
ChallengesDataList.allow_skip === true && item.status === 1? ChallengesDataList.allow_skip === true && item.status === 1?
<a className="edu-default-btn edu-blueback-btn fr Finish_button" <a className={"edu-default-btn edu-blueback-btn fr Finish_button"}
title={"直接挑战"}
style={{marginTop: '-2px'}} style={{marginTop: '-2px'}}
onClick={() => this.startshixunCombat(false,undefined, item.challenge_id)} onClick={()=>this.startshixunCombat(false,undefined, item.challenge_id)}
// onClick={() => this.startshixunCombat(false)} // onClick={() => this.startshixunCombat(false)}
>直接挑战</a> : "" >直接挑战</a> : ""
} }
{
ChallengesDataList.allow_skip === false ? item.status === 1?
<Tooltip placement="bottom" title={"直接挑战"}>
<a className={"edu-default-btn edu-blueback-btn fr Finish_button"}
onClick={()=>this.startshixunCombat(false,undefined, item.challenge_id)}
style={{marginTop: '-2px'}}>直接挑战</a>
</Tooltip>:"":""
{ }
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.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.challenge_id):""}
style={{marginTop: '-2px'}}>直接挑战</a>
</Tooltip> : "" : ""
}
{ {
item.status === 0 ? item.status === 0 ?
<Tooltip placement="bottom" title={this.props.identity<5&&item.open_game!=""?"直接挑战":"请先完成前序关卡"}> <Tooltip placement="bottom" title={"请先完成前序关卡"}>
<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"} <a className={"edu-default-btn edu-greyback-btn fr Finish_button"}
onClick={this.props.identity<5&&item.open_game!=""?()=>this.startshixunCombat(false,undefined, item.challenge_id):""} // onClick={this.props.identity<5&&item.open_game!=""?()=>this.startshixunCombat(false,undefined, item.challenge_id):""}
style={{marginTop: '-2px'}}>直接挑战</a> style={{marginTop: '-2px'}}>直接挑战</a>
</Tooltip>: "" </Tooltip>:""
} }
@ -598,3 +593,19 @@ class Challenges extends Component {
} }
export default Challenges; export default Challenges;
// {
// ChallengesDataList.allow_skip === false ? item.status === 1 && newstatus === 2 ?
// <Tooltip placement="bottom" title={"直接挑战"}>
// <a className={"edu-default-btn edu-blueback-btn fr Finish_button"}
// onClick={()=>this.startshixunCombat(false,undefined, item.challenge_id)}
// style={{marginTop: '-2px'}}>直接挑战</a>
// </Tooltip>
//
// : item.status === 1 && newstatus === 1 ?
// <Tooltip placement="bottom" title={"直接挑战"}>
// <a className={"edu-default-btn edu-blueback-btn fr Finish_button"}
// onClick={()=>this.startshixunCombat(false,undefined, item.challenge_id)}
// style={{marginTop: '-2px'}}>直接挑战</a>
// </Tooltip> : "" : ""
//
// }

@ -51,11 +51,11 @@ class AccountPage extends Component {
} }
getBasicInfo=(login)=>{ getBasicInfo=(login)=>{
let url=`/users/accounts/${login}.json`; let url=`/users/accounts/${login || this.props.current_user.login}.json`;
axios.get(url).then((result)=>{ axios.get(url).then((result)=>{
if(result.data){ if(result.data){
this.setState({ this.setState({
basicInfo:result.data basicInfo: Object.assign({}, {...result.data}, { avatar_url: `${result.data.avatar_url}?t=${new Date().getTime()}`})
}) })
if(result.data && result.data.base_info_completed == false){ if(result.data && result.data.base_info_completed == false){
this.props.history.push(`/account/basic/edit`); this.props.history.push(`/account/basic/edit`);

@ -28,8 +28,8 @@ class AccountBasic extends Component {
} }
} }
componentDidUpdate =(prevState)=>{ componentDidUpdate =(prevProps)=>{
if(this.props.basicInfo && this.props.basicInfo != prevState.basicInfo){ if(this.props.basicInfo && prevProps.basicInfo == undefined){
this.setValue(this.props.basicInfo); this.setValue(this.props.basicInfo);
this.getSchoolList(this.props.basicInfo); this.getSchoolList(this.props.basicInfo);
} }

@ -1,11 +1,17 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { SnackbarHOC, getImageUrl } from 'educoder'; import { SnackbarHOC, getImageUrl } from 'educoder';
import ChangeHeaderPicModal from './ChangeHeaderPicModal'
class AccountNav extends Component { class AccountImg extends Component {
editImg = () => {
this.refs['picModal'].setVisible(true)
}
render() { render() {
const picUrl = getImageUrl("images/"+this.props.src)
return ( return (
<div className="headphoto mt14"> <div className="headphoto mt14">
<ChangeHeaderPicModal
{...this.props} ref="picModal" imageSrc={picUrl} userLogin={this.props.current_user ? this.props.current_user.login : '' }></ChangeHeaderPicModal>
<style>{` <style>{`
/* /*
.headphoto { .headphoto {
@ -43,11 +49,11 @@ class AccountNav extends Component {
display: block; display: block;
} }
`}</style> `}</style>
<img alt="头像" id="user_avatar_show" nhname="avatar_image" src={`${getImageUrl("images/"+this.props.src)}`}></img> <img alt="头像" id="user_avatar_show" nhname="avatar_image" src={`${picUrl}`}></img>
<p className="headphoto-black" onClick={this.editImg} >修改头像</p> <p className="headphoto-black" onClick={this.editImg} >修改头像</p>
</div> </div>
); );
} }
} }
export default AccountNav; export default AccountImg;

@ -22,7 +22,7 @@ class AccountNav extends Component {
return ( return (
<div className="accountNav fl"> <div className="accountNav fl">
<div className="accountInfo"> <div className="accountInfo">
<AccountImg src={basicInfo && basicInfo.avatar_url}></AccountImg> <AccountImg src={basicInfo && basicInfo.avatar_url} {...this.props}></AccountImg>
<span className="name">{basicInfo && basicInfo.name}</span> <span className="name">{basicInfo && basicInfo.name}</span>
<span className="role">{basicInfo && basicInfo.technical_title}</span> <span className="role">{basicInfo && basicInfo.technical_title}</span>
</div> </div>

@ -28,6 +28,10 @@ class ChangeHeaderPicModal extends Component{
file = files[0]; file = files[0];
if (/^image\/\w+/.test(file.type)) { if (/^image\/\w+/.test(file.type)) {
if (file.size > 2 * 1024 * 1024) {
this.props.showNotification && this.props.showNotification("仅支持文件大小小于2M的文件")
return;
}
uploadedImageType = file.type; uploadedImageType = file.type;
uploadedImageName = file.name; uploadedImageName = file.name;
@ -41,8 +45,8 @@ class ChangeHeaderPicModal extends Component{
// cropper = new Cropper(image, options); // cropper = new Cropper(image, options);
inputImage.value = null; inputImage.value = null;
} else { } else {
// TODO noti this.props.showNotification && this.props.showNotification("请选择一个图片格式的文件")
window.alert('Please choose an image file.'); // window.alert('Please choose an image file.');
} }
} }
}; };
@ -71,14 +75,18 @@ class ChangeHeaderPicModal extends Component{
var dataUrl = canvas.toDataURL("image/jpeg"); var dataUrl = canvas.toDataURL("image/jpeg");
console.log(dataUrl) console.log(dataUrl)
const url = `/users/accounts/${this.props.userLogin || 'kosasa'}/avatar.json` const url = `/users/accounts/${this.props.userLogin}/avatar.json`
axios.put(url, { axios.put(url, {
image: dataUrl image: dataUrl
}) })
.then((response) => { .then((response) => {
// {"status":0,"message":"success","avatar_url":"avatars/User/15739"} // {"status":0,"message":"success","avatar_url":"avatars/User/15739"}
if (response.data.status == 0) { if (response.data.status == 0) {
// TODO noti // this.props.getBasicInfo()
this.props.fetchUser()
// 头像更新后会触发AccountPage的DidUpdate然后会调用getBasicInfo
this.props.showNotification && this.props.showNotification("修改头像成功")
this.setVisible(false)
} }
}) })
.catch(function (error) { .catch(function (error) {
@ -108,6 +116,7 @@ class ChangeHeaderPicModal extends Component{
text-align: center; text-align: center;
width: 120px; width: 120px;
height: 120px; height: 120px;
border: 1px solid #eee;
} }
.previewWrap { .previewWrap {
flex-direction: column; flex-direction: column;
@ -118,10 +127,14 @@ class ChangeHeaderPicModal extends Component{
} }
.changeHeaderModal .tip { .changeHeaderModal .tip {
color: #9B9B9B; color: #9B9B9B;
margin-top: 4px;
}
.changeHeaderModal .cropperWrap .tip {
display: inline-block;
} }
.previewWrap .tip { .previewWrap .tip {
text-align: center; text-align: center;
margin-top: 2px; margin-top: 4px;
} }
#uploadBtn { #uploadBtn {
color: #4CACFF; color: #4CACFF;
@ -131,8 +144,9 @@ class ChangeHeaderPicModal extends Component{
} }
`}</style> `}</style>
<div className="df"> <div className="df">
<div> <div className="cropperWrap">
<Cropper <Cropper
imageSrc={''}
ref="cropper" ref="cropper"
imageId={imageId} imageId={imageId}
previewId="changeHeader_imagePreview" previewId="changeHeader_imagePreview"

Loading…
Cancel
Save