杨树林 5 years ago
commit 572dd32fee

File diff suppressed because it is too large Load Diff

@ -114,21 +114,21 @@ module.exports = {
// First, run the linter.
// It's important to do this before Babel processes the JS.
// 上线然后要注释回来
// {
// test: /\.(js|jsx|mjs)$/,
// enforce: 'pre',
// use: [
// {
// options: {
// formatter: eslintFormatter,
// eslintPath: require.resolve('eslint'),
//
// },
// loader: require.resolve('eslint-loader'),
// },
// ],
// include: paths.appSrc,
// },
{
test: /\.(js|jsx|mjs)$/,
enforce: 'pre',
use: [
{
options: {
formatter: eslintFormatter,
eslintPath: require.resolve('eslint'),
},
loader: require.resolve('eslint-loader'),
},
],
include: paths.appSrc,
},
{
// "oneOf" will traverse all following loaders until one will
// match the requirements. When no loader matches it will fall

@ -56,8 +56,8 @@ module.exports = {
bail: true,
// We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment.
// devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
devtool: shouldUseSourceMap ? 'source-map' : false,//测试版
devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
// devtool: shouldUseSourceMap ? 'source-map' : false,//测试版
// In production, we only want to load the polyfills and the app code.
entry: [require.resolve('./polyfills'), paths.appIndexJs],
output: {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,16 +1,27 @@
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
class Loading extends Component {
render() {
// Loading
return (
<div className="App" style={{minHeight: '800px'}}>
</div>
);
}
}
export default Loading;
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import { Spin } from 'antd';
class Loading extends Component {
render() {
// Loading
return (
<div className="App" style={{minHeight: '800px'}}>
<style>
{
`
.margintop{
margin-top:20%;
}
`
}
</style>
<Spin size="large" className={"margintop"}/>
</div>
);
}
}
export default Loading;

@ -1,4 +1,8 @@
import { bytesToSize } from 'educoder';
export function isImageExtension(fileName) {
return fileName ? !!(fileName.match(/.(jpg|jpeg|png|gif)$/i)) : false
}
export function markdownToHTML(oldContent, selector) {
window.$('#md_div').html('')
// markdown to html

@ -14,7 +14,7 @@ export { updatePageParams as updatePageParams } from './RouterUti
export { bytesToSize as bytesToSize } from './UnitUtil';
export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from './TextUtil'
export { markdownToHTML, uploadNameSizeSeperator, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll, isImageExtension } from './TextUtil'
export { handleDateString, getNextHalfHourOfMoment,formatDuring } from './DateUtil'

@ -6,6 +6,8 @@ import Loading from '../../Loading';
import axios from 'axios';
import { TPMIndexHOC } from '../tpm/TPMIndexHOC';
import { CNotificationHOC } from './common/CNotificationHOC'
import {ImageLayerOfCommentHOC} from '../page/layers/ImageLayerOfCommentHOC'
import "./css/Courses.css"
//引入对应跳转的组件
@ -862,4 +864,4 @@ class CoursesIndex extends Component{
}
}
export default CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(CoursesIndex) ));
export default ImageLayerOfCommentHOC({imgSelector: '.imageLayerParent img, .imageLayerParent .imageTarget', parentSelector: '.newMain'}) (CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC(CoursesIndex) )));

