From cb970e2223b62f28f222d03cd8616d85546c4214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 24 Jun 2019 11:34:47 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 2 +- .../tasks/GraduationTasksSubmitnew.js | 46 ++++++++++++++++--- .../react/src/modules/login/EducoderLogin.js | 4 +- public/react/src/modules/tpm/NewHeader.js | 36 ++++++--------- public/react/src/modules/tpm/TPMIndexHOC.js | 9 +--- 5 files changed, 57 insertions(+), 40 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 05a4463cd..6c4a20fa9 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -31,7 +31,7 @@ export function initAxiosInterceptors(props) { // proxy = "http://testbdweb.trustie.net" // proxy = "http://testbdweb.educoder.net" proxy = "https://testeduplus2.educoder.net" - // proxy="http://47.96.87.25:48080" + proxy="http://47.96.87.25:48080" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js index 7421170d6..b68458e3f 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js @@ -83,7 +83,7 @@ class GraduationTasksSubmitnew extends Component{ } handleSubmit=(e) => { - + console.log("86"); let {fileList,selectmemberslist,workslist}=this.state; if(fileList.length === 0){ @@ -91,7 +91,7 @@ class GraduationTasksSubmitnew extends Component{ Modalstype:true, Modalstopval:'请上传附件!', Loadtype:true, - ModalCancel:this.cancelAttachment + ModalSave:this.cancelAttachment, }) @@ -119,7 +119,7 @@ class GraduationTasksSubmitnew extends Component{ listid.push(list.response.id) } - e.preventDefault(); + // e.preventDefault(); if( GraduationTasksnewtype===true){ this.props.form.validateFields((err, values) => { if (!err) { @@ -408,7 +408,27 @@ class GraduationTasksSubmitnew extends Component{ selectmemberslist:selects }) } + onSearchKeywordKeyUp = (e) => { + if (e.keyCode === 13) { + } + } + onSearckeyd=(e)=>{ + if(e.keyCode){ + + let {search} = this.state; + this.searchList(search,1,10) + } + } + onSearchKeywordKeyUps= (e)=>{ + if(e.keyCode=== 13){ + } + } + onKeywordSearchKeyDown = (e) => { + if(e.keyCode == 13) { + return false; + } + } gocannel=()=>{ window.history.go(-1) } @@ -483,7 +503,8 @@ render(){ 返回 -
+ {/**/}
- -
- - - { - newshixunmodallist&&newshixunmodallist.map((item,key)=>{ - return( -
-
  • - - - -
  • -
  • {item.shixun_count}
  • -
  • {item.myshixun_count}
  • - -
  • 详情
  • -
    -
    - ) - }) - } -
    -
    -
    - { this.state.patheditarrytype===true?{this.state.patheditarryvalue}:""} -
    - 取消 - 确定 -
    -
    - - - - ) - } -} +import React,{ Component } from "react"; +import { Modal,Checkbox,Select,Input,Tooltip } from "antd"; +import axios from'axios'; +import Loading from '@icedesign/base/lib/loading'; +import '@icedesign/base/lib/loading/style.js'; +import Modals from '../../modals/Modals'; + +const Option = Select.Option; +const Search = Input.Search; +class PathModal extends Component{ + constructor(props){ + super(props); + this.state={ + StudentList_value:"", + Searchvalue:undefined, + type:'all', + page:1, + patheditarry:undefined + } + } + + hidecouseShixunModal=()=>{ + this.props.hidecouseShixunModal() + } + + //tag + changeTag=(types)=>{ + let {Searchvalue}=this.state; + this.setState({ + type:types, + page:1, + }) + this.props.funshixunpathlist(Searchvalue,types,true,1) + } + + //搜索 + SenttotheValue=(e)=>{ + this.setState({ + Searchvalue:e.target.value + }) + } + SenttotheSearch=(value)=>{ + let{type}=this.state; + this.setState({ + page:1, + }) + this.props.funshixunpathlist(value,type,true,1) + } + + + //勾选实训 + shixunhomeworkedit=(list)=>{ + this.setState({ + patheditarry:list + }) + // this.props.funpatheditarry(newpatheditarry) + } + + contentViewScrolledit=(e)=>{ + //滑动到底判断 + + if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ + + let {Searchvalue,type,page,shixunpathlist}=this.state; + let newpage=page+1 + this.props.funshixunpathlist(Searchvalue,type,true,newpage) + this.setState({ + page:newpage + }) + + } + + } + //提交 + savecouseShixunModal=()=>{ + let {patheditarry}=this.state; + let {coursesId,Coursename,page,order,category_id,datas}=this.props; + let url="/courses/"+coursesId+"/homework_commons/create_subject_homework.json"; + if(patheditarry===undefined){ + this.setState({ + patheditarrytype:true, + patheditarryvalue:"请先选择实训课程" + }) + return + }else if(patheditarry.length===0){ + this.setState({ + patheditarrytype:true, + patheditarryvalue:"请先选择实训课程" + }) + return + } + axios.post(url, { + // category_id: datas&&datas.category_name===undefined||datas&&datas.category_name===null?undefined:category_id, + subject_ids:patheditarry, + } + ).then((response) => { + if(response.data.status===-1){ + // this.setState({ + // Modalstype:true, + // Modalstopval:response.data.message, + // ModalsBottomval:"", + // ModalSave:this.cancelmodel, + // Loadtype:true + // }) + this.props.showNotification(response.data.message) + + }else{ + // this.homeworkstart + //调用立即发布弹窗 + this.props.hidecouseShixunModal(); + this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) + // this.props.showNotification("选用成功") + // this.props.showNotification(response.data.message) + // this.props.homeworkupdatalists(Coursename,page,order); + } + + // if(response.status===200) { + // this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) + // } + + + }).catch((error) => { + console.log(error) + }) + } + render(){ + let {Searchvalue,type,Modalstype}=this.state; + let {visible,shixunmodallist,hometypepvisible,newshixunmodallist}=this.props; + + + return( +
    + {/*提示*/} + {Modalstype&&Modalstype===true?:""} + + + +
    + { shixunmodallist && shixunmodallist.tags.length===0?"":} +
    + + + {shixunmodallist === undefined ? "":shixunmodallist.subjects_count} + 个实训 + +
    + this.SenttotheSearch(value)} + style={{width: '115%'}} + /> +
    +
    +
      +
    • 实训路径名称
    • +
    • 已发布实训数
    • +
    • 使用人数
    • +
    • +
    + + + +
    + + + { + newshixunmodallist&&newshixunmodallist.map((item,key)=>{ + return( +
    +
  • + + + +
  • +
  • {item.shixun_count}
  • +
  • {item.myshixun_count}
  • + +
  • 详情
  • +
    +
    + ) + }) + } +
    +
    +
    + { this.state.patheditarrytype===true?{this.state.patheditarryvalue}:""} +
    + 取消 + 确定 +
    +
    +
    +
    +
    + ) + } +} export default PathModal; \ No newline at end of file diff --git a/public/react/src/modules/courses/coursesPublic/SelectResource.js b/public/react/src/modules/courses/coursesPublic/SelectResource.js index 1b400b800..878395144 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectResource.js +++ b/public/react/src/modules/courses/coursesPublic/SelectResource.js @@ -285,6 +285,11 @@ class Selectresource extends Component{ padding: 0 30px; padding-top:30px; } + .search-news{ + width: 237px!important; + height: 30px; + margin-bottom: 30px; + } `}
    @@ -292,7 +297,7 @@ class Selectresource extends Component{
  • this.changeTag("all")} className={ type==="all" ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部
  • this.changeTag("my")} className={ type==="my" ? " active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>我的资源
  • -
    +
    - {item.response===undefined?"":isNaN(bytesToSize(item.response.filesize))?"":bytesToSize(item.response.filesize)} + {item.response===undefined?"":isNaN(this.props.bytesToSize(item.response.filesize))?"":this.props.bytesToSize(item.response.filesize)} { - - let newpatheditarry=[]; - if (this.props.singleChoose == true) { - if (list.length > 0) { - newpatheditarry.push(list[list.length - 1]) - } - } else { - for(var i=0; i{ - //滑动到底判断 - - if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ - - let {Searchvalue,type,page}=this.state; - let newpage=page+1 - this.props.funshixunmodallist(Searchvalue,type,true,newpage) - this.setState({ - page:newpage - }) - - } - - } - - //搜索 - SenttotheValue=(e)=>{ - this.setState({ - Searchvalue:e.target.value - }) - } - SenttotheSearch=(value)=>{ - let{type}=this.state; - this.setState({ - page:1, - }) - - this.props.funshixunmodallist(value,type,true,1) - this.props.funpatheditarry([]) - } - - //tag - changeTag=(types)=>{ - let {Searchvalue}=this.state; - this.setState({ - type:types, - page:1, - }) - - this.props.funshixunmodallist(Searchvalue,types,true,1) - this.props.funpatheditarry([]) - } - - - hidecouseShixunModal=()=>{ - this.props.hidecouseShixunModal() - } - - savecouseShixunModal=()=>{ - let {coursesId,patheditarry,datas}=this.props; - - let{category_id}=this.state; - if (this.props.chooseShixun) { - this.props.chooseShixun(patheditarry) - return; - } - if(patheditarry.length===0){ - this.setState({ - shixunmodelchke:true, - chekicmessage:"请先选择实训" - }) - - return - } - let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json"; - axios.post(url, { - category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id), - shixun_ids:patheditarry, - } - ).then((response) => { - if(response.data.status===-1){ - // this.props.showNotification(response.data.message) - - }else{ - this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) - this.props.hidecouseShixunModal() - } - - // category_id: 3 - // homework_ids: (5) [9171, 9172, 9173, 9174, 9175] - }).catch((error) => { - console.log(error) - }) - } - - selectCloseList=(value)=>{ - this.setState({ - category_id:value - }) - } - render(){ - let {Searchvalue,type,category_id}=this.state; - let {visible,shixunmodallist,hometypepvisible,newshixunmodallist,patheditarry}=this.props; - const antIcon = ; - // console.log(patheditarry) - return( -
    - - - - - {/**/} - {/*{*/} - {/*shixunmodallist === undefined ? "":shixunmodallist.homework_category.length>0?
    */} - - {/*
    选择目录名称:
    */} - {/*
    */} - {/**/} - {/*{ shixunmodallist.main_category.map((item,key)=>{*/} - {/*return(*/} - {/**/} - {/*)*/} - {/*})*/} - {/*}*/} - - {/*{*/} - {/*shixunmodallist.homework_category.map((item,key)=>{*/} - {/*return(*/} - {/**/} - {/*)*/} - {/*})*/} - {/*}*/} - - {/**/} - {/*
    */} - - {/*
    :""}*/} - -
    - - -
    - - - {shixunmodallist === undefined ? "":shixunmodallist.shixuns_count} - 个实训 - -
    - this.SenttotheSearch(value)} - style={{width: '100%'}} - /> -
    -
    - { - - } -
      -
    • 实训名称
    • -
    • 使用院校
    • -
    • 使用人数
    • -
    • 评价等级
    • -
    • -
    - - - -
    - - {/**/} - - { - newshixunmodallist === undefined ? "": newshixunmodallist.map((item,key)=>{ - return( -
    -
  • - - {item.shixun_name} - -
  • -
  • {item.school_users}
  • -
  • {item.myshixuns_count}
  • -
  • {item.preference}
  • - -
  • 详情
  • -
    -
    - ) - }) - } -
    - {/*
    */} -
    -
    -
    - {this.state.shixunmodelchke===true?{this.state.chekicmessage}:""} -
    - 取消 - 确定 -
    -
    -
    - ) - } -} +import React,{ Component } from "react"; +import { Modal,Checkbox,Select,Input,Tooltip,Spin,Icon} from "antd"; +import axios from'axios'; +// import Loading from '@icedesign/base/lib/loading'; +// import '@icedesign/base/lib/loading/style.js'; + +const Option = Select.Option; +const Search = Input.Search; +class ShixunModal extends Component{ + constructor(props){ + super(props); + this.state={ + Searchvalue:undefined, + type:'all', + category_id:0, + page:1 + } + } + componentDidMount() { + + + } + + //勾选实训 + shixunhomeworkedit=(list)=>{ + + let newpatheditarry=[]; + if (this.props.singleChoose == true) { + if (list.length > 0) { + newpatheditarry.push(list[list.length - 1]) + } + } else { + for(var i=0; i{ + //滑动到底判断 + + if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ + + let {Searchvalue,type,page}=this.state; + let newpage=page+1 + this.props.funshixunmodallist(Searchvalue,type,true,newpage) + this.setState({ + page:newpage + }) + + } + + } + + //搜索 + SenttotheValue=(e)=>{ + this.setState({ + Searchvalue:e.target.value + }) + } + SenttotheSearch=(value)=>{ + let{type}=this.state; + this.setState({ + page:1, + }) + + this.props.funshixunmodallist(value,type,true,1) + this.props.funpatheditarry([]) + } + + //tag + changeTag=(types)=>{ + let {Searchvalue}=this.state; + this.setState({ + type:types, + page:1, + }) + + this.props.funshixunmodallist(Searchvalue,types,true,1) + this.props.funpatheditarry([]) + } + + + hidecouseShixunModal=()=>{ + this.props.hidecouseShixunModal() + } + + savecouseShixunModal=()=>{ + let {coursesId,patheditarry,datas}=this.props; + + let{category_id}=this.state; + if (this.props.chooseShixun) { + this.props.chooseShixun(patheditarry) + return; + } + if(patheditarry.length===0){ + this.setState({ + shixunmodelchke:true, + chekicmessage:"请先选择实训" + }) + + return + } + let url="/courses/"+coursesId+"/homework_commons/create_shixun_homework.json"; + axios.post(url, { + category_id:this.props.category_id===null||this.props.category_id===undefined?undefined:parseInt(this.props.category_id), + shixun_ids:patheditarry, + } + ).then((response) => { + if(response.data.status===-1){ + // this.props.showNotification(response.data.message) + + }else{ + this.props.courseshomeworkstart(response.data.category_id,response.data.homework_ids) + this.props.hidecouseShixunModal() + } + + // category_id: 3 + // homework_ids: (5) [9171, 9172, 9173, 9174, 9175] + }).catch((error) => { + console.log(error) + }) + } + + selectCloseList=(value)=>{ + this.setState({ + category_id:value + }) + } + render(){ + let {Searchvalue,type,category_id}=this.state; + let {visible,shixunmodallist,hometypepvisible,newshixunmodallist,patheditarry}=this.props; + const antIcon = ; + // console.log(patheditarry) + return( +
    + + + + + {/**/} + {/*{*/} + {/*shixunmodallist === undefined ? "":shixunmodallist.homework_category.length>0?
    */} + + {/*
    选择目录名称:
    */} + {/*
    */} + {/**/} + {/*{ shixunmodallist.main_category.map((item,key)=>{*/} + {/*return(*/} + {/**/} + {/*)*/} + {/*})*/} + {/*}*/} + + {/*{*/} + {/*shixunmodallist.homework_category.map((item,key)=>{*/} + {/*return(*/} + {/**/} + {/*)*/} + {/*})*/} + {/*}*/} + + {/**/} + {/*
    */} + + {/*
    :""}*/} + +
    + + +
    + + + {shixunmodallist === undefined ? "":shixunmodallist.shixuns_count} + 个实训 + +
    + this.SenttotheSearch(value)} + style={{width: '115%'}} + /> +
    +
    + { + + } +
      +
    • 实训名称
    • +
    • 使用院校
    • +
    • 使用人数
    • +
    • 评价等级
    • +
    • +
    + + + +
    + + {/**/} + + { + newshixunmodallist === undefined ? "": newshixunmodallist.map((item,key)=>{ + return( +
    +
  • + + {item.shixun_name} + +
  • +
  • {item.school_users}
  • +
  • {item.myshixuns_count}
  • +
  • {item.preference}
  • + +
  • 详情
  • +
    +
    + ) + }) + } +
    + {/*
    */} +
    +
    +
    + {this.state.shixunmodelchke===true?{this.state.chekicmessage}:""} +
    + 取消 + 确定 +
    +
    +
    + ) + } +} export default ShixunModal; \ No newline at end of file diff --git a/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js b/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js index 1cb47ae7e..d01c8d986 100644 --- a/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js +++ b/public/react/src/modules/courses/coursesPublic/modal/ShixunModal2.js @@ -230,11 +230,11 @@ class ShixunModal extends Component{
    this.SenttotheSearch(value)} - style={{width: '100%'}} + style={{width: '115%'}} />
    diff --git a/public/react/src/modules/courses/coursesPublic/sendResource.js b/public/react/src/modules/courses/coursesPublic/sendResource.js index 544c44286..bdd597495 100644 --- a/public/react/src/modules/courses/coursesPublic/sendResource.js +++ b/public/react/src/modules/courses/coursesPublic/sendResource.js @@ -22,13 +22,6 @@ function disabledDateTime() { }; } -function bytesToSize(bytes) { - if (bytes === 0) return '0 B'; - let k = 1024, - sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], - i = Math.floor(Math.log(bytes) / Math.log(k)); - return (bytes / Math.pow(k, i)). toFixed(2) + ' ' + sizes[i]; -} const dateFormat="YYYY-MM-DD HH:mm"; class Sendresource extends Component{ constructor(props){ @@ -456,7 +449,7 @@ class Sendresource extends Component{ {item.name} - {item.response===undefined?"":isNaN(bytesToSize(item.response.filesize))?"":bytesToSize(item.response.filesize)} + {item.response===undefined?"":isNaN(this.props.bytesToSize(item.response.filesize))?"":this.props.bytesToSize(item.response.filesize)} { + //onAttachmentRemove = (file) => { // confirm({ // title: '确定要删除这个附件吗?', @@ -228,14 +228,14 @@ class GraduationTasksSubmitedit extends Component{ // }); // return false; - this.setState({ - Modalstype:true, - Modalstopval:'确定要删除这个附件吗?', - ModalSave: ()=>this.deleteAttachment(file), - ModalCancel:this.cancelAttachment - }) - return false; - } + // this.setState({ + // Modalstype:true, + // Modalstopval:'确定要删除这个附件吗?', + // ModalSave: ()=>this.deleteAttachment(file), + // ModalCancel:this.cancelAttachment + // }) + // return false; + //} cancelAttachment=()=>{ this.setState({ @@ -246,8 +246,8 @@ class GraduationTasksSubmitedit extends Component{ }) } - deleteAttachment = (file) => { - let {attachments}=this.state; + onAttachmentRemove = (file) => { + let {attachments,fileList}=this.state; const url = `/attachments/${file.uid===undefined?file.id:file.uid}.json` axios.delete(url, { }) @@ -426,7 +426,7 @@ class GraduationTasksSubmitedit extends Component{ multiple: true, // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 - // showUploadList: false, + showUploadList: false, action: `${getUrl()}/api/attachments.json`, onChange: this.handleChange, onRemove: this.onAttachmentRemove, @@ -553,7 +553,37 @@ class GraduationTasksSubmitedit extends Component{ ) })} - + + {this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{ + return( +

    + + + + + {item.name} + + + {item.response===undefined?"":isNaN(this.props.bytesToSize(item.response.filesize))?"":this.props.bytesToSize(item.response.filesize)} + + +

    + ) + })} diff --git a/public/react/src/modules/forums/RightSection.css b/public/react/src/modules/forums/RightSection.css index 3efe0bc43..73994ae24 100644 --- a/public/react/src/modules/forums/RightSection.css +++ b/public/react/src/modules/forums/RightSection.css @@ -1,52 +1,53 @@ -/* 右侧搜索区域*/ -.searchFor .searchCon { - width: 215px; -} - -.search-new { - width:237px!important; - height: 30px; - margin-bottom: 30px; -} - .search-new-input { - padding-left: 16px; - height: 30px; - } - .search-span { - border-radius: 17px; - } - -.search-new img { - right: 10px; -} - - -/* 右侧 热门标签 */ -.HotLabelList a{display: block;float: left;padding: 0px 9px;height: 28px;line-height: 28px;border-radius: 14px;background-color: #f5f5f5;color: #666;margin-right: 10px;margin-bottom: 9px;} -.HotLabelList a.selected { - background: #4CACFF; - color: #fff; -} - - - -/* 右侧 热门问题 */ -.hotQuestionItem{padding:20px 0px;border-bottom: 1px solid #eee;} -.questiontName{max-width: 100%;display: block;} - - - -/* 用户信息-UserSection*/ -.user_default_btn {width: 114px;} -.userPrivateName{line-height: 25px;margin-bottom: 9px;} -.userPrivatePost{line-height: 20px;} -.noteDetailTitle{line-height: 38px;font-size: 24px;font-weight: normal;text-align:justify } - -.noteDetailNum{float: left;padding:0px 12px;position: relative;color: #999!important;height: 28px;line-height: 26px;} -.noteDetailNum.rightline:after{position: absolute;content: '';right: 0px;width: 1px;background-color: #EAEAEA;height: 8px;top:10px;} - -/*帖子详情点赞*/ -.noteDetailPoint{width: 100px;height: 70px;background-color: #4cacff;border-radius: 35px;color: #FFFFff;text-align: center;margin: 0px auto;box-sizing: border-box;padding: 2px 0px;cursor: pointer; line-height: 22px; - padding-top: 12px;} -.Pointed{background-color:#f0f0f0;color: #b3b3b3; cursor: default} -.notefileDownload{height: 25px;line-height: 22px;} +/* 右侧搜索区域*/ +.searchFor .searchCon { + width: 215px; +} + +.search-new { + width:237px!important; + height: 30px; + margin-bottom: 30px; + margin-right: 35px; +} + .search-new-input { + padding-left: 16px; + height: 30px; + } + .search-span { + border-radius: 17px; + } + +.search-new img { + right: 10px; +} + + +/* 右侧 热门标签 */ +.HotLabelList a{display: block;float: left;padding: 0px 9px;height: 28px;line-height: 28px;border-radius: 14px;background-color: #f5f5f5;color: #666;margin-right: 10px;margin-bottom: 9px;} +.HotLabelList a.selected { + background: #4CACFF; + color: #fff; +} + + + +/* 右侧 热门问题 */ +.hotQuestionItem{padding:20px 0px;border-bottom: 1px solid #eee;} +.questiontName{max-width: 100%;display: block;} + + + +/* 用户信息-UserSection*/ +.user_default_btn {width: 114px;} +.userPrivateName{line-height: 25px;margin-bottom: 9px;} +.userPrivatePost{line-height: 20px;} +.noteDetailTitle{line-height: 38px;font-size: 24px;font-weight: normal;text-align:justify } + +.noteDetailNum{float: left;padding:0px 12px;position: relative;color: #999!important;height: 28px;line-height: 26px;} +.noteDetailNum.rightline:after{position: absolute;content: '';right: 0px;width: 1px;background-color: #EAEAEA;height: 8px;top:10px;} + +/*帖子详情点赞*/ +.noteDetailPoint{width: 100px;height: 70px;background-color: #4cacff;border-radius: 35px;color: #FFFFff;text-align: center;margin: 0px auto;box-sizing: border-box;padding: 2px 0px;cursor: pointer; line-height: 22px; + padding-top: 12px;} +.Pointed{background-color:#f0f0f0;color: #b3b3b3; cursor: default} +.notefileDownload{height: 25px;line-height: 22px;} diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js index 3ac61cb1e..393c28c9f 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js @@ -1,618 +1,619 @@ -import React, { Component } from 'react'; -import {getImageUrl} from 'educoder'; -import {Modal,Input,Checkbox,Tooltip} from "antd"; -import { DragDropContext , Draggable, Droppable} from 'react-beautiful-dnd'; -import Modals from '../../modals/Modals'; -import Loading from '@icedesign/base/lib/loading'; -import '@icedesign/base/lib/loading/style.js'; -import '../ShixunPaths.css'; -import axios from 'axios'; -const $ = window.$; -const Search = Input.Search; - -//a little function to help us with reordering the result -const reorder = (list, startIndex, endIndex) => { - // console.log(list) - // console.log(startIndex) - // console.log(endIndex) - - let newlist=list; - const result = Array.from(newlist); - const [removed] = result.splice(startIndex, 1); - result.splice(endIndex, 0, removed); - - return result; -}; - -const getItemStyle = (isDragging, draggableStyle) => ({ - // change background colour if dragging - background: isDragging ? '#dceeff' : '', - // styles we need to apply on draggables - ...draggableStyle, -}); - -class DetailCardsEditAndAdd extends Component{ - constructor(props){ - super(props); - this.state={ - selectShixun:false, - editPanel:false, - search:"", - type:0, - page:1, - ChooseShixunList:undefined, - hometypepvisible:true, - shixuns_listedit:undefined, - shixuns_listeditlist:[], - patheditarry:[], - stage_descriptions:undefined, - stage_names:undefined, - delectfunvalue:undefined, - Modalstype:false, - Modalstopval:"", - Modalsbottomval:"", - ChooseShixunListshixun_list:undefined, - stage_nametype:false, - descriptiontype:false - } - this.onDragEnd = this.onDragEnd.bind(this); - } - //选择实训弹框 - AddShixunBox = () =>{ - this.setState({ - selectShixun:true, - patheditarry:[] - }) - this.changeTag(0,""); - } - - //关闭选择实训弹框 - cloasShixunBox =()=>{ - this.setState({ - selectShixun:false, - patheditarry:[] - }) - } - clickShixunchoose=()=>{ - - let{patheditarry,shixuns_listeditlist}=this.state - let newshixuns_listedit=[]; - let list=shixuns_listeditlist - - if(patheditarry.length===0){ - this.setState({ - Modalstype:true, - Modalstopval:'请选择实训', - cardsModalsave:this.cardsModalsave - }) - - return - } - - let url='/paths/append_to_stage.json' - axios.post(url,{ - shixun_id:patheditarry - }).then((response) => { - let newshixun_lists=response.data.shixun_lists; - - for(var z=0; z { - console.log(error) - }); - - } - - //点击新建阶段 - addStage=()=>{ - this.props.editeditbuttomtypes(); - this.setState({ - editPanel:true - }) - - } - //取消新建阶段 - cancelAddState = () =>{ - this.setState({ - editPanel:false, - stage_names:undefined, - stage_descriptions:undefined, - shixuns_listeditlist:[], - shixuns_listedit:undefined - }) - this.props.getPathCardsLists(); - } - - searchNameInput=(e)=>{ - this.setState({ - search:e.target.value - }) - } - - //打开选择实训弹框初始化tag标签和列表 - changeTag=(id,search)=>{ - this.setState({ - hometypepvisible:true - }) - let pathId=this.props.pathid; - let {page}=this.state; - let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+page - if(search!="" && search!=undefined){ - url+="&search="+search; - } - if(id!=0){ - url+="&type="+id; - } - axios.get(url).then((result)=>{ - if(result.status===200){ - this.setState({ - ChooseShixunList:result.data, - hometypepvisible:false, - type:id, - ChooseShixunListshixun_list:result.data.shixun_list - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - - //勾选实训 - shixunhomeworkedit=(list)=>{ - - let newpatheditarry=[]; - for(var i=0; i{ - - this.setState({ - stage_names:e.target.value - }) - - } - - updatastage_descriptions=(e)=>{ - - this.setState({ - stage_descriptions:e.target.value - }) - - } - - //删除实训 - shixunslisteditdelect=(e)=>{ - this.setState({ - Modalstype:true, - Modalstopval:'是否删除该实训?', - Modalsbottomval:'', - delectfunvalue:e.target.id - }) - } - shixunslisteditdelectfun=()=>{ - let {delectfunvalue}=this.state; - let sum = parseInt(delectfunvalue); - let {shixuns_listedit,shixuns_listeditlist} =this.state; - let newshixuns_listedit=shixuns_listedit - let newshixuns_listeditlist=shixuns_listeditlist - newshixuns_listedit.splice(sum, 1); - newshixuns_listeditlist.splice(sum, 1); - this.setState({ - shixuns_listedit:newshixuns_listedit, - shixuns_listeditlist:newshixuns_listeditlist - }) - this.setState({ - Modalstype:false, - Modalstopval:'', - Modalsbottomval:'', - delectfunvalue:undefined - }) - } - cardsModalcancel=()=>{ - this.setState({ - Modalstype:false, - Modalstopval:'', - Modalsbottomval:'', - delectfunvalue:undefined - }) - } - - //保存 - clickShixunsaves=()=>{ - let{stage_names,stage_descriptions,shixuns_listeditlist}=this.state; - let newstage_descriptions=stage_descriptions; - - if(stage_names===""||stage_names===undefined){ - - this.setState({ - stage_nametype:true - }) - - return - }else{ - this.setState({ - stage_nametype:false - }) - } - - if(newstage_descriptions!=undefined){ - - if(newstage_descriptions.length>300){ - - this.setState({ - descriptiontype:true - }) - - return - } - }else{ - newstage_descriptions="" - } - - - - let pathId=this.props.pathid; - let url='/stages.json?subject_id='+pathId - axios.post(url, { - name:stage_names, - description:newstage_descriptions, - shixun_id:shixuns_listeditlist - }).then((response) => { - // window.location.href = "/paths/" + response.data.subject_id - this.props.getPathCardsLists(); - - this.cancelAddState(); - this.setState({ - stage_nametype:false, - descriptiontype:false - }) - }).catch((error) => { - console.log(error) - }); - } - - - contentViewScrolladd=(e)=>{ - - //滑动到底判断 - if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ - // console.log("到达底部"); - this.setState({ - hometypepvisible:true - }) - let pathId=this.props.pathid; - let {search,page,type,ChooseShixunListshixun_list}=this.state; - let newpage=page+1; - let newChooseShixunListshixun_list=ChooseShixunListshixun_list; - let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage - if(search!="" && search!=undefined){ - url+="&search="+search; - } - if(type!=0){ - url+="&type="+type; - } - axios.get(url).then((result)=>{ - if(result.status===200){ - let list =result.data.shixun_list; - - for(var i=0; i{ - console.log(error); - }) - } - - } - onDragEnd (result) { - - let {shixuns_listedit,shixuns_listeditlist} =this.state; - const listedit = reorder( - shixuns_listedit, - result.source.index, - result.destination.index - ); - const listeditlist = reorder( - shixuns_listeditlist, - result.source.index, - result.destination.index - ); - this.setState({ - shixuns_listedit:listedit, - shixuns_listeditlist:listeditlist - }) - } - - - render(){ - let {selectShixun, - editPanel, - ChooseShixunList, - type, - page, - search, - hometypepvisible, - stage_descriptions, - stage_names, - shixuns_listedit, - delectfunvalue, - Modalstype, - Modalstopval, - Modalsbottomval, - ChooseShixunListshixun_list, - stage_nametype, - descriptiontype} = this.state - - - return( -
    - - - - { editPanel && -
    -
    -

    - - - - 第{this.props.sum}部分 - {/**/} -

    -
    -

    章节名称

    -
    - * -
    - -
    名称不能为空
    -
    -
    必填项
    -
    -

    描述

    -
    - -
    描述不能超多最大限制300个字符
    -
    - -

    - - - 选择实训 - 选择下面实训后,可以通过拖拽进行排序调整 -

    - - {selectShixun===true?:""} - - - -
    - -
    - - - {ChooseShixunList && ChooseShixunList.shixuns_count} - 个实训 - -
    - this.changeTag(`${type}`,`${search}`)} - > -
    -
    -
      -
    • 实训名称
    • -
    • 使用院校
    • -
    • 使用人数
    • -
    • 评价等级
    • -
    • -
    - - -
    - - { - ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{ - return( -
    -
  • - - - -
  • -
  • {item.school_users}
  • -
  • {item.myshixuns_count}
  • -
  • {item.preference}
  • -
  • 详情
  • -
    - ) - }) - } -
    -
    -
    - 取消 - 确定 -
    -
    -
    -
    -
    - - {/* 可拖拽选择实训列表*/} - {shixuns_listedit===undefined?'': - - - - {(provided, snapshot) => ( -
    - {shixuns_listedit.map((item,key)=>{ - return( - - {(provided, snapshot) => ( -
    - -
  • - - - - - - - - - - {this.props.sum+1}-{key+1}  {item.shixun_name} - - - - - -
  • - -
  • - - - -
  • - {provided.placeholder} -
    - )} -
    - )})} -
    - )} -
    -
    - } - - {/*老版本实训新建卡片*/} - {/*
    */} - {/*
    */} - {/*×*/} - {/*Shixun0*/} - {/*
    */} - {/*

    frerere

    */} - {/*
    */} - {/*
    */} - {/*
    */} - -

    -

    - 取消 - 保存 -
    -

    - -
    -
    - } - - {this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_statistics===true?editPanel===false?
    - +点击新建阶段(选择1至多个实训项目,组成一个阶段) -
    :'':''} -
    - ) - } -} +import React, { Component } from 'react'; +import {getImageUrl} from 'educoder'; +import {Modal,Input,Checkbox,Tooltip} from "antd"; +import { DragDropContext , Draggable, Droppable} from 'react-beautiful-dnd'; +import Modals from '../../modals/Modals'; +import Loading from '@icedesign/base/lib/loading'; +import '@icedesign/base/lib/loading/style.js'; +import '../ShixunPaths.css'; +import axios from 'axios'; +const $ = window.$; +const Search = Input.Search; + +//a little function to help us with reordering the result +const reorder = (list, startIndex, endIndex) => { + // console.log(list) + // console.log(startIndex) + // console.log(endIndex) + + let newlist=list; + const result = Array.from(newlist); + const [removed] = result.splice(startIndex, 1); + result.splice(endIndex, 0, removed); + + return result; +}; + +const getItemStyle = (isDragging, draggableStyle) => ({ + // change background colour if dragging + background: isDragging ? '#dceeff' : '', + // styles we need to apply on draggables + ...draggableStyle, +}); + +class DetailCardsEditAndAdd extends Component{ + constructor(props){ + super(props); + this.state={ + selectShixun:false, + editPanel:false, + search:"", + type:0, + page:1, + ChooseShixunList:undefined, + hometypepvisible:true, + shixuns_listedit:undefined, + shixuns_listeditlist:[], + patheditarry:[], + stage_descriptions:undefined, + stage_names:undefined, + delectfunvalue:undefined, + Modalstype:false, + Modalstopval:"", + Modalsbottomval:"", + ChooseShixunListshixun_list:undefined, + stage_nametype:false, + descriptiontype:false + } + this.onDragEnd = this.onDragEnd.bind(this); + } + //选择实训弹框 + AddShixunBox = () =>{ + this.setState({ + selectShixun:true, + patheditarry:[] + }) + this.changeTag(0,""); + } + + //关闭选择实训弹框 + cloasShixunBox =()=>{ + this.setState({ + selectShixun:false, + patheditarry:[] + }) + } + clickShixunchoose=()=>{ + + let{patheditarry,shixuns_listeditlist}=this.state + let newshixuns_listedit=[]; + let list=shixuns_listeditlist + + if(patheditarry.length===0){ + this.setState({ + Modalstype:true, + Modalstopval:'请选择实训', + cardsModalsave:this.cardsModalsave + }) + + return + } + + let url='/paths/append_to_stage.json' + axios.post(url,{ + shixun_id:patheditarry + }).then((response) => { + let newshixun_lists=response.data.shixun_lists; + + for(var z=0; z { + console.log(error) + }); + + } + + //点击新建阶段 + addStage=()=>{ + this.props.editeditbuttomtypes(); + this.setState({ + editPanel:true + }) + + } + //取消新建阶段 + cancelAddState = () =>{ + this.setState({ + editPanel:false, + stage_names:undefined, + stage_descriptions:undefined, + shixuns_listeditlist:[], + shixuns_listedit:undefined + }) + this.props.getPathCardsLists(); + } + + searchNameInput=(e)=>{ + this.setState({ + search:e.target.value + }) + } + + //打开选择实训弹框初始化tag标签和列表 + changeTag=(id,search)=>{ + this.setState({ + hometypepvisible:true + }) + let pathId=this.props.pathid; + let {page}=this.state; + let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+page + if(search!="" && search!=undefined){ + url+="&search="+search; + } + if(id!=0){ + url+="&type="+id; + } + axios.get(url).then((result)=>{ + if(result.status===200){ + this.setState({ + ChooseShixunList:result.data, + hometypepvisible:false, + type:id, + ChooseShixunListshixun_list:result.data.shixun_list + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + + //勾选实训 + shixunhomeworkedit=(list)=>{ + + let newpatheditarry=[]; + for(var i=0; i{ + + this.setState({ + stage_names:e.target.value + }) + + } + + updatastage_descriptions=(e)=>{ + + this.setState({ + stage_descriptions:e.target.value + }) + + } + + //删除实训 + shixunslisteditdelect=(e)=>{ + this.setState({ + Modalstype:true, + Modalstopval:'是否删除该实训?', + Modalsbottomval:'', + delectfunvalue:e.target.id + }) + } + shixunslisteditdelectfun=()=>{ + let {delectfunvalue}=this.state; + let sum = parseInt(delectfunvalue); + let {shixuns_listedit,shixuns_listeditlist} =this.state; + let newshixuns_listedit=shixuns_listedit + let newshixuns_listeditlist=shixuns_listeditlist + newshixuns_listedit.splice(sum, 1); + newshixuns_listeditlist.splice(sum, 1); + this.setState({ + shixuns_listedit:newshixuns_listedit, + shixuns_listeditlist:newshixuns_listeditlist + }) + this.setState({ + Modalstype:false, + Modalstopval:'', + Modalsbottomval:'', + delectfunvalue:undefined + }) + } + cardsModalcancel=()=>{ + this.setState({ + Modalstype:false, + Modalstopval:'', + Modalsbottomval:'', + delectfunvalue:undefined + }) + } + + //保存 + clickShixunsaves=()=>{ + let{stage_names,stage_descriptions,shixuns_listeditlist}=this.state; + let newstage_descriptions=stage_descriptions; + + if(stage_names===""||stage_names===undefined){ + + this.setState({ + stage_nametype:true + }) + + return + }else{ + this.setState({ + stage_nametype:false + }) + } + + if(newstage_descriptions!=undefined){ + + if(newstage_descriptions.length>300){ + + this.setState({ + descriptiontype:true + }) + + return + } + }else{ + newstage_descriptions="" + } + + + + let pathId=this.props.pathid; + let url='/stages.json?subject_id='+pathId + axios.post(url, { + name:stage_names, + description:newstage_descriptions, + shixun_id:shixuns_listeditlist + }).then((response) => { + // window.location.href = "/paths/" + response.data.subject_id + this.props.getPathCardsLists(); + + this.cancelAddState(); + this.setState({ + stage_nametype:false, + descriptiontype:false + }) + }).catch((error) => { + console.log(error) + }); + } + + + contentViewScrolladd=(e)=>{ + + //滑动到底判断 + if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ + // console.log("到达底部"); + this.setState({ + hometypepvisible:true + }) + let pathId=this.props.pathid; + let {search,page,type,ChooseShixunListshixun_list}=this.state; + let newpage=page+1; + let newChooseShixunListshixun_list=ChooseShixunListshixun_list; + let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage + if(search!="" && search!=undefined){ + url+="&search="+search; + } + if(type!=0){ + url+="&type="+type; + } + axios.get(url).then((result)=>{ + if(result.status===200){ + let list =result.data.shixun_list; + + for(var i=0; i{ + console.log(error); + }) + } + + } + onDragEnd (result) { + + let {shixuns_listedit,shixuns_listeditlist} =this.state; + const listedit = reorder( + shixuns_listedit, + result.source.index, + result.destination.index + ); + const listeditlist = reorder( + shixuns_listeditlist, + result.source.index, + result.destination.index + ); + this.setState({ + shixuns_listedit:listedit, + shixuns_listeditlist:listeditlist + }) + } + + + render(){ + let {selectShixun, + editPanel, + ChooseShixunList, + type, + page, + search, + hometypepvisible, + stage_descriptions, + stage_names, + shixuns_listedit, + delectfunvalue, + Modalstype, + Modalstopval, + Modalsbottomval, + ChooseShixunListshixun_list, + stage_nametype, + descriptiontype} = this.state + + + return( +
    + + + + { editPanel && +
    +
    +

    + + + + 第{this.props.sum}部分 + {/**/} +

    +
    +

    章节名称

    +
    + * +
    + +
    名称不能为空
    +
    +
    必填项
    +
    +

    描述

    +
    + +
    描述不能超多最大限制300个字符
    +
    + +

    + + + 选择实训 + 选择下面实训后,可以通过拖拽进行排序调整 +

    + + {selectShixun===true?:""} + + + +
    + +
    + + + {ChooseShixunList && ChooseShixunList.shixuns_count} + 个实训 + +
    + this.changeTag(`${type}`,`${search}`)} + style={{width: '115%'}} + > +
    +
    +
      +
    • 实训名称
    • +
    • 使用院校
    • +
    • 使用人数
    • +
    • 评价等级
    • +
    • +
    + + +
    + + { + ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{ + return( +
    +
  • + + + +
  • +
  • {item.school_users}
  • +
  • {item.myshixuns_count}
  • +
  • {item.preference}
  • +
  • 详情
  • +
    + ) + }) + } +
    +
    +
    + 取消 + 确定 +
    +
    +
    +
    +
    + + {/* 可拖拽选择实训列表*/} + {shixuns_listedit===undefined?'': + + + + {(provided, snapshot) => ( +
    + {shixuns_listedit.map((item,key)=>{ + return( + + {(provided, snapshot) => ( +
    + +
  • + + + + + + + + + + {this.props.sum+1}-{key+1}  {item.shixun_name} + + + + + +
  • + +
  • + + + +
  • + {provided.placeholder} +
    + )} +
    + )})} +
    + )} +
    +
    + } + + {/*老版本实训新建卡片*/} + {/*
    */} + {/*
    */} + {/*×*/} + {/*Shixun0*/} + {/*
    */} + {/*

    frerere

    */} + {/*
    */} + {/*
    */} + {/*
    */} + +

    +

    + 取消 + 保存 +
    +

    + +
    +
    + } + + {this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_statistics===true?editPanel===false?
    + +点击新建阶段(选择1至多个实训项目,组成一个阶段) +
    :'':''} +
    + ) + } +} export default DetailCardsEditAndAdd; \ No newline at end of file diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js index 8b33bb793..63263dfc1 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndEdit.js @@ -1,702 +1,703 @@ -import React, { Component } from 'react'; -import {getImageUrl} from 'educoder'; -import {Modal,Input,Checkbox,Tooltip} from "antd"; -import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd'; -import Modals from '../../modals/Modals'; -import Loading from '@icedesign/base/lib/loading'; -import '@icedesign/base/lib/loading/style.js'; -import '../ShixunPaths.css'; -import axios from 'axios'; -const $ = window.$; -const Search = Input.Search; - - -//a little function to help us with reordering the result -const reorder = (list, startIndex, endIndex) => { - // console.log(list) - // console.log(startIndex) - // console.log(endIndex) - - let newlist=list; - const result = Array.from(newlist); - const [removed] = result.splice(startIndex, 1); - result.splice(endIndex, 0, removed); - - return result; -}; - -const getItemStyle = (isDragging, draggableStyle) => ({ - // change background colour if dragging - background: isDragging ? '#dceeff' : '', - // styles we need to apply on draggables - ...draggableStyle, -}); - - -class DetailCardsEditAndEdit extends Component{ - constructor(props){ - super(props); - this.state={ - selectShixun:false, - editPanel:true, - search:"", - type:0, - page:1, - ChooseShixunList:undefined, - hometypepvisible:true, - shixuns_listedit:undefined, - patheditarry:[], - stage_name:undefined, - stage_description:undefined, - stageid:undefined, - Modalstype:false, - Modalstopval:'', - Modalsbottomval:'', - delectfunvalue:undefined, - ChooseShixunListshixun_list:undefined, - stage_nametype:false, - descriptiontype:false - } - this.onDragEnd = this.onDragEnd.bind(this); - } - //选择实训弹框 - AddShixunBox = () =>{ - this.setState({ - selectShixun:true, - patheditarry:[] - }) - this.changeTag(0,""); - } - //关闭选择实训弹框 - cloasShixunBox =()=>{ - this.setState({ - selectShixun:false, - patheditarry:[] - }) - } - - searchNameInput=(e)=>{ - this.setState({ - search:e.target.value - }) - } - - //打开选择实训弹框初始化tag标签和列表 - changeTag(id,search){ - this.setState({ - hometypepvisible:true - }) - let pathId=this.props.pathid; - let {page}=this.state; - let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+page - if(search!="" && search!=undefined){ - url+="&search="+search; - } - if(id!=0){ - url+="&type="+id; - } - axios.get(url).then((result)=>{ - if(result.status===200){ - this.setState({ - ChooseShixunList:result.data, - hometypepvisible:false, - type:id, - search:search, - ChooseShixunListshixun_list:result.data.shixun_list - }) - } - }).catch((error)=>{ - console.log(error); - }) - } - - shixunhomeworkedit=(list)=>{ - - let newpatheditarry=[]; - for(var i=0; i{ - - this.setState({ - stage_name:e.target.value - }) - - } - - updatastage_description=(e)=>{ - - this.setState({ - stage_description:e.target.value - }) - - } - - clickShixunchoose=()=>{ - - let{patheditarry,shixuns_listedit,shixuns_listeditlist}=this.state - let newshixuns_listedit=shixuns_listedit; - let list=shixuns_listeditlist - - if(patheditarry.length===0){ - this.setState({ - Modalstype:true, - Modalstopval:'请选择实训', - - }) - - return - } - - let url='/paths/append_to_stage.json' - axios.post(url,{ - shixun_id:patheditarry - }).then((response) => { - let newshixun_lists=response.data.shixun_lists; - - - for(var j=0; j { - console.log(error) - }); - - } - - //保存 - clickShixunsave=()=>{ - let{stage_name,stage_description,stageid,shixuns_listeditlist}=this.state; - let newstage_descriptions=stage_description; - - if(stage_name===""||stage_name===undefined){ - - this.setState({ - stage_nametype:true - }) - - return - } - if(newstage_descriptions!=undefined){ - - if(newstage_descriptions.length>300){ - - this.setState({ - descriptiontype:true - }) - - return - } - }else{ - newstage_descriptions="" - } - - - - let url='/stages/'+stageid+'.json' - axios.put(url, { - name:stage_name, - description:newstage_descriptions, - shixun_id:shixuns_listeditlist - }).then((response) => { - // window.location.href = "/paths/" + response.data.subject_id - this.setState({ - stage_name:undefined, - stage_description:undefined, - shixuns_listeditlist:[], - shixuns_listedit:undefined, - stage_nametype:false, - descriptiontype:false - }) - this.props.updatapathCardsedits() - }).catch((error) => { - console.log(error) - }); - } - - //删除实训 - shixunslisteditdelect=(e)=>{ - - this.setState({ - Modalstype:true, - Modalstopval:'是否删除该实训?', - Modalsbottomval:'', - delectfunvalue:e.target.id - }) - - } - - shixunslisteditdelectfun=()=>{ - let{delectfunvalue}=this.state; - let sum = parseInt(delectfunvalue); - let {shixuns_listedit,shixuns_listeditlist} =this.state; - let newshixuns_listedit=shixuns_listedit - let newshixuns_listeditlist=shixuns_listeditlist - newshixuns_listedit.splice(sum, 1); - newshixuns_listeditlist.splice(sum, 1); - this.setState({ - shixuns_listedit:newshixuns_listedit, - shixuns_listeditlist:newshixuns_listeditlist, - Modalstype:false, - Modalstopval:' ', - Modalsbottomval:'', - delectfunvalue:undefined - }) - } - - - cardsModalcancel=()=>{ - this.setState({ - Modalstype:false, - Modalstopval:'', - Modalsbottomval:'', - delectfunvalue:undefined - }) - } - cardsModalsave=()=>{ - this.setState({ - Modalstype:false, - Modalstopval:'', - Modalsbottomval:'' - }) - } - - - - onDragStart = () => { - /*...*/ - }; - onDragUpdate = () => { - /*...*/ - } - - - onDragEnd (result) { - - let {shixuns_listedit,shixuns_listeditlist} =this.state; - const listedit = reorder( - shixuns_listedit, - result.source.index, - result.destination.index - ); - const listeditlist = reorder( - shixuns_listeditlist, - result.source.index, - result.destination.index - ); - this.setState({ - shixuns_listedit:listedit, - shixuns_listeditlist:listeditlist - }) - } - - contentViewScrolledit=(e)=>{ - //滑动到底判断 - - if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ - this.setState({ - hometypepvisible:true - }) - // console.log("到达底部"); - - let {page,type,search,ChooseShixunListshixun_list}=this.state; - - let newpage=page+1; - - let pathId=this.props.pathid; - - let newChooseShixunListshixun_list=ChooseShixunListshixun_list; - - let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage - - if(search!="" && search!=undefined){ - url+="&search="+search; - } - - if(type!=0){ - url+="&type="+type; - } - axios.get(url).then((result)=>{ - if(result.status===200){ - - let list =result.data.shixun_list; - - for(var i=0; i{ - console.log(error); - }) - - } - - } - - - render(){ - let {selectShixun, - editPanel, - ChooseShixunList, - type, - page, - search, - hometypepvisible, - shixuns_listedit, - patheditarry, - stage_name, - stage_description, - Modalstype, - Modalstopval, - Modalsbottomval, - delectfunvalue, - ChooseShixunListshixun_list, - stage_nametype, - descriptiontype - } = this.state - - return( -
    - this.cardsModalsave():()=>this.shixunslisteditdelectfun()} - > - - - { this.props.idsum===this.props.keys&&this.props.pathCardsedittype===true? - -
    - -
    -

    - {/**/} - {/**/} - {/**/} - - {/**/} -

    -
    - {/*

    章节名称

    */} -
    - * -
    - -
    名称不能为空
    -
    -
    必填项
    -
    -

    描述

    -
    - -
    描述不能超多最大限制300个字符
    -
    -

    - - 选择实训 - - 选择下面实训后,可以通过拖拽进行排序调整 -

    - - {selectShixun===true?:""} - - - - -
    - -
    - - - {ChooseShixunList && ChooseShixunList.shixuns_count} - 个实训 - -
    - this.changeTag(`${type}`,`${search}`)} - > -
    -
    -
      -
    • 实训名称
    • -
    • 使用院校
    • -
    • 使用人数
    • -
    • 评价等级
    • -
    • -
    - - -
    - - { - ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{ - return( -
    -
  • - - - -
  • -
  • {item.school_users}
  • -
  • {item.myshixuns_count}
  • -
  • {item.preference}
  • -
  • 详情
  • -
    - ) - }) - } -
    -
    -
    - 取消 - 确定 -
    -
    -
    -
    -
    - - {/* 可拖拽选择实训列表*/} - {shixuns_listedit===undefined?'': - - - - {(provided, snapshot) => ( -
    - {shixuns_listedit.map((item,key)=>{ - return( - - {(provided, snapshot) => ( -
    - -
  • - - - - - - - - - - {this.props.idsum+1}-{key+1}  {item.shixun_name} - - - - - -
  • - -
  • - - - -
  • - {provided.placeholder} -
    - )} -
    - )})} -
    - )} -
    -
    - } - - {/*
    */} - {/*
    */} - {/*×*/} - {/*Shixun0*/} - {/*
    */} - {/*

    frerere

    */} - {/*
    */} - {/*
    */} - {/*
    */} - - - {/*

    */} - {/*取消*/} - {/*保存*/} - {/*

    */} - -

    -

    - 取消 - 保存 -
    -

    - - -
    -
    - :''} -
    - ) - } -} -export default DetailCardsEditAndEdit; - - - - - -// { -// shixuns_listedit===undefined?'':shixuns_listedit.map((item,key)=>{ -// return( -//
    -// -//
  • -// -// -// -// -// -// -// -// -// -// {this.props.idsum+1}-{key+1}  {item.shixun_name} -// -// -// -// -// -//
  • -// -//
  • -// -// -// -//
  • -// -//
    -// ) -// }) +import React, { Component } from 'react'; +import {getImageUrl} from 'educoder'; +import {Modal,Input,Checkbox,Tooltip} from "antd"; +import { DragDropContext,Draggable, Droppable} from 'react-beautiful-dnd'; +import Modals from '../../modals/Modals'; +import Loading from '@icedesign/base/lib/loading'; +import '@icedesign/base/lib/loading/style.js'; +import '../ShixunPaths.css'; +import axios from 'axios'; +const $ = window.$; +const Search = Input.Search; + + +//a little function to help us with reordering the result +const reorder = (list, startIndex, endIndex) => { + // console.log(list) + // console.log(startIndex) + // console.log(endIndex) + + let newlist=list; + const result = Array.from(newlist); + const [removed] = result.splice(startIndex, 1); + result.splice(endIndex, 0, removed); + + return result; +}; + +const getItemStyle = (isDragging, draggableStyle) => ({ + // change background colour if dragging + background: isDragging ? '#dceeff' : '', + // styles we need to apply on draggables + ...draggableStyle, +}); + + +class DetailCardsEditAndEdit extends Component{ + constructor(props){ + super(props); + this.state={ + selectShixun:false, + editPanel:true, + search:"", + type:0, + page:1, + ChooseShixunList:undefined, + hometypepvisible:true, + shixuns_listedit:undefined, + patheditarry:[], + stage_name:undefined, + stage_description:undefined, + stageid:undefined, + Modalstype:false, + Modalstopval:'', + Modalsbottomval:'', + delectfunvalue:undefined, + ChooseShixunListshixun_list:undefined, + stage_nametype:false, + descriptiontype:false + } + this.onDragEnd = this.onDragEnd.bind(this); + } + //选择实训弹框 + AddShixunBox = () =>{ + this.setState({ + selectShixun:true, + patheditarry:[] + }) + this.changeTag(0,""); + } + //关闭选择实训弹框 + cloasShixunBox =()=>{ + this.setState({ + selectShixun:false, + patheditarry:[] + }) + } + + searchNameInput=(e)=>{ + this.setState({ + search:e.target.value + }) + } + + //打开选择实训弹框初始化tag标签和列表 + changeTag(id,search){ + this.setState({ + hometypepvisible:true + }) + let pathId=this.props.pathid; + let {page}=this.state; + let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+page + if(search!="" && search!=undefined){ + url+="&search="+search; + } + if(id!=0){ + url+="&type="+id; + } + axios.get(url).then((result)=>{ + if(result.status===200){ + this.setState({ + ChooseShixunList:result.data, + hometypepvisible:false, + type:id, + search:search, + ChooseShixunListshixun_list:result.data.shixun_list + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + + shixunhomeworkedit=(list)=>{ + + let newpatheditarry=[]; + for(var i=0; i{ + + this.setState({ + stage_name:e.target.value + }) + + } + + updatastage_description=(e)=>{ + + this.setState({ + stage_description:e.target.value + }) + + } + + clickShixunchoose=()=>{ + + let{patheditarry,shixuns_listedit,shixuns_listeditlist}=this.state + let newshixuns_listedit=shixuns_listedit; + let list=shixuns_listeditlist + + if(patheditarry.length===0){ + this.setState({ + Modalstype:true, + Modalstopval:'请选择实训', + + }) + + return + } + + let url='/paths/append_to_stage.json' + axios.post(url,{ + shixun_id:patheditarry + }).then((response) => { + let newshixun_lists=response.data.shixun_lists; + + + for(var j=0; j { + console.log(error) + }); + + } + + //保存 + clickShixunsave=()=>{ + let{stage_name,stage_description,stageid,shixuns_listeditlist}=this.state; + let newstage_descriptions=stage_description; + + if(stage_name===""||stage_name===undefined){ + + this.setState({ + stage_nametype:true + }) + + return + } + if(newstage_descriptions!=undefined){ + + if(newstage_descriptions.length>300){ + + this.setState({ + descriptiontype:true + }) + + return + } + }else{ + newstage_descriptions="" + } + + + + let url='/stages/'+stageid+'.json' + axios.put(url, { + name:stage_name, + description:newstage_descriptions, + shixun_id:shixuns_listeditlist + }).then((response) => { + // window.location.href = "/paths/" + response.data.subject_id + this.setState({ + stage_name:undefined, + stage_description:undefined, + shixuns_listeditlist:[], + shixuns_listedit:undefined, + stage_nametype:false, + descriptiontype:false + }) + this.props.updatapathCardsedits() + }).catch((error) => { + console.log(error) + }); + } + + //删除实训 + shixunslisteditdelect=(e)=>{ + + this.setState({ + Modalstype:true, + Modalstopval:'是否删除该实训?', + Modalsbottomval:'', + delectfunvalue:e.target.id + }) + + } + + shixunslisteditdelectfun=()=>{ + let{delectfunvalue}=this.state; + let sum = parseInt(delectfunvalue); + let {shixuns_listedit,shixuns_listeditlist} =this.state; + let newshixuns_listedit=shixuns_listedit + let newshixuns_listeditlist=shixuns_listeditlist + newshixuns_listedit.splice(sum, 1); + newshixuns_listeditlist.splice(sum, 1); + this.setState({ + shixuns_listedit:newshixuns_listedit, + shixuns_listeditlist:newshixuns_listeditlist, + Modalstype:false, + Modalstopval:' ', + Modalsbottomval:'', + delectfunvalue:undefined + }) + } + + + cardsModalcancel=()=>{ + this.setState({ + Modalstype:false, + Modalstopval:'', + Modalsbottomval:'', + delectfunvalue:undefined + }) + } + cardsModalsave=()=>{ + this.setState({ + Modalstype:false, + Modalstopval:'', + Modalsbottomval:'' + }) + } + + + + onDragStart = () => { + /*...*/ + }; + onDragUpdate = () => { + /*...*/ + } + + + onDragEnd (result) { + + let {shixuns_listedit,shixuns_listeditlist} =this.state; + const listedit = reorder( + shixuns_listedit, + result.source.index, + result.destination.index + ); + const listeditlist = reorder( + shixuns_listeditlist, + result.source.index, + result.destination.index + ); + this.setState({ + shixuns_listedit:listedit, + shixuns_listeditlist:listeditlist + }) + } + + contentViewScrolledit=(e)=>{ + //滑动到底判断 + + if(e.currentTarget.scrollHeight-e.currentTarget.scrollTop===e.currentTarget.clientHeight){ + this.setState({ + hometypepvisible:true + }) + // console.log("到达底部"); + + let {page,type,search,ChooseShixunListshixun_list}=this.state; + + let newpage=page+1; + + let pathId=this.props.pathid; + + let newChooseShixunListshixun_list=ChooseShixunListshixun_list; + + let url='/paths/'+pathId+'/choose_subject_shixun.json?page='+newpage + + if(search!="" && search!=undefined){ + url+="&search="+search; + } + + if(type!=0){ + url+="&type="+type; + } + axios.get(url).then((result)=>{ + if(result.status===200){ + + let list =result.data.shixun_list; + + for(var i=0; i{ + console.log(error); + }) + + } + + } + + + render(){ + let {selectShixun, + editPanel, + ChooseShixunList, + type, + page, + search, + hometypepvisible, + shixuns_listedit, + patheditarry, + stage_name, + stage_description, + Modalstype, + Modalstopval, + Modalsbottomval, + delectfunvalue, + ChooseShixunListshixun_list, + stage_nametype, + descriptiontype + } = this.state + + return( +
    + this.cardsModalsave():()=>this.shixunslisteditdelectfun()} + > + + + { this.props.idsum===this.props.keys&&this.props.pathCardsedittype===true? + +
    + +
    +

    + {/**/} + {/**/} + {/**/} + + {/**/} +

    +
    + {/*

    章节名称

    */} +
    + * +
    + +
    名称不能为空
    +
    +
    必填项
    +
    +

    描述

    +
    + +
    描述不能超多最大限制300个字符
    +
    +

    + + 选择实训 + + 选择下面实训后,可以通过拖拽进行排序调整 +

    + + {selectShixun===true?:""} + + + + +
    + +
    + + + {ChooseShixunList && ChooseShixunList.shixuns_count} + 个实训 + +
    + this.changeTag(`${type}`,`${search}`)} + style={{width: '115%'}} + > +
    +
    +
      +
    • 实训名称
    • +
    • 使用院校
    • +
    • 使用人数
    • +
    • 评价等级
    • +
    • +
    + + +
    + + { + ChooseShixunListshixun_list && ChooseShixunListshixun_list.map((item,key)=>{ + return( +
    +
  • + + + +
  • +
  • {item.school_users}
  • +
  • {item.myshixuns_count}
  • +
  • {item.preference}
  • +
  • 详情
  • +
    + ) + }) + } +
    +
    +
    + 取消 + 确定 +
    +
    +
    +
    +
    + + {/* 可拖拽选择实训列表*/} + {shixuns_listedit===undefined?'': + + + + {(provided, snapshot) => ( +
    + {shixuns_listedit.map((item,key)=>{ + return( + + {(provided, snapshot) => ( +
    + +
  • + + + + + + + + + + {this.props.idsum+1}-{key+1}  {item.shixun_name} + + + + + +
  • + +
  • + + + +
  • + {provided.placeholder} +
    + )} +
    + )})} +
    + )} +
    +
    + } + + {/*
    */} + {/*
    */} + {/*×*/} + {/*Shixun0*/} + {/*
    */} + {/*

    frerere

    */} + {/*
    */} + {/*
    */} + {/*
    */} + + + {/*

    */} + {/*取消*/} + {/*保存*/} + {/*

    */} + +

    +

    + 取消 + 保存 +
    +

    + + +
    +
    + :''} +
    + ) + } +} +export default DetailCardsEditAndEdit; + + + + + +// { +// shixuns_listedit===undefined?'':shixuns_listedit.map((item,key)=>{ +// return( +//
    +// +//
  • +// +// +// +// +// +// +// +// +// +// {this.props.idsum+1}-{key+1}  {item.shixun_name} +// +// +// +// +// +//
  • +// +//
  • +// +// +// +//
  • +// +//
    +// ) +// }) // } \ No newline at end of file diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 77d2e13bb..7845a1526 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -183,10 +183,12 @@ export function TPMIndexHOC(WrappedComponent) { // return false return this.state.coursedata&&this.state.coursedata.course_identity === 0 } + // 管理员等 isAdminOrCreator = () => { // return this.state.coursedata&&this.state.coursedata.course_identity >= 0 && return this.state.coursedata&&this.state.coursedata.course_identity < 3 } + // 助教等 isAdminOrTeacher = () => { // return this.state.coursedata&&this.state.coursedata.course_identity >= 0 && return this.state.coursedata&&this.state.coursedata.course_identity < 4 diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 7b649f704..db85e9337 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -296,7 +296,7 @@ label.infolabel{display: block;float: left;width: 56px;text-align: right;margin- .subshaicontent a{float: left;margin-right: 20px;color: #999;cursor: pointer} -.search-new{width: 248px;height:32px;position: relative} +.search-new{width: 248px;height:32px;position: relative;margin-right: 35px;} .search-span{display: block;position: absolute;width: 100%;height: 100%;left:0px;top:0px;background-color: #F4F4F4;border: 1px solid #EAEAEA; border-radius: 4px;z-index: 1} .search-new-input{height: 32px;padding-left: 5px;width: 225px;border: none;box-sizing: border-box;background: none;outline: none;position: absolute;left:0px;top:1px;z-index: 2} .search-new img,.search-new a,.search-new .searchicon{cursor: pointer;position: absolute;right:2px;top:2px;z-index: 2} From aa498d7db5411faf1551a479c08d760aa7a51613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Mon, 24 Jun 2019 14:51:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesPublic/Startshixuntask.js | 3 +- .../shixunHomework/Trainingjobsetting.js | 77 ++++++++++++++----- public/react/src/modules/tpm/NewHeader.js | 4 +- 3 files changed, 60 insertions(+), 24 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js index e643d9608..9cf44c9a7 100644 --- a/public/react/src/modules/courses/coursesPublic/Startshixuntask.js +++ b/public/react/src/modules/courses/coursesPublic/Startshixuntask.js @@ -103,7 +103,8 @@ class Startshixuntask extends Component{ hidestartshixunsreplacevalue, startshixunCombattype, shixunsmessage, - startbtn + startbtn, + isSpin } = this.state; return( diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index a15fd16b1..a1896da66 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -637,7 +637,8 @@ class Trainingjobsetting extends Component { //允许补交 onChanges = (e) => { - // debugger + console.log("640"); + console.log(this.state.end_time); if(e.target.value ==="允许补交"){ if(this.state.end_time !== null && this.state.end_time!== undefined){ // console.log(this.state.end_time); @@ -955,26 +956,55 @@ class Trainingjobsetting extends Component { - disabledEndDate = (end_time) => { - const publish_time = this.state.publish_time; - if (!end_time || !publish_time) { + // disabledEndDate = (end_time) => { + // const publish_time = this.state.publish_time; + // if (!end_time || !publish_time) { + // return false; + // } + // return end_time.valueOf() <= publish_time.valueOf(); + // + // } + // disabledEndDates = (end_time) => { + // const publish_time = this.state.end_time + // if (!end_time || !publish_time) { + // return false; + // } + // console.log("end_time.valueOf()") + // // console.log(end_time.valueOf()); + // // console.log(publish_time.valueOf()); + // return end_time.valueOf() <= publish_time.valueOf(); + // + // + // } + + disabledStartDatestart= (startValue) => { + const endValue = this.state.end_time + + if (!startValue || !endValue) { return false; } - return end_time.valueOf() <= publish_time.valueOf(); + return startValue.valueOf() > endValue.valueOf(); + }; + disabledEndDateend = (endValue) => { + const startValue = this.state.publish_time; + if (!endValue || !startValue) { + return false; + } + return endValue.valueOf() <= startValue.valueOf(); + }; - } - disabledEndDates = (end_time) => { - const publish_time = this.state.end_time - if (!end_time || !publish_time) { + + disabledEndDateendd = (endsValue) => { + const endValues = this.state.end_time + + if (!endsValue|| !endValues) { return false; } - console.log("end_time.valueOf()") - // console.log(end_time.valueOf()); - // console.log(publish_time.valueOf()); - return end_time.valueOf() <= publish_time.valueOf(); + return endsValue.valueOf() <= endValues.valueOf(); + }; + - } onChangedata = (field, value, dateString) => { this.setState({ [field]: handleDateString(dateString), @@ -1085,7 +1115,10 @@ class Trainingjobsetting extends Component { // console.log(value); console.log(dateString); // console.log(handleDateString(dateString)); - this.onChangedata('publish_time', value, dateString); + // this.onChangedata('publish_time', value, dateString); + this.setState({ + publish_time:moment(handleDateString(dateString)) + }) if(this.state.allowreplenishment === "允许补交") { this.setState({ end_time:moment(handleDateString(dateString)).add(1, 'months'), @@ -1144,11 +1177,13 @@ class Trainingjobsetting extends Component { } catch (e) { } - this.onChangedata('end_time', value, dateString); + // this.onChangedata('end_time', value, dateString); if(this.state.allowreplenishment === "允许补交"){ this.setState({ - late_time:moment(handleDateString(dateString)).add(1, 'months'), - late_times:moment(handleDateString(dateString)).add(1, 'months').format('YYYY-MM-DD HH:mm'), + end_time:moment(handleDateString(dateString)).add(1, 'months'), + deadline:moment(handleDateString(dateString)).add(1, 'months').format('YYYY-MM-DD HH:mm'), + late_time:moment(handleDateString(dateString)).add(2, 'months'), + late_times:moment(handleDateString(dateString)).add(2, 'months').format('YYYY-MM-DD HH:mm'), }) } @@ -1647,7 +1682,7 @@ class Trainingjobsetting extends Component { { // join_course_url: "https://www.educoder.net/courses/join_course_multi_role" // join_project_url: "https://www.educoder.net/applied_project/applied_project_info" // rolearr:["",""], - console.log("618"); - console.log(user_phone_binded); + // console.log("618"); + // console.log(user_phone_binded); return (