diff --git a/public/react/src/App.js b/public/react/src/App.js index 1a1af02d9..15105f749 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -207,6 +207,12 @@ const UsersInfo = Loadable({ loading: Loading, }) +// 兴趣页面 +const Interestpage = Loadable({ + loader: () => import('./modules/user/Interestpage'), + loading: Loading, +}) + class App extends Component { constructor(props) { super(props) @@ -324,8 +330,8 @@ class App extends Component { */} {/* */} - - + {/* 兴趣页面*/} + {/**/} diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index e69cdb4d5..a2f57a8e1 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -38,14 +38,10 @@ class Fileslistitem extends Component{ if(result.data.attachment_histories.length===0){ let link = document.createElement('a'); - // link.href = window.URL.createObjectURL(new Blob([result.data.url])); + document.body.appendChild(link); link.href = result.data.url; - let filesname=encodeURIComponent(result.data.title) - console.log(result.data.title) - link.download = decodeURIComponent(filesname) + link.download = result.data.title; //兼容火狐浏览器 - console.log(result.data.title) - document.body.appendChild(link); let evt = document.createEvent("MouseEvents"); evt.initEvent("click", false, false); link.dispatchEvent(evt); @@ -300,7 +296,7 @@ class Fileslistitem extends Component{ :""} - {this.props.current_user.login===discussMessage.author.login? + {this.props.isStudent===true&&this.props.current_user.login===discussMessage.author.login? diff --git a/public/react/src/modules/courses/Resource/index.js b/public/react/src/modules/courses/Resource/index.js index 07731686e..8ce285ae1 100644 --- a/public/react/src/modules/courses/Resource/index.js +++ b/public/react/src/modules/courses/Resource/index.js @@ -7,11 +7,12 @@ import Sendtofilesmodal from "../coursesPublic/SendToFilesModal"; import Selectresource from "../coursesPublic/SelectResource"; import Sendresource from "../coursesPublic/sendResource"; import Selectsetting from "../coursesPublic/SelectSetting"; -import CourseLayoutcomponent from '../common/CourseLayoutComponent'; +import HomeworkModal from "../coursesPublic/HomeworkModal"; import Fileslistitem from './Fileslistitem'; import Titlesearchsection from '../common/titleSearch/TitleSearchSection'; import './style.css'; import '../css/members.css'; +import moment from 'moment'; class Fileslists extends Component{ constructor(props){ @@ -232,7 +233,9 @@ class Fileslists extends Component{ this.props.showNotification("请先在列表中选择要发送的资源"); }else if(value===3){ this.props.showNotification("请先在列表中选择要公开的资源"); - } + }else if(value===4){ + this.props.showNotification("请先在列表中选择要发布的资源"); + } } onDelete = () => { @@ -549,7 +552,78 @@ class Fileslists extends Component{ }) } + homeworkstart=()=>{ + let selectnum= this.testonSelect(); + if(selectnum===true){ + this.noSelect(4); + return + } + let starttime= this.props.getNowFormatDates(1); + let endtime=this.props.getNowFormatDates(2); + this.setState({ + modalname:"立即发布", + visible:true, + typs:"start", + Topval:"学生将能立即查看和下载发布资源", + // Botvalleft:"暂不发布", + // Botval:`本操作只对"未发布"的分班有效`, + // starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"), + // starttimes:starttime, + // endtime:"截止时间:"+endtime, + Cancelname:"暂不发布", + Savesname:"立即发布", + Cancel:this.homeworkhide, + Saves:this.homeworkstartend, + }) + } + // 立即发布 + homeworkstartend=(ds,endtime)=>{ + let {checkBoxValues}=this.state; + let coursesId=this.props.match.params.coursesId; + let url ="/files/bulk_publish.json"; + axios.put(url, { + course_id:coursesId, + ids :checkBoxValues, + }).then((result)=>{ + if(result.status===200){ + this.props.showNotification("发布成功") + this.setState({ + checkBoxValues:[], + checkAllValue:false + }) + this.homeworkhide() + this.props.updataleftNavfun() + this.updatafiled() + } + }).catch((error)=>{ + console.log(error); + }) + } + + homeworkhide=()=>{ + this.setState({ + modalname:undefined, + modaltype:undefined, + visible:false, + Topval:undefined, + Topvalright:undefined, + Botvalleft:undefined, + Botval:undefined, + starttime:undefined, + endtime:undefined, + Cancelname:undefined, + Savesname:undefined, + Cancel:undefined, + Saves:undefined, + StudentList_value:undefined, + addname:undefined, + addnametype:false, + addnametab:undefined, + typs:undefined, + starttimes:undefined, + }) + } render(){ let { searchValue, @@ -582,6 +656,26 @@ class Fileslists extends Component{ return( + {/*立即发布*/} + {this.state.visible===true?:""} {/*发送*/} {this.props.isAdmin()?
  • 删除
  • :""} {this.props.isAdmin()?
  • 发送
  • :""} - {/*{this.props.isAdmin()?*/} - {/*
  • 立即发布
  • */} - {/*:""}*/} + {this.props.isAdmin()? +
  • 立即发布
  • + :""} {this.props.isAdmin()?course_is_public===true?
  • 设为公开
  • :"":""} diff --git a/public/react/src/modules/courses/coursesPublic/HomeworkModal.js b/public/react/src/modules/courses/coursesPublic/HomeworkModal.js index bc2fb60b5..440d8893c 100644 --- a/public/react/src/modules/courses/coursesPublic/HomeworkModal.js +++ b/public/react/src/modules/courses/coursesPublic/HomeworkModal.js @@ -88,25 +88,30 @@ class HomeworkModal extends Component{ propsSaves=(ds,endtime)=>{ - if(this.props.typs!="end"){ - if(endtime === ""||endtime===undefined||endtime===null){ + if(ds.length ===0&&endtime === ""){ + this.props.Saves() + }else{ + if(this.props.typs!="end"){ + if(endtime === ""||endtime===undefined||endtime===null){ - this.setState({ - endtimetype:true, - endtimetypevalue:"截止时间不能为空" - }) - return - } + this.setState({ + endtimetype:true, + endtimetypevalue:"截止时间不能为空" + }) + return + } - if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttimes,"YYYY-MM-DD HH:mm")){ - this.setState({ - endtimetype:true, - endtimetypevalue:"必须晚于发布时间" - }) - return + if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttimes,"YYYY-MM-DD HH:mm")){ + this.setState({ + endtimetype:true, + endtimetypevalue:"必须晚于发布时间" + }) + return + } } + this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm")) } - this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm")) + } diff --git a/public/react/src/modules/courses/css/Courses.css b/public/react/src/modules/courses/css/Courses.css index 83d5ebbde..11ba24c5d 100644 --- a/public/react/src/modules/courses/css/Courses.css +++ b/public/react/src/modules/courses/css/Courses.css @@ -369,13 +369,13 @@ a.white-btn.use_scope-btn:hover{ } #memoMD .CodeMirror { - width: 576px !important; + /*width: 576px !important;*/ margin-top: 31px !important; height: 364px !important; } #memoMD .editormd-preview { - width: 567px !important; + width: 578px !important; top: 40px !important; height: 364px !important; } diff --git a/public/react/src/modules/courses/exercise/Exercisesetting.js b/public/react/src/modules/courses/exercise/Exercisesetting.js index d07258ab3..1e151b654 100644 --- a/public/react/src/modules/courses/exercise/Exercisesetting.js +++ b/public/react/src/modules/courses/exercise/Exercisesetting.js @@ -131,9 +131,9 @@ class Exercisesetting extends Component{ // end_timetype:false // }) // }else{ - this.setState({ - end_timetype:true - }) + // this.setState({ + // end_timetype:true + // }) // } } diff --git a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js index c2930bcdf..09cfdf947 100644 --- a/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js +++ b/public/react/src/modules/courses/exercise/Studentshavecompletedthelist.js @@ -1246,43 +1246,43 @@ class Studentshavecompletedthelist extends Component { this.Generatenewdatas(response.data.exercise_users); if (response.data.exercise_types.subjective === 0) { if (this.state.noclassroom === undefined || this.state.noclassroom === "" || this.state.noclassroom === null) { - this.state.columnss.map((item,key)=>{ + var arr =[]; + for(var i=0;i{ + var arr =[]; + for(var i=0;i{ + var arr =[]; + for(var i=0;i{ + else{ + arr.push(item); + } + } + + var arr2 =[]; + for(var i=0;i{ + + var arr =[]; + for(var i=0;i{ - if(item.title==="客观题得分"){ - this.state.columns.splice(key,1) + else{ + arr.push(item); } - if(item.title==="主观题得分"){ - this.state.columns.splice(key,1) + } + var arr2 =[]; + for(var i=0;i{ + + var arr =[]; + for(var i=0;i{ + else{ + arr.push(item); + } + } + + var arr2 =[]; + for(var i=0;i{ + // this.state.columnsys.map((item,key)=>{ + // + // }) + var arr =[]; + for(var i=0;i{ + + var arr =[]; + for(var i=0;i 0) { //显示分班 //8ge - this.state.columnsys.map((item,key)=>{ + + var arr =[]; + for(var i=0;i{ + var arr =[]; + for(var i=0;i 0) { - this.state.columnsys.map((item,key)=>{ - if(this.props.isNotMember()===true) { - if(item.title==="学号"){ - this.state.columnsys.splice(key,1) - } + var arr =[]; + for(var i=0;i{ + var arr =[]; + for(var i=0;i{ + var arr =[]; + for(var i=0;i { // console.log("componentDidMount 50") + if( this.props.isStudent() === true){ + + this.props.history.push("/403") + + return + } if (this.props.match.params.news !== undefined) { if (this.props.match.params.news === "new") { this.state.Newedit === true; @@ -780,19 +786,21 @@ class PollNew extends Component { } } - if (maxtie < 3) { - if (object.question.question_type === 1) { - this.props.showNotification(`选项不能少于3个!`); + if (object.question.question_type === 1) { + if (maxtie < 2) { + this.props.showNotification(`选项不能少于2个!`); return + } } else if (object.question.question_type === 2) { + if (maxtie < 3) { this.props.showNotification(`选项不能少于3个!`); - return + } } - } + if (object.question.question_type === 2) { if (object.question.max_choices > 0) { @@ -1260,17 +1268,19 @@ class PollNew extends Component { } } - if (maxtie < 3) { if (object.question.question_type === 1) { - this.props.showNotification('选项不能少于3个!'); + if (maxtie < 2) { + this.props.showNotification('选项不能少于2个!'); return + } } else if (object.question.question_type === 2) { + if (maxtie < 3) { this.props.showNotification('选项不能少于3个!'); return + } } - } if (object.question.question_type === 2) { if (object.question.max_choices > 0) { @@ -2329,95 +2339,114 @@ class PollNew extends Component { {/*
    */} -
    -
    - + -
    -
    *问卷标题 -
    - { - this.props.match.params.news === undefined ? "" : this.props.match.params.news === "new" ? - ( - this.state.mysave === false ? - - : "") - : -
    +
    +
    *问卷标题 +
    + { + this.props.match.params.news === undefined ? "" : this.props.match.params.news === "new" ? + ( + this.state.mysave === false ? + - } +
    + : "") + :"" + } -
    +
    + + - - -
    -
    - + -
    问卷须知
    +
    问卷须知
    - - { - this.state.Newedit === true || this.state.mysave === true ? -
    - - {cancellation === false ? - - : ""} + + { + this.state.Newedit === true || this.state.mysave === true ? +
    + + {cancellation === false ? + + : ""} + +
    + : "" + } + +
    + +
    :"" + } -
    - : "" - } - -

    @@ -2496,8 +2525,8 @@ class PollNew extends Component { ( {item.question.answers === undefined ? "" : item.question.answers.map((items, i) => { return ( -

    - +
    + {/*
    {items.answer_text}
    */} {/*
    {items.answer_text}
    */} @@ -2511,7 +2540,7 @@ class PollNew extends Component { ( {item.question.answers === undefined ? "" : item.question.answers.map((items, i) => { return ( -
    +
    {items.answer_text} diff --git a/public/react/src/modules/courses/shixunHomework/Homeworddescription.js b/public/react/src/modules/courses/shixunHomework/Homeworddescription.js index 405490f38..472d76d2c 100644 --- a/public/react/src/modules/courses/shixunHomework/Homeworddescription.js +++ b/public/react/src/modules/courses/shixunHomework/Homeworddescription.js @@ -41,7 +41,7 @@ class Homeworddescription extends Component { super(props); this.state = { props: props, - description:undefined, + description:props.description, } @@ -74,10 +74,8 @@ class Homeworddescription extends Component {
    {/* - } -
    -
    -
    - - -
    -
    -
    -

    - 课程须知 - {detailInfoList===undefined?"":detailInfoList.allow_statistics===true? - - - - :"" - } -

    -
    - {detailInfoList === undefined ? "" :detailInfoList.learning_notes===null?"": - - } -
    -
    - {detailInfoList === undefined ? "" : detailInfoList.tags === null ? "": -
    -

    技能标签 {detailInfoList.tags.length}

    - -
    -
    - { - detailInfoList.tags && detailInfoList.tags.map((item,key)=>{ - return( - {item.tag_name} - ) - }) - } -
    -
    - -
    15&&clickdetailInfoListtype===false?"newsubscript mb9 color-grey-9 fr":"newsubscript mb9 color-grey-9 none"} - data-tip-down="显示全部" - onClick={()=>this.clickNewsubscript(0)} - >... -
    - -
    this.clickNewsubscript(1)}> -
    - -
    - } - { - detailInfoList === undefined ? "" : detailInfoList.progress === null ? "" : -
    -

    - 我的进展 - - {detailInfoList.progress.my_score} / {detailInfoList.progress.all_score} - -

    -

    - 已学 {detailInfoList.progress.learned}% - 学习耗时{this.timeStamp(detailInfoList.progress.time)} -

    -
    -
    - } - - { - detailInfoList ===undefined ?"":detailInfoList.members === null ?"": -
    -

    教学团队

    - - { detailInfoList===undefined? - detailInfoList.members && detailInfoList.members.map((item,key)=>{ - return( -
    - - 头像 - - -
    -

    {item.name} - {/*{*/} - {/* detailInfoList===undefined?"":detailInfoList.allow_add_member===true?*/} - {/* this.shanchuallow(item.id)}>:""*/} - {/*}*/} -

    -
    -

    {item.school}{item.identity}

    -
    -
    -
    - ) - }) - :detailInfoList.allow_add_member===true? - detailInfoList.members && detailInfoList.members.map((item,key)=>{ - return( -
    - - 头像 - - -
    -

    {item.name} - { - detailInfoList===undefined?"":detailInfoList.allow_add_member===true? - this.shanchuallow(item.id)}>:"" - } -

    -
    -

    {item.school}{item.identity}

    -
    - { - detailInfoList===undefined?"":detailInfoList.allow_add_member===true? - :"" - } - -
    -
    - ) - }) - : detailInfoList.members && detailInfoList.members.map((item,key)=>{ - return( -
    - - 头像 - - -
    -

    {item.name} - {/*{*/} - {/* detailInfoList===undefined?"":detailInfoList.allow_add_member===true?*/} - {/* this.shanchuallow(item.id)}>:""*/} - {/*}*/} -

    -
    -

    {item.school}{item.identity}

    -
    -
    -
    - ) - })} - -
    - } - - - - -
    -
    -
    - - - ) - } -} +import React, { Component } from 'react'; +import {getImageUrl,markdownToHTML} from 'educoder'; +import DetailTop from './DetailTop.js'; +import DetailCards from './DetailCards.js' +import AddCollaborators from "./addCollaborators.js"; +import {Icon,Tooltip} from 'antd'; +import { BrowserRouter as Router, Route, Link } from "react-router-dom"; +import { DragDropContext , Draggable, Droppable} from 'react-beautiful-dnd'; +import '../../paths/ShixunPaths.css'; +import "antd/dist/antd.css"; +import Modals from '../../modals/Modals'; +import axios from 'axios'; +import TPMRightSection from "../../tpm/component/TPMRightSection"; +import styled from "styled-components"; + +const getItemStyle = (isDragging, draggableStyle) => ({ + // change background colour if dragging + background: isDragging ? '#dceeff' : '', + // styles we need to apply on draggables + ...draggableStyle, +}); +const getItems = count => + Array.from({ length: count }, (v, k) => k).map(k => ({ + id: `item-${k}`, + content: `item ${k}` + })); + +// a little function to help us with reordering the result +const reorder = (list, startIndex, endIndex) => { + const result = Array.from(list); + const [removed] = result.splice(startIndex, 1); + result.splice(endIndex, 0, removed); + + return result; +}; + +const List = styled.div` + background: lightgrey; + padding: 10px; +`; + +const Item = styled.div` + display: flex; + align-items: center; + padding: 10px; + margin-bottom: 10px; + border: 1px solid grey; + background: white; + &:hover { + background: lightgrey; + } +`; + +const DragHandle = styled.div` + width: 15px; + height: 15px; + margin-right: 8px; + background: grey; + visibility: hidden; + &:hover { + background: black; + } + ${Item}:hover & { + visibility: visible; + } +`; +const $ =window.$ +class PathDetailIndex extends Component{ + constructor(props){ + super(props) + this.state={ + detailInfoList:undefined, + clickdetailInfoListtype:false, + Modalstype:false, + Modalstopval:undefined, + Modalsbottomval:undefined, + cardsModalcancel:this.cardsModalcancel, + cardsModalsave:this.cardsModalsave, + user_id:undefined, + loadtype:false, + items: getItems(10) + } + this.onDragEnd = this.onDragEnd.bind(this); + + } + onDragEnd(result) { + // dropped outside the list + if (!result.destination) { + return; + } + + try { + + }catch (e) { + + } + const items = reorder( + this.state.detailInfoList.members, + result.source.index, + result.destination.index + ); + this.state.detailInfoList.members=items; + this.setState({ + detailInfoList:this.state.detailInfoList, + items + }); + console.log(this.state.detailInfoList.members) + console.log("items 数组数组数组数组") + console.log(items) + } + cardsModalcancel=()=>{ + this.setState({ + Modalstype:false, + }) + window.history.go(-1) + } + + cardsModalsave=()=>{ + this.setState({ + Modalstype:false, + }) + window.history.go(-1) + } + // 加载markdown + updatamakedown=(id)=>{ + setTimeout(()=>{ + var shixunDescr = window.editormd.markdownToHTML(id, { + htmlDecode: "style,script,iframe", + taskList: true, + tex: true, + flowChart: true, + sequenceDiagram: true + }); + $("#"+id+" p:first").addClass("ReactMarkdown"); + }, 200) + } + + componentDidMount(){ + let pathid=this.props.match.params.pathId; + let url="/paths/"+pathid+".json"; + axios.get(url).then((result)=>{ + + if(result.data.allow_visit===true){ + this.setState({ + detailInfoList:result.data, + items: getItems(result.data.members.length), + }) + }else{ + window.location.href = "/403"; + // this.setState({ + // Modalstype:true, + // Modalstopval:'你没有权限访问,请联系对应课程管理人员开通', + // }) + } + + }).catch((error)=>{ + console.log(error); + }) + } + + updatadetailInfoList=()=>{ + let pathid=this.props.match.params.pathId; + let url="/paths/"+pathid+".json"; + axios.get(url).then((result)=>{ + if(result.data.allow_visit===true){ + this.setState({ + detailInfoList:result.data, + items: getItems(result.data.members.length), + user_id:undefined, + }) + }else{ + window.location.href = "/403"; + // this.setState({ + // Modalstype:true, + // Modalstopval:'你没有权限访问,请联系对应课程管理人员开通', + // }) + } + }).catch((error)=>{ + console.log(error); + }) + } + clickNewsubscript=(val)=>{ + if(val===0){ + this.setState({ + clickdetailInfoListtype:true + }) + }else{ + this.setState({ + clickdetailInfoListtype:false + }) + } + + } + + timeStamp=(value)=>{ + var secondTime = parseInt(value);// 秒 + var minuteTime = 0;// 分 + var hourTime = 0;// 小时 + if(secondTime > 60) {//如果秒数大于60,将秒数转换成整数 + //获取分钟,除以60取整数,得到整数分钟 + minuteTime = parseInt(secondTime / 60); + //获取秒数,秒数取佘,得到整数秒数 + secondTime = parseInt(secondTime % 60); + //如果分钟大于60,将分钟转换成小时 + if(minuteTime > 60) { + //获取小时,获取分钟除以60,得到整数小时 + hourTime = parseInt(minuteTime / 60); + //获取小时后取佘的分,获取分钟除以60取佘的分 + minuteTime = parseInt(minuteTime % 60); + } + } + var result = "" + parseInt(secondTime) + "秒"; + + if(minuteTime > 0) { + result = "" + parseInt(minuteTime) + "分" + result; + } + if(hourTime > 0) { + result = "" + parseInt(hourTime) + "小时" + result; + } + return result; + } + + + shanchuallow=(id)=>{ + this.setState({ + user_id:id, + Modalstype:true, + Modalstopval:"你确定要删除该成员吗?", + cardsModalsave:this.delectshanchuallow, + loadtype:false + }) + } + + delectshanchuallow=()=>{ + let{user_id}=this.state; + let pathid=this.props.match.params.pathId; + let url="/paths/"+pathid+"/delete_member.json"; + let param={user_id:user_id}; + axios.delete(url,{data:param}).then((response) => { + if(response.data.status===1){ + this.setState({ + Modalstype:true, + Modalstopval:response.data.message, + loadtype:true, + cardsModalsave:this.cardsModalsave, + }) + this.updatadetailInfoList(); + } + }).catch((error) => { + console.log(error) + }) + } + + //上移 + moveup=(data)=>{ + // console.log(data); + let pathid=this.props.match.params.pathId; + let url=`/paths/${pathid}/up_member_position.json`; + axios.post(url,{ + user_id:data.id + }).then((response) => { + if(response.status === 200){ + console.log("上移"); + // console.log(this.state.detailInfoList.members); + // console.log(response); + this.state.detailInfoList.members=response.data.members; + this.setState({ + detailInfoList:this.state.detailInfoList, + }); + // console.log(this.state.detailInfoList.members); + + } + + }).catch((error) => { + console.log(error) + }) + } + + //下移 + movedown =(data) => { + // console.log(data); + let pathid=this.props.match.params.pathId; + let url=`/paths/${pathid}/down_member_position.json`; + axios.post(url,{ + user_id:data.id + }).then((response) => { + if( response.status === 200){ + console.log("下移"); + // console.log(this.state.detailInfoList.members); + // console.log(response); + this.state.detailInfoList.members=response.data.members; + this.setState({ + detailInfoList:this.state.detailInfoList, + }); + // console.log(this.state.detailInfoList.members); + } + + }).catch((error) => { + console.log(error) + }) + } + render(){ + + this.updatamakedown("shixuns_propaedeutics"); + this.updatamakedown("subject_learning_notes"); + let {detailInfoList, + clickdetailInfoListtype, + Modalstype, + Modalstopval, + Modalsbottomval, + cardsModalcancel, + cardsModalsave, + loadtype + } = this.state + + + return( +
    + + +
    + +
    +
    +
    +

    + 简介 + {detailInfoList===undefined?"":detailInfoList.allow_statistics===true? + + + + :"" + } +

    +
    +
    + {detailInfoList === undefined ? "" :detailInfoList.description===null?"": +
    + } +
    +
    +
    + + +
    +
    +
    +

    + 课程须知 + {detailInfoList===undefined?"":detailInfoList.allow_statistics===true? + + + + :"" + } +

    +
    + {detailInfoList === undefined ? "" :detailInfoList.learning_notes===null?"": + + } +
    +
    + {detailInfoList === undefined ? "" : detailInfoList.tags === null ? "": +
    +

    技能标签 {detailInfoList.tags.length}

    + +
    +
    + { + detailInfoList.tags && detailInfoList.tags.map((item,key)=>{ + return( + {item.tag_name} + ) + }) + } +
    +
    + +
    15&&clickdetailInfoListtype===false?"newsubscript mb9 color-grey-9 fr":"newsubscript mb9 color-grey-9 none"} + data-tip-down="显示全部" + onClick={()=>this.clickNewsubscript(0)} + >... +
    + +
    this.clickNewsubscript(1)}> +
    + +
    + } + { + detailInfoList === undefined ? "" : detailInfoList.progress === null ? "" : +
    +

    + 我的进展 + + {detailInfoList.progress.my_score} / {detailInfoList.progress.all_score} + +

    +

    + 已学 {detailInfoList.progress.learned}% + 学习耗时{this.timeStamp(detailInfoList.progress.time)} +

    +
    +
    + } + + { + detailInfoList ===undefined ?"":detailInfoList.members === null ?"": +
    +

    教学团队

    + + { detailInfoList===undefined? + detailInfoList.members && detailInfoList.members.map((item,key)=>{ + return( +
    + + 头像 + + +
    +

    {item.name} + {/*{*/} + {/* detailInfoList===undefined?"":detailInfoList.allow_add_member===true?*/} + {/* this.shanchuallow(item.id)}>:""*/} + {/*}*/} +

    +
    +

    {item.school}{item.identity}

    +
    +
    +
    + ) + }) + :detailInfoList.allow_add_member===true? + detailInfoList.members && detailInfoList.members.map((item,key)=>{ + return( +
    + + 头像 + + +
    +

    {item.name} + { + detailInfoList===undefined?"":detailInfoList.allow_add_member===true? + this.shanchuallow(item.id)}>:"" + } +

    +
    +

    {item.school}{item.identity}

    +
    + { + detailInfoList===undefined?"":detailInfoList.allow_add_member===true? + :"" + } + +
    +
    + ) + }) + : detailInfoList.members && detailInfoList.members.map((item,key)=>{ + return( +
    + + 头像 + + +
    +

    {item.name} + {/*{*/} + {/* detailInfoList===undefined?"":detailInfoList.allow_add_member===true?*/} + {/* this.shanchuallow(item.id)}>:""*/} + {/*}*/} +

    +
    +

    {item.school}{item.identity}

    +
    +
    +
    + ) + })} + +
    + } + + + + +
    +
    +
    + +
    + ) + } +} export default PathDetailIndex; \ No newline at end of file diff --git a/public/react/src/modules/paths/PathNew.js b/public/react/src/modules/paths/PathNew.js index 0d0eff177..89adbc233 100644 --- a/public/react/src/modules/paths/PathNew.js +++ b/public/react/src/modules/paths/PathNew.js @@ -1,274 +1,274 @@ -import React,{ Component } from "react"; - -import {getUrl} from 'educoder'; -import {Input} from 'antd'; -import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; - -import axios from 'axios'; -// import '../page/tpiPage.css'; -require('codemirror/lib/codemirror.css'); - - -const $ = window.$; - -let origin = getUrl(); -let path = getUrl("/editormd/lib/"); -function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) { - var editorName = window.editormd(id, { - width: width, - height: high, - path: path, // "/editormd/lib/" - markdown : initValue, - syncScrolling: "single", - tex: true, - tocm: true, - emoji: true, - taskList: true, - codeFold: true, - searchReplace: true, - htmlDecode: "style,script,iframe", - sequenceDiagram: true, - autoFocus: false, - placeholder: placeholder, - toolbarIcons: function () { - // Or return editormd.toolbarModes[name]; // full, simple, mini - // Using "||" set icons align right. - return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] - }, - toolbarCustomIcons: { - testIcon: "
    ", - testIcon1: "
    " - }, - //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 - saveHTMLToTextarea: true, - // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 - dialogMaskOpacity: 0.6, - imageUpload: true, - imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], - imageUploadURL: imageUrl,//url - onload: function () { - // this.previewing(); - $("#" + id + " [type=\"latex\"]").bind("click", function () { - editorName.cm.replaceSelection("```latex"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("```"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line - 1, 0); - }); - - $("#" + id + " [type=\"inline\"]").bind("click", function () { - editorName.cm.replaceSelection("$$$$"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); - editorName.cm.focus(); - }); - $("[type=\"inline\"]").attr("title", "行内公式"); - $("[type=\"latex\"]").attr("title", "多行公式"); - - - callback && callback() - } - }); - // 一个页面有多个md时,onload方法只执行了一次 - window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`); - - return editorName; -} - - - - -class PathNew extends Component{ - constructor(props){ - super(props); - this.state={ - pathName:"", - description:"", - point:"", - flag_name:true - } - } - - // 提交 - submitNewPath=()=>{ - let {pathName} = this.state; - if(pathName===""){ - this.props.showSnackbar("请输入实训课程名称"); - window.location.href="#part_Name"; - this.setState({ - flag_name:false - }) - return; - } - let des=this.Des_editMD.getValue(); - if(des===""){ - this.props.showSnackbar("请输入实训课程的简介"); - window.location.href="#part_Des"; - return; - } - if (des.length > 5000) { - this.props.showSnackbar("实训课程的简介最大限制5000个字符"); - window.location.href="#part_Des"; - return; - } - let point = this.Point_editMD.getValue(); - if(point===""){ - this.props.showSnackbar("请输入实训课程的学习须知"); - window.location.href="#part_point"; - return; - } - if(point.length > 500){ - this.props.showSnackbar("实训课程的学习须知最大限制500个字符"); - window.location.href="#part_point"; - return; - } - if (this.isEditPage == true) { - let pathId = this.props.match.params.pathId; - - const editUrl = `/paths/${pathId}.json` - axios.put(editUrl,{ - name:pathName, - description:des, - learning_notes:point - }).then((response)=>{ - // console.log(response.data.subject_id); - if (response.data.subject_id) { - this.props.history.push(`/paths/${response.data.subject_id}`) - } - }).catch((error)=>{ - console.log(error); - }) - } else { - let url="/paths.json" - axios.post(url,{ - name:pathName, - description:des, - learning_notes:point - }).then((response)=>{ - // console.log(response.data.subject_id); - if (response.data.subject_id) { - this.props.history.push(`/paths/${response.data.subject_id}`) - } - }).catch((error)=>{ - console.log(error); - }) - } - - } - - componentDidMount() { - let pathId = this.props.match.params.pathId; - if (pathId) { - this.isEditPage = true - - // const url = `/paths/${pathId}.json` - const url = `/paths/${pathId}/edit.json` - axios.get(url).then((response)=>{ - /** - description: - id: 13 - learning_notes: - name: - */ - if (response.data.name) { - this.setState({ - pathName: response.data.name - }) - - const Des_editMD = create_editorMD("shixun_introduction","100%","490px" - ,"请在此输入实训课程的简介,最大限制5000个字符","/api/attachments.json", response.data.description,""); - this.Des_editMD=Des_editMD; - const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px" - ,"请在此输入实训课程的学习须知,最大限制500个字符","/api/attachments.json",response.data.learning_notes,""); - this.Point_editMD=Point_editMD; - } - }).catch((error)=>{ - console.log(error); - }) - } else { - this.isEditPage = false - - const Des_editMD = create_editorMD("shixun_introduction","100%","490px","请在此输入实训课程的简介,最大限制5000个字符","/api/attachments.json","",""); - this.Des_editMD=Des_editMD; - const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实训课程的学习须知,最大限制500个字符","/api/attachments.json","",""); - this.Point_editMD=Point_editMD; - } - - } - - InputName=(e)=>{ - this.setState({ - pathName:e.target.value, - }) - } - - render(){ - let {pathName,description,point,flag_name}=this.state; - return( -
    -
    -
    -
    -

    创建实训课程

    -
    -

    实训课程名称

    -
    - * -
    - -
    -
    -
    -
    - -
    -

    简介

    -
    - * -
    -
    - -
    -

    -

    -
    -
    -
    - -
    -

    学习须知

    -
    - * -
    -
    - -
    -

    -

    -
    -
    -
    - -
    - 提交 - {this.isEditPage ? - 取消 - : 取消 - } -
    - -
    -
    - -
    - ) - } -} +import React,{ Component } from "react"; + +import {getUrl,markdownToHTML} from 'educoder'; +import {Input} from 'antd'; +import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; + +import axios from 'axios'; +// import '../page/tpiPage.css'; +require('codemirror/lib/codemirror.css'); + + +const $ = window.$; + +let origin = getUrl(); +let path = getUrl("/editormd/lib/"); +function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) { + var editorName = window.editormd(id, { + width: width, + height: high, + path: path, // "/editormd/lib/" + markdown : initValue, + syncScrolling: "single", + tex: true, + tocm: true, + emoji: true, + taskList: true, + codeFold: true, + searchReplace: true, + htmlDecode: "style,script,iframe", + sequenceDiagram: true, + autoFocus: false, + placeholder: placeholder, + toolbarIcons: function () { + // Or return editormd.toolbarModes[name]; // full, simple, mini + // Using "||" set icons align right. + return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] + }, + toolbarCustomIcons: { + testIcon: "
    ", + testIcon1: "
    " + }, + //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 + saveHTMLToTextarea: true, + // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 + dialogMaskOpacity: 0.6, + imageUpload: true, + imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], + imageUploadURL: imageUrl,//url + onload: function () { + // this.previewing(); + $("#" + id + " [type=\"latex\"]").bind("click", function () { + editorName.cm.replaceSelection("```latex"); + editorName.cm.replaceSelection("\n"); + editorName.cm.replaceSelection("\n"); + editorName.cm.replaceSelection("```"); + var __Cursor = editorName.cm.getDoc().getCursor(); + editorName.cm.setCursor(__Cursor.line - 1, 0); + }); + + $("#" + id + " [type=\"inline\"]").bind("click", function () { + editorName.cm.replaceSelection("$$$$"); + var __Cursor = editorName.cm.getDoc().getCursor(); + editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); + editorName.cm.focus(); + }); + $("[type=\"inline\"]").attr("title", "行内公式"); + $("[type=\"latex\"]").attr("title", "多行公式"); + + + callback && callback() + } + }); + // 一个页面有多个md时,onload方法只执行了一次 + window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`); + + return editorName; +} + + + + +class PathNew extends Component{ + constructor(props){ + super(props); + this.state={ + pathName:"", + description:"", + point:"", + flag_name:true + } + } + + // 提交 + submitNewPath=()=>{ + let {pathName} = this.state; + if(pathName===""){ + this.props.showSnackbar("请输入实训课程名称"); + window.location.href="#part_Name"; + this.setState({ + flag_name:false + }) + return; + } + let des=this.Des_editMD.getValue(); + if(des===""){ + this.props.showSnackbar("请输入实训课程的简介"); + window.location.href="#part_Des"; + return; + } + if (des.length > 5000) { + this.props.showSnackbar("实训课程的简介最大限制5000个字符"); + window.location.href="#part_Des"; + return; + } + let point = this.Point_editMD.getValue(); + if(point===""){ + this.props.showSnackbar("请输入实训课程的学习须知"); + window.location.href="#part_point"; + return; + } + if(point.length > 500){ + this.props.showSnackbar("实训课程的学习须知最大限制500个字符"); + window.location.href="#part_point"; + return; + } + if (this.isEditPage == true) { + let pathId = this.props.match.params.pathId; + + const editUrl = `/paths/${pathId}.json` + axios.put(editUrl,{ + name:pathName, + description:des, + learning_notes:point + }).then((response)=>{ + // console.log(response.data.subject_id); + if (response.data.subject_id) { + this.props.history.push(`/paths/${response.data.subject_id}`) + } + }).catch((error)=>{ + console.log(error); + }) + } else { + let url="/paths.json" + axios.post(url,{ + name:pathName, + description:des, + learning_notes:point + }).then((response)=>{ + // console.log(response.data.subject_id); + if (response.data.subject_id) { + this.props.history.push(`/paths/${response.data.subject_id}`) + } + }).catch((error)=>{ + console.log(error); + }) + } + + } + + componentDidMount() { + let pathId = this.props.match.params.pathId; + if (pathId) { + this.isEditPage = true + + // const url = `/paths/${pathId}.json` + const url = `/paths/${pathId}/edit.json` + axios.get(url).then((response)=>{ + /** + description: + id: 13 + learning_notes: + name: + */ + if (response.data.name) { + this.setState({ + pathName: response.data.name + }) + + const Des_editMD = create_editorMD("shixun_introduction","100%","490px" + ,"请在此输入实训课程的简介,最大限制5000个字符","/api/attachments.json", response.data.description,""); + this.Des_editMD=Des_editMD; + const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px" + ,"请在此输入实训课程的学习须知,最大限制500个字符","/api/attachments.json",response.data.learning_notes,""); + this.Point_editMD=Point_editMD; + } + }).catch((error)=>{ + console.log(error); + }) + } else { + this.isEditPage = false + + const Des_editMD = create_editorMD("shixun_introduction","100%","490px","请在此输入实训课程的简介,最大限制5000个字符","/api/attachments.json","",""); + this.Des_editMD=Des_editMD; + const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实训课程的学习须知,最大限制500个字符","/api/attachments.json","",""); + this.Point_editMD=Point_editMD; + } + + } + + InputName=(e)=>{ + this.setState({ + pathName:e.target.value, + }) + } + + render(){ + let {pathName,description,point,flag_name}=this.state; + return( +
    +
    +
    +
    +

    创建实训课程

    +
    +

    实训课程名称

    +
    + * +
    + +
    +
    +
    +
    + +
    +

    简介

    +
    + * +
    +
    + +
    +

    +

    +
    +
    +
    + +
    +

    学习须知

    +
    + * +
    +
    + +
    +

    +

    +
    +
    +
    + +
    + 提交 + {this.isEditPage ? + 取消 + : 取消 + } +
    + +
    +
    + +
    + ) + } +} export default PathNew; \ No newline at end of file diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 3f5b9ee0e..c5b72946e 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -756,6 +756,8 @@ submittojoinclass=(value)=>{
  • 账号管理
  • {/*
  • this.educoderlogin()} >登入测试接口
  • */} {/*
  • this.trialapplications()} >试用申请
  • */} + {/*
  • 兴趣页
  • */} +
  • {/*退出*/} {/*this.educoderlogin()}>退出*/} diff --git a/public/react/src/modules/tpm/SiderBar.js b/public/react/src/modules/tpm/SiderBar.js index bc5800153..14aeeb5ae 100644 --- a/public/react/src/modules/tpm/SiderBar.js +++ b/public/react/src/modules/tpm/SiderBar.js @@ -106,7 +106,7 @@ class SiderBar extends Component {

    - +

    微信扫一扫

    关注公众号

    diff --git a/public/react/src/modules/tpm/TPMUpdatepropaede/TPMUpdatepropaede.js b/public/react/src/modules/tpm/TPMUpdatepropaede/TPMUpdatepropaede.js index d1606da51..835debddb 100644 --- a/public/react/src/modules/tpm/TPMUpdatepropaede/TPMUpdatepropaede.js +++ b/public/react/src/modules/tpm/TPMUpdatepropaede/TPMUpdatepropaede.js @@ -1,202 +1,202 @@ -import React, {Component} from 'react'; - -import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd'; - -import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; - -// import "antd/dist/antd.css"; - -import axios from 'axios'; - -import {getUrl} from 'educoder'; - -let origin = getUrl(); - -let path = getUrl("/editormd/lib/") - -const $ = window.$; - -let timeout; - -let currentValue; - -const Option = Select.Option; - -const RadioGroup = Radio.Group; - -function create_editorMD(id, width, high, placeholder, imageUrl, callback) { - var editorName = window.editormd(id, { - width: width, - height: high, - path: path, // "/editormd/lib/" - - syncScrolling: "single", - tex: true, - tocm: true, - emoji: true, - taskList: true, - codeFold: true, - searchReplace: true, - htmlDecode: "style,script,iframe", - sequenceDiagram: true, - autoFocus: false, - toolbarIcons: function () { - // Or return editormd.toolbarModes[name]; // full, simple, mini - // Using "||" set icons align right. - return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] - }, - toolbarCustomIcons: { - testIcon: "
    ", - testIcon1: "
    " - }, - //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 - saveHTMLToTextarea: true, - // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 - dialogMaskOpacity: 0.6, - placeholder: placeholder, - imageUpload: true, - imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], - imageUploadURL: imageUrl,//url - onload: function () { - // this.previewing(); - $("#" + id + " [type=\"latex\"]").bind("click", function () { - editorName.cm.replaceSelection("```latex"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("```"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line - 1, 0); - }); - - $("#" + id + " [type=\"inline\"]").bind("click", function () { - editorName.cm.replaceSelection("$$$$"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); - editorName.cm.focus(); - }); - $("[type=\"inline\"]").attr("title", "行内公式"); - $("[type=\"latex\"]").attr("title", "多行公式"); - - window.md_elocalStorage(editorName, `UpdatepropaedeMDs_${id}`, "UpdatepropaedeMDs"); - - callback && callback() - } - }); - return editorName; -} - - -export default class TPMUpdatepropaede extends Component { - constructor(props) { - super(props) - this.state = { - shixunId:undefined - } - } - - updatepropaedeMD(initValue, id) { - - this.contentChanged = false; - const placeholder = ""; - // amp; - // 编辑时要传memoId - const imageUrl = `/api/attachments.json`; - // 创建editorMd - - const Updatepropaede_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => { - setTimeout(() => { - Updatepropaede_editormd.resize() - Updatepropaede_editormd.cm && Updatepropaede_editormd.cm.refresh() - }, 500) - - if (initValue != undefined) { - Updatepropaede_editormd.setValue(initValue) - } - Updatepropaede_editormd.cm.on("change", (_cm, changeObj) => { - console.log('....contentChanged') - this.contentChanged = true; - }) - }); - this.Updatepropaede_editormd = Updatepropaede_editormd; - window.Updatepropaede_editormd = Updatepropaede_editormd; - } - - componentDidMount() { - let id = this.props.match.params.shixunId; - let url="/shixuns/"+id+"/propaedeutics.json"; - axios.get(url).then((response) => { - console.log(response) - if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - - }else{ - this.setState({ - shixunId:id - }) - - if(response.data.content[0]!=null){ - this.updatepropaedeMD(response.data.content[0], "UpdatepropaedeMD"); - }else{ - this.updatepropaedeMD("", "UpdatepropaedeMD"); - } - } - }).catch((error) => { - console.log(error) - }); - - } - - updatepropaedeuticsvalue=()=>{ - let id = this.props.match.params.shixunId; - let url="/shixuns/"+id+"/update_propaedeutics.json"; - const update_propaedeuticsvalue = this.Updatepropaede_editormd.getValue(); - axios.post(url,{ - content:update_propaedeuticsvalue - } - ).then((response) => { - if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - - }else{ - this.props.showSnackbar(response.data.message); - } - }).catch((error) => { - console.log(error) - }); - } - render() { - - let {shixunId} = this.state; - - - return ( - -
    - -
    -
    - 背景知识 - 返回 -
    - -
    -
    - -
    -
    -
    -
    -
    - -
    - 保存 - 取消 -
    - -
    -
    - ) - } -} - - +import React, {Component} from 'react'; + +import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd'; + +import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; + +// import "antd/dist/antd.css"; + +import axios from 'axios'; + +import {getUrl} from 'educoder'; + +let origin = getUrl(); + +let path = getUrl("/editormd/lib/") + +const $ = window.$; + +let timeout; + +let currentValue; + +const Option = Select.Option; + +const RadioGroup = Radio.Group; + +function create_editorMD(id, width, high, placeholder, imageUrl, callback) { + var editorName = window.editormd(id, { + width: width, + height: high, + path: path, // "/editormd/lib/" + + syncScrolling: "single", + tex: true, + tocm: true, + emoji: true, + taskList: true, + codeFold: true, + searchReplace: true, + htmlDecode: "style,script,iframe", + sequenceDiagram: true, + autoFocus: false, + toolbarIcons: function () { + // Or return editormd.toolbarModes[name]; // full, simple, mini + // Using "||" set icons align right. + return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] + }, + toolbarCustomIcons: { + testIcon: "
    ", + testIcon1: "
    " + }, + //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 + saveHTMLToTextarea: true, + // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 + dialogMaskOpacity: 0.6, + placeholder: placeholder, + imageUpload: true, + imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], + imageUploadURL: imageUrl,//url + onload: function () { + // this.previewing(); + $("#" + id + " [type=\"latex\"]").bind("click", function () { + editorName.cm.replaceSelection("```latex"); + editorName.cm.replaceSelection("\n"); + editorName.cm.replaceSelection("\n"); + editorName.cm.replaceSelection("```"); + var __Cursor = editorName.cm.getDoc().getCursor(); + editorName.cm.setCursor(__Cursor.line - 1, 0); + }); + + $("#" + id + " [type=\"inline\"]").bind("click", function () { + editorName.cm.replaceSelection("$$$$"); + var __Cursor = editorName.cm.getDoc().getCursor(); + editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); + editorName.cm.focus(); + }); + $("[type=\"inline\"]").attr("title", "行内公式"); + $("[type=\"latex\"]").attr("title", "多行公式"); + + window.md_elocalStorage(editorName, `UpdatepropaedeMDs_${id}`, "UpdatepropaedeMDs"); + + callback && callback() + } + }); + return editorName; +} + + +export default class TPMUpdatepropaede extends Component { + constructor(props) { + super(props) + this.state = { + shixunId:undefined + } + } + + updatepropaedeMD(initValue, id) { + + this.contentChanged = false; + const placeholder = ""; + // amp; + // 编辑时要传memoId + const imageUrl = `/api/attachments.json`; + // 创建editorMd + + const Updatepropaede_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => { + setTimeout(() => { + Updatepropaede_editormd.resize() + Updatepropaede_editormd.cm && Updatepropaede_editormd.cm.refresh() + }, 500) + + if (initValue != undefined) { + Updatepropaede_editormd.setValue(initValue) + } + Updatepropaede_editormd.cm.on("change", (_cm, changeObj) => { + console.log('....contentChanged') + this.contentChanged = true; + }) + }); + this.Updatepropaede_editormd = Updatepropaede_editormd; + window.Updatepropaede_editormd = Updatepropaede_editormd; + } + + componentDidMount() { + let id = this.props.match.params.shixunId; + let url="/shixuns/"+id+"/propaedeutics.json"; + axios.get(url).then((response) => { + console.log(response) + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + + }else{ + this.setState({ + shixunId:id + }) + + if(response.data.content[0]!=null){ + this.updatepropaedeMD(response.data.content, "UpdatepropaedeMD"); + }else{ + this.updatepropaedeMD("", "UpdatepropaedeMD"); + } + } + }).catch((error) => { + console.log(error) + }); + + } + + updatepropaedeuticsvalue=()=>{ + let id = this.props.match.params.shixunId; + let url="/shixuns/"+id+"/update_propaedeutics.json"; + const update_propaedeuticsvalue = this.Updatepropaede_editormd.getValue(); + axios.post(url,{ + content:update_propaedeuticsvalue + } + ).then((response) => { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + + }else{ + this.props.showSnackbar(response.data.message); + } + }).catch((error) => { + console.log(error) + }); + } + render() { + + let {shixunId} = this.state; + + + return ( + +
    + +
    +
    + 背景知识 + 返回 +
    + +
    +
    + +
    +
    +
    +
    +
    + +
    + 保存 + 取消 +
    + +
    +
    + ) + } +} + + diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index 788002b4a..949b0a949 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -1553,7 +1553,7 @@ export default class TPMsettings extends Component {
    -
    +
    {/**/} { // this.props.identity<4&&this.props.status==0? - this.props.identity<4? + this.props.identity<5?
    保存 diff --git a/public/react/src/modules/tpm/TPMsettings/css/TPMsettings.css b/public/react/src/modules/tpm/TPMsettings/css/TPMsettings.css index 0df6110be..015174c44 100644 --- a/public/react/src/modules/tpm/TPMsettings/css/TPMsettings.css +++ b/public/react/src/modules/tpm/TPMsettings/css/TPMsettings.css @@ -10,24 +10,22 @@ line-height: 30px; } #shixundescription .CodeMirror{ - width: 570px !important; margin-top: 31px !important; height: 364px !important; } #shixundescription .editormd-preview{ - width: 567px !important; + width:578px !important; top: 40px !important; height: 364px !important; } #shixunmemoMD .CodeMirror{ - width: 548px !important; margin-top: 31px !important; height: 578px !important; } #shixunmemoMD .editormd-preview{ - width: 544px !important; + width: 578px !important; top: 40px !important; height: 578px !important; } diff --git a/public/react/src/modules/tpm/challengesnew/TPManswer.js b/public/react/src/modules/tpm/challengesnew/TPManswer.js index c44b74966..d29516422 100644 --- a/public/react/src/modules/tpm/challengesnew/TPManswer.js +++ b/public/react/src/modules/tpm/challengesnew/TPManswer.js @@ -352,7 +352,7 @@ export default class TPManswer extends Component {
    -
    3||this.props.identity===undefined||power===false?"none":"block"}}> +
    4||this.props.identity===undefined||power===false?"none":"block"}}> 提交 取消 diff --git a/public/react/src/modules/tpm/challengesnew/TPManswer2.js b/public/react/src/modules/tpm/challengesnew/TPManswer2.js index 67b0e7fe9..98c615065 100644 --- a/public/react/src/modules/tpm/challengesnew/TPManswer2.js +++ b/public/react/src/modules/tpm/challengesnew/TPManswer2.js @@ -339,7 +339,7 @@ export default class TPManswer extends Component { }) } -
    3||this.props.identity===undefined||power===false?"none":"block"}}> +
    4||this.props.identity===undefined||power===false?"none":"block"}}> 新增
    @@ -347,7 +347,7 @@ export default class TPManswer extends Component {
    -
    3||this.props.identity===undefined||power===false?"none":"block"}}> +
    4||this.props.identity===undefined||power===false?"none":"block"}}> 提交 取消 diff --git a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js index e0944cac6..024f49589 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js +++ b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js @@ -575,12 +575,12 @@ export default class TPMchallengesnew extends Component { 3||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}} + style={{display:this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}} data-tip-down="新增代码编辑类型的任务">+ 实践类型 3||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}} + style={{display:this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}} data-tip-down="新增选择题类型的任务">+ 选择题类型
    @@ -739,7 +739,7 @@ export default class TPMchallengesnew extends Component {
    3||this.props.identity===undefined?"none":'block'}} + style={{display:this.props.identity>4||this.props.identity===undefined?"none":'block'}} > {checkpointId===undefined?提交: 提交} diff --git a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js index ccd34f1ee..61c5dd977 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js +++ b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js @@ -777,11 +777,11 @@ export default class TPMevaluation extends Component { 3||this.props.identity===undefined||this.props.status===2||this.props.status===1? "none":'block'}} + style={{display:this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1? "none":'block'}} data-tip-down="新增代码编辑类型的任务">+ 实践类型 3||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}} + style={{display:this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}} data-tip-down="新增选择题类型的任务">+ 选择题类型
    @@ -914,11 +914,9 @@ export default class TPMevaluation extends Component {

    效果展现方式

    -
    +