@ -26,7 +26,8 @@ class BoardsNew extends Component{
this.state = {
fileList: [],
boards: []
boards: [],
title_num: 60
}
}
addSuccess = () => {
@ -93,7 +94,8 @@ class BoardsNew extends Component{
status: 'done'
}
})
this.setState({ fileList: _fileList, board_name: data.board_name })
this.setState({ fileList: _fileList, board_name: data.board_name, title_num: 60 - parseInt(data.subject.length) })
}
}
})
@ -228,8 +230,14 @@ class BoardsNew extends Component{
});
}
// 附件相关 ------------ END
changeTitle=(e)=>{
console.log(e.target.value.length);
this.setState({
title_num: 60 - parseInt(e.target.value.length)
})
}
render() {
let { addGroup, fileList, course_id } = this.state;
let { addGroup, fileList, course_id, title_num } = this.state;
const { getFieldDecorator } = this.props.form;
const formItemLayout = {
@ -303,21 +311,27 @@ class BoardsNew extends Component{
返回
</a>
</p>
{/* notRequired */}
<Form {...formItemLayout} onSubmit={this.handleSubmit}>
<div className="formBlock" style={{paddingBottom: '0px'}}>
<Form.Item
label="标题"
className="topicTitle "
>
{getFieldDecorator('sticky', {
valuePropName: 'checked',
})(
<Checkbox style={{ right: '0px',
top: '-50px',
position: 'absolute'
}}>置顶</Checkbox>
)}
{ isAdmin &&
<React.Fragment>
{getFieldDecorator('sticky', {
valuePropName: 'checked',
})(
isAdmin && <Checkbox style={{ right: '0px',
top: '-50px',
position: 'absolute'
}}>置顶</Checkbox>
)}
{/* checkbox 有个边距样式 .ant-checkbox-wrapper + span, */}
<span style={{ "padding-left": 0, "padding-right": 0 }}></span>
</React.Fragment>
}
{getFieldDecorator('subject', {
rules: [{
required: true, message: '请输入标题',
@ -325,7 +339,8 @@ class BoardsNew extends Component{
max: 60, message: '最大限制为60个字符',
}],
})(
<Input placeholder="请输入帖子标题最大限制60个字符" className="searchViewAfter"/>
<Input placeholder="请输入帖子标题最大限制60个字符" className="searchViewAfter" maxLength="60"
onInput={this.changeTitle} addonAfter={String(title_num)} />
)}
</Form.Item>

@ -237,16 +237,16 @@ class TopicDetail extends Component {
// </a>
// </p>
<div className="color-grey" key={index}>
<a className="color-grey ml20">
<div className="color-grey df" key={index}>
<a className="color-grey ">
<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
</a>
{fileName && <ConditionToolTip title={fileName} condition={fileName.length > 30 }>
<a href={item.url}
className="mr12 color9B9B" length="58">
{/* {fileName && <ConditionToolTip title={fileName} condition={fileName.length > 30 }> </ConditionToolTip>} */}
<a href={item.url} title={fileName.length > 30 ? fileName : ''}
className="mr12 color9B9B overflowHidden1" length="58" style={{maxWidth: '480px'}}>
{fileName}
</a>
</ConditionToolTip>}
<span className="color656565 mt2 color-grey-6 font-12 mr8">{item.filesize}</span>
@ -416,7 +416,7 @@ class TopicDetail extends Component {
const user = this._getUser();
this.setState({
comments: addNewComment(comments, _id, content, user, this)
comments: addNewComment(comments, _id, content, user, this.props.isSuperAdmin(), this)
})
const newMemo2 = Object.assign({}, this.state.memo);
newMemo2.total_replies_count = newMemo2.total_replies_count + 1;
@ -540,6 +540,10 @@ class TopicDetail extends Component {
padding-bottom: 20px;
margin-bottom: 0px !important;
}
.course-message.topicDetail .panel-comment_item .comment_orig_content {
width: 1072px;
}
`}</style>
<CBreadcrumb className={'independent'} items={[
{ to: `/courses/${courseId}`, name: this.props.coursedata.name},
@ -646,7 +650,7 @@ class TopicDetail extends Component {
<div className="padding30 memoContent new_li" style={{ paddingBottom: '10px'}}>
<MarkdownToHtml content={memo.content}></MarkdownToHtml>
</div>
<div className="padding40 bor-bottom-greyE" style={{paddingTop: '2px'}}>
<div className="padding30 bor-bottom-greyE" style={{paddingTop: '2px'}}>
<div className="mt10 mb20">
{/* ${memo.user_praise ? '' : ''} */}
<Tooltip title={`${memo.liked ? '取消点赞' : '点赞'}`}>
@ -701,11 +705,13 @@ class TopicDetail extends Component {
</div>} */}
</div>
{ total_count > REPLY_PAGE_COUNT &&
<div className="memoMore">
<Pagination showQuickJumper onChange={this.onPaginationChange} current={pageCount} total={total_count} pageSize={10}/>
<div className="memoMore" style={{'margin-top': '20px'}}>
{ total_count > REPLY_PAGE_COUNT &&
<Pagination showQuickJumper onChange={this.onPaginationChange} current={pageCount} total={total_count} pageSize={10}/>
}
<div className="writeCommentBtn" onClick={this.showCommentInput}>写评论</div>
</div> }
</div>
</div>
</div>

@ -218,6 +218,9 @@ class Boards extends Component{
}
onPressEnter = (e) => {
clearTimeout(this.timeoutHandler)
this.timeoutHandler = null;
this.fetchAll(this.state.searchValue, 1)
}
onInputSearchChange = (e) => {
@ -227,6 +230,7 @@ class Boards extends Component{
if (this.timeoutHandler) {
clearTimeout(this.timeoutHandler)
this.timeoutHandler = null;
}
this.timeoutHandler = setTimeout(() => {
this.fetchAll(this.state.searchValue, 1)
@ -359,7 +363,7 @@ class Boards extends Component{
<FilesListItem></FilesListItem> */}
<div className="mt20 edu-back-white padding20-30">
{isAdmin && <div className="mt20 edu-back-white padding20-30">
<div className="clearfix">
{isAdmin && <Checkbox className="fl" onChange={this.onCheckAll} checked={checkAllValue}>已选 {checkBoxValues.length} </Checkbox>}
<div className="studentList_operation_ul">
@ -406,6 +410,7 @@ class Boards extends Component{
</div>
</div>
</div>
}
<style>{`
.panel-inner-fourm {
border-bottom: none;

@ -179,7 +179,7 @@ class CommonWorkAppraise extends Component{
{/* <div className="padding40 memoContent new_li">
</div> */}
<div className={"appraise "} style={{}}>
<div className={"appraise imageLayerParent "} style={{}}>
<style>{`
.workAppraise>div:last-child {
border-bottom: none !important;
@ -199,8 +199,9 @@ class CommonWorkAppraise extends Component{
<a className="color-grey ml20">
<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
</a>
<a href={item.url}
className="mr12 color9B9B" length="58" title={`${item.title && item.title.length > 40 ? item.title : ''}`}>
className="mr12 color9B9B imageTarget" length="58" title={`${item.title && item.title.length > 40 ? item.title : ''}`}>
{item.title}
</a>
<span className="color656565 mt2 color-grey-6 font-12 mr8">{item.filesize}</span>
@ -253,7 +254,7 @@ class CommonWorkAppraise extends Component{
<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
</a>
<a href={item.url}
className="mr12 color9B9B" length="58">
className="mr12 color9B9B imageTarget" length="58">
{item.title}
</a>
<span className="color656565 mt2 color-grey-6 font-12 mr8">{item.filesize}</span>

@ -103,7 +103,14 @@ class UseBank extends Component{
}
closeSelectBank=()=>{
this.setState({
flag:false
flag:false,
nav_my: 'myself',
search: '',
page: 1,
checkBoxValues: [],
isChecked:'',
is_teacher:undefined,
hometypepvisible:false
})
}
@ -190,7 +197,7 @@ class UseBank extends Component{
width:218px !important;
}
.bankwidth{
width:29% !important;
width:24% !important;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap
@ -245,7 +252,7 @@ class UseBank extends Component{
<div style={{"height":"230px"}} className="d_middle edu-txt-center">
<div>
<p className="font-16 mb20 color-grey-3">通过职业认证的教师才能访问公共题库</p>
<a className="white-btn edu-orangeback-btn" target="_blank" href="https://www.educoder.net/account/professional_certification">立即认证</a>
<a className="white-btn edu-orangeback-btn" target="_blank" href="/account/professional_certification">立即认证</a>
</div>
</div>
:
@ -275,7 +282,7 @@ class UseBank extends Component{
<span className="fl with65">
<label className="task-hide fl" title={item.name && item.name.length > 30 ? item.name:""} style={{"maxWidth":"100%"}}>{item.name}</label>
</span>
<span title={item.course_list_name && item.course_list_name.length > 14 && item.course_list_name}
<span title={item.course_list_name && item.course_list_name.length > 10 && item.course_list_name}
className={nav_my==='myself'?"fl with30 color-grey-6 task-hide pl5 bankwidth":"fl with30 color-grey-6 task-hide pl5 bankwidth"}
>{item.course_list_name}</span>

@ -18,6 +18,10 @@
.courseForm .ant-form-item-label {
margin-left: -10px;
}
.courseForm .notRequired .ant-form-item-label {
margin-left: 0px;
}
/* 不知道被哪个样式影响,这里需要重置 */
.courseForm .ant-input:focus {

@ -825,9 +825,9 @@ class Coursesleftnav extends Component{
{ is_teacher===true?
course_modules===undefined?"":course_modules.map((item,key)=>{
return(
<div key={key} >
<div key={key} >
<a>
<li onClick={(e)=>this.showsandians(e,key,item.category_url,1)} className={this.props.mainurl===item.category_url&&key===this.props.indexs?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}>
<li title={item.name.length<7?"":item.name} onClick={(e)=>this.showsandians(e,key,item.category_url,1)} className={this.props.mainurl===item.category_url&&key===this.props.indexs?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}>
<a onClick={(e)=>this.showsandians(e,key,item.category_url,1)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}>
{
item.type==="shixun_homework"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-daima mr10 fl":"iconfont icon-daima mr10 fl"}></i>:
@ -844,7 +844,6 @@ class Coursesleftnav extends Component{
{/*||this.props.location.pathname===this.state.url&&key===this.state.indexs*/}
<span className={this.props.location.pathname===item.category_url?"color-blue task-hide activity-left-name":"task-hide activity-left-name"}
title={item.name.length<6?"":item.name}
onClick={(e)=>this.selectnavid(e,key,item.id,item.type,item.category_url)}
>{item.name}</span>
@ -901,6 +900,7 @@ class Coursesleftnav extends Component{
ref={provided.innerRef}
{...provided.draggableProps}
{...provided.dragHandleProps}
title={iem.category_name.length<10?"":iem.category_name}
>
<a className="fl pl46 pd0 Draggablelichild">
@ -940,6 +940,7 @@ class Coursesleftnav extends Component{
<a >
<li className={this.props.mainurl===item.category_url&&key===this.props.indexs?"liactive":"clearfix active"}
onClick={(e)=>this.setnavid(e,key,item.id,item.type,item.category_url)} onMouseEnter={(e)=>this.showsandian(e,key)}
title={item.name.length<7?"":item.name}
>
<a className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}>
{
@ -977,7 +978,7 @@ class Coursesleftnav extends Component{
}
return(
<a >
<li className="clearfix Draggableli" key={index} style={{ width: '244px'}}>
<li className="clearfix Draggableli" key={index} style={{ width: '244px'}} title={iem.category_name.length<10?"":iem.category_name}>
<a className="fl pl46 pd0 Draggablelichild" onClick={(e)=>this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} >
{/*<span className="fl ml38 maxwidth155 task-hide">{iem.category_name}</span>*/}

@ -1,11 +1,7 @@
import React,{ Component } from "react";
import { Modal,Checkbox,Select,Input,Tooltip } from "antd";
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';
import Modals from '../../modals/Modals';
const Option = Select.Option;
const Search = Input.Search;
class PathModal extends Component{
constructor(props){
@ -126,7 +122,7 @@ class PathModal extends Component{
render(){
let {Searchvalue,type,Modalstype}=this.state;
let {visible,shixunmodallist,hometypepvisible,newshixunmodallist}=this.props;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
return(
<div>
@ -148,8 +144,7 @@ class PathModal extends Component{
width="840px"
destroyOnClose={true}
>
<Loading visible={false} shape="dot-circle" color='#4AC7FF'>
<Spin indicator={antIcon} spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
<div className="newupload_conbox">
{ shixunmodallist && shixunmodallist.tags.length===0?"":<div className="clearfix mb20 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div">
@ -203,7 +198,6 @@ class PathModal extends Component{
<div className="over210 pl20 pr20"
onScroll={this.contentViewScrolledit}
style={{"Height":"204px"}}>
<Loading visible={hometypepvisible} shape="dot-circle" className="newnext-loading" color='#4AC7FF'>
<Checkbox.Group style={{ width: '100%' }} onChange={this.shixunhomeworkedit}>
{
newshixunmodallist&&newshixunmodallist.map((item,key)=>{
@ -229,7 +223,6 @@ class PathModal extends Component{
})
}
</Checkbox.Group>
</Loading>
</div>
{ this.state.patheditarrytype===true?<span className={"color-red"}>{this.state.patheditarryvalue}</span>:""}
<div className="mt20 marginauto clearfix edu-txt-center">
@ -237,7 +230,7 @@ class PathModal extends Component{
<a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.savecouseShixunModal}>确定</a>
</div>
</div>
</Loading>
</Spin>
</Modal>
</div>
)

@ -1,9 +1,7 @@
import React,{ Component } from "react";
import { Modal,Checkbox,Select,Input} from "antd";
import { Modal,Checkbox,Select,Input,Spin,Icon} from "antd";
import axios from'axios';
import NoneData from "../coursesPublic/NoneData";
import Loading from '@icedesign/base/lib/loading';
import '@icedesign/base/lib/loading/style.js';
import Modals from '../../modals/Modals';
const Option = Select.Option;
@ -244,7 +242,7 @@ class Selectresource extends Component{
render(){
let {Searchvalue,type,category_id,Resourcelist,hometypepvisible,patheditarry}=this.state;
let {visible,shixunmodallist}=this.props;
const antIcon = <Icon type="loading" style={{ fontSize: 24 }} spin />;
return(
<div>
{/*提示*/}
@ -275,8 +273,8 @@ class Selectresource extends Component{
`
}
</style>
<Loading visible={false} shape="dot-circle" color='#4AC7FF'>
<Spin indicator={antIcon} spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
<style>{`
.newupload_conboxtop{
margin-top: -30px;
@ -343,8 +341,8 @@ class Selectresource extends Component{
>
{
Resourcelist === undefined ? "":
<Loading visible={hometypepvisible} shape="dot-circle" className="newnext-loading" color='#4AC7FF'>
Resourcelist === undefined ?Resourcelist.files.length===0?<NoneData/>:
<Checkbox.Group style={{ width: '100%' }} value={patheditarry} onChange={this.shixunhomeworkedit}>
{
Resourcelist.files.map((item,key)=>{
@ -367,9 +365,8 @@ class Selectresource extends Component{
)
})
}
</Checkbox.Group>
{ Resourcelist.files.length===0?<NoneData/>:""}
</Loading>
</Checkbox.Group>:""
}
</div>
@ -382,7 +379,7 @@ class Selectresource extends Component{
<a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.savecouseShixunModal}>确定</a>
</div>
</div>
</Loading>
</Spin>
</Modal>:""}
</div>
)

@ -1,218 +1,216 @@
import React,{ Component } from "react";
import { Modal,Checkbox,Select,Input} 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;
function formatDate(date) {
var dateee = new Date(date).toJSON();
return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
}
class Showoldfiles extends Component{
constructor(props){
super(props);
this.state={
Searchvalue:undefined,
type:'all',
category_id:0,
page:1,
Resourcelist:undefined,
getallfiles:false,
searchtype:'getallfiles'
}
}
componentDidMount() {
}
componentDidUpdate = (prevProps) => {
if ( prevProps.visible != this.props.visible ) {
}
}
cloasshanchudiao=()=>{
this.props.closaoldfilesprops()
}
render(){
let {visible,allfiles}=this.props;
return(
<div>
{/*提示*/}
<Modals
modalsType={this.state.Modalstype}
modalsTopval={this.state.Modalstopval}
modalCancel={this.state.ModalCancel}
modalSave={this.state.ModalSave}
loadtype= {this.state.loadtype}
/>
{visible===true?
<Modal
title="选择版本"
visible={visible}
closable={false}
footer={null}
width="600px"
destroyOnClose={true}
keyboard={false}
>
<a id='closeIcon' onClick={this.cloasshanchudiao}><i className='iconfont icon-shanchudiao'></i></a>
<style>
{
`
.ant-modal-body{
padding: 30px 0px;
}
`
}
</style>
<Loading visible={false} shape="dot-circle" color='#4AC7FF'>
<style>{`
.newupload_conboxtop{
margin-top: -30px;
}
#shixun_tab_div{
padding: 0 30px;
padding-top:30px;
}
.selectfiles{
width: 600px;
height: 48px;
background: rgba(255,104,0,0.1);
line-height: 48px;
text-align: center;
}
.selectfilesfont{
font-size:14px;
font-family:Microsoft YaHei;
font-weight:400;
line-height:25px;
color:rgba(255,104,0,1);
}
`}</style>
<div className="newupload_conbox newupload_conboxtop">
<div className="clearfix cdefault" style={{"marginRight":"4px"}}>
<div className={"selectfiles"}>
<span className={"selectfilesfont"}>
该文件有历史版本请选择您需要的文件点击文件名 下载
</span>
</div>
</div>
<style>{`
.greybackHead{
padding:0px 30px;
}
.fontlefts{
width: 300px;
text-align: center;
}
.filesves{
width: 220px;
text-align: center;
}
`}</style>
<ul className="clearfix greybackHead edu-txt-center">
<li className="fl paddingleft22 fontlefts">资源名称</li>
<li className="fl filesves" >版本</li>
</ul>
<div className="over210 pl20 pr20"
onScroll={this.contentViewScroll}
style={{"Height":"204px"}}>
<style>{`
.color-grey-9a{color: #9A9A9A !important;}
.datastyle{
width: 120px;
overflow: hidden;
height: 37px;
}
`}</style>
<style>{`
.fontlefts{
width: 340px;
text-align: center;
}
.filesves{
width: 200px;
text-align: center;
}
.isabox{
max-width: 280px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: inline-block;
float: left;
}
`}</style>
{
allfiles === undefined ? "":
<div>
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" id={allfiles.id}>
<li className="fl fontlefts">
<a className={"isabox"} href={allfiles.url}>{allfiles.title}</a>
<span className={"newcolor-orange fl"}>当前版本</span>
</li>
<li className="fl filesves ">
{formatDate(allfiles.created_on)}
</li>
</div>
{
allfiles.attachment_histories.length===0?"":allfiles.attachment_histories.map((item,key)=>{
return(
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" id={item.id} key={key}>
<li className="fl fontlefts">
<a className={"isabox"} href={item.url}>{item.title}</a>
</li>
<li className="fl filesves ">
{formatDate(item.created_on)}
</li>
</div>
)
})
}
</div>
}
</div>
</div>
</Loading>
</Modal>:""}
</div>
)
}
}
import React,{ Component } from "react";
import { Modal,Checkbox,Select,Input} from "antd";
import axios from'axios';
import Modals from '../../modals/Modals';
const Option = Select.Option;
const Search = Input.Search;
function formatDate(date) {
var dateee = new Date(date).toJSON();
return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
}
class Showoldfiles extends Component{
constructor(props){
super(props);
this.state={
Searchvalue:undefined,
type:'all',
category_id:0,
page:1,
Resourcelist:undefined,
getallfiles:false,
searchtype:'getallfiles'
}
}
componentDidMount() {
}
componentDidUpdate = (prevProps) => {
if ( prevProps.visible != this.props.visible ) {
}
}
cloasshanchudiao=()=>{
this.props.closaoldfilesprops()
}
render(){
let {visible,allfiles}=this.props;
return(
<div>
{/*提示*/}
<Modals
modalsType={this.state.Modalstype}
modalsTopval={this.state.Modalstopval}
modalCancel={this.state.ModalCancel}
modalSave={this.state.ModalSave}
loadtype= {this.state.loadtype}
/>
{visible===true?
<Modal
title="选择版本"
visible={visible}
closable={false}
footer={null}
width="600px"
destroyOnClose={true}
keyboard={false}
>
<a id='closeIcon' onClick={this.cloasshanchudiao}><i className='iconfont icon-shanchudiao'></i></a>
<style>
{
`
.ant-modal-body{
padding: 30px 0px;
}
`
}
</style>
<style>{`
.newupload_conboxtop{
margin-top: -30px;
}
#shixun_tab_div{
padding: 0 30px;
padding-top:30px;
}
.selectfiles{
width: 600px;
height: 48px;
background: rgba(255,104,0,0.1);
line-height: 48px;
text-align: center;
}
.selectfilesfont{
font-size:14px;
font-family:Microsoft YaHei;
font-weight:400;
line-height:25px;
color:rgba(255,104,0,1);
}
`}</style>
<div className="newupload_conbox newupload_conboxtop">
<div className="clearfix cdefault" style={{"marginRight":"4px"}}>
<div className={"selectfiles"}>
<span className={"selectfilesfont"}>
该文件有历史版本请选择您需要的文件点击文件名 下载
</span>
</div>
</div>
<style>{`
.greybackHead{
padding:0px 30px;
}
.fontlefts{
width: 300px;
text-align: center;
}
.filesves{
width: 220px;
text-align: center;
}
`}</style>
<ul className="clearfix greybackHead edu-txt-center">
<li className="fl paddingleft22 fontlefts">资源名称</li>
<li className="fl filesves" >版本</li>
</ul>
<div className="over210 pl20 pr20"
onScroll={this.contentViewScroll}
style={{"Height":"204px"}}>
<style>{`
.color-grey-9a{color: #9A9A9A !important;}
.datastyle{
width: 120px;
overflow: hidden;
height: 37px;
}
`}</style>
<style>{`
.fontlefts{
width: 340px;
text-align: center;
}
.filesves{
width: 200px;
text-align: center;
}
.isabox{
max-width: 280px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: inline-block;
float: left;
}
`}</style>
{
allfiles === undefined ? "":
<div>
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" id={allfiles.id}>
<li className="fl fontlefts">
<a className={"isabox"} href={allfiles.url}>{allfiles.title}</a>
<span className={"newcolor-orange fl"}>当前版本</span>
</li>
<li className="fl filesves ">
{formatDate(allfiles.created_on)}
</li>
</div>
{
allfiles.attachment_histories.length===0?"":allfiles.attachment_histories.map((item,key)=>{
return(
<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" id={item.id} key={key}>
<li className="fl fontlefts">
<a className={"isabox"} href={item.url}>{item.title}</a>
</li>
<li className="fl filesves ">
{formatDate(item.created_on)}
</li>
</div>
)
})
}
</div>
}
</div>
</div>
</Modal>:""}
</div>
)
}
}
export default Showoldfiles;

@ -1,8 +1,6 @@
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;
@ -276,7 +274,7 @@ class ShixunModal extends Component{
`
}
</style>
{/*<Loading visible={hometypepvisible} shape="dot-circle" className="newnext-loading" color='#4AC7FF'>*/}
<Checkbox.Group style={{ width: '100%' }} value={patheditarry} onChange={this.shixunhomeworkedit}>
{
newshixunmodallist === undefined ? "": newshixunmodallist.map((item,key)=>{
@ -303,7 +301,6 @@ class ShixunModal extends Component{
})
}
</Checkbox.Group>
{/*</Loading>*/}
</div>
</div>
</Spin>

@ -193,7 +193,7 @@ class Exercise extends Component{
}
// 题库选用成功后刷新页面
useBankSuccess=(checkValue,value)=>{
debugger
let{type,StudentList_value,page,limit}=this.state;
let coursesId=this.props.match.params.coursesId;
let url=`/courses/${coursesId}/exercises/publish_modal.json`;

@ -116,7 +116,7 @@ class ExerciseListItem extends Component{
{
item.lock_status === 0 ?
<Tooltip title={ this.props.isNotMember()?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom">
<Tooltip title={ this.props.isNotMember()===true?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl"></i>
</Tooltip>
:""

@ -197,18 +197,18 @@ class Exercisestatisticalresult extends Component {
item.ques_details.map((ite,k)=>{
return(
<div>
<div className="clearfix edu-back-white poll_list" style={{padding: '0px 20px'}}>
<div className="font-16 shixunreporttitle fl" >
<span> {ite.challenge_position}{ite.challenge_name}</span>
<div className={"mt20"}>
<div className="clearfix edu-back-white poll_list" style={{padding: '0px 20px'}}>
<div className="font-16 shixunreporttitle fl" >
<span> {ite.challenge_position}{ite.challenge_name}</span>
</div>
</div>
</div>
<Exercisetablesmubu
data={ite.challenge_details}
type={item.ques_type}
effictive_counts={item.effictive_counts}
choicetype={choicetype}
/>
<Exercisetablesmubu
data={ite.challenge_details}
type={item.ques_type}
effictive_counts={item.effictive_counts}
choicetype={choicetype}
/>
</div>
)
}):

@ -613,7 +613,7 @@ class GraduationTasksSubmitedit extends Component{
{item.delete===true?
<i className="font-14 iconfont icon-guanbi "
id={item.id}
onClick={()=>this.onAttachmentRemove(item)}
onClick={()=>this.onAttachmentRemove(item.id)}
aria-hidden="true">
</i>:""}
</div>

@ -2,7 +2,7 @@ import React,{Component} from "React";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import { WordsBtn,getUrl } from 'educoder';
import { WordsBtn,getUrl ,bytesToSize} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
import '../../css/Courses.css';
@ -40,27 +40,28 @@ class GraduationTasksedit extends Component{
axios.get(url).then((result)=>{
// console.log(result)
let newfilelist=[];
if(result.data.attachments.length!=0){
for(var list of result.data.attachments){
newfilelist.push({
uid:list.id,
name:list.title,
status: 'done',
url:list.url,
})
}
}
// let newfilelist=[];
// if(result.data.attachments.length!=0){
// for(var list of result.data.attachments){
// newfilelist.push({
// uid:list.id,
// name:list.title,
// status: 'done',
// url:list.url,
// })
// }
//
// }
let namelength=result.data.task_name.length;
let sixlength=title_num-namelength
this.setState({
fileList:newfilelist,
// fileList:newfilelist,
description:result.data.description,
tasktype:result.data.task_type,
name:result.data.task_name,
data:result.data,
title_num:sixlength
title_num:sixlength,
attachments:result.data.attachments,
})
@ -100,36 +101,36 @@ class GraduationTasksedit extends Component{
// 附件相关 START
handleChange = (info) => {
let fileList = info.fileList;
console.log(fileList)
// console.log(fileList)
// for(var list of fileList ){
// console.log(fileList)
// }
this.setState({ fileList });
}
onAttachmentRemove = (file) => {
// confirm({
// title: '确定要删除这个附件吗?',
// okText: '确定',
// cancelText: '取消',
// // content: 'Some descriptions',
// onOk: () => {
// this.deleteAttachment(file)
// },
// onCancel() {
// console.log('Cancel');
// },
// });
// return false;
this.setState({
Modalstype:true,
Modalstopval:'确定要删除这个附件吗?',
ModalSave: ()=>this.deleteAttachment(file),
ModalCancel:this.cancelAttachment
})
return false;
}
// onAttachmentRemove = (file) => {
// // confirm({
// // title: '确定要删除这个附件吗?',
// // okText: '确定',
// // cancelText: '取消',
// // // content: 'Some descriptions',
// // onOk: () => {
// // this.deleteAttachment(file)
// // },
// // onCancel() {
// // console.log('Cancel');
// // },
// // });
// // return false;
//
// this.setState({
// Modalstype:true,
// Modalstopval:'确定要删除这个附件吗?',
// ModalSave: ()=>this.deleteAttachment(file),
// ModalCancel:this.cancelAttachment
// })
// return false;
// }
cancelAttachment=()=>{
this.setState({
@ -141,10 +142,11 @@ class GraduationTasksedit extends Component{
})
}
deleteAttachment = (file) => {
onAttachmentRemove = (file) => {
this.cancelAttachment();
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
// const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
const url = `/attachments/${file}.json`
axios.delete(url, {
})
.then((response) => {
@ -268,7 +270,7 @@ class GraduationTasksedit extends Component{
}
render(){
const { getFieldDecorator } = this.props.form;
let {title_num,pageType,name,description,Loadtype,
let {title_num,pageType,name,description,Loadtype,attachments,
Modalstype,Modalstopval,ModalCancel,ModalSave,shixunsreplace} =this.state;
let {coursedata}=this.props;
@ -279,7 +281,7 @@ class GraduationTasksedit extends Component{
width: 600,
// 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,
@ -418,8 +420,65 @@ class GraduationTasksedit extends Component{
</Button>
(单个文件150M以内)
</Upload>
{attachments&&attachments.map((item,key)=>{
return(
<div className="color-grey mt5"
key={key}
>
<a className="color-grey ml3">
<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
</a>
<a
href={item.url}
className="mr12 color9B9B" length="58">
{item.title}
</a>
<span className="color656565 mt2 color-grey-6 font-12 mr8">
{item.filesize}
</span>
{item.delete===true?
<i className="font-14 iconfont icon-guanbi "
id={item.id}
onClick={()=>this.onAttachmentRemove(item.id)}
aria-hidden="true">
</i>:""}
</div>
)
})}
<style>
{
`
.maxwidth500{
max-width:500px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #05101a;
}
`
}
</style>
{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{
return(
<p className="color-grey mt10" key={key} >
<a className="color-grey fl">
<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
</a>
<span className="mr12 color9B9B maxwidth500 fl" length="58">
{item.name}
</span>
<span className="color656565 mt2 color-grey-6 font-12 mr8">
{item.response===undefined?"":bytesToSize(item.size)}
</span>
<i className="font-14 iconfont icon-guanbi "
id={item.response===undefined?"":item.response.id}
aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}></i>
</p>
)
})}
{/*{attachments&&attachments.map((item,key)=>{*/}
{/*return(*/}

@ -2,7 +2,7 @@ import React, {Component} from "React";
import {Form, Select, Input, Button, Checkbox, Upload, Icon, message, Modal} from "antd";
import {Link} from 'react-router-dom';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import {WordsBtn, getUrl} from 'educoder';
import {WordsBtn, getUrl,bytesToSize} from 'educoder';
import axios from 'axios';
import Modals from '../../../modals/Modals';
import '../../css/Courses.css';
@ -133,29 +133,29 @@ class GraduationTasksnew extends Component {
this.setState({fileList});
}
onAttachmentRemove = (file) => {
// confirm({
// title: '确定要删除这个附件吗?',
// okText: '确定',
// cancelText: '取消',
// // content: 'Some descriptions',
// onOk: () => {
// this.deleteAttachment(file)
// },
// onCancel() {
// console.log('Cancel');
// },
// });
// return false;
this.setState({
Modalstype: true,
Modalstopval: '确定要删除这个附件吗?',
ModalSave: () => this.deleteAttachment(file),
ModalCancel: this.cancelAttachment
})
return false;
}
// onAttachmentRemove = (file) => {
// // confirm({
// // title: '确定要删除这个附件吗?',
// // okText: '确定',
// // cancelText: '取消',
// // // content: 'Some descriptions',
// // onOk: () => {
// // this.deleteAttachment(file)
// // },
// // onCancel() {
// // console.log('Cancel');
// // },
// // });
// // return false;
//
// this.setState({
// Modalstype: true,
// Modalstopval: '确定要删除这个附件吗?',
// ModalSave: () => this.deleteAttachment(file),
// ModalCancel: this.cancelAttachment
// })
// return false;
// }
cancelAttachment = () => {
this.setState({
@ -166,8 +166,9 @@ class GraduationTasksnew extends Component {
})
}
deleteAttachment = (file) => {
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
onAttachmentRemove = (file) => {
// const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
const url = `/attachments/${file}.json`
axios.delete(url, {})
.then((response) => {
if (response.data) {
@ -256,7 +257,7 @@ class GraduationTasksnew 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,
@ -385,7 +386,7 @@ class GraduationTasksnew extends Component {
</div>
<div className="stud-class-set pt20 pl20 pr20 coursenavbox edu-back-white">
<div className="stud-class-set pd20 coursenavbox edu-back-white">
<style>{`
.uploadBtn.ant-btn {
border: none;
@ -428,6 +429,39 @@ class GraduationTasksnew extends Component {
</Button>
(单个文件150M以内)
</Upload>
<style>
{
`
.maxwidth500{
max-width:500px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #05101a;
}
`
}
</style>
{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{
return(
<p className="color-grey mt10" key={key} >
<a className="color-grey fl">
<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
</a>
<span className="mr12 color9B9B maxwidth500 fl" length="58">
{item.name}
</span>
<span className="color656565 mt2 color-grey-6 font-12 mr8">
{item.response===undefined?"":bytesToSize(item.size)}
</span>
<i className="font-14 iconfont icon-guanbi "
id={item.response===undefined?"":item.response.id}
aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}></i>
</p>
)
})}
</div>

@ -316,6 +316,30 @@ class GraduationTaskssettingapp extends Component{
})
}
updatesfuncrosscomment=(types,checked,newlatetime,newcommenttime)=>{
let {endtimetype}=this.state;
if(types===1){
this.setState({
latetime:newlatetime,
crosscomment:checked,
commenttime:newcommenttime
})
}else{
if(endtimetype===true){
this.setState({
crosscomment:checked,
commenttime:newcommenttime
})
}else{
this.setState({
end_time:newlatetime,
crosscomment:checked,
commenttime:newcommenttime
})
}
}
}
funcrosscomment=(e)=>{
let {latetime,end_time,allowlate}=this.state;
@ -325,41 +349,23 @@ class GraduationTaskssettingapp extends Component{
if(latetime===null||latetime===""){
let newlatetime=moment(new Date()).add(7, 'days').format("YYYY-MM-DD HH:mm");
let newcommenttime=moment(new Date()).format("YYYY-MM-DD HH:mm");
this.setState({
latetime:newlatetime,
crosscomment:e.target.checked,
commenttime:newcommenttime
})
this.updatesfuncrosscomment=(1,e.target.checked,newlatetime,newcommenttime)
}else{
let newlatetime=moment(latetime).add(7, 'days').format("YYYY-MM-DD HH:mm");
let newcommenttime=moment(latetime).format("YYYY-MM-DD HH:mm");
this.setState({
latetime:newlatetime,
crosscomment:e.target.checked,
commenttime:newcommenttime
})
this.updatesfuncrosscomment=(1,e.target.checked,newlatetime,newcommenttime)
}
}else{
if(end_time===null||end_time===""){
let newend_time=moment(new Date()).add(7, 'days').format("YYYY-MM-DD HH:mm");
let newcommenttime=moment(new Date()).add(8, 'days').format("YYYY-MM-DD HH:mm");
this.setState({
end_time:newend_time,
crosscomment:e.target.checked,
commenttime:newcommenttime
})
this.updatesfuncrosscomment=(2,e.target.checked,newend_time,newcommenttime)
}else{
let newend_time=moment(end_time).add(7, 'days').format("YYYY-MM-DD HH:mm");
let newcommenttime=moment(end_time).add(8, 'days').format("YYYY-MM-DD HH:mm");
this.setState({
end_time:newend_time,
crosscomment:e.target.checked,
commenttime:newcommenttime
})
this.updatesfuncrosscomment=(2,e.target.checked,newend_time,newcommenttime)
}
}

@ -86,7 +86,7 @@ class GraduateTopicItem extends Component{
{
discussMessage.private_icon===true?
<Tooltip title={ this.props.isNotMember?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom">
<Tooltip title={ this.props.isNotMember()===true?"私有属性,非课堂成员不能访问":"私有属性"} placement="bottom">
<i className="iconfont icon-guansuo color-grey-c ml10 font-16 fl mt4"></i>
</Tooltip>
:""

@ -498,10 +498,10 @@ class studentsList extends Component{
showSearchInput={total_count >= 10}
searchPlaceholder={ '请输入姓名、学号进行搜索' }
firstRowRight={
<React.Fragment>
<React.Fragment>
{ isSuperAdmin && <React.Fragment>
{/* <CreateGroupByImportModal ref="createGroupByImportModal" {...this.props}></CreateGroupByImportModal> */}
{/* <WordsBtn style="blue" className="mr30" onClick={()=> this.refs['createGroupByImportModal'].setVisible(true)}>导入创建分班</WordsBtn> */}
<CreateGroupByImportModal ref="createGroupByImportModal" {...this.props}></CreateGroupByImportModal>
<WordsBtn style="blue" className="mr30" onClick={()=> this.refs['createGroupByImportModal'].setVisible(true)}>导入创建分班</WordsBtn>
</React.Fragment> }
{ isAdmin && isParent && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>新建分班</WordsBtn> }
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> }

@ -61,6 +61,7 @@ class Listofworks extends Component {
props: props,
data: [],
page: 1,
computeTimetype:true,
limit: 20,
loadingstate: true,
order: "update_time",
@ -1182,8 +1183,6 @@ class Listofworks extends Component {
}).catch((error) => {
console.log(error)
});
}
// 立即发布
homeworkstartend = (ds,endtime) => {
@ -1313,10 +1312,24 @@ class Listofworks extends Component {
}
setComputeTime=()=>{
this.setState({
computeTimetype:false
})
let homeworkid = this.props.match.params.homeworkid;
let url = "/homework_commons/"+homeworkid+"/update_score.json";
axios.get(url).then((response) => {
this.props.showNotification(`${response.data.message}`);
}).catch((error) => {
console.log(error)
});
}
render() {
// console.log("Listofworks.js000")
let {columns, page, boolgalist,limit,experience,course_groupysls, course_groupyslstwo, unlimited, unlimitedtwo, loadingstate, viewtrainingdata, game_list, data, course_group_info, order, teacherdata, task_status, checkedValuesine, searchtext, teacherlist, visible, visibles, jobsettingsdata} = this.state;
let {columns,computeTimetype, page, boolgalist,limit,experience,course_groupysls, course_groupyslstwo, unlimited, unlimitedtwo, loadingstate, viewtrainingdata, game_list, data, course_group_info, order, teacherdata, task_status, checkedValuesine, searchtext, teacherlist, visible, visibles, jobsettingsdata} = this.state;
//
// console.log(teacherdata&&teacherdata.shixun_identifier)
// console.log(course_group_info)
@ -1345,8 +1358,8 @@ class Listofworks extends Component {
{
`
body {
overflow: hidden !important;
}
overflow: hidden !important;
}
`
}
</style>
@ -1418,6 +1431,7 @@ class Listofworks extends Component {
</div>
<div className="edu-back-white">
<div className="stud-class-set bor-bottom-greyE ">
<div className=" clearfix edu-back-white poll_list">
@ -1481,10 +1495,83 @@ class Listofworks extends Component {
</div>
</div>
<style>
{`
.startbox{
height: 48px;
background: rgba(255,104,0,0.1);
line-height: 48px;
text-align: center;
}
.startfont{
font-size:14px;
font-family:MicrosoftYaHei;
font-weight:400;
color:rgba(255,104,0,1);
}
.computeTime{
width: 73px;
height: 24px;
display: inline-block;
padding: 5px;
text-align: center;
line-height: 13px;
color: #4CACFF;
border: 1px solid #4CACFF;
cursor: pointer;
}
.computeTimes{
width: 73px;
height: 24px;
display: inline-block;
padding: 5px;
text-align: center;
line-height: 13px;
color: #C5C5C5;
border: 1px solid #EDEDED;
background:#EDEDED;
cursor: pointer;
}
`}
</style>
{computeTimetype===false?<li className="clearfix startbox">
<span className={"startfont"}>
正在执行成绩计算请稍后刷新页面查看结果
温馨提示执行时间因作品数量而异
</span>
</li>:""}
{/*作品状态GraduationTaskssettinglist*/}
<ul className="clearfix" style={{padding: '20px 15px 10px 20px'}}>
<li className="clearfix ">
<span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>
<span>
{computeTimetype===true?<div className={"computeTime font-13"} onClick={this.setComputeTime}>
计算成绩
</div>:<div className={"computeTimes font-13"} onClick={this.setComputeTime}>
计算成绩
</div>}
</span>
<div className="fr mr5 search-newysl" style={{marginBottom: '1px'}}>
<Search
placeholder="请输入姓名或学号搜索"
id="subject_search_input"
autoComplete="off"
value={searchtext}
onKeyUp={(e) => this.onSearchKeywordKeyUp(e)}
onInput={this.inputSearchValues}
onSearch={this.searchValues}
></Search>
</div>
</li>
<li className="clearfix mt10">
<span className="fl mr10 color-grey-8 ">作品状态</span>
<span className="fl "><a id="graduation_comment_no_limit"
@ -1508,17 +1595,7 @@ class Listofworks extends Component {
</CheckboxGroup>
{/*请输入姓名或学号搜索*/}
<div className="fr mr5 search-newysl" style={{marginBottom: '1px'}}>
<Search
placeholder="请输入姓名或学号搜索"
id="subject_search_input"
autoComplete="off"
value={searchtext}
onKeyUp={(e) => this.onSearchKeywordKeyUp(e)}
onInput={this.inputSearchValues}
onSearch={this.searchValues}
></Search>
</div>
</li>

@ -40,6 +40,8 @@ class Listofworksstudentone extends Component {
props: props,
data: [],
datas: [],
view_report:false,
computeTimetype:true,
page: 1,
pages: 1,
limit: 20,
@ -305,6 +307,7 @@ class Listofworksstudentone extends Component {
work_efficiency: result.data.work_efficiency,
code_review: result.data.code_review,
challenges_count:result.data.challenges_count,
view_report:result.data.view_report,
})
if (result.data.student_works === undefined || result.data.student_works === null || JSON.stringify(result.data.student_works) === "[]") {
this.seacthdata(result.data);
@ -359,6 +362,7 @@ class Listofworksstudentone extends Component {
end_immediately: result.data.end_immediately,
code_review: result.data.code_review,
challenges_count:result.data.challenges_count,
view_report:result.data.view_report,
})
if (result.data.student_works === undefined || result.data.student_works === null || JSON.stringify(result.data.student_works) === "[]") {
this.seacthdata(result.data);
@ -707,6 +711,7 @@ class Listofworksstudentone extends Component {
end_immediately: result.data.end_immediately,
code_review: result.data.code_review,
challenges_count:result.data.challenges_count,
view_report:result.data.view_report,
})
this.seacthdata(result.data);
}
@ -742,21 +747,77 @@ class Listofworksstudentone extends Component {
this.Getalistofworkstwo(this.state.order, "", "", "", pageNumber, this.state.limit);
}
setComputeTime=()=>{
this.setState({
computeTimetype:false
})
let homeworkid = this.props.match.params.homeworkid;
let url = "/homework_commons/"+homeworkid+"/update_student_score.json";
axios.get(url).then((response) => {
this.props.showNotification(`${response.data.message}`);
}).catch((error) => {
console.log(error)
});
}
render() {
let {visibles, game_list,columns, limit,experience, boolgalist,viewtrainingdata, teacherdata, page, data, jobsettingsdata, styletable, datas, order, loadingstate} = this.state;
let {visibles, game_list,columns, limit,experience, boolgalist,viewtrainingdata, teacherdata, page, data, jobsettingsdata, styletable, datas, order, loadingstate,computeTimetype} = this.state;
return (
teacherdata === undefined || teacherdata.student_works === undefined || teacherdata.student_works === null || JSON.stringify(teacherdata.student_works) === "[]" ?
// 学生不能查看别人的
<div className="newMain clearfix ">
<style>
{`
.startbox{
height: 48px;
background: rgba(255,104,0,0.1);
line-height: 48px;
text-align: center;
}
.startfont{
font-size:14px;
font-family:MicrosoftYaHei;
font-weight:400;
color:rgba(255,104,0,1);
}
.computeTime{
width: 73px;
height: 24px;
display: inline-block;
padding: 5px;
text-align: center;
line-height: 13px;
color: #4CACFF;
border: 1px solid #4CACFF;
cursor: pointer;
}
.computeTimes{
width: 73px;
height: 24px;
display: inline-block;
padding: 5px;
text-align: center;
line-height: 13px;
color: #C5C5C5;
border: 1px solid #EDEDED;
background:#EDEDED;
cursor: pointer;
}
`}
</style>
{visibles === true ?
<div>
<style>
{
`
body {
overflow: hidden !important;
}
overflow: hidden !important;
}
`
}
</style>
@ -810,10 +871,10 @@ class Listofworksstudentone extends Component {
<Link
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/settings`}
>设置</Link>
<Link className="fr color-blue font-16" target={"_blank"}
{this.state.view_report===true?<Link className="fr color-blue font-16" target={"_blank"}
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${teacherdata === undefined ? "" : teacherdata.id}/shixun_work_report`}>
查看实训报告
</Link>
</Link>:""}
{/*<a className="fr color-blue font-16">查看实训报告</a>*/}
{
teacherdata === undefined ? ""
@ -829,6 +890,14 @@ class Listofworksstudentone extends Component {
</div>
{computeTimetype===false?<li className="clearfix startbox mb20">
<span className={"startfont"}>
正在执行成绩计算请稍后刷新页面查看结果
温馨提示执行时间因作品数量而异
</span>
</li>:""}
{JSON.stringify(data) !== "[]" ?
<div>
<div id="graduation_work_list"
@ -839,17 +908,32 @@ class Listofworksstudentone extends Component {
}}>
<div className="clearfix">
<span className="fl color-grey-6 font-12"><span
className="color-orange-tip">{teacherdata === undefined ? "" : teacherdata.commit_count === undefined ? "" : teacherdata.commit_count}</span><span
className="ml10">{teacherdata === undefined ? "" : teacherdata.uncommit_count}</span><span></span>
{teacherdata === undefined ? "" : teacherdata.left_time === undefined ? "" : teacherdata.left_time === null ? "" :
<span className="ml20">{teacherdata.left_time.status}</span>
}
{teacherdata === undefined ? "0" : teacherdata.left_time === undefined ? "0" : teacherdata.left_time === null ? "0" :
<span className="ml20"
style={{"color": '#FF6800'}}>{teacherdata.left_time.time}</span>
}
</span>
<span className="fl color-grey-6 font-12">
<span
className="color-orange-tip">{teacherdata === undefined ? "" : teacherdata.commit_count === undefined ? "" : teacherdata.commit_count}</span><span
className="ml10">{teacherdata === undefined ? "" : teacherdata.uncommit_count}</span><span></span>
{teacherdata === undefined ? "" : teacherdata.left_time === undefined ? "" : teacherdata.left_time === null ? "" :
<span className="ml20">{teacherdata.left_time.status}</span>
}
{teacherdata === undefined ? "0" : teacherdata.left_time === undefined ? "0" : teacherdata.left_time === null ? "0" :
<span className="ml20"
style={{"color": '#FF6800'}}>{teacherdata.left_time.time}</span>
}
</span>
<div className="fr">
<span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>
<span>
{computeTimetype===true?<div className={"computeTime font-13"} onClick={this.setComputeTime}>
计算成绩
</div>:<div className={"computeTimes font-13"} onClick={this.setComputeTime}>
计算成绩
</div>}
</span>
</div>
</div>
@ -941,10 +1025,10 @@ class Listofworksstudentone extends Component {
<Link
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/settings`}
>设置</Link>
<Link className="fr color-blue font-16" target={"_blank"}
{this.state.view_report===true?<Link className="fr color-blue font-16" target={"_blank"}
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/shixun_work_report`}>
查看实训报告
</Link>
</Link>:""}
{
teacherdata === undefined ? ""
: teacherdata.commit_des === null || teacherdata.commit_des === undefined ? "" :
@ -958,17 +1042,14 @@ class Listofworksstudentone extends Component {
</div>
</div>
{computeTimetype===false?<li className="clearfix startbox mb20">
<span className={"startfont"}>
正在执行成绩计算请稍后刷新页面查看结果
温馨提示执行时间因作品数量而异
</span>
</li>:""}
{/*<div id="graduation_work_list" style={{padding: '0px 40px 10px 40px'}}>*/}
{/* <div className="clearfix">*/}
{/* <span className="fl color-grey-6 font-12"><span className="color-orange-tip">89</span>已交<span*/}
{/* className="ml10">9000</span><span>未交</span> <span className="ml20">剩余提交时间:</span><span*/}
{/* className="ml20">{this.state.day}天 {this.state.hour}:{this.state.minute}:{this.state.second}</span></span>*/}
{/* </div>*/}
{/*</div>*/}
<div className="edu-table edu-back-white ">
{data === undefined ? "" : <Table
style={styletable}
@ -987,33 +1068,51 @@ class Listofworksstudentone extends Component {
"margin-bottom": "10px"
}}>
<div className="clearfix">
<span className="fl color-grey-6 font-12"><span
className="color-orange-tip">{teacherdata === undefined ? "" : teacherdata.commit_count === undefined ? "" : teacherdata.commit_count}</span><span
className="ml10">{teacherdata === undefined ? "" : teacherdata.uncommit_count}</span><span></span>
{teacherdata === undefined ? "" : teacherdata.left_time === undefined ? "" : teacherdata.left_time === null ? "" :
<span className="ml20">{teacherdata.left_time.status}</span>}
{teacherdata === undefined ? "0" : teacherdata.left_time === undefined ? "0" : teacherdata.left_time === null ? "0" :
<span className="ml20"
style={{"color": '#FF6800'}}>{teacherdata.left_time.time}</span>}
</span>
<div className="fr edu-menu-panel">
<ul>
<li className="edu-position edu-position-hidebox">
<a className="font-12 ">
{order === "updated_at" ? "时间" : order === "work_score" ? "成绩" : order === "student_id" ? "学号" : ""}排序</a>
<i className="iconfont icon-xiajiantou ml5 font-12 "></i>
<ul className="edu-position-hide undis mt10">
<li><a onClick={(e) => this.funorder("updated_at")} data-remote="true"
className="color-grey-6 font-12" style={{"text-align": "center "}}>更新时间</a></li>
<li><a onClick={(e) => this.funorder("work_score")} data-remote="true"
className="color-grey-6 font-12" style={{"text-align": "center "}}>最终成绩</a></li>
<li><a onClick={(e) => this.funorder("student_id")} data-remote="true"
className="color-grey-6 font-12" style={{"text-align": "center "}}>学生学号</a></li>
</ul>
</li>
</ul>
</div>
<span className="fl color-grey-6 font-12">
<span className="color-orange-tip">
{teacherdata === undefined ? "" : teacherdata.commit_count === undefined ? "" : teacherdata.commit_count}
</span>
<span className="ml10">{teacherdata === undefined ? "" : teacherdata.uncommit_count}</span><span></span>
{teacherdata === undefined ? "" : teacherdata.left_time === undefined ? "" : teacherdata.left_time === null ? "" :
<span className="ml20">{teacherdata.left_time.status}</span>}
{teacherdata === undefined ? "0" : teacherdata.left_time === undefined ? "0" : teacherdata.left_time === null ? "0" :
<span className="ml20"
style={{"color": '#FF6800'}}>{teacherdata.left_time.time}</span>}
<div className="fr">
<span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>
<span>
{computeTimetype===true?<div className={"computeTime font-13"} onClick={this.setComputeTime}>
计算成绩
</div>:<div className={"computeTimes font-13"} onClick={this.setComputeTime}>
计算成绩
</div>}
</span>
</div>
</span>
{/*因为计算按钮占了和这个位置,和设计沟通学生视角取消这个按钮*/}
{/*<div className="fr edu-menu-panel">*/}
{/*<ul>*/}
{/*<li className="edu-position edu-position-hidebox">*/}
{/*<a className="font-12 ">*/}
{/*{order === "updated_at" ? "时间" : order === "work_score" ? "成绩" : order === "student_id" ? "学号" : ""}排序</a>*/}
{/*<i className="iconfont icon-xiajiantou ml5 font-12 "></i>*/}
{/*<ul className="edu-position-hide undis mt10">*/}
{/*<li><a onClick={(e) => this.funorder("updated_at")} data-remote="true"*/}
{/*className="color-grey-6 font-12" style={{"text-align": "center "}}>更新时间</a></li>*/}
{/*<li><a onClick={(e) => this.funorder("work_score")} data-remote="true"*/}
{/*className="color-grey-6 font-12" style={{"text-align": "center "}}>最终成绩</a></li>*/}
{/*<li><a onClick={(e) => this.funorder("student_id")} data-remote="true"*/}
{/*className="color-grey-6 font-12" style={{"text-align": "center "}}>学生学号</a></li>*/}
{/*</ul>*/}
{/*</li>*/}
{/*</ul>*/}
{/*</div>*/}
</div>

@ -80,7 +80,7 @@ function startechart(data){
{
name:'',
type:'scatter',
data:data.echart_data.efficiency_list,
data:data.echart_data===undefined?"":data.echart_data.efficiency_list,
itemStyle:{
normal:{color:'#2e65ad'}
},
@ -106,9 +106,9 @@ function startechart(data){
data : [
{
name: data.username,
xAxis:data.echart_data.myself_eff[0],
yAxis:data.echart_data.myself_eff[1],
value:data.echart_data.myself_eff[1],
xAxis:data.echart_data===undefined?"":data.echart_data.myself_eff[0],
yAxis:data.echart_data===undefined?"":data.echart_data.myself_eff[1],
value:data.echart_data===undefined?"":data.echart_data.myself_eff[1],
}
],
itemStyle: {
@ -132,7 +132,7 @@ function startechart(data){
{
name:'二班',
type:'scatter',
data: data.echart_data.myself_eff,
data: data.echart_data===undefined?"":data.echart_data.myself_eff,
itemStyle:{
color:'#c23531'
}}
@ -141,7 +141,7 @@ function startechart(data){
var ablChart = echarts.init(document.getElementById('shixun_overall_ablility_chart'));
var dataBJ = data.echart_data.consume_list;
var dataBJ = data.echart_data===undefined?"":data.echart_data.consume_list;
var itemStyle = {
@ -188,7 +188,7 @@ function startechart(data){
formatter: function (obj) {
var value = obj.value;
if(obj.name ==data.username){
return "姓名:"+data.username + "<br/>"+'学号: '+data.user_id + "<br/>"+'得分:'+ data.echart_data.myself_object[1];
return "姓名:"+data.username + "<br/>"+'学号: '+data.user_id + "<br/>"+'得分:'+ data.echart_data===undefined?"":data.echart_data.myself_object[1];
}
}
@ -241,9 +241,9 @@ function startechart(data){
data : [
{
name: data.username,
xAxis: data.echart_data.myself_object[0],
yAxis:data.echart_data.myself_object[1],
value:data.echart_data.myself_object[1]
xAxis: data.echart_data===undefined?"":data.echart_data.myself_object[0],
yAxis:data.echart_data===undefined?"":data.echart_data.myself_object[1],
value:data.echart_data===undefined?"":data.echart_data.myself_object[1]
}
],
itemStyle: {
@ -256,7 +256,7 @@ function startechart(data){
{
name: '能力1',
type: 'scatter',
data: data.echart_data.myself_object,
data: data.echart_data===undefined?"":data.echart_data.myself_object,
itemStyle:itemStyle1,
symbolSize: function (val){
return Math.round(val[2]);
@ -367,8 +367,8 @@ class Shixunechart extends Component {
<div className="fl with65" style={{paddingLeft: "5%"}}>
<li className="mt5 mb5">{data&&data.username}</li>
<li className="mt5 mb5">{data&&data.user_id}</li>
<li className="mt5 mb5 color-orange03"><span className="color-orange03">{data&&data.echart_data.myself_eff[1]}</span></li>
<li className="mt5 mb5 color-orange03"><span className="color-orange03">{data&&data.echart_data.myself_eff[0]}</span></li>
<li className="mt5 mb5 color-orange03"><span className="color-orange03">{data&&data.echart_data===undefined?"":data&&data.echart_data.myself_eff[1]}</span></li>
<li className="mt5 mb5 color-orange03"><span className="color-orange03">{data&&data.echart_data===undefined?"":data&&data.echart_data.myself_eff[0]}</span></li>
</div>
</div>
<div className="pr mt20 with100">
@ -393,7 +393,7 @@ class Shixunechart extends Component {
<div className="fl with65" style={{paddingLeft: "5%"}}>
<li className="mt5 mb5">{data&&data.username}</li>
<li className="mt5 mb5">{data&&data.user_id}</li>
<li className="mt5 mb5 color-orange03"><span className="color-orange03">{data&&data.echart_data.myself_object[1]}</span></li>
<li className="mt5 mb5 color-orange03"><span className="color-orange03">{data&&data.echart_data===undefined?"":data&&data.echart_data.myself_object[1]}</span></li>
</div>
</div>
<div className="popup_tip_box fontGrey2 with100 disc mt20"

@ -32,6 +32,7 @@ class MemoDetailMDEditor extends Component {
}
initMDEditor = () => {
// 因为props.memo不存在时本组件不会被加载这里直接在didMount里初始化即可
const placeholder = '我要回复...'
// const imageUrl = `/upload_with_markdown?container_id=${this.props.memo.id}&container_type=Memo`;
@ -42,7 +43,7 @@ class MemoDetailMDEditor extends Component {
setTimeout(() => {
var commentMDEditor = window.create_editorMD_4comment("memo_comment_editorMd", '', this.props.height || 240, placeholder, imageUrl, () => {
commentMDEditor.focus()
this.isMDInited = true
this.initDrag()
commentMDEditor.cm.on("change", (_cm, changeObj) => {
@ -114,7 +115,13 @@ class MemoDetailMDEditor extends Component {
}
onMockInputClick = () => {
this.setState({isInited: true})
this.initMDEditor()
if (!this.isMDInited) {
this.initMDEditor()
} else {
setTimeout(() => {
this.commentMDEditor.focus()
}, 10)
}
}
render() {
const { match, history, memo, placeholder, className } = this.props

@ -1,75 +1,75 @@
.slider-img-wrapper img {
width: 100%;
border-radius: 15px;
height: 350px;
}
.next-slick-list{
width: 100%;
position: relative;
overflow: hidden;
border-radius: 10px;
}
.user_navlist{
margin-left: 40px;
}
.next-slick-list{
margin-left: 12px;
}
.black_nav_span{
display: block;
margin: 0px 20px;
border-bottom: 1px solid #4B4B4B;
padding-left: 8px;
color: #FAFAFA;
}
.user_navlist_white{
z-index: 100 !important;
}
.next-slick.next-slick-horizontal.next-slick-outer{
height: 350px;
}
.black_nav_list li span a{
color:#fff;
}
.black_nav_list li span a:hover{
color:#000;
}
.black_nav_list li:hover span a{
color:#000;
}
.little-titles{
height: 22px !important;
}
.user_navlist_white a{
color: #989898 !important;
}
.user_navlist_white .navlistpanel-line .little-titles a{
color: #000 !important;
}
.newnext-loading{
display:block;
}
.educontentSlider{
width: 1282px !important;
}
.user_navlist_white{
max-height:350px !important;
overflow-y: auto;
}
.iconfontzhangjie{
font-size: 10px !important;
line-height: 23px;
}
.iconfontshixundaibeijing{
font-size: 18px !important;
line-height: 24px;
.slider-img-wrapper img {
width: 100%;
/*border-radius: 15px;*/
height: 350px;
}
.next-slick-list{
width: 100%;
position: relative;
overflow: hidden;
border-radius: 10px;
}
.user_navlist{
margin-left: 40px;
}
.next-slick-list{
margin-left: 12px;
}
.black_nav_span{
display: block;
margin: 0px 20px;
border-bottom: 1px solid #4B4B4B;
padding-left: 8px;
color: #FAFAFA;
}
.user_navlist_white{
z-index: 100 !important;
}
.next-slick.next-slick-horizontal.next-slick-outer{
height: 350px;
}
.black_nav_list li span a{
color:#fff;
}
.black_nav_list li span a:hover{
color:#000;
}
.black_nav_list li:hover span a{
color:#000;
}
.little-titles{
height: 22px !important;
}
.user_navlist_white a{
color: #989898 !important;
}
.user_navlist_white .navlistpanel-line .little-titles a{
color: #000 !important;
}
.newnext-loading{
display:block;
}
.educontentSlider{
width: 1282px !important;
}
.user_navlist_white{
max-height:350px !important;
overflow-y: auto;
}
.iconfontzhangjie{
font-size: 10px !important;
line-height: 23px;
}
.iconfontshixundaibeijing{
font-size: 18px !important;
line-height: 24px;
}

@ -10,8 +10,6 @@ import { TPMIndexHOC } from '../tpm/TPMIndexHOC';
import SiderBar from '../tpm/SiderBar';
import Loading from '@icedesign/base/lib/loading';
import { SnackbarHOC , getImageUrl} from 'educoder';
import Slider from '@icedesign/base/lib/slider';
@ -24,9 +22,7 @@ import '@icedesign/base/lib/rating/style.js';
import './home.css';
import '@icedesign/base/lib/loading/style.js';
import {Tooltip} from 'antd';
import {Tooltip,Spin} from 'antd';
const $ = window.$;
@ -110,7 +106,7 @@ class ShixunsHome extends Component {
return (
<div className="newMain clearfix backFAFAFA">
<Loading visible={hometypepvisible} shape="dot-circle" className="newnext-loading" color='#4AC7FF'>
<Spin spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
{/*懒加载*/}
<SiderBar/>
@ -198,13 +194,13 @@ class ShixunsHome extends Component {
</div>
<Link to={"/paths"} className="moreitem">更多<i className="fa fa-angle-right ml5"></i></Link>
<div className="square-list clearfix">
<div className="square-list clearfix" style={{width:'102%'}}>
{homedatalist===undefined?"":homedatalist.subjects.map((item,key)=>{
if(key<8)
return(
<div className="square-Item" key={key} id={item.id}>
<div className="square-Item" key={key} id={item.id} style={{width:'286px'}}>
<div className="tag-green">
<span className="tag-name"> {item.name}</span>
@ -272,10 +268,10 @@ class ShixunsHome extends Component {
</div>
<Link to={"/shixuns"} className="moreitem">更多<i className="fa fa-angle-right ml5"></i></Link>
<div className="square-list clearfix">
<div className="square-list clearfix" style={{width:'102%'}}>
{homedatalist===undefined?"":homedatalist.shixuns.map((item,key)=>{
return(
<div className="square-Item" key={key} id={item.id}>
<div className="square-Item" key={key} id={item.id} style={{width:'286px'}}>
<div className="tag-green">
<span className="tag-name"> {item.tag_name}</span>
@ -498,8 +494,7 @@ class ShixunsHome extends Component {
</div>
</div>
</div>
</Loading>
</Spin>
</div>
);
}

@ -1,5 +1,6 @@
import React, { Component } from 'react';
import ImageLayer from './ImageLayer'
import { isImageExtension } from 'educoder'
const $ = window.$;
export function ImageLayerOfCommentHOC(options = {}) {
return function wrap(WrappedComponent) {
@ -16,18 +17,29 @@ export function ImageLayerOfCommentHOC(options = {}) {
componentDidMount() {
// commentsDelegateParent #game_left_contents #tab_con_4
setTimeout(() => {
$(".commentsDelegateParent")
.delegate(".J_Comment_Reply .comment_content img, .J_Comment_Reply .childrenCommentsView img","click", (event) => {
$(options.parentSelector || ".commentsDelegateParent")
.delegate(options.imgSelector || ".J_Comment_Reply .comment_content img, .J_Comment_Reply .childrenCommentsView img","click", (event) => {
const imageSrc = event.target.src
// 非回复里的头像图片; 非emoticons
if (imageSrc.indexOf('/images/avatars/User') === -1 &&
imageSrc.indexOf('kindeditor/plugins/emoticons') === -1 ) {
this.setState({
showImage: true,
imageSrc,
})
const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href')
// 判断imageSrc是否是图片
const fileName = event.target.innerHTML.trim()
if (isImageExtension(imageSrc.trim()) || isImageExtension(fileName)) {
// 非回复里的头像图片; 非emoticons
if (imageSrc.indexOf('/images/avatars/User') === -1 &&
imageSrc.indexOf('kindeditor/plugins/emoticons') === -1 ) {
this.setState({
showImage: true,
imageSrc,
})
}
event.stopPropagation()
event.preventDefault && event.preventDefault()
event.originalEvent.preventDefault()
// event.originalEvent.stopPropagation()
// event.originalEvent.cancelBubble = true
return false;
}
});
}, 3000)

@ -1,10 +1,8 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import {Modal,Input,Checkbox,Tooltip} from "antd";
import {Modal,Input,Checkbox,Tooltip,Spin} 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.$;
@ -437,7 +435,7 @@ class DetailCardsEditAndAdd extends Component{
width="840px"
destroyOnClose={true}
>
<Loading visible={hometypepvisible} shape="dot-circle" color='#4AC7FF'>
<Spin spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
<div className="newupload_conbox">
<div className="clearfix mb20 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div">
<li className="fl mr5 mt5"> <a onClick={()=>this.changeTag(0,`${search}`)} className={ type===0 ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a></li>
@ -516,7 +514,7 @@ class DetailCardsEditAndAdd extends Component{
<a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.clickShixunchoose}>确定</a>
</div>
</div>
</Loading>
</Spin>
</Modal>
</div>

@ -1,10 +1,8 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import {Modal,Input,Checkbox,Tooltip} from "antd";
import {Modal,Input,Checkbox,Tooltip,Spin} 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.$;
@ -478,8 +476,8 @@ class DetailCardsEditAndEdit extends Component{
footer={null}
width="840px"
destroyOnClose={true}
>
<Loading visible={hometypepvisible} shape="dot-circle" color='#4AC7FF'>
>Z
<Spin spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
<div className="newupload_conbox">
<div className="clearfix mb20 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div">
<li className="fl mr5 mt5"> <a onClick={()=>this.changeTag(0,`${search}`)} className={ type===0 ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a></li>
@ -558,7 +556,7 @@ class DetailCardsEditAndEdit extends Component{
<a className="task-btn task-btn-orange margin-tp26" id="submit_send_shixun" onClick={this.clickShixunchoose}>确定</a>
</div>
</div>
</Loading>
</Spin>
</Modal>
</div>

@ -1,49 +1,49 @@
import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { getImageUrl, toPath } from 'educoder'
import PropTypes from 'prop-types';
class NewFooter extends Component {
constructor(props) {
super(props)
}
componentWillReceiveProps(newProps, newContext) {
}
render() {
return (
<div className="newFooter edu-txt-center">
<div className="inner-footer_con">
<div className="footercon">
<div className="inline mt40 mb5">
<a href="/" className="fl" style={{height:'70px'}}>
<img alt="高校智能化教学与实训平台" src={getImageUrl(`images/educoder/headNavLogo.png?1526520218`)} width="70px">
</img>
</a>
<span className="fl color-grey-c cdefault font-28 ml22" style={{lineHeight:'74px'}}>EduCoder.net</span>
</div>
<ul className="clearfix inner-footernav">
<li><a href="/" className="fl" target="_blank">网站首页</a></li>
<li><a href={this.props.Footerdown===undefined?"":this.props.Footerdown.about_us} className="fl" target="_blank">关于我们</a></li>
<li><a href={this.props.Footerdown===undefined?"":this.props.Footerdown.connect_us} className="fl" target="_blank">联系我们</a></li>
<li><a href={this.props.Footerdown===undefined?"":this.props.Footerdown.cooperation_partner} className="fl" target="_blank">合作伙伴</a></li>
<li><a href={this.props.Footerdown===undefined?"":this.props.Footerdown.service_agreement} className="fl" target="_blank">服务协议</a></li>
<li><a href={this.props.Footerdown===undefined?"":this.props.Footerdown.help_center} className="fl" target="_blank">帮助中心</a></li>
<li><a href={this.props.Footerdown===undefined?"":this.props.Footerdown.feedback} className="fl" target="_blank">意见反馈</a></li>
</ul>
</div>
<div>
<p className="footer_con-p inline lineh-30 font-14"><span className="font-18 fl">©</span>&nbsp;2019&nbsp;EduCoder<span className="ml15 mr15">ICP17009477</span><a href="https://team.trustie.net" style={{"color":"#888"}} target="_blank">Trustie</a>&nbsp;&nbsp;&nbsp;&amp;&nbsp;&nbsp;&nbsp;IntelliDE inside.</p>
</div>
<div className="cl"></div>
</div>
</div>
);
}
}
export default NewFooter;
import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { getImageUrl, toPath } from 'educoder'
import PropTypes from 'prop-types';
class NewFooter extends Component {
constructor(props) {
super(props)
}
componentWillReceiveProps(newProps, newContext) {
}
render() {
return (
<div className="newFooter edu-txt-center newContainers">
<div className="inner-footer_con">
<div className="footercon">
<div className="inline mt40 mb5">
<a href="/" className="fl" style={{height:'70px'}}>
<img alt="高校智能化教学与实训平台" src={getImageUrl(`images/educoder/headNavLogo.png?1526520218`)} width="70px">
</img>
</a>
<span className="fl color-grey-c cdefault font-28 ml22" style={{lineHeight:'74px'}}>EduCoder.net</span>
</div>
<ul className="clearfix inner-footernav">
<li><a href="/" className="fl" target="_blank">网站首页</a></li>
<li><a href={this.props.Footerdown===undefined?"":this.props.Footerdown.about_us} className="fl" target="_blank">关于我们</a></li>
<li><a href={this.props.Footerdown===undefined?"":this.props.Footerdown.connect_us} className="fl" target="_blank">联系我们</a></li>
<li><a href={this.props.Footerdown===undefined?"":this.props.Footerdown.cooperation_partner} className="fl" target="_blank">合作伙伴</a></li>
<li><a href={this.props.Footerdown===undefined?"":this.props.Footerdown.service_agreement} className="fl" target="_blank">服务协议</a></li>
<li><a href={this.props.Footerdown===undefined?"":this.props.Footerdown.help_center} className="fl" target="_blank">帮助中心</a></li>
<li><a href={this.props.Footerdown===undefined?"":this.props.Footerdown.feedback} className="fl" target="_blank">意见反馈</a></li>
</ul>
</div>
<div>
<p className="footer_con-p inline lineh-30 font-14"><span className="font-18 fl">©</span>&nbsp;2019&nbsp;EduCoder<span className="ml15 mr15">ICP17009477</span><a href="https://team.trustie.net" style={{"color":"#888"}} target="_blank">Trustie</a>&nbsp;&nbsp;&nbsp;&amp;&nbsp;&nbsp;&nbsp;IntelliDE inside.</p>
</div>
<div className="cl"></div>
</div>
</div>
);
}
}
export default NewFooter;

@ -638,7 +638,7 @@ submittojoinclass=(value)=>{
{/*<li><a href={this.props.Headertop===undefined?"":this.props.Headertop.shixun_paths_url}>实训路径</a></li>*/}
<li className={`${activePaths === true ? 'pr active' : 'pr'}`}>
<a href={this.props.Headertop===undefined?"":'/paths'}>课程</a></li>
<a href={this.props.Headertop===undefined?"":'/paths'}>课程</a></li>
{/*<li><a href={this.props.Headertop===undefined?"":'/courses'}>课堂</a></li>*/}
<li className={`${coursestype === true ? 'pr active' : 'pr'}`}>
@ -671,13 +671,13 @@ submittojoinclass=(value)=>{
</div>
</li>
{/*<li className=""><a href={"/libraries"}>教学案例</a></li>*/}
<li className=""><a href={this.props.Headertop===undefined?"":this.props.Headertop.competitions_url}>在线竞赛</a></li>
<li className=""><a href={this.props.Headertop===undefined?"":this.props.Headertop.competitions_url}>竞赛</a></li>
<li className={`${activeForums === true ? 'active' : ''}`}><a href={this.props.Headertop===undefined?"":this.props.Headertop.topic_url}>问答</a></li>
<li className={`${activeForums === true ? 'active' : ''}`}><a href={this.props.Headertop===undefined?"":this.props.Headertop.topic_url}>交流问答</a></li>
<li
style={{display: this.props.Headertop === undefined ? 'none' : this.props.Headertop.auth===null? 'none' : 'block'}}
><a href={this.props.Headertop===undefined?"":this.props.Headertop.auth}>认证</a></li>
><a href={this.props.Headertop===undefined?"":this.props.Headertop.auth}>工程认证</a></li>
</ul>

@ -23,7 +23,7 @@ $(window).scroll(function(){
});
function rightSlider(){
var poi=parseInt((parseInt($(window).width())- 1200 )/2)-60;
var poi=parseInt((parseInt($(window).width())- 1200 )/2)-81;
// console.log(parseInt($(window).width())+" "+poi);
if(poi>0){
$(".-task-sidebar").css("right",poi);

@ -1,193 +1,192 @@
import React, {Component} from 'react';
import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Pagination,Tooltip} from 'antd';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
// import "antd/dist/antd.css";
import Rating from '@icedesign/base/lib/rating';
import Loading from '@icedesign/base/lib/loading';
import axios from 'axios';
import {getImageUrl, toPath, getUrl} from 'educoder'
import './shixunCss/fork.css';
let origin = getUrl();
let path = getUrl("/editormd/lib/")
const $ = window.$;
let timeout;
let currentValue;
export default class TPMFork_listComponent extends Component {
constructor(props) {
super(props)
this.state = {
shixuns:undefined,
total_count:0,
shixunsID:undefined,
Forkvisible: true,
Forkcurrent: 1
}
}
componentDidMount() {
let id = this.props.match.params.shixunId;
let Url="/shixuns/"+id+"/fork_list.json";
axios.get(Url, {
params: {
page:1,
limit:8
}
}).then((response)=> {
this.setState({
shixunsID:id,
shixuns:response.data.shixuns,
total_count:response.data.total_count,
Forkvisible:false
})
}).catch((error)=>{
console.log(error)
});
}
TPMForkonChange=(pageNumber)=>{
let id = this.props.match.params.shixunId;
this.setState({
Forkvisible:true
})
let Url="/shixuns/"+id+"/fork_list.json";
axios.get(Url, {
params: {
page:pageNumber,
limit:8
}
}).then((response)=> {
this.setState({
shixunsID:id,
shixuns:response.data.shixuns,
total_count:response.data.total_count,
Forkvisible: false,
Forkcurrent: pageNumber
})
}).catch((error)=>{
console.log(error)
});
}
render() {
let {shixuns, total_count, shixunsID, Forkvisible, Forkcurrent} = this.state;
return (
<React.Fragment>
<div className="educontent mb20">
<div className="edu-back-white padding20 clearfix mt30">
<span className="fl font-16">Fork实训列表</span>
<a href={"/shixuns/"+shixunsID+"/challenges"} className="font-16 color-grey-9 fr">返回</a>
</div>
<Loading visible={Forkvisible} shape="dot-circle" style={{width:'100%'}}color='#4AC7FF'>
<div className="mt30 square-list clearfix mh320">
{ shixuns===undefined?" ":shixuns.map((item,key)=>{
return(
<div className="square-Item" key={key} id={item.id}>
<div className="tag-green">
<span className="tag-name"> {item.tag_name}</span>
<img src={require(`./shixunCss/tag2.png`)}/>
</div>
<div className={item.power === false ? "closeSquare" : "none"}>
<img src={getImageUrl("images/educoder/icon/lockclose.svg")}
className="mt80 mb25"/>
<p className="font-14 color-white">非试用内容需要授权</p>
</div>
<a href={"/shixuns/"+item.identifier+"/challenges"} className="square-img" target="_blank">
<img src={'/'+item.pic}/>
</a>
<div className="square-main">
<p className="task-hide">
<a href={"/shixuns/"+item.identifier+"/challenges"} target="_blank" className="justify color-grey-name">
{item.name}
</a>
</p>
<p className="clearfix mt8 ml-3">
<span className="rateYoStar fl" style={{padding: '0px',height: '20px',lineHeight: '19px',cursor: 'default'}} title="">
<Rating key={key} value={item.score_info===null?5:item.score_info} disabled allowHalf />
</span>
<span className="fl ml25 font-12 color-grey-9 lineh-12 mt4">{item.score_info===null?"5分":item.score_info+"分"}</span>
</p>
<p className="clearfix mt8 font-12 color-grey-B4">
<Tooltip placement="bottom" title={"关卡"}>
<span className="mr10 fl squareIconSpan">
<i className="iconfont icon-shixunguanqia fl mr3"></i>{item.challenges_count}
</span>
</Tooltip>
{/*<Tooltip placement="bottom" title={"经验值"}>*/}
{/*<span className="mr10 fl squareIconSpan">*/}
{/*<i className="iconfont icon-jingyan fl mr3"></i>{item.exp}*/}
{/*</span>*/}
{/*</Tooltip>*/}
<Tooltip placement="bottom" title={"学习人数"}>
<span className="mr10 fl squareIconSpan" style={{display:item.stu_num===0?"none":'block'}}>
<i className="iconfont icon-chengyuan fl mr3"></i>{item.stu_num}
</span>
</Tooltip>
<span className="fr color-grey-B3 squareIconSpan">{item.level}</span>
</p>
</div>
</div>
)
})
}
</div>
{/*<div>{total_count}</div>*/}
<div className="educontent mb80 edu-txt-center mt10" style={{display: total_count > 8 ? "block" : "none"}}>
{/*<div className={total_count < 9 ? " ml32" : "ml105"}>*/}
<Pagination
showQuickJumper
defaultCurrent={1}
pageSize={8}
total={total_count}
current={Forkcurrent}
style={
{
display: total_count < 9 ? 'none' : 'block'
}
}
onChange={this.TPMForkonChange}/>
</div>
</Loading>
</div>
</React.Fragment>
)
}
}
import React, {Component} from 'react';
import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Pagination,Tooltip,Spin} from 'antd';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
// import "antd/dist/antd.css";
import Rating from '@icedesign/base/lib/rating';
import axios from 'axios';
import {getImageUrl, toPath, getUrl} from 'educoder'
import './shixunCss/fork.css';
let origin = getUrl();
let path = getUrl("/editormd/lib/")
const $ = window.$;
let timeout;
let currentValue;
export default class TPMFork_listComponent extends Component {
constructor(props) {
super(props)
this.state = {
shixuns:undefined,
total_count:0,
shixunsID:undefined,
Forkvisible: true,
Forkcurrent: 1
}
}
componentDidMount() {
let id = this.props.match.params.shixunId;
let Url="/shixuns/"+id+"/fork_list.json";
axios.get(Url, {
params: {
page:1,
limit:8
}
}).then((response)=> {
this.setState({
shixunsID:id,
shixuns:response.data.shixuns,
total_count:response.data.total_count,
Forkvisible:false
})
}).catch((error)=>{
console.log(error)
});
}
TPMForkonChange=(pageNumber)=>{
let id = this.props.match.params.shixunId;
this.setState({
Forkvisible:true
})
let Url="/shixuns/"+id+"/fork_list.json";
axios.get(Url, {
params: {
page:pageNumber,
limit:8
}
}).then((response)=> {
this.setState({
shixunsID:id,
shixuns:response.data.shixuns,
total_count:response.data.total_count,
Forkvisible: false,
Forkcurrent: pageNumber
})
}).catch((error)=>{
console.log(error)
});
}
render() {
let {shixuns, total_count, shixunsID, Forkvisible, Forkcurrent} = this.state;
return (
<React.Fragment>
<div className="educontent mb20">
<div className="edu-back-white padding20 clearfix mt30">
<span className="fl font-16">Fork实训列表</span>
<a href={"/shixuns/"+shixunsID+"/challenges"} className="font-16 color-grey-9 fr">返回</a>
</div>
{/*<Loading visible={Forkvisible} shape="dot-circle" style={{width:'100%'}}color='#4AC7FF'>*/}
<Spin spinning={Forkvisible} size="large" style={{marginTop:'15%'}}>
<div className="mt30 square-list clearfix mh320">
{ shixuns===undefined?" ":shixuns.map((item,key)=>{
return(
<div className="square-Item" key={key} id={item.id}>
<div className="tag-green">
<span className="tag-name"> {item.tag_name}</span>
<img src={require(`./shixunCss/tag2.png`)}/>
</div>
<div className={item.power === false ? "closeSquare" : "none"}>
<img src={getImageUrl("images/educoder/icon/lockclose.svg")}
className="mt80 mb25"/>
<p className="font-14 color-white">非试用内容需要授权</p>
</div>
<a href={"/shixuns/"+item.identifier+"/challenges"} className="square-img" target="_blank">
<img src={'/'+item.pic}/>
</a>
<div className="square-main">
<p className="task-hide">
<a href={"/shixuns/"+item.identifier+"/challenges"} target="_blank" className="justify color-grey-name">
{item.name}
</a>
</p>
<p className="clearfix mt8 ml-3">
<span className="rateYoStar fl" style={{padding: '0px',height: '20px',lineHeight: '19px',cursor: 'default'}} title="">
<Rating key={key} value={item.score_info===null?5:item.score_info} disabled allowHalf />
</span>
<span className="fl ml25 font-12 color-grey-9 lineh-12 mt4">{item.score_info===null?"5分":item.score_info+"分"}</span>
</p>
<p className="clearfix mt8 font-12 color-grey-B4">
<Tooltip placement="bottom" title={"关卡"}>
<span className="mr10 fl squareIconSpan">
<i className="iconfont icon-shixunguanqia fl mr3"></i>{item.challenges_count}
</span>
</Tooltip>
{/*<Tooltip placement="bottom" title={"经验值"}>*/}
{/*<span className="mr10 fl squareIconSpan">*/}
{/*<i className="iconfont icon-jingyan fl mr3"></i>{item.exp}*/}
{/*</span>*/}
{/*</Tooltip>*/}
<Tooltip placement="bottom" title={"学习人数"}>
<span className="mr10 fl squareIconSpan" style={{display:item.stu_num===0?"none":'block'}}>
<i className="iconfont icon-chengyuan fl mr3"></i>{item.stu_num}
</span>
</Tooltip>
<span className="fr color-grey-B3 squareIconSpan">{item.level}</span>
</p>
</div>
</div>
)
})
}
</div>
{/*<div>{total_count}</div>*/}
<div className="educontent mb80 edu-txt-center mt10" style={{display: total_count > 8 ? "block" : "none"}}>
{/*<div className={total_count < 9 ? " ml32" : "ml105"}>*/}
<Pagination
showQuickJumper
defaultCurrent={1}
pageSize={8}
total={total_count}
current={Forkcurrent}
style={
{
display: total_count < 9 ? 'none' : 'block'
}
}
onChange={this.TPMForkonChange}/>
</div>
</Spin>
{/*</Loading>*/}
</div>
</React.Fragment>
)
}
}

@ -1,382 +1,382 @@
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import Loading from '../../Loading';
import Loadable from 'react-loadable';
import { TPMIndexHOC } from './TPMIndexHOC';
import { SnackbarHOC } from 'educoder';
import TPMBanner from './TPMBanner';
import axios from 'axios';
import TPMShixunDiscussContainer from './TPMShixunDiscussContainer';
import TPMRepositoryComponent from './TPMRepositoryComponent';
import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits';
import TPMsettings from './TPMsettings/TPMsettings';
import TPMChallengeComponent from './TPMChallengeContainer'
import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent'
import TPMRanking_listComponent from './TPMRanking_listContainer'
import TPMCollaboratorsComponent from './TPMCollaboratorsContainer'
import '../page/tpiPage.css'
//任务
// const TPMChallengeComponent = Loadable({
// loader: () => import('./TPMChallengeContainer'),
// loading: Loading,
// })
//背景知识
// const TPMPropaedeuticsComponent = Loadable({
// loader: () => import('./TPMPropaedeuticsComponent'),
// loading: Loading,
// })
//版本库
// const TPMRepositoryComponent = Loadable({
// loader: () => import('./TPMRepositoryComponent'),
// loading: Loading,
// })
// const TPMRepositoryComponent = Loadable({
// loader: () => import('./TPMRepositoryComponent'),
// loading: Loading,
// })
//合作
// const TPMCollaboratorsComponent = Loadable({
// loader: () => import('./TPMCollaboratorsContainer'),
// loading: Loading,
// })
//评论
// const TPMShixunDiscussComponent = Loadable({
// loader: () => import('./TPMShixunDiscussContainer'),
// loading: Loading,
// })
//排行版
// const TPMRanking_listComponent = Loadable({
// loader: () => import('./TPMRanking_listContainer'),
// loading: Loading,
// })
// //编辑实训
// const TPMModifysettings = Loadable({
// loader: () =>import('./modules/tpm/TPMsettings/TPMsettings'),
// loading: Loading,
// })
//新建实训
const TPMchallengesnew = Loadable({
loader: () => import('./challengesnew/TPMchallengesnew'),
loading: Loading,
})
//新建tab2
const TPMevaluation = Loadable({
loader: () => import('./challengesnew/TPMevaluation'),
loading: Loading,
})
//新建tab3答案
// const TPManswer = Loadable({
// loader: () => import('./challengesnew/TPManswer'),
// loading: Loading,
// })
const TPManswer = Loadable({
loader: () => import('./challengesnew/TPManswer2'),
loading: Loading,
})
//选择题
const TPMquestion = Loadable({
loader: () => import('./challengesnew/TPMquestion'),
loading: Loading,
})
//fork列表
const TPMFork_listComponent = Loadable({
loader: () => import('./TPMFork/TPMForklist'),
loading: Loading,
})
//背景知识修改
const TPMUpdatepropaede = Loadable({
loader: () => import('./TPMUpdatepropaede/TPMUpdatepropaede'),
loading: Loading,
})
const interceptorUrlArray = ['repository.json', 'commits.json', 'propaedeutics.json'
, 'challenges.json', 'discusses.json', 'ranking_list.json', 'collaborators.json']
const cacheInterceptorUrlMap = {}
class TPMIndex extends Component {
constructor(props) {
super(props)
this.state = {
loadingContent: false,
power: false,
shixunsDetails: {},
shixunId: undefined,
star_info: [0, 0, 0, 0, 0, 0],
star_infos: [0, 0, 0, 0, 0, 0],
identity:undefined,
TPMRightSectionData:undefined,
PropaedeuticsList: undefined,
}
}
componentDidMount = () => {
let id = this.props.match.params.shixunId;
// let collaborators = `/shixuns/` + id + `/propaedeutics.json`;
//
// axios.get(collaborators).then((response) => {
// if (response.status === 200) {
// if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
//
// }else{
// this.setState({
// PropaedeuticsList: response.data,
// shixunId: id
// });
// }
//
// }
// }).catch((error) => {
// console.log(error)
// });
let Url = `/shixuns/` + id + `.json`;
axios.get(Url).then((response) => {
if (response.status === 200) {
document.title=response.data.name;
let newstar_info = [];
// let start1=
for (var i = 0; i < response.data.score_info.length; i++) {
if (i === 0) {
newstar_info.push(response.data.score_info[i])
} else {
newstar_info.push((response.data.score_info[i] / 100) * 5)
}
}
let newstar_infos = response.data.score_info;
this.setState({
shixunsDetails: response.data,
shixunId: id,
star_info: newstar_info,
star_infos: newstar_infos,
power: response.data.power,
identity: response.data.identity,
propaedeutics:response.data.propaedeutics,
status: response.data.status,
});
}
}).catch((error) => {
this.setState({
shixunsDetails: undefined,
shixunId: undefined,
star_info: undefined,
star_infos: undefined,
power: undefined,
identity: undefined,
status: undefined,
propaedeutics:undefined
});
});
this.tpmContentRequestInterceptor = axios.interceptors.request.use((config) => {
let url = config.url;
// console.log('tpmContentRequestInterceptor:', url)
for ( let i = 0; i < interceptorUrlArray.length; i++ ) {
if (url.indexOf(interceptorUrlArray[i]) != -1) {
url = url.split('?')[0]
console.log('loadingContent, url:', url)
this.setState({ loadingContent: true })
cacheInterceptorUrlMap[url] = true
}
}
return config;
}, function (error) {
return Promise.reject(error);
});
// Add a response interceptor
this.tpmContentResponseInterceptor = axios.interceptors.response.use((response) => {
// console.log('loadingContent finished, url:', response.config.url)
// TODO 依赖了api这个前缀
let url = response.config.url.split('api')[1];
url = url.split('?')[0]
if (cacheInterceptorUrlMap[url]) {
this.setState({ loadingContent: false })
delete cacheInterceptorUrlMap[response.url]
}
return response;
}, function (error) {
// Do something with response error
return Promise.reject(error);
});
//右侧数据
let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`;
axios.get(shixunsDetailsURL).then((response)=> {
this.setState({
TPMRightSectionData: response.data
});
})
}
componentWillUnmount = () => {
axios.interceptors.request.eject(this.tpmContentRequestInterceptor);
this.tpmContentRequestInterceptor = null;
axios.interceptors.request.eject(this.tpmContentResponseInterceptor);
this.tpmContentResponseInterceptor = null;
}
setLoadingContent = (isLoadingContent) => {
this.setState({ loadingContent: isLoadingContent })
}
// TpmTPMBannertype(type){
//
// }
render() {
return (
<div className="newMain clearfix">
<TPMBanner
{...this.props}
{...this.state}
></TPMBanner>
<Switch {...this.props}>
<Route path="/shixuns/:shixunId/repository/:repoId/commits" render={
(props) => (<TPMRepositoryCommits {...this.props} {...this.state} {...props}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/challenges" render={
(props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
<Route path="/shixuns/:shixunId/repository" render={
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
{/* <Route exact path="/shixuns/:shixunId/propaedeutics" component={TPMPropaedeuticsComponent}></Route> */}
<Route exact path="/shixuns/:shixunId/propaedeutics" render={
(props) => (<TPMPropaedeuticsComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/collaborators" render={
(props) => (<TPMCollaboratorsComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
{/* <Route exact path="/shixuns/:shixunId/repository/:shixunId/" component={TPMRepositoryComponent}></Route> */}
<Route path="/shixuns/:shixunId/shixun_discuss" render={
(props) => (<TPMShixunDiscussContainer {...this.props} {...this.state} {...props}
initForumState={(data)=>this.initForumState(data)}
setSearchValue={this.setSearchValue}
setHotLabelIndex={this.setHotLabelIndex}
/>)
}></Route>
<Route path="/shixuns/:shixunId/settings" render={
(props) => (<TPMsettings {...this.props} {...this.state} {...props} />)
}></Route>
<Route exact path="/shixuns/:shixunId/ranking_list" render={
(props) => (<TPMRanking_listComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/fork_list" render={
(props) => (<TPMFork_listComponent {...this.props} {...props}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/update_propaedeutics" render={
(props) => (<TPMUpdatepropaede {...this.props} {...props}
/>)
}></Route>
{/*评测设置*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/tab=2" render={
(props) => (<TPMevaluation {...this.props} {...props} {...this.state}/>)
}></Route>
{/*参考答案*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/tab=3" render={
(props) => (<TPManswer {...this.props} {...props} {...this.state}/>)
}></Route>
{/*新建关卡*/}
<Route path="/shixuns/:shixunId/challenges/new" render={
(props) => (<TPMchallengesnew {...this.props} {...props} {...this.state}/>)
}></Route>
{/*编辑关卡*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/editcheckpoint" render={
(props) => (<TPMchallengesnew {...this.props} {...props} {...this.state} />)
}></Route>
{/*新建选择题*/}
<Route path="/shixuns/:shixunId/challenges/newquestion" render={
(props) => (<TPMquestion {...this.props} {...props} {...this.state} />)
}></Route>
{/*修改选择题*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/editquestion/:choose_id" render={
(props) => (<TPMquestion {...this.props} {...props} {...this.state}/>)
}></Route>
{/*修改选择题*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/editquestion" render={
(props) => (<TPMquestion {...this.props} {...props} {...this.state}/>)
}></Route>
<Route exact path="/shixuns/:shixunId" render={
(props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
{/*<Route exact path="/shixuns/:shixunId" component={TPMChallengeComponent}></Route>*/}
</Switch>
</div>
);
}
}
export default SnackbarHOC() (TPMIndexHOC ( TPMIndex ));
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import Loading from '../../Loading';
import Loadable from 'react-loadable';
import { TPMIndexHOC } from './TPMIndexHOC';
import { SnackbarHOC } from 'educoder';
import TPMBanner from './TPMBanner';
import axios from 'axios';
import TPMShixunDiscussContainer from './TPMShixunDiscussContainer';
import TPMRepositoryComponent from './TPMRepositoryComponent';
import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits';
import TPMsettings from './TPMsettings/TPMsettings';
import TPMChallengeComponent from './TPMChallengeContainer'
import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent'
import TPMRanking_listComponent from './TPMRanking_listContainer'
import TPMCollaboratorsComponent from './TPMCollaboratorsContainer'
import '../page/tpiPage.css'
//任务
// const TPMChallengeComponent = Loadable({
// loader: () => import('./TPMChallengeContainer'),
// loading: Loading,
// })
//背景知识
// const TPMPropaedeuticsComponent = Loadable({
// loader: () => import('./TPMPropaedeuticsComponent'),
// loading: Loading,
// })
//版本库
// const TPMRepositoryComponent = Loadable({
// loader: () => import('./TPMRepositoryComponent'),
// loading: Loading,
// })
// const TPMRepositoryComponent = Loadable({
// loader: () => import('./TPMRepositoryComponent'),
// loading: Loading,
// })
//合作
// const TPMCollaboratorsComponent = Loadable({
// loader: () => import('./TPMCollaboratorsContainer'),
// loading: Loading,
// })
//评论
// const TPMShixunDiscussComponent = Loadable({
// loader: () => import('./TPMShixunDiscussContainer'),
// loading: Loading,
// })
//排行版
// const TPMRanking_listComponent = Loadable({
// loader: () => import('./TPMRanking_listContainer'),
// loading: Loading,
// })
// //编辑实训
// const TPMModifysettings = Loadable({
// loader: () =>import('./modules/tpm/TPMsettings/TPMsettings'),
// loading: Loading,
// })
//新建实训
const TPMchallengesnew = Loadable({
loader: () => import('./challengesnew/TPMchallengesnew'),
loading: Loading,
})
//新建tab2
const TPMevaluation = Loadable({
loader: () => import('./challengesnew/TPMevaluation'),
loading: Loading,
})
//新建tab3答案
// const TPManswer = Loadable({
// loader: () => import('./challengesnew/TPManswer'),
// loading: Loading,
// })
const TPManswer = Loadable({
loader: () => import('./challengesnew/TPManswer2'),
loading: Loading,
})
//选择题
const TPMquestion = Loadable({
loader: () => import('./challengesnew/TPMquestion'),
loading: Loading,
})
//fork列表
const TPMFork_listComponent = Loadable({
loader: () => import('./TPMFork/TPMForklist'),
loading: Loading,
})
//背景知识修改
const TPMUpdatepropaede = Loadable({
loader: () => import('./TPMUpdatepropaede/TPMUpdatepropaede'),
loading: Loading,
})
const interceptorUrlArray = ['repository.json', 'commits.json', 'propaedeutics.json'
, 'challenges.json', 'discusses.json', 'ranking_list.json', 'collaborators.json']
const cacheInterceptorUrlMap = {}
class TPMIndex extends Component {
constructor(props) {
super(props)
this.state = {
loadingContent: false,
power: false,
shixunsDetails: {},
shixunId: undefined,
star_info: [0, 0, 0, 0, 0, 0],
star_infos: [0, 0, 0, 0, 0, 0],
identity:undefined,
TPMRightSectionData:undefined,
PropaedeuticsList: undefined,
}
}
componentDidMount = () => {
let id = this.props.match.params.shixunId;
// let collaborators = `/shixuns/` + id + `/propaedeutics.json`;
//
// axios.get(collaborators).then((response) => {
// if (response.status === 200) {
// if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
//
// }else{
// this.setState({
// PropaedeuticsList: response.data,
// shixunId: id
// });
// }
//
// }
// }).catch((error) => {
// console.log(error)
// });
let Url = `/shixuns/` + id + `.json`;
axios.get(Url).then((response) => {
if (response.status === 200) {
document.title=response.data.name;
let newstar_info = [];
// let start1=
for (var i = 0; i < response.data.score_info.length; i++) {
if (i === 0) {
newstar_info.push(response.data.score_info[i])
} else {
newstar_info.push((response.data.score_info[i] / 100) * 5)
}
}
let newstar_infos = response.data.score_info;
this.setState({
shixunsDetails: response.data,
shixunId: id,
star_info: newstar_info,
star_infos: newstar_infos,
power: response.data.power,
identity: response.data.identity,
propaedeutics:response.data.propaedeutics,
status: response.data.shixun_status,
});
}
}).catch((error) => {
this.setState({
shixunsDetails: undefined,
shixunId: undefined,
star_info: undefined,
star_infos: undefined,
power: undefined,
identity: undefined,
status: undefined,
propaedeutics:undefined
});
});
this.tpmContentRequestInterceptor = axios.interceptors.request.use((config) => {
let url = config.url;
// console.log('tpmContentRequestInterceptor:', url)
for ( let i = 0; i < interceptorUrlArray.length; i++ ) {
if (url.indexOf(interceptorUrlArray[i]) != -1) {
url = url.split('?')[0]
console.log('loadingContent, url:', url)
this.setState({ loadingContent: true })
cacheInterceptorUrlMap[url] = true
}
}
return config;
}, function (error) {
return Promise.reject(error);
});
// Add a response interceptor
this.tpmContentResponseInterceptor = axios.interceptors.response.use((response) => {
// console.log('loadingContent finished, url:', response.config.url)
// TODO 依赖了api这个前缀
let url = response.config.url.split('api')[1];
url = url.split('?')[0]
if (cacheInterceptorUrlMap[url]) {
this.setState({ loadingContent: false })
delete cacheInterceptorUrlMap[response.url]
}
return response;
}, function (error) {
// Do something with response error
return Promise.reject(error);
});
//右侧数据
let shixunsDetailsURL=`/shixuns/`+id+`/show_right.json`;
axios.get(shixunsDetailsURL).then((response)=> {
this.setState({
TPMRightSectionData: response.data
});
})
}
componentWillUnmount = () => {
axios.interceptors.request.eject(this.tpmContentRequestInterceptor);
this.tpmContentRequestInterceptor = null;
axios.interceptors.request.eject(this.tpmContentResponseInterceptor);
this.tpmContentResponseInterceptor = null;
}
setLoadingContent = (isLoadingContent) => {
this.setState({ loadingContent: isLoadingContent })
}
// TpmTPMBannertype(type){
//
// }
render() {
return (
<div className="newMain clearfix">
<TPMBanner
{...this.props}
{...this.state}
></TPMBanner>
<Switch {...this.props}>
<Route path="/shixuns/:shixunId/repository/:repoId/commits" render={
(props) => (<TPMRepositoryCommits {...this.props} {...this.state} {...props}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/challenges" render={
(props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
<Route path="/shixuns/:shixunId/repository" render={
(props) => (<TPMRepositoryComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
{/* <Route exact path="/shixuns/:shixunId/propaedeutics" component={TPMPropaedeuticsComponent}></Route> */}
<Route exact path="/shixuns/:shixunId/propaedeutics" render={
(props) => (<TPMPropaedeuticsComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/collaborators" render={
(props) => (<TPMCollaboratorsComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
{/* <Route exact path="/shixuns/:shixunId/repository/:shixunId/" component={TPMRepositoryComponent}></Route> */}
<Route path="/shixuns/:shixunId/shixun_discuss" render={
(props) => (<TPMShixunDiscussContainer {...this.props} {...this.state} {...props}
initForumState={(data)=>this.initForumState(data)}
setSearchValue={this.setSearchValue}
setHotLabelIndex={this.setHotLabelIndex}
/>)
}></Route>
<Route path="/shixuns/:shixunId/settings" render={
(props) => (<TPMsettings {...this.props} {...this.state} {...props} />)
}></Route>
<Route exact path="/shixuns/:shixunId/ranking_list" render={
(props) => (<TPMRanking_listComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/fork_list" render={
(props) => (<TPMFork_listComponent {...this.props} {...props}
/>)
}></Route>
<Route exact path="/shixuns/:shixunId/update_propaedeutics" render={
(props) => (<TPMUpdatepropaede {...this.props} {...props}
/>)
}></Route>
{/*评测设置*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/tab=2" render={
(props) => (<TPMevaluation {...this.props} {...props} {...this.state}/>)
}></Route>
{/*参考答案*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/tab=3" render={
(props) => (<TPManswer {...this.props} {...props} {...this.state}/>)
}></Route>
{/*新建关卡*/}
<Route path="/shixuns/:shixunId/challenges/new" render={
(props) => (<TPMchallengesnew {...this.props} {...props} {...this.state}/>)
}></Route>
{/*编辑关卡*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/editcheckpoint" render={
(props) => (<TPMchallengesnew {...this.props} {...props} {...this.state} />)
}></Route>
{/*新建选择题*/}
<Route path="/shixuns/:shixunId/challenges/newquestion" render={
(props) => (<TPMquestion {...this.props} {...props} {...this.state} />)
}></Route>
{/*修改选择题*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/editquestion/:choose_id" render={
(props) => (<TPMquestion {...this.props} {...props} {...this.state}/>)
}></Route>
{/*修改选择题*/}
<Route path="/shixuns/:shixunId/challenges/:checkpointId/editquestion" render={
(props) => (<TPMquestion {...this.props} {...props} {...this.state}/>)
}></Route>
<Route exact path="/shixuns/:shixunId" render={
(props) => (<TPMChallengeComponent {...this.props} {...this.state} {...props}
/>)
}></Route>
{/*<Route exact path="/shixuns/:shixunId" component={TPMChallengeComponent}></Route>*/}
</Switch>
</div>
);
}
}
export default SnackbarHOC() (TPMIndexHOC ( TPMIndex ));

@ -131,7 +131,7 @@ export function TPMIndexHOC(WrappedComponent) {
}else if(this.props.match.path==="/shixuns"){
document.title="开发社区";
}else if(this.props.match.path==="/paths"){
document.title="实课程";
document.title="实课程";
}else if(this.props.match.path==="/courses"){
document.title="翻转课堂";
}
@ -294,23 +294,34 @@ export function TPMIndexHOC(WrappedComponent) {
return (
<div>
<SiderBar
Headertop={Headertop}
/>
<NewHeader {...this.state} {...this.props}></NewHeader>
<div className="newContainer">
<WrappedComponent initCommonState={(user)=>this.initCommonState(user)}
{...this.props} {...this.state}
showShixun={this.showShixun} aboutFocus={this.aboutFocus}
{...common}
>
</WrappedComponent>
</div>
<NewFooter
Footerdown={Footerdown}
/>
<SiderBar Headertop={Headertop}/>
<style>{
`
.newContainers{
width: 100%;
min-width: 1440px;
max-width: unset;
}
// .-task-sidebar{
// right: 270px !important;
// }
`
}</style>
<NewHeader {...this.state} {...this.props}></NewHeader>
<div className="newContainer newContainers">
<WrappedComponent initCommonState={(user)=>this.initCommonState(user)}
{...this.props} {...this.state}
showShixun={this.showShixun} aboutFocus={this.aboutFocus}
{...common}
>
</WrappedComponent>
</div>
<NewFooter
Footerdown={Footerdown}
/>
</div>
);
}

@ -190,7 +190,7 @@ export default class TPMsettings extends Component {
evaluate_script:undefined,
standard_scripts: undefined,
choice_main_type: "",
choice_small_type: [""],
choice_small_type: [],
choice_standard_scripts:undefined,
editordescriptios: undefined,
editorevaluate_scripts: undefined,
@ -222,7 +222,8 @@ export default class TPMsettings extends Component {
scope_partmenttype:false,
newuse_scope:undefined,
scope_partments:0,
shixun_service_configs:undefined,
shixun_service_configlist:undefined,
pod_exist_time: undefined,
pod_exist_timetype: false,
shixunmemoMDvalue:"",
@ -325,6 +326,8 @@ export default class TPMsettings extends Component {
newuse_scope:response.data.shixun.use_scope,
scope_partments: response.data.shixun.scope_partment.length,
shixunmemoMDvalue:response.data.shixun.evaluate_script,
shixun_service_configs:response.data.shixun.shixun_service_configs,
shixun_service_configlist:response.data.shixun.shixun_service_configs,
})
// if(response.data.status===403){
@ -489,14 +492,14 @@ export default class TPMsettings extends Component {
}
shixun_vnc=(e)=>{
let sum = ""
if (e.target.checked === false) {
sum = 0
} else if (e.target.checked === true) {
sum = 1
}
// let sum = ""
// if (e.target.checked === false) {
// sum = 0
// } else if (e.target.checked === true) {
// sum = 1
// }
this.setState({
vnc: sum,
vnc: e.target.checked,
});
}
@ -513,6 +516,23 @@ export default class TPMsettings extends Component {
bigClass = (value) => {
let {settingsData,shixun_service_configs}=this.state;
let newshixun_service_configs=shixun_service_configs;
settingsData.shixun.main_type.some((item,key)=> {
if (item.id === value) {
newshixun_service_configs[0]={
mirror_repository_id:value,
name:item.type_name,
cpu_limit:1,
lower_cpu_limit:0.1,
memory_limit:1024,
request_limit:10
}
return true
}
}
)
let url = `/shixuns/get_mirror_script.json?mirror_id=`+value;
axios.get(url).then((response) => {
if (response.status === 200) {
@ -520,7 +540,9 @@ export default class TPMsettings extends Component {
this.setState({
choice_main_type: value,
standard_scripts:response.data,
choice_standard_scripts:null
choice_standard_scripts:null,
shixun_service_configs:newshixun_service_configs,
shixun_service_configlist:newshixun_service_configs,
})
}
}).catch((error) => {
@ -530,10 +552,80 @@ export default class TPMsettings extends Component {
}
Deselectlittle=(value)=>{
let {settingsData,shixun_service_configs,choice_small_type}=this.state;
let newshixun_service_configs=shixun_service_configs;
let newchoice_small_type=choice_small_type;
newchoice_small_type.some((items,keys)=> {
if (items === value) {
newchoice_small_type.splice(keys, 1)
return true
}
}
)
settingsData.shixun.small_type.some((items,keys)=> {
if (items.id === value) {
newshixun_service_configs.splice(keys+1, 1)
return true
}
}
)
this.setState({
choice_small_type: newchoice_small_type,
shixun_service_configs:newshixun_service_configs,
shixun_service_configlist:newshixun_service_configs,
})
}
littleClass = (value) => {
let {settingsData,shixun_service_configs,choice_small_type}=this.state;
let newshixun_service_configs=shixun_service_configs;
let newchoice_small_type=choice_small_type;
// if(Array.isArray(value)===true){
// value.map((item,key)=>{
// settingsData.shixun.small_type.some((items,keys)=> {
// if (items.id === item) {
// newshixun_service_configs.push({
// mirror_repository_id:value,
// name:items.type_name,
// cpu_limit:1,
// lower_cpu_limit:0.1,
// memory_limit:1024,
// request_limit:10
// })
// return true
// }
// }
// )
// })
// }
settingsData.shixun.small_type.some((items,keys)=> {
if (items.id === value) {
newshixun_service_configs.push({
mirror_repository_id:value,
name:items.type_name,
cpu_limit:1,
lower_cpu_limit:0.1,
memory_limit:1024,
request_limit:10
})
return true
}
}
)
newchoice_small_type.push(value)
this.setState({
choice_small_type: value
choice_small_type: newchoice_small_type,
shixun_service_configs:newshixun_service_configs,
shixun_service_configlist:newshixun_service_configs,
})
}
onPodExistTimeChange = (e) => {
@ -594,10 +686,15 @@ export default class TPMsettings extends Component {
// }
submit_edit_shixun = () => {
let {
name, description, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum,
evaluate_script, exec_time, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh,
opening_time, pod_exist_time,shixunmemoMDvalue
name, choice_main_type, choice_small_type, choice_standard_scripts, scope_partment, choice_standard_scriptssum,
evaluate_script, webssh, use_scope, trainee, can_copy, task_pass, test_set_permission, hide_code, code_hidden, forbid_copy, vnc,multi_webssh,
opening_time,shixunmemoMDvalue,shixun_service_configlist
} = this.state;
shixun_service_configlist.map((item,key)=>{
delete item.name;
})
let operateauthority=this.props.identity<5&&this.state.status==0||this.props.identity===1&&this.state.status==2||this.props.identity===1&&this.state.status==1;
const description_editormd = this.description_editormd.getValue();
@ -652,15 +749,15 @@ export default class TPMsettings extends Component {
return
}
}
if (exec_time === "") {
this.setState({
exec_timetype: true
})
$('html').animate({
scrollTop: 1500
}, 1000);
return
}
// if (exec_time === "") {
// this.setState({
// exec_timetype: true
// })
// $('html').animate({
// scrollTop: 1500
// }, 1000);
// return
// }
// if (!pod_exist_time) {
// this.setState({
@ -680,40 +777,38 @@ export default class TPMsettings extends Component {
let id = this.props.match.params.shixunId;
let newmulti_webssh=multi_webssh;
if(newmulti_webssh===true){
newmulti_webssh=1
}else{
newmulti_webssh=0
}
if(newmulti_webssh===null){
newmulti_webssh=0
newmulti_webssh=false
}
//exec_time: exec_time,
let Url = `/shixuns/` + id + `.json`;
let data = {
name: name,
description: description_editormd,
main_type: choice_main_type,
small_type: choice_small_type,
webssh: webssh,
user_scope: use_scope,
scope_partment: scope_partment,
can_copy: can_copy,
vnc: vnc,
test_set_permission: test_set_permission,
code_hidden: code_hidden,
trainee: trainee,
task_pass: task_pass,
standard_scripts: choice_standard_scripts,
hide_code: hide_code,
forbid_copy: forbid_copy,
exec_time: exec_time,
evaluate_script: evaluate_script_editormd,
multi_webssh:newmulti_webssh,
opening_time:opening_time,
mirror_script_id:choice_standard_scriptssum,
delType:1
shixun:{
name: name,
webssh: webssh,
user_scope: use_scope,
can_copy: can_copy,
vnc: vnc===null?undefined:vnc,
test_set_permission: test_set_permission,
code_hidden: code_hidden,
trainee: trainee,
task_pass: task_pass,
hide_code: hide_code,
forbid_copy: forbid_copy,
multi_webssh:newmulti_webssh,
opening_time:opening_time,
mirror_script_id:choice_standard_scriptssum,
},
shixun_info:{
description: description_editormd,
evaluate_script: evaluate_script_editormd,
},
main_type: choice_main_type,
small_type: choice_small_type,
scope_partment: scope_partment,
shixun_service_configs:shixun_service_configlist
}
axios.put(Url, data).then((response) => {
@ -941,6 +1036,7 @@ export default class TPMsettings extends Component {
this.setState({
opers:true
})
}
bigopens=()=>{
@ -950,16 +1046,19 @@ export default class TPMsettings extends Component {
opersss:false,
opensmail:false
})
}
bigopensmal=()=>{
bigopensmal=(e)=>{
this.setState({
opensmail:true
})
}
sbigopen=()=>{
sbigopen=(e)=>{
this.setState({
operss:true
})
}
sbigopens=()=>{
@ -967,10 +1066,11 @@ export default class TPMsettings extends Component {
operss:false
})
}
sbigopenss=()=>{
sbigopenss=(e)=>{
this.setState({
opersss:true
})
}
sbigopensss=()=>{
@ -1015,7 +1115,9 @@ export default class TPMsettings extends Component {
})
}
inputs=()=>{
}
render() {
let {
@ -1070,7 +1172,8 @@ export default class TPMsettings extends Component {
scope_partmenttype,
newuse_scope,
scope_partments,
shixunmemoMDvalue,delType
shixunmemoMDvalue,delType,
shixun_service_configs
} = this.state;
let options;
@ -1087,7 +1190,7 @@ export default class TPMsettings extends Component {
let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false;
return (
<div className="educontent mt30 mb50" id="shixun_settings_show" onClick={this.bigopens} onMouseEnter={this.bigopens}>
<div className="educontent mt30 mb50" id="shixun_settings_show" onClick={this.bigopens} >
<div className="edu-back-white mb10">
<div className="padding30 bor-bottom-greyE clearfix">
<span className="fl font-16">配置</span>
@ -1254,9 +1357,10 @@ export default class TPMsettings extends Component {
value={choice_small_type.length===0||choice_small_type[0]===""||choice_small_type===[]?undefined:choice_small_type}
style={{width: 180}}
disabled={operateauthority?false:true}
onChange={operateauthority?this.littleClass:""}
// onChange={operateauthority?this.littleClass:""}
onDeselect={operateauthority?this.Deselectlittle:""}
onMouseEnter={operateauthority?this.bigopensmal:""}
onSelect={operateauthority?this.bigopens:""}
onSelect={operateauthority?this.littleClass:""}
defaultOpen={false}
open={opensmail}
>
@ -1468,21 +1572,21 @@ export default class TPMsettings extends Component {
</div>
</div>
<div className="edu-back-white mb10 padding40-20 clearfix">
<span className="color-orange fl mr20">*</span>
{/*<div className="edu-back-white mb10 padding40-20 clearfix">*/}
{/*<span className="color-orange fl mr20">*</span>*/}
<p className="color-grey-6 font-16 mb30">程序最大执行时间</p>
{/*<p className="color-grey-6 font-16 mb30">程序最大执行时间</p>*/}
<Input className="mr10 fl" placeholder="请输入程序最大执行时间" maxLength="60" style={{width: '20%'}}
onInput={this.Timevalue} value={exec_time === undefined ? "" : exec_time}/> <span
className="fl mr10 ml20"></span>
{/*<Input className="mr10 fl" placeholder="请输入程序最大执行时间" maxLength="60" style={{width: '20%'}}*/}
{/*onInput={this.Timevalue} value={exec_time === undefined ? "" : exec_time}/> <span*/}
{/*className="fl mr10 ml20">秒</span>*/}
<div style={{width: ' 57px '}} className="fl">
<span className={exec_timetype === true ? "color-orange mt8" : "color-orange mt8 none"}
id="shixun_name_notice"><i
className="fa fa-exclamation-circle mr3"></i></span>
</div>
</div>
{/*<div style={{width: ' 57px '}} className="fl">*/}
{/*<span className={exec_timetype === true ? "color-orange mt8" : "color-orange mt8 none"}*/}
{/*id="shixun_name_notice"><i*/}
{/*className="fa fa-exclamation-circle mr3"></i>必填项</span>*/}
{/*</div>*/}
{/*</div>*/}
{/* <div className="edu-back-white mb10 padding40-20 clearfix" id="pod_exist_time">
<span className="color-orange fl mr20">*</span>
@ -1675,8 +1779,9 @@ export default class TPMsettings extends Component {
<span className="color-grey-6 mt5 fl" style={{minWidth: '95px'}}>开启时间:</span>
<span className="fl mt5">
<DatePicker
showToday={false}
showToday={false}
showTime
width={178}
locale={locale}
format={dateFormat}
placeholder="请选择开启时间"
@ -1686,15 +1791,67 @@ export default class TPMsettings extends Component {
<label style={{top:'6px'}} className="color-grey-9 ml10" >为空则学员在实训发布后能随时开启实训挑战否则学员在开启时间后才能开启实训挑战</label>
</span>
</div>
{/*<div className="clearfix mt20">*/}
{/*<span className="color-grey-6 mt5 fl" style={{minWidth: '95px'}}>VNC图形化:</span>*/}
{/*<span className="fl mt5">*/}
{/*<Checkbox checked={vnc === undefined ? false : vnc} onChange={this.shixun_vnc}></Checkbox>*/}
{/*<label style={{top:'6px'}} className="color-grey-9 ml10" >勾选则给学员的实践任务提供Ubuntu系统图形化实践窗口否则不提供</label>*/}
{/*</span>*/}
{/*</div>*/}
<div className="clearfix mt20 ml30">
<span className="color-grey-6 mt5 fl" style={{minWidth: '95px'}}>VNC图形化:</span>
<span className="fl mt5">
<Checkbox checked={vnc === undefined ? false : vnc} onChange={this.shixun_vnc}></Checkbox>
<label style={{top:'6px'}} className="color-grey-9 ml10" >勾选则给学员的实践任务提供Ubuntu系统图形化实践窗口否则不提供</label>
</span>
</div>
</div>
{/*"name": "我是镜像名", # 镜像名称*/}
{/*"cpu_limit": 1, # cpu核*/}
{/*"lower_cpu_limit": 0.1, # 最低cpu核 浮点数*/}
{/*"memory_limit": 1024 ,#内存限制*/}
{/*"request_limit": 10, # 内存要求*/}
{/*"mirror_repository_id": 12, # 镜像id*/}
<div className="edu-back-white padding40-20 mb20">
{this.props.identity<2?shixun_service_configs&&shixun_service_configs.map((item,key)=>{
return(
<div key={key}>
<p className="color-grey-6 font-16 mb30">服务配置</p>
<div id="5">
<p className="color-grey-6 font-16 mt30 mb20" id="shixun_scenario_type_name">{item.name}</p>
<div className="clearfix mb5">
<label className="panel-form-label fl">CPU()</label>
<div className="pr fl with80 status_con">
<input type="text" name="cpu_limit[]" value={item.cpu_limit} onInput={this.inputs}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
</div>
<div className="cl"></div>
</div>
<div className="clearfix mb5">
<label className="panel-form-label fl">最低CPU()</label>
<div className="pr fl with80 status_con">
<input type="text" name="lower_cpu_limit[]" value={item.lower_cpu_limit} onInput={this.inputs}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
</div>
<div className="cl"></div>
</div>
<div className="clearfix mb5">
<label className="panel-form-label fl">内存限制(M)</label>
<div className="pr fl with80 status_con">
<input type="text" name="memory_limit[]" value={item.memory_limit} onInput={this.inputs}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
</div>
<div className="cl"></div>
</div>
<div className="clearfix mb5">
<label className="panel-form-label fl">内存要求(M)</label>
<div className="pr fl with20 status_con">
<input type="text" name="request_limit[]" value={item.request_limit} onInput={this.inputs}
className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" />
</div>
<label className="panel-form-label fl" style={{width: '48%'}}>温馨提示纯编程类型实训建议使用默认值对于大数据等建议使用最大内存的30%</label>
<div className="cl"></div>
</div>
</div>
</div>
)
}) :""}
</div>
<p>
{
@ -1706,49 +1863,7 @@ export default class TPMsettings extends Component {
<a href={"/shixuns/" + shixunsID + "/challenges"} className="defalutCancelbtn fl">取消</a>
</div> :""
}
{/*{*/}
{/*this.props.identity===1&&this.props.status==2?*/}
{/*<div className="clearfix mt30">*/}
{/*<a className="defalutSubmitbtn fl mr20"*/}
{/*onClick={this.submit_edit_shixun}>保存</a>*/}
{/*<a href={"/shixuns/" + shixunsID + "/challenges"} className="defalutCancelbtn fl">取消</a>*/}
{/*/!*<a className="edu-default-btn edu-blueline-btn fl ml20"*!/*/}
{/*/!*id="challenge_begin"*!/*/}
{/*/!*onClick={this.operateshixuns}>*!/*/}
{/*/!*永久关闭*!/*/}
{/*/!*</a>*!/*/}
{/*</div> :""*/}
{/*}*/}
{/*{*/}
{/*this.props.identity===1||this.props.power==true?*/}
{/*<div className="clearfix mt30">*/}
{/*<a className="defalutSubmitbtn fl mr20"*/}
{/*onClick={this.submit_edit_shixun}>保存</a>*/}
{/*<a href={"/shixuns/" + shixunsID + "/challenges"} className="defalutCancelbtn fl">取消</a>*/}
{/*<Popconfirm title={status===0?"删除实训后,用户不能再开始挑战了是否确认删除?":"关闭实训后,用户不能再开始挑战了是否确认关闭?"} onConfirm={this.shixunsclose} okText="确定"*/}
{/*cancelText="取消"*/}
{/*style={{display:status===0?"none":"block"}}*/}
{/*>*/}
{/*<a*/}
{/*className="edu-default-btn edu-blueline-btn fl ml20"*/}
{/*id="challenge_begin"*/}
{/*style={{display:status===0?"none":"block"}}*/}
{/*>*/}
{/*{status===0?"":"永久关闭"}*/}
{/*</a>*/}
{/*</Popconfirm>*/}
{/*</div> :""*/}
{/*}*/}
{/*<div className="clearfix mt30">*/}
{/*<a className="defalutSubmitbtn fl mr20"*/}
{/*onClick={this.submit_edit_shixun}>保存</a>*/}
{/*<a href={"/shixuns/" + shixunsID + "/challenges"} className="defalutCancelbtn fl">取消</a>*/}
{/*</div>*/}
</p>
</div>

@ -1,366 +1,366 @@
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 { getImageUrl, toPath, getUrl } from 'educoder';
import axios from 'axios';
import './css/TPMchallengesnew.css';
let origin = getUrl();
let path = getUrl("/editormd/lib/")
const $ = window.$;
let timeout;
let currentValue;
const Option = Select.Option;
const RadioGroup = Radio.Group;
// 恢复数据
function md_rec_data(k,mdu,id, editor){
if(window.sessionStorage.getItem(k+mdu) !== null){
editor.setValue(window.sessionStorage.getItem(k+mdu));
md_clear_data(k,mdu,id);
}
}
// 保存数据
function md_add_data(k,mdu,d){
window.sessionStorage.setItem(k+mdu,d);
}
// 清空保存的数据
function md_clear_data(k,mdu,id){
window.sessionStorage.removeItem(k+mdu);
var id1 = "#e_tip_"+id;
var id2 = "#e_tips_"+id;
if(k == 'content'){
$(id2).html("");
}else{
$(id1).html("");
}
}
function md_elocalStorage(editor,mdu,id){
if (window.sessionStorage){
var oc = window.sessionStorage.getItem('content'+mdu);
if(oc !== null ){
console.log("#e_tips_"+id)
$("#e_tips_"+id).data('editor', editor);
var h = '您上次有已保存的数据,是否<a style="cursor: pointer;" class="link-color-blue" onclick="md_rec_data(\'content\',\''+ mdu + '\',\'' + id + '\')">恢复</a> ? / <a style="cursor: pointer;" class="link-color-blue" onclick="md_clear_data(\'content\',\''+ mdu + '\',\'' + id + '\')">不恢复</a>';
$("#e_tips_"+id).html(h);
}
setInterval(function() {
var d = new Date();
var h = d.getHours();
var m = d.getMinutes();
var s = d.getSeconds();
h = h < 10 ? '0' + h : h;
m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s;
if(editor.getValue().trim() != ""){
md_add_data("content",mdu,editor.getValue());
var id1 = "#e_tip_"+id;
var id2 = "#e_tips_"+id;
$(id1).html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 ");
$(id2).html("");
}
},10000);
}else{
$("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!');
}
}
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: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
},
//这个配置在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", "多行公式");
md_elocalStorage(editorName, `answers__${id}`, "Memoanswers");
callback && callback()
}
});
return editorName;
}
export default class TPManswer extends Component {
constructor(props) {
super(props)
this.state = {
choice_url: undefined,
practice_url: undefined,
go_back_url: undefined,
value: 1,
answer:"",
id:undefined,
checkpointId:undefined,
power: false,
prev_challenge: undefined,
next_challenge: undefined,
}
}
answerMD(initValue, id) {
this.contentChanged = false;
const placeholder = "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
// 创建editorMd
const answers_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => {
setTimeout(() => {
answers_editormd.resize()
answers_editormd.cm && answers_editormd.cm.refresh()
}, 500)
if (initValue != undefined) {
answers_editormd.setValue(initValue)
}
answers_editormd.cm.on("change", (_cm, changeObj) => {
console.log('....contentChanged')
this.contentChanged = true;
})
});
this.answers_editormd = answers_editormd;
window.answers_editormd = answers_editormd;
}
componentDidMount() {
let id = this.props.match.params.shixunId;
let checkpointId=this.props.match.params.checkpointId;
let newchoice_url= "/shixuns/"+id+"/challenges/newquestion";
let newpractice_url= "/shixuns/"+id+"/challenges/new";
let newgo_back_url="/shixuns/"+id+"/challenges";
this.setState({
shixunId:id,
checkpointId:checkpointId
})
let url = "/shixuns/" + id + "/challenges/" + checkpointId + "/edit.json?tab=2";
axios.get(url).then((response) => {
let newprev_challenge = response.data.prev_challenge;
let next_challenge = response.data.next_challenge;
if (newprev_challenge != undefined) {
if(newprev_challenge.st===0){
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint";
}else{
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editquestion";
}
}
if (next_challenge != undefined) {
if(next_challenge.st===0){
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editcheckpoint";
}else{
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editquestion";
}
}
this.setState({
answer:response.data.answer,
power: response.data.power,
choice_url: newchoice_url, // 导航中的新建选择题url
practice_url: newpractice_url, //string 导航中新建实践题url
go_back_url: newgo_back_url, //string 导航中的返回url
position: response.data.position, //int 关卡位置,导航栏中的第几关
prev_challenge: newprev_challenge,
next_challenge: next_challenge,
})
if(response.data.power===false){
this.props.showSnackbar("没有权限修改");
}
if(response.data.answer===undefined||response.data.answer===null){
this.answerMD("", "answerMD");
}else{
this.answerMD(response.data.answer, "answerMD");
}
}).catch((error) => {
console.log(error)
});
}
challenge_answer_submit=()=> {
let id = this.props.match.params.shixunId;
let{checkpointId}=this.state;
let url = "/shixuns/"+id+"/challenges/"+checkpointId+".json";
const answer_editormdvalue = this.answers_editormd.getValue();
axios.put(url,{
tab:2,
identifier:id,
id:checkpointId,
challenge:{
answer:answer_editormdvalue
}
}
).then((response) => {
this.props.showSnackbar(response.data.messages);
}).catch((error) => {
console.log(error)
});
}
render() {
let {
choice_url,
practice_url,
go_back_url,
position,
task_pass_default,
submit_url,
shixunId,
checkpointId,
power,
prev_challenge,
next_challenge,
} = this.state;
let tab1url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/editcheckpoint";
let tab2url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=2";
let tab3url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=3";
// console.log(this.props)
return (
<React.Fragment>
<div className="educontent mt30 mb30">
<div className="padding10-20 mb10 edu-back-white clearfix">
<span className="fl ring-blue mr10 mt7">
<img src={getImageUrl("images/educoder/icon/code.svg")} data-tip-down="实训任务" className="fl mt2 ml2"/>
</span>
<span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-16 ml30">返回</Link>
{prev_challenge === undefined ? "" :
<a href={prev_challenge} className="fr color-blue mr15 mt3">上一关</a>
}
{next_challenge === undefined ? "" :
<a href={next_challenge} className="fr color-blue mr15 mt3">下一关</a>
}
<Link to={practice_url === undefined ? "" : practice_url}
className="fr color-blue mr15 mt4"
style={{display:this.props.status===2||this.props.status===1?'none':'block'}}
data-tip-down="新增代码编辑类型的任务">+&nbsp;实践类型</Link>
<Link to={choice_url === undefined ? "" : choice_url}
className="fr color-blue mr15 mt4"
style={{display:this.props.status===2||this.props.status===1?'none':'block'}}
data-tip-down="新增选择题类型的任务">+&nbsp;选择题类型</Link>
</div>
<div className="challenge_nav clearfix edu-back-white">
<li>
<Link to={tab1url}>本关任务</Link>
</li>
<li >
<Link to={tab2url}>评测设置</Link>
</li>
<li className="active">
<Link to={tab3url}>参考答案</Link>
</li>
</div>
<div className="edu-back-white mb10 clearfix">
<div className="padding40-20">
<p className="color-grey-6 font-16 mb30">参考答案</p>
<div className="df">
<div className="padding10-20 edu-back-greyf5 radius4" id="answerMD">
<textarea style={{display: 'none'}} id="evaluate_script_show" name="content"> </textarea>
<div className="CodeMirror cm-s-defualt">
</div>
</div>
</div>
<p id="e_tip_Memoanswers" className="edu-txt-right color-grey-cd font-12"></p>
<p id="e_tips_Memoanswers" className="edu-txt-right color-grey-cd font-12"></p>
</div>
</div>
<div className="clearfix mt20" style={{display:this.props.identity>3||this.props.identity===undefined||power===false?"none":"block"}}>
<a className="defalutSubmitbtn fl mr20"
onClick={this.challenge_answer_submit}>提交</a>
<a href={"/shixuns/" + shixunId + "/challenges"} className="defalutCancelbtn fl">取消</a>
</div>
</div>
</React.Fragment>
)
}
}
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 { getImageUrl, toPath, getUrl } from 'educoder';
import axios from 'axios';
import './css/TPMchallengesnew.css';
let origin = getUrl();
let path = getUrl("/editormd/lib/")
const $ = window.$;
let timeout;
let currentValue;
const Option = Select.Option;
const RadioGroup = Radio.Group;
// 恢复数据
function md_rec_data(k,mdu,id, editor){
if(window.sessionStorage.getItem(k+mdu) !== null){
editor.setValue(window.sessionStorage.getItem(k+mdu));
md_clear_data(k,mdu,id);
}
}
// 保存数据
function md_add_data(k,mdu,d){
window.sessionStorage.setItem(k+mdu,d);
}
// 清空保存的数据
function md_clear_data(k,mdu,id){
window.sessionStorage.removeItem(k+mdu);
var id1 = "#e_tip_"+id;
var id2 = "#e_tips_"+id;
if(k == 'content'){
$(id2).html("");
}else{
$(id1).html("");
}
}
function md_elocalStorage(editor,mdu,id){
if (window.sessionStorage){
var oc = window.sessionStorage.getItem('content'+mdu);
if(oc !== null ){
console.log("#e_tips_"+id)
$("#e_tips_"+id).data('editor', editor);
var h = '您上次有已保存的数据,是否<a style="cursor: pointer;" class="link-color-blue" onclick="md_rec_data(\'content\',\''+ mdu + '\',\'' + id + '\')">恢复</a> ? / <a style="cursor: pointer;" class="link-color-blue" onclick="md_clear_data(\'content\',\''+ mdu + '\',\'' + id + '\')">不恢复</a>';
$("#e_tips_"+id).html(h);
}
setInterval(function() {
var d = new Date();
var h = d.getHours();
var m = d.getMinutes();
var s = d.getSeconds();
h = h < 10 ? '0' + h : h;
m = m < 10 ? '0' + m : m;
s = s < 10 ? '0' + s : s;
if(editor.getValue().trim() != ""){
md_add_data("content",mdu,editor.getValue());
var id1 = "#e_tip_"+id;
var id2 = "#e_tips_"+id;
$(id1).html(" 数据已于 " + h + ':' + m + ':' + s +" 保存 ");
$(id2).html("");
}
},10000);
}else{
$("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!');
}
}
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: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
},
//这个配置在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", "多行公式");
md_elocalStorage(editorName, `answers__${id}`, "Memoanswers");
callback && callback()
}
});
return editorName;
}
export default class TPManswer extends Component {
constructor(props) {
super(props)
this.state = {
choice_url: undefined,
practice_url: undefined,
go_back_url: undefined,
value: 1,
answer:"",
id:undefined,
checkpointId:undefined,
power: false,
prev_challenge: undefined,
next_challenge: undefined,
}
}
answerMD(initValue, id) {
this.contentChanged = false;
const placeholder = "";
// amp;
// 编辑时要传memoId
const imageUrl = `/api/attachments.json`;
// 创建editorMd
const answers_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => {
setTimeout(() => {
answers_editormd.resize()
answers_editormd.cm && answers_editormd.cm.refresh()
}, 500)
if (initValue != undefined) {
answers_editormd.setValue(initValue)
}
answers_editormd.cm.on("change", (_cm, changeObj) => {
console.log('....contentChanged')
this.contentChanged = true;
})
});
this.answers_editormd = answers_editormd;
window.answers_editormd = answers_editormd;
}
componentDidMount() {
let id = this.props.match.params.shixunId;
let checkpointId=this.props.match.params.checkpointId;
let newchoice_url= "/shixuns/"+id+"/challenges/newquestion";
let newpractice_url= "/shixuns/"+id+"/challenges/new";
let newgo_back_url="/shixuns/"+id+"/challenges";
this.setState({
shixunId:id,
checkpointId:checkpointId
})
let url = "/shixuns/" + id + "/challenges/" + checkpointId + "/edit.json?tab=2";
axios.get(url).then((response) => {
let newprev_challenge = response.data.prev_challenge;
let next_challenge = response.data.next_challenge;
if (newprev_challenge != undefined) {
if(newprev_challenge.st===0){
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint";
}else{
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editquestion";
}
}
if (next_challenge != undefined) {
if(next_challenge.st===0){
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editcheckpoint";
}else{
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editquestion";
}
}
this.setState({
answer:response.data.answer,
power: response.data.power,
choice_url: newchoice_url, // 导航中的新建选择题url
practice_url: newpractice_url, //string 导航中新建实践题url
go_back_url: newgo_back_url, //string 导航中的返回url
position: response.data.position, //int 关卡位置,导航栏中的第几关
prev_challenge: newprev_challenge,
next_challenge: next_challenge,
})
if(response.data.power===false){
this.props.showSnackbar("没有权限修改");
}
if(response.data.answer===undefined||response.data.answer===null){
this.answerMD("", "answerMD");
}else{
this.answerMD(response.data.answer, "answerMD");
}
}).catch((error) => {
console.log(error)
});
}
challenge_answer_submit=()=> {
let id = this.props.match.params.shixunId;
let{checkpointId}=this.state;
let url = "/shixuns/"+id+"/challenges/"+checkpointId+".json";
const answer_editormdvalue = this.answers_editormd.getValue();
axios.put(url,{
tab:2,
identifier:id,
id:checkpointId,
challenge:{
answer:answer_editormdvalue
}
}
).then((response) => {
this.props.showSnackbar(response.data.messages);
}).catch((error) => {
console.log(error)
});
}
render() {
let {
choice_url,
practice_url,
go_back_url,
position,
task_pass_default,
submit_url,
shixunId,
checkpointId,
power,
prev_challenge,
next_challenge,
} = this.state;
let tab1url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/editcheckpoint";
let tab2url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=2";
let tab3url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=3";
// console.log(this.props)
return (
<React.Fragment>
<div className="educontent mt30 mb30">
<div className="padding10-20 mb10 edu-back-white clearfix">
<span className="fl ring-blue mr10 mt7">
<img src={getImageUrl("images/educoder/icon/code.svg")} data-tip-down="实训任务" className="fl mt2 ml2"/>
</span>
<span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-15 mt3">返回</Link>
{prev_challenge === undefined ? "" :
<a href={prev_challenge} className="fr color-blue mr15 mt4">上一关</a>
}
{next_challenge === undefined ? "" :
<a href={next_challenge} className="fr color-blue mr15 mt4">下一关</a>
}
<Link to={practice_url === undefined ? "" : practice_url}
className="fr color-blue mr15 mt4"
style={{display:this.props.status===2||this.props.status===1?'none':'block'}}
data-tip-down="新增代码编辑类型的任务">+&nbsp;实践类型</Link>
<Link to={choice_url === undefined ? "" : choice_url}
className="fr color-blue mr15 mt4"
style={{display:this.props.status===2||this.props.status===1?'none':'block'}}
data-tip-down="新增选择题类型的任务">+&nbsp;选择题类型</Link>
</div>
<div className="challenge_nav clearfix edu-back-white">
<li>
<Link to={tab1url}>本关任务</Link>
</li>
<li >
<Link to={tab2url}>评测设置</Link>
</li>
<li className="active">
<Link to={tab3url}>参考答案</Link>
</li>
</div>
<div className="edu-back-white mb10 clearfix">
<div className="padding40-20">
<p className="color-grey-6 font-16 mb30">参考答案</p>
<div className="df">
<div className="padding10-20 edu-back-greyf5 radius4" id="answerMD">
<textarea style={{display: 'none'}} id="evaluate_script_show" name="content"> </textarea>
<div className="CodeMirror cm-s-defualt">
</div>
</div>
</div>
<p id="e_tip_Memoanswers" className="edu-txt-right color-grey-cd font-12"></p>
<p id="e_tips_Memoanswers" className="edu-txt-right color-grey-cd font-12"></p>
</div>
</div>
<div className="clearfix mt20" style={{display:this.props.identity>3||this.props.identity===undefined||power===false?"none":"block"}}>
<a className="defalutSubmitbtn fl mr20"
onClick={this.challenge_answer_submit}>提交</a>
<a href={"/shixuns/" + shixunId + "/challenges"} className="defalutCancelbtn fl">取消</a>
</div>
</div>
</React.Fragment>
)
}
}

@ -1,345 +1,345 @@
import React, {Component} from 'react';
import {Input, InputNumber, 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 { getImageUrl, toPath, getUrl } from 'educoder';
import axios from 'axios';
import './css/TPMchallengesnew.css';
import TPMMDEditor from './TPMMDEditor';
let origin = getUrl();
let path = getUrl("/editormd/lib/")
const $ = window.$;
let timeout;
let currentValue;
const Option = Select.Option;
const RadioGroup = Radio.Group;
// const testAnswers = [{
// "id": 4337,
// "name": "解题思路1",
// "contents": "答案的解题思路1",
// "level": 1,
// "score": 25
// },
// {
// "id": 4338,
// "name": "解题思路2",
// "contents": "答案的解题思路2",
// "level": 2,
// "score": 25
// }]
export default class TPManswer extends Component {
constructor(props) {
super(props)
this.state = {
choice_url: undefined,
practice_url: undefined,
go_back_url: undefined,
value: 1,
answer:"",
id:undefined,
checkpointId:undefined,
power: false,
prev_challenge: undefined,
next_challenge: undefined,
answers: [] //testAnswers
}
}
componentDidMount() {
let id = this.props.match.params.shixunId;
let checkpointId=this.props.match.params.checkpointId;
let newchoice_url= "/shixuns/"+id+"/challenges/newquestion";
let newpractice_url= "/shixuns/"+id+"/challenges/new";
let newgo_back_url="/shixuns/"+id+"/challenges";
this.setState({
shixunId:id,
checkpointId:checkpointId
})
let url = "/shixuns/" + id + "/challenges/" + checkpointId + "/edit.json?tab=2";
axios.get(url).then((response) => {
let newprev_challenge = response.data.prev_challenge;
let next_challenge = response.data.next_challenge;
if (newprev_challenge != undefined) {
if(newprev_challenge.st===0){
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint";
}else{
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editquestion";
}
}
if (next_challenge != undefined) {
if(next_challenge.st===0){
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editcheckpoint";
}else{
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editquestion";
}
}
this.setState({
answer:response.data.answer,
power: response.data.power,
choice_url: newchoice_url, // 导航中的新建选择题url
practice_url: newpractice_url, //string 导航中新建实践题url
go_back_url: newgo_back_url, //string 导航中的返回url
position: response.data.position, //int 关卡位置,导航栏中的第几关
prev_challenge: newprev_challenge,
next_challenge: next_challenge,
})
if(response.data.power===false){
this.props.showSnackbar("没有权限修改");
}
// if(response.data.answer===undefined||response.data.answer===null){
// this.answerMD("", "answerMD");
// }else{
// this.answerMD(response.data.answer, "answerMD");
// }
}).catch((error) => {
console.log(error)
});
let urlAnswer = `/shixuns/${id}/challenges/${checkpointId}/answer.json`;
axios.get(urlAnswer).then((response) => {
if (response.data) {
this.setState({ answers: response.data })
}
})
}
challenge_answer_submit=()=> {
// `levelSection${index}`
// this.refs.md0
const { answers } = this.state;
const answersParams = answers.slice(0)
console.log(answersParams)
let isValidate = true;
let totalScore = 0;
answersParams.forEach( (item, index) => {
if (!isValidate) {
return;
}
const sectionId = `#levelSection${index}`;
const mdContnet = this.refs[`md${index}`].getValue().trim();;
item.contents = mdContnet;
item.name = item.name.trim()
totalScore += item.score;
delete item.id;
if (!item.name) {
this.props.showSnackbar("请先填写参考答案名称");
isValidate = false;
} else if (!mdContnet) {
this.props.showSnackbar("请先填写参考答案内容");
isValidate = false;
}
if (!isValidate) {
$("html, body").animate({ scrollTop: $(`${sectionId}`).offset().top - 100})
}
})
if (!isValidate) {
return;
}
if (totalScore != 100) {
this.props.showSnackbar("请先保证占比和为100%");
return;
}
let id = this.props.match.params.shixunId;
let {checkpointId} = this.state;
let url = `/shixuns/${id}/challenges/${checkpointId}/crud_answer.json`;
axios.post(url,{
challenge_answer: answersParams
}
).then((response) => {
if (response.data) {
if (response.data.message) {
this.props.showSnackbar(response.data.message);
}
}
}).catch((error) => {
console.log(error)
});
}
onNameChange = (e, index) => {
const newAnswer = Object.assign({}, this.state.answers[index])
newAnswer.name = e.target.value
const newAnswers = this.state.answers.slice(0)
newAnswers[index] = newAnswer
this.setState({ answers: newAnswers})
}
onScoreChange = (val, index) => {
const newAnswer = Object.assign({}, this.state.answers[index])
newAnswer.score = val
const newAnswers = this.state.answers.slice(0)
newAnswers[index] = newAnswer
this.setState({ answers: newAnswers})
}
addAnswer = () => {
const newAnswers = this.state.answers.slice(0)
newAnswers.push({
"name": `解题思路${newAnswers.length + 1}`,
"contents": "",
"score": 10
})
this.setState({ answers: newAnswers })
}
delanswers=(index)=>{
let {answers}=this.state;
let newanswers=answers;
newanswers.splice(index,1)
this.setState({
answers:newanswers
})
}
render() {
let {
choice_url,
practice_url,
go_back_url,
position,
task_pass_default,
submit_url,
shixunId,
checkpointId,
power,
prev_challenge,
next_challenge,
answers,
} = this.state;
let tab1url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/editcheckpoint";
let tab2url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=2";
let tab3url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=3";
// console.log(this.props)
return (
<React.Fragment>
<div className="educontent mt30 mb30 tpmAnswer">
<div className="padding10-20 mb10 edu-back-white clearfix">
<span className="fl ring-blue mr10 mt7">
<img src={getImageUrl("images/educoder/icon/code.svg")} data-tip-down="实训任务" className="fl mt2 ml2"/>
</span>
<span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-16 ml30">返回</Link>
{prev_challenge === undefined ? "" :
<a href={prev_challenge} className="fr color-blue mr15 mt3">上一关</a>
}
{next_challenge === undefined ? "" :
<a href={next_challenge} className="fr color-blue mr15 mt3">下一关</a>
}
<Link to={practice_url === undefined ? "" : practice_url}
className="fr color-blue mr15 mt4"
style={{display:this.props.status===2||this.props.status===1?'none':'block'}}
data-tip-down="新增代码编辑类型的任务">+&nbsp;实践类型</Link>
<Link to={choice_url === undefined ? "" : choice_url}
className="fr color-blue mr15 mt4"
style={{display:this.props.status===2||this.props.status===1?'none':'block'}}
data-tip-down="新增选择题类型的任务">+&nbsp;选择题类型</Link>
</div>
<div className="challenge_nav clearfix edu-back-white">
<li>
<Link to={tab1url}>本关任务</Link>
</li>
<li >
<Link to={tab2url}>评测设置</Link>
</li>
<li className="active">
<Link to={tab3url}>参考答案</Link>
</li>
</div>
<div className="edu-back-white mb10 clearfix">
<div className="padding30-20">
<p className=" font-12" style={{ paddingBottom: '5px'
, color: '#666666'}}>
可以将参考答案分级设置让学员自行选择级别每级查看后按照比例扣分值学员已完成任务再查看则不影响原因已获得的成绩
</p>
<p className=" font-12 "
style={{ maxWidth: "782px"
, color: '#999999'}}>
示例级别1扣减分值占比25%级别2扣减分值占比35%级别3扣减分值占比40%则学员选择查看级别1的答案将被扣减25%的分值
选择查看级别2的答案将被扣减60%的分值选择查看级别3的答案将被扣减100%的分值
</p>
<style>{`
.tpmAnswer .ant-input { width: 230px }
.tpmAnswer .score.ant-input-number { width: 54px; }
.levelSection { margin-top: 16px }
`}</style>
{
answers.map((answer, index) => {
return <div className="levelSection" id={`levelSection${index}`}>
<span className="mr4 color-orange pt10">*</span>
<p className="color-grey-6 font-16 mb30 mt10" style={{ display: "inline" }}>级别{index + 1}</p>
<a className="fr sample_icon_remove mr30 mt8" onClick={()=>this.delanswers(index)}>
<i className="fa fa-times-circle color-grey-c font-16 fl" ></i>
</a>
<div className=" color-grey-6 font-16" style={{ marginLeft: "9px", margin: '8px 9px'}}>
<div className=" ">
<span>名称</span>
<Input value={answer.name} onChange={(e) => this.onNameChange(e, index)}></Input>
<span style={{ marginLeft: "20px"}} >扣减分值占比</span>
<InputNumber className="score" step={1} min={1} max={100} defaultValue={answer.score}
onChange={(e) => this.onScoreChange(e, index)} ></InputNumber>%
</div>
<div className="mt10">
<span>参考答案</span>
<TPMMDEditor ref={`md${index}`} mdID={index} initValue={answer.contents}></TPMMDEditor>
</div>
</div>
</div>
})
}
<div className="clearfix mt20" style={{display:this.props.identity>3||this.props.identity===undefined||power===false?"none":"block"}}>
<a href={"javascript:void(0)"} className="defalutCancelbtn fl" onClick={this.addAnswer}>新增</a>
</div>
</div>
</div>
<div className="clearfix mt20" style={{display:this.props.identity>3||this.props.identity===undefined||power===false?"none":"block"}}>
<a className="defalutSubmitbtn fl mr20"
onClick={this.challenge_answer_submit}>提交</a>
<a href={"/shixuns/" + shixunId + "/challenges"} className="defalutCancelbtn fl">取消</a>
</div>
</div>
</React.Fragment>
)
}
}
import React, {Component} from 'react';
import {Input, InputNumber, 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 { getImageUrl, toPath, getUrl } from 'educoder';
import axios from 'axios';
import './css/TPMchallengesnew.css';
import TPMMDEditor from './TPMMDEditor';
let origin = getUrl();
let path = getUrl("/editormd/lib/")
const $ = window.$;
let timeout;
let currentValue;
const Option = Select.Option;
const RadioGroup = Radio.Group;
// const testAnswers = [{
// "id": 4337,
// "name": "解题思路1",
// "contents": "答案的解题思路1",
// "level": 1,
// "score": 25
// },
// {
// "id": 4338,
// "name": "解题思路2",
// "contents": "答案的解题思路2",
// "level": 2,
// "score": 25
// }]
export default class TPManswer extends Component {
constructor(props) {
super(props)
this.state = {
choice_url: undefined,
practice_url: undefined,
go_back_url: undefined,
value: 1,
answer:"",
id:undefined,
checkpointId:undefined,
power: false,
prev_challenge: undefined,
next_challenge: undefined,
answers: [] //testAnswers
}
}
componentDidMount() {
let id = this.props.match.params.shixunId;
let checkpointId=this.props.match.params.checkpointId;
let newchoice_url= "/shixuns/"+id+"/challenges/newquestion";
let newpractice_url= "/shixuns/"+id+"/challenges/new";
let newgo_back_url="/shixuns/"+id+"/challenges";
this.setState({
shixunId:id,
checkpointId:checkpointId
})
let url = "/shixuns/" + id + "/challenges/" + checkpointId + "/edit.json?tab=2";
axios.get(url).then((response) => {
let newprev_challenge = response.data.prev_challenge;
let next_challenge = response.data.next_challenge;
if (newprev_challenge != undefined) {
if(newprev_challenge.st===0){
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint";
}else{
newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editquestion";
}
}
if (next_challenge != undefined) {
if(next_challenge.st===0){
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editcheckpoint";
}else{
next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editquestion";
}
}
this.setState({
answer:response.data.answer,
power: response.data.power,
choice_url: newchoice_url, // 导航中的新建选择题url
practice_url: newpractice_url, //string 导航中新建实践题url
go_back_url: newgo_back_url, //string 导航中的返回url
position: response.data.position, //int 关卡位置,导航栏中的第几关
prev_challenge: newprev_challenge,
next_challenge: next_challenge,
})
if(response.data.power===false){
this.props.showSnackbar("没有权限修改");
}
// if(response.data.answer===undefined||response.data.answer===null){
// this.answerMD("", "answerMD");
// }else{
// this.answerMD(response.data.answer, "answerMD");
// }
}).catch((error) => {
console.log(error)
});
let urlAnswer = `/shixuns/${id}/challenges/${checkpointId}/answer.json`;
axios.get(urlAnswer).then((response) => {
if (response.data) {
this.setState({ answers: response.data })
}
})
}
challenge_answer_submit=()=> {
// `levelSection${index}`
// this.refs.md0
const { answers } = this.state;
const answersParams = answers.slice(0)
console.log(answersParams)
let isValidate = true;
let totalScore = 0;
answersParams.forEach( (item, index) => {
if (!isValidate) {
return;
}
const sectionId = `#levelSection${index}`;
const mdContnet = this.refs[`md${index}`].getValue().trim();;
item.contents = mdContnet;
item.name = item.name.trim()
totalScore += item.score;
delete item.id;
if (!item.name) {
this.props.showSnackbar("请先填写参考答案名称");
isValidate = false;
} else if (!mdContnet) {
this.props.showSnackbar("请先填写参考答案内容");
isValidate = false;
}
if (!isValidate) {
$("html, body").animate({ scrollTop: $(`${sectionId}`).offset().top - 100})
}
})
if (!isValidate) {
return;
}
if (totalScore != 100) {
this.props.showSnackbar("请先保证占比和为100%");
return;
}
let id = this.props.match.params.shixunId;
let {checkpointId} = this.state;
let url = `/shixuns/${id}/challenges/${checkpointId}/crud_answer.json`;
axios.post(url,{
challenge_answer: answersParams
}
).then((response) => {
if (response.data) {
if (response.data.message) {
this.props.showSnackbar(response.data.message);
}
}
}).catch((error) => {
console.log(error)
});
}
onNameChange = (e, index) => {
const newAnswer = Object.assign({}, this.state.answers[index])
newAnswer.name = e.target.value
const newAnswers = this.state.answers.slice(0)
newAnswers[index] = newAnswer
this.setState({ answers: newAnswers})
}
onScoreChange = (val, index) => {
const newAnswer = Object.assign({}, this.state.answers[index])
newAnswer.score = val
const newAnswers = this.state.answers.slice(0)
newAnswers[index] = newAnswer
this.setState({ answers: newAnswers})
}
addAnswer = () => {
const newAnswers = this.state.answers.slice(0)
newAnswers.push({
"name": `解题思路${newAnswers.length + 1}`,
"contents": "",
"score": 10
})
this.setState({ answers: newAnswers })
}
delanswers=(index)=>{
let {answers}=this.state;
let newanswers=answers;
newanswers.splice(index,1)
this.setState({
answers:newanswers
})
}
render() {
let {
choice_url,
practice_url,
go_back_url,
position,
task_pass_default,
submit_url,
shixunId,
checkpointId,
power,
prev_challenge,
next_challenge,
answers,
} = this.state;
let tab1url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/editcheckpoint";
let tab2url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=2";
let tab3url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=3";
// console.log(this.props)
return (
<React.Fragment>
<div className="educontent mt30 mb30 tpmAnswer">
<div className="padding10-20 mb10 edu-back-white clearfix">
<span className="fl ring-blue mr10 mt7">
<img src={getImageUrl("images/educoder/icon/code.svg")} data-tip-down="实训任务" className="fl mt2 ml2"/>
</span>
<span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-15 mt3">返回</Link>
{prev_challenge === undefined ? "" :
<a href={prev_challenge} className="fr color-blue mr15 mt4">上一关</a>
}
{next_challenge === undefined ? "" :
<a href={next_challenge} className="fr color-blue mr15 mt4">下一关</a>
}
<Link to={practice_url === undefined ? "" : practice_url}
className="fr color-blue mr15 mt4"
style={{display:this.props.status===2||this.props.status===1?'none':'block'}}
data-tip-down="新增代码编辑类型的任务">+&nbsp;实践类型</Link>
<Link to={choice_url === undefined ? "" : choice_url}
className="fr color-blue mr15 mt4"
style={{display:this.props.status===2||this.props.status===1?'none':'block'}}
data-tip-down="新增选择题类型的任务">+&nbsp;选择题类型</Link>
</div>
<div className="challenge_nav clearfix edu-back-white">
<li>
<Link to={tab1url}>本关任务</Link>
</li>
<li >
<Link to={tab2url}>评测设置</Link>
</li>
<li className="active">
<Link to={tab3url}>参考答案</Link>
</li>
</div>
<div className="edu-back-white mb10 clearfix">
<div className="padding30-20">
<p className=" font-12" style={{ paddingBottom: '5px'
, color: '#666666'}}>
可以将参考答案分级设置让学员自行选择级别每级查看后按照比例扣分值学员已完成任务再查看则不影响原因已获得的成绩
</p>
<p className=" font-12 "
style={{ maxWidth: "782px"
, color: '#999999'}}>
示例级别1扣减分值占比25%级别2扣减分值占比35%级别3扣减分值占比40%则学员选择查看级别1的答案将被扣减25%的分值
选择查看级别2的答案将被扣减60%的分值选择查看级别3的答案将被扣减100%的分值
</p>
<style>{`
.tpmAnswer .ant-input { width: 230px }
.tpmAnswer .score.ant-input-number { width: 54px; }
.levelSection { margin-top: 16px }
`}</style>
{
answers.map((answer, index) => {
return <div className="levelSection" id={`levelSection${index}`}>
<span className="mr4 color-orange pt10">*</span>
<p className="color-grey-6 font-16 mb30 mt10" style={{ display: "inline" }}>级别{index + 1}</p>
<a className="fr sample_icon_remove mr30 mt8" onClick={()=>this.delanswers(index)}>
<i className="fa fa-times-circle color-grey-c font-16 fl" ></i>
</a>
<div className=" color-grey-6 font-16" style={{ marginLeft: "9px", margin: '8px 9px'}}>
<div className=" ">
<span>名称</span>
<Input value={answer.name} onChange={(e) => this.onNameChange(e, index)}></Input>
<span style={{ marginLeft: "20px"}} >扣减分值占比</span>
<InputNumber className="score" step={1} min={1} max={100} defaultValue={answer.score}
onChange={(e) => this.onScoreChange(e, index)} ></InputNumber>%
</div>
<div className="mt10">
<span>参考答案</span>
<TPMMDEditor ref={`md${index}`} mdID={index} initValue={answer.contents}></TPMMDEditor>
</div>
</div>
</div>
})
}
<div className="clearfix mt20" style={{display:this.props.identity>3||this.props.identity===undefined||power===false?"none":"block"}}>
<a href={"javascript:void(0)"} className="defalutCancelbtn fl" onClick={this.addAnswer}>新增</a>
</div>
</div>
</div>
<div className="clearfix mt20" style={{display:this.props.identity>3||this.props.identity===undefined||power===false?"none":"block"}}>
<a className="defalutSubmitbtn fl mr20"
onClick={this.challenge_answer_submit}>提交</a>
<a href={"/shixuns/" + shixunId + "/challenges"} className="defalutCancelbtn fl">取消</a>
</div>
</div>
</React.Fragment>
)
}
}

@ -765,14 +765,14 @@ export default class TPMevaluation extends Component {
</span>
<span className="font-16 task-hide fl TPMtaskName">{position}</span>
<Link to={go_back_url === undefined ? "" : go_back_url}
className="color-grey-6 fr font-16 ml30">返回</Link>
className="color-grey-6 fr font-15 mt3">返回</Link>
{prev_challenge === undefined ? "" :
<a href={prev_challenge} className="fr color-blue mr15 mt3">上一关</a>
<a href={prev_challenge} className="fr color-blue mr15 mt4">上一关</a>
}
{next_challenge === undefined ? "" :
<a href={next_challenge} className="fr color-blue mr15 mt3">下一关</a>
<a href={next_challenge} className="fr color-blue mr15 mt4">下一关</a>
}
<Link to={practice_url === undefined ? "" : practice_url}

File diff suppressed because it is too large Load Diff

@ -15,14 +15,14 @@
/*flex-wrap: wrap;*/
/*display: -webkit-flex; !* Safari *!*/
/*display: flex;*/
width: 340px;
width: 360px;
position:relative;
overflow: hidden;
}
.newsubscript{
position: absolute;
right: 23px;
bottom: 38px;
bottom: 16px;
cursor: pointer;
}
.newsubscript:hover{

@ -631,13 +631,14 @@ class Newshixuns extends Component {
}
bigopen = () => {
bigopen = (e) => {
this.setState({
opers: true
})
}
bigopens = () => {
bigopens = (e) => {
this.setState({
opers: false,
operss: false,
@ -646,16 +647,18 @@ class Newshixuns extends Component {
}
bigopensmal = () => {
bigopensmal = (e) => {
this.setState({
opensmail: true
})
}
sbigopen = () => {
sbigopen = (e) => {
this.setState({
operss: true
})
}
// sbigopens=()=>{
@ -1193,6 +1196,7 @@ class Newshixuns extends Component {
showToday={false}
showTime
locale={locale}
style={{"width": "184px"}}
format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择开启时间"
onChange={this.onChangeTimePicker}

@ -7,11 +7,9 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
// import { Rating,Loading} from '@icedesign/base';
import {getImageUrl,setImagesUrl, toPath} from 'educoder';
// import { Pagination,Row,Col } from 'antd';
import { Spin,Icon } from 'antd';
import 'antd/lib/pagination/style/index.css';
@ -21,8 +19,6 @@ import Rating from '@icedesign/base/lib/rating';
import Pagination from '@icedesign/base/lib/pagination';
// import Loading from '@icedesign/base/lib/loading';
// 引入业务组件样式
import '@icedesign/base/lib/pagination/style.js';
@ -30,8 +26,6 @@ import '@icedesign/base/lib/rating/style.js';
import { Tooltip } from 'antd';
// import '@icedesign/base/lib/loading/style.js';
import axios from 'axios';
const $ = window.$;
@ -63,8 +57,8 @@ class ShixunCard extends Component {
let {middleshixundata, pagination, typepvisible, pages, totalcount} = this.props;
return (
<div className="educontent mb80">
{/*<Loading visible={typepvisible} shape="dot-circle" color='#4AC7FF'>*/}
<Spin spinning={typepvisible} size="large" style={{marginTop:'15%'}}>
<div id="shixun_list_content"
style={{display: middleshixundata === undefined || middleshixundata.length === 0 ? "block" : "none"}}>
<div className="square-list clearfix">
@ -168,7 +162,7 @@ class ShixunCard extends Component {
</div>
</div>
{/*</Loading>*/}
</Spin>
</div>
)
}

@ -6,6 +6,8 @@ import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import axios from 'axios';
import { Spin } from 'antd';
import { TPMIndexHOC } from '../TPMIndexHOC';
import { SnackbarHOC } from 'educoder';
@ -16,10 +18,6 @@ import ShixunSearchBar from './ShixunSearchBar';
import ShixunCard from './ShixunCard';
import Loading from '@icedesign/base/lib/loading';
import '@icedesign/base/lib/loading/style.js';
const queryString = require('query-string');
const $ = window.$;
@ -362,9 +360,7 @@ class ShixunsIndex extends Component {
return (
<div className="newMain clearfix backFAFAFA">
<Loading visible={typepvisible} shape="dot-circle" color='#4AC7FF'>
{/*懒加载*/}
{/*<Spin spinning={typepvisible} size="large" style={{marginTop:'15%'}}>*/}
<ShixunSearchBar
Updatasearchlist={this.Updatasearchlist.bind(this)}
allUpdatashixunlist={this.allUpdatashixunlist}
@ -393,8 +389,7 @@ class ShixunsIndex extends Component {
pages={pages}
shixunsPage={this.shixunsPage.bind(this)}
/>
</Loading>
{/*</Spin>*/}
</div>
);
}

@ -115,6 +115,9 @@ return;
Raphaël 2.1.3 - JavaScript Vector Library
flowchart, v1.3.4
editormd.js
// Codemirror单独放置哪些地方还在使用Codemirror
// 新版使用了Monaco 无需一些Codemirror插件了
CodeMirror
cm active-line.js
cm mode javascript
@ -126,7 +129,24 @@ return;
CodeMirror c-like(java)
CodeMirror matchbrackets
余下
CodeMirror
diff
merge
移除的在js_min_cm.js
/**
active-line.js
mode javascript
fuzzysort
showHint
javascript-hint
anyword-hint
CodeMirror python
CodeMirror c-like(java)
CodeMirror matchbrackets
/
>
// Copyright (C) 2006 Google Inc.
@ -143,5 +163,7 @@ return;
// See the License for the specific language governing permissions and
// limitations under the License.
去掉了
marked v0.3.3 去不了去掉后 这句代码会报错window.editormd.markdownToHTML TODO 看能否去掉单独加载marked的地方
*/
Loading…
Cancel
Save