dev_forum
杨树明 5 years ago
parent 7b83f0c604
commit 7c2c06874a

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

@ -458,7 +458,7 @@ class CoursesBanner extends Component {
{
`
.teachersbox{
margin-right:28px !important;
margin-right:22px !important;
}
`
}

@ -1,5 +1,5 @@
import React,{ Component } from "react";
import { Modal,Checkbox,Upload,Button,Icon,message} from "antd";
import { Modal,Checkbox,Upload,Button,Icon,message,notification} from "antd";
import { WordsBtn,getUrl, getUploadActionUrl} from 'educoder';
import axios from 'axios';
import Modals from '../../modals/Modals';
@ -110,6 +110,7 @@ class AccessoryModal extends Component{
this.props.Cancel()
}
Saves=()=>{
let id=this.props.categoryid;
let {fileList,description} =this.state;
@ -131,10 +132,12 @@ class AccessoryModal extends Component{
description:description,
attachment_ids:newfileList
}).then((result)=>{
console.log(result)
if(result !== undefined){
this.props.setupdate()
this.props.showNotification('提交成功')
if(result.data.status===0){
debugger
this.props.Cancel()
this.props.setupdate()
// this.setState({
// Modalstype:true,
// Modalstopval:result.data.message,
@ -142,9 +145,16 @@ class AccessoryModal extends Component{
// loadtype:true
// })
this.ModalCancelModalCancel()
notification.open({
message: '提示',
description:
'提交成功'
});
if(this.props.seeworks!=undefined){
this.props.history.push(this.props.seeworks);
}
}
}).catch((error)=>{
@ -170,10 +180,12 @@ class AccessoryModal extends Component{
description:description,
attachment_ids:newfileList
}).then((result)=>{
console.log(result)
if(result.data.status===0){
debugger
this.props.Cancel()
this.props.setupdate()
this.props.showNotification('提交成功')
// this.setState({
// Modalstype:true,
// Modalstopval:result.data.message,
@ -182,9 +194,15 @@ class AccessoryModal extends Component{
// })
this.ModalCancelModalCancel()
notification.open({
message: '提示',
description:
'提交成功'
});
if(this.props.seeworks!=undefined){
this.props.history.push(this.props.seeworks);
}
}
}).catch((error)=>{

@ -1,262 +1,263 @@
import React,{ Component } from "react";
import { Modal,Checkbox,Upload,Button,Icon,message} from "antd";
import { WordsBtn, getUploadActionUrl} from 'educoder';
import axios from 'axios';
import Modals from '../../modals/Modals';
const CheckboxGroup = Checkbox.Group;
class AccessoryModal2 extends Component{
constructor(props){
super(props);
this.state={
group_ids:[],
fileList:[],
Modalstype:false,
Modalstopval:"",
ModalCancel:"",
ModalSave:"",
loadtype:false
}
}
componentDidMount() {
}
//勾选实训
shixunhomeworkedit=(list)=>{
this.setState({
group_ids:list
})
}
// 附件相关 START
handleChange = (info) => {
let fileList = info.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;
this.deleteAttachment(file);
}
deleteAttachment = (file) => {
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, {
})
.then((response) => {
if (response.data) {
const { status } = response.data;
if (status == 0) {
console.log('--- success')
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
newFileList.splice(index, 1);
return {
fileList: newFileList,
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
}
ModalCancelModalCancel=()=>{
this.setState({
Modalstype:false,
Modalstopval:"",
ModalSave:this.ModalCancelModalCancel,
loadtype:false
})
this.props.Cancel()
}
componentDidUpdate = (prevProps) => {
if (JSON.stringify(prevProps.fileList) != JSON.stringify(this.props.fileList)) {
this.setState({
fileList: this.props.fileList
})
}
if (prevProps.description != this.props.description) {
this.setState({
description: this.props.description
})
}
}
Saves=()=>{
let {fileList,description} =this.state;
let newfileList=[];
for(var list of fileList){
newfileList.push(list.response.id)
}
this.props.Saves && this.props.Saves(newfileList, description)
return;
let id=this.props.categoryid;
console.log(newfileList)
let url="/graduation_works/"+id+"/revise_attachment.json"
axios.post(url,{
description:description,
attachment_ids:newfileList
}).then((result)=>{
console.log(result)
if(result.data.status===0){
this.props.setupdate()
this.setState({
Modalstype:true,
Modalstopval:result.data.message,
ModalSave:this.ModalCancelModalCancel,
loadtype:true
})
}
}).catch((error)=>{
})
}
settextarea=(e)=>{
this.setState({
description:e.target.value
})
}
render(){
let {description,fileList,
Modalstype,
Modalstopval,
ModalCancel,
ModalSave,
loadtype,
}=this.state;
let {course_groups}=this.props;
const uploadProps = {
width: 600,
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: getUploadActionUrl(),
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {
console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) {
message.error('文件大小必须小于150MB!');
}
return isLt150M;
},
};
return(
<div>
{/*提示*/}
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalCancel={ModalCancel}
modalSave={ModalSave}
loadtype= {loadtype}
/>
<Modal
className={"HomeworkModal"}
title={this.props.modalname || "补交附件"}
visible={this.props.visible}
closable={false}
footer={null}
destroyOnClose={true}
keyboard={false}
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16">
<span className={"color-blue underline"}> </span>
</p>
<style>{`
.uploadBtn.ant-btn {
border: none;
color: #4CACFF;
box-shadow: none;
background: transparent;
padding: 0 6px;
}
.ant-upload-list-item:hover .ant-upload-list-item-info{
background-color:#fff;
}
.upload_1 .ant-upload-list {
width: 350px;
}
.ant-upload-select{
float: left;
}
.ant-upload-list :nth-child(1).ant-upload-list-item {
margin-top:31px;
}
`}</style>
<p >
<Upload {...uploadProps} fileList={this.state.fileList} className="upload_1">
<Button className="uploadBtn">
<Icon type="upload" /> 选择文件
</Button>
(单个文件最大150M)
</Upload>
</p>
<textarea placeholder="请在此输入补交附件的原因最大限制100个字符" className={"mt20"} value={description} onInput={this.settextarea} style={{
width: '100%',
height:'150px',
border:'1px solid rgba(234,234,234,1)',
padding: '10px'
}}></textarea>
<div className="clearfix mt30 edu-txt-center mb10">
<a className="task-btn color-white mr70" onClick={this.props.Cancel}>{this.props.Cancelname || '取消'}</a>
<a className="task-btn task-btn-orange" onClick={()=>this.Saves()}>{this.props.Savesname || '确认'}</a>
</div>
</div>
</Modal>
</div>
)
}
}
import React,{ Component } from "react";
import { Modal,Checkbox,Upload,Button,Icon,message} from "antd";
import { WordsBtn, getUploadActionUrl} from 'educoder';
import axios from 'axios';
import Modals from '../../modals/Modals';
const CheckboxGroup = Checkbox.Group;
class AccessoryModal2 extends Component{
constructor(props){
super(props);
this.state={
group_ids:[],
fileList:[],
Modalstype:false,
Modalstopval:"",
ModalCancel:"",
ModalSave:"",
loadtype:false
}
}
componentDidMount() {
}
//勾选实训
shixunhomeworkedit=(list)=>{
this.setState({
group_ids:list
})
}
// 附件相关 START
handleChange = (info) => {
let fileList = info.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;
this.deleteAttachment(file);
}
deleteAttachment = (file) => {
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, {
})
.then((response) => {
if (response.data) {
const { status } = response.data;
if (status == 0) {
console.log('--- success')
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
newFileList.splice(index, 1);
return {
fileList: newFileList,
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
}
ModalCancelModalCancel=()=>{
this.setState({
Modalstype:false,
Modalstopval:"",
ModalSave:this.ModalCancelModalCancel,
loadtype:false
})
this.props.Cancel()
}
componentDidUpdate = (prevProps) => {
if (JSON.stringify(prevProps.fileList) != JSON.stringify(this.props.fileList)) {
this.setState({
fileList: this.props.fileList
})
}
if (prevProps.description != this.props.description) {
this.setState({
description: this.props.description
})
}
}
Saves=()=>{
debugger
let {fileList,description} =this.state;
let newfileList=[];
for(var list of fileList){
newfileList.push(list.response.id)
}
this.props.Saves && this.props.Saves(newfileList, description)
return;
let id=this.props.categoryid;
console.log(newfileList)
let url="/graduation_works/"+id+"/revise_attachment.json"
axios.post(url,{
description:description,
attachment_ids:newfileList
}).then((result)=>{
console.log(result)
if(result.data.status===0){
this.props.setupdate()
this.setState({
Modalstype:true,
Modalstopval:result.data.message,
ModalSave:this.ModalCancelModalCancel,
loadtype:true
})
}
}).catch((error)=>{
})
}
settextarea=(e)=>{
this.setState({
description:e.target.value
})
}
render(){
let {description,fileList,
Modalstype,
Modalstopval,
ModalCancel,
ModalSave,
loadtype,
}=this.state;
let {course_groups}=this.props;
const uploadProps = {
width: 600,
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: getUploadActionUrl(),
onChange: this.handleChange,
onRemove: this.onAttachmentRemove,
beforeUpload: (file) => {
console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) {
message.error('文件大小必须小于150MB!');
}
return isLt150M;
},
};
return(
<div>
{/*提示*/}
<Modals
modalsType={Modalstype}
modalsTopval={Modalstopval}
modalCancel={ModalCancel}
modalSave={ModalSave}
loadtype= {loadtype}
/>
<Modal
className={"HomeworkModal"}
title={this.props.modalname || "补交附件"}
visible={this.props.visible}
closable={false}
footer={null}
destroyOnClose={true}
keyboard={false}
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16">
<span className={"color-blue underline"}> </span>
</p>
<style>{`
.uploadBtn.ant-btn {
border: none;
color: #4CACFF;
box-shadow: none;
background: transparent;
padding: 0 6px;
}
.ant-upload-list-item:hover .ant-upload-list-item-info{
background-color:#fff;
}
.upload_1 .ant-upload-list {
width: 350px;
}
.ant-upload-select{
float: left;
}
.ant-upload-list :nth-child(1).ant-upload-list-item {
margin-top:31px;
}
`}</style>
<p >
<Upload {...uploadProps} fileList={this.state.fileList} className="upload_1">
<Button className="uploadBtn">
<Icon type="upload" /> 选择文件
</Button>
(单个文件最大150M)
</Upload>
</p>
<textarea placeholder="请在此输入补交附件的原因最大限制100个字符" className={"mt20"} value={description} onInput={this.settextarea} style={{
width: '100%',
height:'150px',
border:'1px solid rgba(234,234,234,1)',
padding: '10px'
}}></textarea>
<div className="clearfix mt30 edu-txt-center mb10">
<a className="task-btn color-white mr70" onClick={this.props.Cancel}>{this.props.Cancelname || '取消'}</a>
<a className="task-btn task-btn-orange" onClick={()=>this.Saves()}>{this.props.Savesname || '确认'}</a>
</div>
</div>
</Modal>
</div>
)
}
}
export default AccessoryModal2;

@ -193,9 +193,9 @@ class ExerciseListItem extends Component{
{
IsStudent &&
<div className="homepagePostSetting" style={{"right":"0px","top":"62px","position":"absolute","display":"block"}}>
{item.current_status ===0&&item.exercise_status>1? <li> <Link className="btn colorblue" to={`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`}>继续答题</Link></li>:
item.current_status ===1&&item.exercise_status>1? <li> <Link className="btn colorblue" to={`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`}>查看答题</Link></li>:
item.current_status ===2&&item.exercise_status>1? <li> <a className="btn colorblue ml20" onClick={()=>this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题</a></li>:""}
{item.current_status ===0&&item.exercise_status>1? <li> <Link className="btn colorblue font-16" to={`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`}>继续答题</Link></li>:
item.current_status ===1&&item.exercise_status>1? <li> <Link className="btn colorblue font-16" to={`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`}>查看答题</Link></li>:
item.current_status ===2&&item.exercise_status>1? <li> <a className="btn colorblue ml20 font-16" onClick={()=>this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题</a></li>:""}
</div>
}
</div>

@ -178,6 +178,7 @@ class GraduateTaskItem extends Component{
funlist={this.props.funlist}
/>:""}
{this.state.visibles===true?<AccessoryModal
{...this.props}
modalname={"补交附件"}
visible={this.state.visibles}
Cancelname={"取消"}

@ -151,6 +151,7 @@ class GraduationTasksappraise extends Component{
<AccessoryModal
{...this.props}
modalname={"补交附件"}
visible={visible}
Cancelname={"取消"}

@ -944,6 +944,7 @@ class GraduationTaskssettinglist extends Component{
:""}
{this.state.avisible===true?<AccessoryModal
{...this.props}
modalname={"补交附件"}
visible={this.state.avisible}
Cancelname={"取消"}

@ -1,128 +1,128 @@
import React, { Component } from 'react';
import { getImageUrl} from 'educoder';
import './TPMIndex.css';
const $ = window.$;
$(window).resize(function(){
rightSlider();
});
$(window).scroll(function(){
if($(".gotop").length>0){
if($(document).scrollTop()>0){
$(".-task-sidebar .gotop").show();
$(".gotop").click(function(){
$("html,body").scrollTop(0);
});
}
if($(document).scrollTop()==0){
$(".-task-sidebar .gotop").hide();
}
}
});
function rightSlider(){
var poi=parseInt((parseInt($(window).width())- 1200 )/2)-60;
// console.log(parseInt($(window).width())+" "+poi);
if(poi>0){
$(".-task-sidebar").css("right",poi);
}else{
$(".-task-sidebar").css("right","0px");
}
$(".-task-sidebar").show();
}
function _initSider() {
var $descSide = $("<div class='-task-desc'></div>").appendTo("body");
$(".-task-sidebar>div").hover(function(){
//移入显示二维码
if($(this).hasClass("scan")){
$(".scan_ewm").show().css({right:"75px",opacity:0}).stop().animate({
right:"45px",opacity:1
})
return;
}
var $tool = $(this).attr("tooltips");
$descSide.html($tool+"<div><img src='https://www.educoder.net/images/edu_user/jt.png'></div>");
$descSide.data('_dom', this)
$descSide.show().css({
left:$(this).offset().left - $descSide.width()-30,
opacity:0,
top:$(this).offset().top
}).stop().animate({
left:$(this).offset().left - $descSide.width()-5,
opacity:1
},400);
},function(){
if($(this).hasClass("scan")){
$(".scan_ewm").stop().animate({right:"75px",opacity:0},200).hide();
}
$descSide.stop().animate({
left:$(this).offset().left - $descSide.width()-30,
opacity:0
},200).hide();
});
rightSlider();
$(window).scroll(function() {
if ($descSide.height()) {
var hoverIcon = $descSide.data('_dom')
$descSide.css('top', $(hoverIcon).offset().top)
}
})
}
class SiderBar extends Component {
constructor(props) {
super(props)
}
componentDidMount() {
_initSider();
}
render() {
return (
<div className="-task-sidebar">
<div className="gotop" tooltips="返回顶部">
<a>
<i className="iconfont icon-shangjiantou color-white"></i>
</a>
</div>
<div className="feedback" tooltips="意见反馈">
<a target="_blank" className="color_white" href="https://www.educoder.net/help?index=6">
<i className="iconfont icon-yijianfankui color-white font-22"></i>
</a>
</div>
<div className="scan pr">
<span className="inline"><i className="iconfont icon-erweima color-white font-22 fl"></i></span>
<p className="scan_ewm" style={{display: 'none', right:' 75px',opacity: '0'}}>
<p className="pr padding10">
<img src={getImageUrl("images/edu_user/EWM.jpg")} width="158px" height="158px" />
<p>微信扫一扫</p>
<p>关注公众号</p>
<span className="trangle_right"></span>
</p>
</p>
</div>
<div className="consult" tooltips="在线咨询">
<a target="_blank" className="color_white" href="//shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd">
<i className="iconfont icon-qqzaixianzixun color-white font-22"></i>
</a>
</div>
</div>
);
}
}
export default SiderBar;
import React, { Component } from 'react';
import { getImageUrl} from 'educoder';
import './TPMIndex.css';
const $ = window.$;
$(window).resize(function(){
rightSlider();
});
$(window).scroll(function(){
if($(".gotop").length>0){
if($(document).scrollTop()>0){
$(".-task-sidebar .gotop").show();
$(".gotop").click(function(){
$("html,body").scrollTop(0);
});
}
if($(document).scrollTop()==0){
$(".-task-sidebar .gotop").hide();
}
}
});
function rightSlider(){
var poi=parseInt((parseInt($(window).width())- 1200 )/2)-60;
// console.log(parseInt($(window).width())+" "+poi);
if(poi>0){
$(".-task-sidebar").css("right",poi);
}else{
$(".-task-sidebar").css("right","0px");
}
$(".-task-sidebar").show();
}
function _initSider() {
var $descSide = $("<div class='-task-desc'></div>").appendTo("body");
$(".-task-sidebar>div").hover(function(){
//移入显示二维码
if($(this).hasClass("scan")){
$(".scan_ewm").show().css({right:"75px",opacity:0}).stop().animate({
right:"45px",opacity:1
})
return;
}
var $tool = $(this).attr("tooltips");
$descSide.html($tool+"<div><img src='https://www.educoder.net/images/edu_user/jt.png'></div>");
$descSide.data('_dom', this)
$descSide.show().css({
left:$(this).offset().left - $descSide.width()-30,
opacity:0,
top:$(this).offset().top
}).stop().animate({
left:$(this).offset().left - $descSide.width()-5,
opacity:1
},400);
},function(){
if($(this).hasClass("scan")){
$(".scan_ewm").stop().animate({right:"75px",opacity:0},200).hide();
}
$descSide.stop().animate({
left:$(this).offset().left - $descSide.width()-30,
opacity:0
},200).hide();
});
rightSlider();
$(window).scroll(function() {
if ($descSide.height()) {
var hoverIcon = $descSide.data('_dom')
$descSide.css('top', $(hoverIcon).offset().top)
}
})
}
class SiderBar extends Component {
constructor(props) {
super(props)
}
componentDidMount() {
_initSider();
}
render() {
return (
<div className="-task-sidebar">
<div className="gotop" tooltips="返回顶部">
<a>
<i className="iconfont icon-shangjiantou color-white"></i>
</a>
</div>
<div className="feedback" tooltips="意见反馈">
<a target="_blank" className="color_white" href="https://www.educoder.net/help?index=6">
<i className="iconfont icon-yijianfankui color-white font-22"></i>
</a>
</div>
<div className="scan pr">
<span className="inline"><i className="iconfont icon-erweima color-white font-22 fl"></i></span>
<p className="scan_ewm" style={{display: 'none', right:' 75px',opacity: '0'}}>
<p className="pr padding10">
<img src={getImageUrl("images/educoder/EWM.jpg")} width="158px" height="158px" />
<p>微信扫一扫</p>
<p>关注公众号</p>
<span className="trangle_right"></span>
</p>
</p>
</div>
<div className="consult" tooltips="在线咨询">
<a target="_blank" className="color_white" href="//shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd">
<i className="iconfont icon-qqzaixianzixun color-white font-22"></i>
</a>
</div>
</div>
);
}
}
export default SiderBar;

Loading…
Cancel
Save