From 7c2c06874a600e1cce6f44d0d4a9ae17b7788e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 28 Jun 2019 14:50:29 +0800 Subject: [PATCH] =?UTF-8?q?=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/images/{edu_user => educoder}/EWM.jpg | Bin .../courses/coursesDetail/CoursesBanner.js | 2 +- .../courses/coursesPublic/AccessoryModal.js | 32 +- .../courses/coursesPublic/AccessoryModal2.js | 523 +++++++++--------- .../courses/exercise/ExerciseListItem.js | 6 +- .../graduation/tasks/GraduateTaskItem.js | 1 + .../tasks/GraduationTasksappraise.js | 1 + .../tasks/GraduationTaskssettinglist.js | 1 + public/react/src/modules/tpm/SiderBar.js | 256 ++++----- 9 files changed, 422 insertions(+), 400 deletions(-) rename public/images/{edu_user => educoder}/EWM.jpg (100%) diff --git a/public/images/edu_user/EWM.jpg b/public/images/educoder/EWM.jpg similarity index 100% rename from public/images/edu_user/EWM.jpg rename to public/images/educoder/EWM.jpg diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 3389951f5..cc3646b9d 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -458,7 +458,7 @@ class CoursesBanner extends Component { { ` .teachersbox{ - margin-right:28px !important; + margin-right:22px !important; } ` } diff --git a/public/react/src/modules/courses/coursesPublic/AccessoryModal.js b/public/react/src/modules/courses/coursesPublic/AccessoryModal.js index 5baf4e0c6..26d4499aa 100644 --- a/public/react/src/modules/courses/coursesPublic/AccessoryModal.js +++ b/public/react/src/modules/courses/coursesPublic/AccessoryModal.js @@ -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)=>{ diff --git a/public/react/src/modules/courses/coursesPublic/AccessoryModal2.js b/public/react/src/modules/courses/coursesPublic/AccessoryModal2.js index 0cd48c245..14b1f71e1 100644 --- a/public/react/src/modules/courses/coursesPublic/AccessoryModal2.js +++ b/public/react/src/modules/courses/coursesPublic/AccessoryModal2.js @@ -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( -
- {/*提示*/} - - -
-

- - -

- - - -

- - - (单个文件最大150M) - -

- - - -
- {this.props.Cancelname || '取消'} - this.Saves()}>{this.props.Savesname || '确认'} -
- -
-
-
- ) - } -} +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( +
+ {/*提示*/} + + +
+

+ + +

+ + + +

+ + + (单个文件最大150M) + +

+ + + +
+ {this.props.Cancelname || '取消'} + this.Saves()}>{this.props.Savesname || '确认'} +
+ +
+
+
+ ) + } +} export default AccessoryModal2; \ No newline at end of file diff --git a/public/react/src/modules/courses/exercise/ExerciseListItem.js b/public/react/src/modules/courses/exercise/ExerciseListItem.js index 70df3f577..afa0669d4 100644 --- a/public/react/src/modules/courses/exercise/ExerciseListItem.js +++ b/public/react/src/modules/courses/exercise/ExerciseListItem.js @@ -193,9 +193,9 @@ class ExerciseListItem extends Component{ { IsStudent &&
- {item.current_status ===0&&item.exercise_status>1?
  • 继续答题
  • : - item.current_status ===1&&item.exercise_status>1?
  • 查看答题
  • : - item.current_status ===2&&item.exercise_status>1?
  • this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题
  • :""} + {item.current_status ===0&&item.exercise_status>1?
  • 继续答题
  • : + item.current_status ===1&&item.exercise_status>1?
  • 查看答题
  • : + item.current_status ===2&&item.exercise_status>1?
  • this.setgameexercise(`/courses/${coursesId}/exercises/${item.id}/users/${this.props.current_user.login}`)}>开始答题
  • :""}
    } diff --git a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js index 1fe0e5c9b..2cbf0fe33 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduateTaskItem.js @@ -178,6 +178,7 @@ class GraduateTaskItem extends Component{ funlist={this.props.funlist} />:""} {this.state.visibles===true?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 = $("
    ").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+"
    "); - $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 ( -
    -
    - - - -
    - -
    - - - -
    - - - -
    - -

    -

    - -

    微信扫一扫

    -

    关注公众号

    - -

    -

    -
    - -
    - - - -
    - -
    - ); - } -} - -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 = $("
    ").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+"
    "); + $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 ( +
    +
    + + + +
    + +
    + + + +
    + + + +
    + +

    +

    + +

    微信扫一扫

    +

    关注公众号

    + +

    +

    +
    + +
    + + + +
    + +
    + ); + } +} + +export default SiderBar;