Merge branch 'dev_chen' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_chen
commit
a9ba796967
@ -1,94 +1,56 @@
|
||||
import React,{ Component } from "react";
|
||||
import React, { Component } from "react";
|
||||
|
||||
import {
|
||||
Form, Input, InputNumber, Switch, Radio,
|
||||
Slider, Button, Upload, Icon, Rate, Checkbox, message,
|
||||
Row, Col, Select, Modal, Tooltip
|
||||
} from 'antd';
|
||||
import axios from 'axios'
|
||||
// import './board.css'
|
||||
// import "../common/formCommon.css"
|
||||
import { CBreadcrumb } from 'educoder';
|
||||
|
||||
// import { RouteHOC } from './common.js'
|
||||
|
||||
// import { Q_TYPE_SINGLE, Q_TYPE_MULTI, Q_TYPE_JUDGE, Q_TYPE_NULL, Q_TYPE_MAIN, Q_TYPE_SHIXUN } from './new/common'
|
||||
// import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor';
|
||||
// import CBreadcrumb from '../common/CBreadcrumb'
|
||||
import {getUrl, ActionBtn, CBreadcrumb} from 'educoder';
|
||||
|
||||
// import SingleEditor from './new/SingleEditor'
|
||||
// import SingleDisplay from './new/SingleDisplay'
|
||||
// import JudgeEditor from './new/JudgeEditor'
|
||||
// import JudgeDisplay from './new/JudgeDisplay'
|
||||
// import NullEditor from './new/NullEditor'
|
||||
// import NullDisplay from './new/NullDisplay'
|
||||
// import MainEditor from './new/MainEditor'
|
||||
// import MainDisplay from './new/MainDisplay'
|
||||
// import ShixunEditor from './new/ShixunEditor'
|
||||
// import ShixunDisplay from './new/ShixunDisplay'
|
||||
|
||||
import update from 'immutability-helper'
|
||||
import './new/common.css'
|
||||
import '../css/Courses.css'
|
||||
|
||||
import ExerciseNewCommon from './ExerciseNewCommon'
|
||||
const { TextArea } = Input;
|
||||
|
||||
class ExerciceNew extends Component{
|
||||
constructor(props){
|
||||
class ExerciceNew extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
|
||||
this.state = {
|
||||
|
||||
left_banner_id: null
|
||||
}
|
||||
}
|
||||
componentDidMount = () => {
|
||||
|
||||
}
|
||||
initData = (data) => {
|
||||
this.setState({left_banner_id: data.left_banner_id})
|
||||
this.setState({ left_banner_id: data.left_banner_id })
|
||||
}
|
||||
componentDidMount() {
|
||||
document.title = this.props.coursedata && this.props.coursedata.name;
|
||||
}
|
||||
render() {
|
||||
let { left_banner_id } = this.state;
|
||||
|
||||
|
||||
let { left_banner_id } = this.state;
|
||||
const { current_user } = this.props
|
||||
|
||||
const courseId=this.props.match.params.coursesId;
|
||||
|
||||
const isEdit = this.isEdit;
|
||||
|
||||
document.title=this.props.coursedata&&this.props.coursedata.name;
|
||||
return(
|
||||
<div className="newMain exerciseNew">
|
||||
|
||||
<div className="edu-class-container edu-position courseForm">
|
||||
{ current_user && <CBreadcrumb items={[
|
||||
{ to: current_user&¤t_user.first_category_url, name: this.props.coursedata ? this.props.coursedata.name : ''},
|
||||
{ to: `/classrooms/${courseId}/exercises/${left_banner_id}`, name: '试卷列表' },
|
||||
{ name: this.isEdit ? '编辑试卷' : '新建试卷'}
|
||||
]}></CBreadcrumb> }
|
||||
|
||||
<p className="clearfix mt20 mb20">
|
||||
<span className="fl font-24 color-grey-3">{this.isEdit ? "编辑" : "新建"}试卷</span>
|
||||
<a href="javascript:void(0)" className="color-grey-6 fr font-16 mr2"
|
||||
// () => this.props.history.length == 1 ? : this.props.history.goBack()
|
||||
onClick={() => this.props.history.push(`/classrooms/${courseId}/exercises/${left_banner_id}`)}>
|
||||
返回
|
||||
const courseId = this.props.match.params.coursesId;
|
||||
return (
|
||||
<div className="newMain exerciseNew">
|
||||
|
||||
<div className="edu-class-container edu-position courseForm">
|
||||
{current_user && <CBreadcrumb items={[
|
||||
{ to: current_user && current_user.first_category_url, name: this.props.coursedata ? this.props.coursedata.name : '' },
|
||||
{ to: `/classrooms/${courseId}/exercises/${left_banner_id}`, name: '试卷列表' },
|
||||
{ name: this.isEdit ? '编辑试卷' : '新建试卷' }
|
||||
]}></CBreadcrumb>}
|
||||
|
||||
<p className="clearfix mt20 mb20">
|
||||
<span className="fl font-24 color-grey-3">{this.isEdit ? "编辑" : "新建"}试卷</span>
|
||||
<a href="javascript:void(0)" className="color-grey-6 fr font-16 mr2"
|
||||
onClick={() => this.props.history.push(`/classrooms/${courseId}/exercises/${left_banner_id}`)}>
|
||||
返回
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<ExerciseNewCommon
|
||||
{...this.props}
|
||||
{...this.state}
|
||||
isEdit={this.isEdit}
|
||||
initData={this.initData}
|
||||
></ExerciseNewCommon>
|
||||
</div>
|
||||
</p>
|
||||
|
||||
<ExerciseNewCommon
|
||||
{...this.props}
|
||||
{...this.state}
|
||||
isEdit={this.isEdit}
|
||||
initData={this.initData}
|
||||
></ExerciseNewCommon>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
// RouteHOC()
|
||||
export default (ExerciceNew);
|
||||
export default ExerciceNew;
|
||||
|
@ -0,0 +1,47 @@
|
||||
.exercise-new-form {
|
||||
padding: 20px 30px 2px 30px;
|
||||
background: #fff;
|
||||
|
||||
.ant-input {
|
||||
border-right: none;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.task-btn-orange {
|
||||
height: 30px;
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
.defalutCancelbtn {
|
||||
height: '30px';
|
||||
width: '70px';
|
||||
font-size: '14px';
|
||||
line-height: '30px';
|
||||
margin-right: '16px';
|
||||
}
|
||||
|
||||
.editor-tip {
|
||||
font-size: 16px;
|
||||
font-family: PingFangSC-Semibold, PingFang SC;
|
||||
font-weight: 600;
|
||||
color: rgba(51, 51, 51, 1);
|
||||
padding-left: 12px;
|
||||
line-height: 22px;
|
||||
|
||||
span {
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: rgba(136, 136, 136, 1);
|
||||
line-height: 19px;
|
||||
}
|
||||
}
|
||||
|
||||
.ant-form-item label {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ant-form-item-label {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
@ -0,0 +1,196 @@
|
||||
import React, {Component} from "react";
|
||||
import {Modal, Radio, Input, Tooltip, Checkbox, Select, Row, Col, Spin} from "antd";
|
||||
import axios from 'axios';
|
||||
|
||||
const {Search} = Input;
|
||||
|
||||
class SendTopicsModel extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
courses: [],
|
||||
search: null,
|
||||
Radiolist: undefined,
|
||||
showcheck: false,
|
||||
smallisSpin: false,
|
||||
yslbanksMenu: undefined,
|
||||
exercise_id: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
// console.log("SendTopicssssssssssss");
|
||||
// console.log(this.props);
|
||||
let {search} = this.state;
|
||||
this.onupdatalist(search)
|
||||
this.setState({
|
||||
yslbanksMenu: this.props.banksMenu,
|
||||
})
|
||||
}
|
||||
|
||||
//获取的课堂
|
||||
onupdatalist = (search) => {
|
||||
let url = "/question_banks/my_courses.json";
|
||||
axios.get(url, {
|
||||
params: {
|
||||
search
|
||||
}
|
||||
}).then((result) => {
|
||||
this.setState({
|
||||
courses: result.data.courses
|
||||
})
|
||||
}).catch((error) => {
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
|
||||
onSearchChange = (e) => {
|
||||
this.setState({
|
||||
search: e.target.value
|
||||
})
|
||||
// this.onupdatalist(e.target.value)
|
||||
}
|
||||
|
||||
onSearch = (search) => {
|
||||
this.onupdatalist(search)
|
||||
}
|
||||
|
||||
|
||||
onChange = (e) => {
|
||||
console.log("SendTopics");
|
||||
console.log(e);
|
||||
this.setState({
|
||||
Radiolist: e.target.value
|
||||
})
|
||||
}
|
||||
|
||||
submitInfo = () => {
|
||||
if(this.state.Radiolist===undefined) {
|
||||
this.setState({
|
||||
showcheck: true,
|
||||
smallisSpin: false
|
||||
})
|
||||
}
|
||||
let url = `/examination_banks/${this.props.paramsid}/send_to_course.json`;
|
||||
var data = {
|
||||
course_id: this.state.Radiolist
|
||||
};
|
||||
this.getwangluodata(url, data);
|
||||
}
|
||||
getwangluodata = (url, data) => {
|
||||
this.setState({
|
||||
smallisSpin: true
|
||||
})
|
||||
axios.post(url, data).then((response) => {
|
||||
if (response) {
|
||||
if (response.data) {
|
||||
if (response.data.status === 0) {
|
||||
this.setState({
|
||||
exercise_id: response.data.exercise_id
|
||||
})
|
||||
this.props.submitInfos(false, null);
|
||||
if (this.props.mypaper) {
|
||||
this.props.history.push("/paperlibrary?defaultActiveKey=0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setState({
|
||||
smallisSpin: false
|
||||
})
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
this.setState({
|
||||
smallisSpin: false
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
let {courses, Radiolist, showcheck, smallisSpin} = this.state;
|
||||
|
||||
const radioStyle = {
|
||||
display: 'block',
|
||||
height: '30px',
|
||||
lineHeight: '30px',
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
||||
|
||||
<style>
|
||||
{
|
||||
`
|
||||
.ant-modal-body{
|
||||
padding:20px 40px;
|
||||
}
|
||||
.onSearchtopics input{
|
||||
height:40px;
|
||||
}
|
||||
.over221{
|
||||
height:221px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
`
|
||||
}
|
||||
</style>
|
||||
<Modal
|
||||
keyboard={false}
|
||||
title="发送至课堂"
|
||||
visible={this.props.visible}
|
||||
closable={false}
|
||||
footer={null}
|
||||
destroyOnClose={true}
|
||||
width={600}
|
||||
>
|
||||
<div className="newupload_conbox">
|
||||
<div className="mb15 font-14 edu-txt-center color-orange-tip">
|
||||
{this.props&&this.props.mypaper===true?
|
||||
"温馨提示:当前试卷将会发送到指定课堂"
|
||||
:
|
||||
"温馨提示:选择的试卷将会发送到指定课堂"
|
||||
}
|
||||
</div>
|
||||
<div className="mb5"
|
||||
// onMouseLeave={this.closeList}
|
||||
>
|
||||
<Search
|
||||
className="mb14 onSearchtopics"
|
||||
placeholder="请输入课堂名称进行搜索"
|
||||
onChange={this.onSearchChange}
|
||||
onSearch={this.onSearch}
|
||||
></Search>
|
||||
</div>
|
||||
<div className="edu-back-skyblue pl15 pr15 clearfix over221 pt5">
|
||||
<Radio.Group onChange={this.onChange} value={Radiolist}>
|
||||
{
|
||||
courses && courses.map((item, key) => {
|
||||
return (
|
||||
<div className="mt5" key={key}>
|
||||
<Radio style={radioStyle} value={item.course_id} key={item.course_id}>
|
||||
{item.course_name}
|
||||
</Radio>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
}
|
||||
</Radio.Group>
|
||||
|
||||
</div>
|
||||
{showcheck === true ? <div className={"color-red mt10"}>请先选择课堂</div> : ""}
|
||||
<div className="mt20 clearfix edu-txt-center">
|
||||
<a onClick={() => this.props.submitInfos(false, null)} className="pop_close task-btn mr30 ">取消</a>
|
||||
<a className="task-btn task-btn-orange" onClick={() => this.submitInfo()}>确定</a>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default SendTopicsModel;
|
Loading…
Reference in new issue