Merge branches 'dev_aliyun' and 'topic_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun
commit
9f9532eb69
@ -0,0 +1,5 @@
|
||||
class ModifyIsTestForUser < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
change_column :users, :is_test, :integer, :limit => 1
|
||||
end
|
||||
end
|
@ -0,0 +1,449 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import {Link} from 'react-router-dom';
|
||||
import {Tooltip,Menu} from 'antd';
|
||||
import Loadable from 'react-loadable';
|
||||
import Loading from '../../../../Loading';
|
||||
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
|
||||
import axios from 'axios';
|
||||
import HomeworkModal from "../../coursesPublic/HomeworkModal";
|
||||
import AccessoryModal from "../../coursesPublic/AccessoryModal";
|
||||
import Associationmodel from '../../coursesPublic/Associationmodel';
|
||||
import CoursesListType from '../../coursesPublic/CoursesListType';
|
||||
import moment from 'moment';
|
||||
import "../../css/members.css"
|
||||
import "../../css/Courses.css"
|
||||
|
||||
import Modals from '../../../modals/Modals';
|
||||
|
||||
|
||||
//毕设描述
|
||||
const GraduationTasksquestions= Loadable({
|
||||
loader: () => import('./GraduationTaskssettingquestions'),
|
||||
loading: Loading,
|
||||
})
|
||||
//毕设任务设置
|
||||
const GraduationTaskssetting=Loadable({
|
||||
loader: () => import('./GraduationTaskssetting'),
|
||||
loading: Loading,
|
||||
})
|
||||
//毕设任务列表
|
||||
const GraduationTaskslist=Loadable({
|
||||
loader: () => import('./GraduationTaskssettinglist'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
class GraduationTaskDetail extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
modalname:undefined,
|
||||
visible:false,
|
||||
Topval:undefined,
|
||||
starttime:undefined,
|
||||
starttimes:undefined,
|
||||
typs:undefined,
|
||||
endtime:undefined,
|
||||
Cancelname:undefined,
|
||||
Savesname:undefined,
|
||||
Cancel:undefined,
|
||||
Saves:undefined,
|
||||
Topvalright:undefined,
|
||||
Botvalleft:undefined,
|
||||
course_groupslist:undefined,
|
||||
course_groups:undefined,
|
||||
questionslist:undefined,
|
||||
tab:"list",
|
||||
visibles:undefined,
|
||||
Modalstype:undefined,
|
||||
Modalstopval:undefined,
|
||||
ModalCancel:undefined,
|
||||
ModalSave:undefined
|
||||
}
|
||||
}
|
||||
componentDidMount(){
|
||||
this.getdatas()
|
||||
}
|
||||
getdatas=()=>{
|
||||
const task_Id = this.props.match.params.task_Id;
|
||||
let url="/graduation_tasks/"+task_Id+".json";
|
||||
|
||||
axios.get(url).then((result)=>{
|
||||
if(result.status===200){
|
||||
this.setState({
|
||||
questionslist:result.data
|
||||
})
|
||||
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
//返回
|
||||
goback=()=>{
|
||||
// let courseId=this.props.match.params.coursesId;
|
||||
// let category_id=this.props.match.params.category_id;
|
||||
// window.location.href="/courses/"+courseId+"/graduation_tasks/"+category_id;
|
||||
// let courseId = this.props.match.params.coursesId;
|
||||
// if(courseId===undefined){
|
||||
// this.props.history.push("/courses");
|
||||
// }else{
|
||||
// this.props.history.push(this.props.current_user.first_category_url);
|
||||
// }
|
||||
|
||||
// this.props.history.goBack()
|
||||
this.props.history.replace(`/courses/${this.state.questionslist.course_id}/graduation_tasks/${this.state.questionslist.graduation_id}`);
|
||||
}
|
||||
//立即发布
|
||||
publish=()=>{
|
||||
let starttime= this.props.getNowFormatDates(1,1);
|
||||
let endtime=this.props.getNowFormatDates(2,1);
|
||||
// this.homeworkstart()
|
||||
this.setState({
|
||||
modalname:"立即发布",
|
||||
visible:true,
|
||||
Topval:"学生将立即收到毕设任务",
|
||||
// Botvalleft:"点击修改",
|
||||
// Botval:`本操作只对"未发布"的分班有效`,
|
||||
starttime:moment(moment(new Date())).format("YYYY-MM-DD HH:mm") ,
|
||||
starttimes:this.props.getNowFormatDates(1),
|
||||
typs:"start",
|
||||
endtime:endtime,
|
||||
Cancelname:"暂不发布",
|
||||
Savesname:"立即发布",
|
||||
Cancel:this.cancelmodel,
|
||||
Saves:this.homepublish,
|
||||
})
|
||||
}
|
||||
// 确定立即发布
|
||||
homepublish=(ids,endtime)=>{
|
||||
this.cancelmodel();
|
||||
let task_Id=this.props.match.params.task_Id;
|
||||
const cid = this.props.match.params.coursesId;
|
||||
// let url = `/courses/${cid}/graduation_tasks/publish_task.json`;
|
||||
|
||||
let url="/courses/"+cid+"/graduation_tasks/publish_task.json"
|
||||
axios.post(url,{
|
||||
task_ids:[task_Id],
|
||||
group_ids: this.state.course_groupslist,
|
||||
end_time:endtime,
|
||||
}).then((response)=>{
|
||||
if (response.data.status == 0) {
|
||||
this.getdatas()
|
||||
this.props.showNotification(response.data.message);
|
||||
|
||||
this.setState({
|
||||
// Modalstopval:response.data.message,
|
||||
// ModalSave:this.cancelmodel,
|
||||
// Loadtype:true,
|
||||
course_groupslist:[],
|
||||
checkAllValue:false
|
||||
})
|
||||
}
|
||||
}).catch((error)=>{
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
// 刷新
|
||||
resetList=()=>{
|
||||
this.getdatas();
|
||||
this.child && this.child.searchValue();
|
||||
}
|
||||
|
||||
// 立即截止
|
||||
end=()=>{
|
||||
// this.homeworkstart()
|
||||
this.setState({
|
||||
modalname:"立即截止",
|
||||
visible:true,
|
||||
Topval:"学生将不能再提交作品",
|
||||
// Botvalleft:"暂不截止",
|
||||
// Botval:`本操作只对"提交中"的分班有效`,
|
||||
Cancelname:"暂不截止",
|
||||
Savesname:"立即截止",
|
||||
Cancel:this.cancelmodel,
|
||||
Saves:this.coursetaskend,
|
||||
typs:"end",
|
||||
})
|
||||
}
|
||||
// 取消
|
||||
cancelmodel=()=>{
|
||||
this.setState({
|
||||
Modalstype:false,
|
||||
Loadtype:false,
|
||||
visible:false,
|
||||
Modulationtype:false,
|
||||
Allocationtype:false,
|
||||
Modalstopval:"",
|
||||
ModalCancel:"",
|
||||
ModalSave:"",
|
||||
})
|
||||
}
|
||||
|
||||
getcourse_groupslist=(id)=>{
|
||||
this.setState({
|
||||
course_groupslist:id
|
||||
})
|
||||
}
|
||||
|
||||
setTab = (tab) =>{
|
||||
this.setState({
|
||||
tab
|
||||
})
|
||||
}
|
||||
|
||||
// 关联项目
|
||||
AssociationItems=()=>{
|
||||
this.setState({
|
||||
visibles:true
|
||||
})
|
||||
}
|
||||
Cancel=()=>{
|
||||
this.setState({
|
||||
visibles:false
|
||||
})
|
||||
}
|
||||
// 取消关联
|
||||
cannelAssociation=()=>{
|
||||
this.setState({
|
||||
Modalstype:true,
|
||||
Modalstopval:"确定要取消该项目关联?",
|
||||
ModalCancel:this.cannerassocition,
|
||||
ModalSave:this.savetassociton
|
||||
})
|
||||
}
|
||||
savetassociton=()=>{
|
||||
this.cannerassocition();
|
||||
let {questionslist}=this.state;
|
||||
let url = "/graduation_tasks/"+questionslist.task_id+"/graduation_works/cancel_relate_project.json";
|
||||
console.log(url)
|
||||
axios.get(url).then((result)=>{
|
||||
if(result.data.status===0){
|
||||
this.resetList();
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
}
|
||||
cannerassocition=()=>{
|
||||
this.setState({
|
||||
Modalstype:false,
|
||||
Modalstopval:"",
|
||||
ModalCancel:"",
|
||||
ModalSave:"",
|
||||
loadtype:false,
|
||||
visibles:false
|
||||
})
|
||||
}
|
||||
// 补交附件
|
||||
handaccessory=()=>{
|
||||
// let {taskslistdata}=this.state;
|
||||
// let courseId=this.props.match.params.coursesId;
|
||||
//
|
||||
// let url="/courses/"+courseId+"/graduation_tasks/"+taskslistdata.work_id+"/appraise"
|
||||
//
|
||||
// window.location.href=url;
|
||||
this.setState({
|
||||
avisible:true
|
||||
})
|
||||
}
|
||||
Cancelvisible=()=>{
|
||||
this.setState({
|
||||
avisible:false
|
||||
})
|
||||
}
|
||||
|
||||
bindRef = ref => { this.child = ref } ;
|
||||
render(){
|
||||
|
||||
let courseId=this.props.match.params.coursesId;
|
||||
let category_id=this.props.match.params.category_id;
|
||||
let task_Id=this.props.match.params.task_Id;
|
||||
let {
|
||||
questionslist ,
|
||||
tab ,
|
||||
visibles ,
|
||||
Modalstype,
|
||||
Modalstopval,
|
||||
ModalCancel,
|
||||
ModalSave
|
||||
} = this.state
|
||||
|
||||
const commom = {
|
||||
setTab:this.setTab
|
||||
}
|
||||
return(
|
||||
<div className="newMain clearfix">
|
||||
{
|
||||
questionslist &&
|
||||
<div className={"educontent mb20"}>
|
||||
<HomeworkModal
|
||||
starttimes={this.state.starttimes}
|
||||
typs={this.state.typs}
|
||||
modalname={this.state.modalname}
|
||||
visible={this.state.visible}
|
||||
Topval={this.state.Topval}
|
||||
Topvalright={this.state.Topvalright}
|
||||
Botvalleft={this.state.Botvalleft}
|
||||
Botval={this.state.Botval}
|
||||
starttime={this.state.starttime}
|
||||
endtime={this.state.endtime}
|
||||
Cancelname={this.state.Cancelname}
|
||||
Savesname={this.state.Savesname}
|
||||
Cancel={this.state.Cancel}
|
||||
Saves={this.state.Saves}
|
||||
course_groups={this.state.course_groups}
|
||||
modaltype={this.state.modaltype}
|
||||
getcourse_groupslist={(id) => this.getcourse_groupslist(id)}
|
||||
/>
|
||||
{/*关联项目*/}
|
||||
{visibles===true?
|
||||
<Associationmodel
|
||||
modalname={"关联项目"}
|
||||
visible={visibles}
|
||||
Cancel={()=>this.Cancel()}
|
||||
taskid={ questionslist && questionslist.task_id }
|
||||
funlist={this.resetList}
|
||||
/>
|
||||
:""}
|
||||
|
||||
{this.state.avisible===true?<AccessoryModal
|
||||
{...this.props}
|
||||
modalname={"补交附件"}
|
||||
visible={this.state.avisible}
|
||||
Cancelname={"取消"}
|
||||
Savesname={"确认"}
|
||||
Cancel={this.Cancelvisible}
|
||||
categoryid={questionslist.work_id}
|
||||
setupdate={this.resetList}
|
||||
/>:""}
|
||||
{/*提示*/}
|
||||
<Modals
|
||||
modalsType={Modalstype}
|
||||
modalsTopval={Modalstopval}
|
||||
modalCancel={ModalCancel}
|
||||
modalSave={ModalSave}
|
||||
closable={false}
|
||||
footer={null}
|
||||
destroyOnClose={true}
|
||||
centered={true}
|
||||
/>
|
||||
<p className="clearfix mt10">
|
||||
<a onClick={this.goback} className="color-grey-9 fl">{questionslist.course_name}</a>
|
||||
<span className="color-grey-9 fl ml3 mr3">></span>
|
||||
<Link to={`/courses/${courseId}/graduation_tasks/${category_id}`} className="color-grey-9 fl">{questionslist.graduation_name}</Link>
|
||||
<span className="color-grey-9 fl ml3 mr3">></span>
|
||||
<span className="color-grey-6">任务详情</span>
|
||||
</p>
|
||||
<div className="clearfix mt20 mb20 lineh-25 linbox">
|
||||
<p className=" fl color-black summaryname">
|
||||
<Link to={`/courses/${courseId}/graduation_tasks/${category_id}`} className="color-grey-3">{questionslist.task_name}</Link>
|
||||
</p>
|
||||
<CoursesListType
|
||||
typelist={questionslist.task_status}
|
||||
/>
|
||||
<a className="color-grey-3 fr font-16 ml30 mr20" onClick={this.goback}>返回</a>
|
||||
</div>
|
||||
<div className="stud-class-set bor-bottom-greyE">
|
||||
<div className="clearfix edu-back-white pl30 pr30 graduationTaskMenu">
|
||||
|
||||
<Link className={tab && tab == "list" ? "active" : ""} to={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+task_Id+"/list"}>任务列表</Link>
|
||||
<Link className={tab && tab == "questions" ? "active" : ""} to={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+task_Id+"/questions"}>毕设描述</Link>
|
||||
<Link className={tab && tab == "setting" ? "active" : ""} to={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+task_Id+"/setting?tab=3"}>设置</Link>
|
||||
|
||||
{/*<a className={"fr color-blue font-16"}>导出成绩</a>*/}
|
||||
{/*{this.props.isAdmin()?<a href={"/api/graduation_tasks/"+task_Id+"/tasks_list.xls"} className={"fr color-blue font-16"}>导出成绩</a>:""}*/}
|
||||
{/*{this.props.isAdmin()?<a href={"/api/graduation_tasks/"+task_Id+"/tasks_list.zip"} className={"fr color-blue font-16"}>导出作品附件</a>:""}*/}
|
||||
|
||||
<style>
|
||||
{ `
|
||||
.drop_down_menu{
|
||||
height: 118px;
|
||||
left:0px;
|
||||
width: 121px;
|
||||
}
|
||||
.drop_down_menu li {
|
||||
overflow: visible;
|
||||
width: 121px;
|
||||
}
|
||||
.drop_down_menu li a{
|
||||
padding: 0px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.mt19{
|
||||
margin-top:19px;
|
||||
}
|
||||
.drop_down_menu, .drop_down_normal{
|
||||
padding-top: 10px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
.drop_down_menu li .color-dark{
|
||||
color: #666 !important;
|
||||
}
|
||||
.linbox{
|
||||
height: 26px;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
{this.props.isAdmin()? <li className="li_line drop_down fr color-blue font-16 mt20" style={{"paddingLeft":"0px"}}>
|
||||
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
|
||||
<ul className="drop_down_menu" style={{"right":"-34px","left":"unset","height":"auto"}}>
|
||||
<li><a onClick={()=>this.confirmysl("/graduation_tasks/"+task_Id+"/tasks_list.xlsx")} className="color-dark">导出成绩</a></li>
|
||||
<li><a onClick={()=>this.confirmysl("/graduation_tasks/"+task_Id+"/tasks_list.zip")} className="color-dark">导出作品附件</a></li>
|
||||
</ul>
|
||||
</li>:""}
|
||||
{questionslist.work_status===undefined||questionslist.work_status===null||questionslist.work_status.length===0?"":questionslist.work_status.map((item,key)=>{
|
||||
return(
|
||||
<span key={key}>
|
||||
{item==="提交作品"?<a className={"fr color-blue font-16"} href={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+task_Id+"/works/new"}>提交作品</a>:""}
|
||||
{item==="补交作品"?<a className={"fr color-blue font-16"} href={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+task_Id+"/works/new"}>补交作品</a>:""}
|
||||
{item==="修改作品"?<a className={"fr color-blue font-16"} href={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+questionslist.work_id+"/works/edit"}>修改作品</a>:""}
|
||||
{item==="查看作品"?<a className={"fr color-blue font-16"} href={"/courses/"+courseId+"/graduation_tasks/"+category_id+"/"+questionslist.work_id+"/works/edit"}>查看作品</a> :""}
|
||||
{item==="创建项目"?<a className={"fr color-blue font-16"} href={'/projects/new'} target="_blank">创建项目</a>:""}
|
||||
{item==="关联项目"?<a className={"fr color-blue font-16"} onClick={this.AssociationItems}>关联项目</a>:""}
|
||||
{item==="取消关联"?<a className={"fr color-blue font-16"} onClick={this.cannelAssociation}>取消关联</a>:""}
|
||||
{item==="补交附件"?<a className={"fr color-blue font-16"} onClick={this.handaccessory}>补交附件</a>:""}
|
||||
</span>
|
||||
|
||||
)
|
||||
})}
|
||||
|
||||
{/*<a className={"fr color-blue font-16"}>项目在线质量检测</a>*/}
|
||||
{ this.props.isAdmin() ? questionslist.status===1 ? <a className={"fr color-blue font-16 mr20"} onClick={() => { this.end()} }>立即截止</a> : "" : "" }
|
||||
{ this.props.isAdmin() ? questionslist.status===0 ? <a className={"fr color-blue font-16 mr20"} onClick={() => { this.publish()} }>立即发布</a> : "" : "" }
|
||||
|
||||
{ this.props.isAdmin() ? <a className={"fr color-blue font-16"} href={"/courses/"+courseId+"/graduation_tasks/"+task_Id+"/edit"}>编辑任务</a> : "" }
|
||||
</div>
|
||||
</div>
|
||||
<Switch {...this.props}>
|
||||
|
||||
<Route exact path="/courses/:coursesId/graduation_tasks/:category_id/:task_Id/list"
|
||||
render={
|
||||
(props) => (<GraduationTaskslist {...this.props} {...props} {...this.state} {...commom} triggerRef={this.bindRef} tab={`list`}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route exact path="/courses/:coursesId/graduation_tasks/:category_id/:task_Id/setting"
|
||||
render={
|
||||
(props) => (<GraduationTaskssetting {...this.props} {...props} {...this.state} {...commom} tab={`setting`}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route exact path="/courses/:coursesId/graduation_tasks/:category_id/:task_Id/questions"
|
||||
render={
|
||||
(props) => (<GraduationTasksquestions {...this.props} {...props} {...this.state} {...commom} tab={`questions`}/>)
|
||||
}></Route>
|
||||
|
||||
</Switch>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
// CNotificationHOC() ( SnackbarHOC() ( TPMIndexHOC))
|
||||
export default (GraduationTaskDetail) ;
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,45 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { Redirect } from 'react-router';
|
||||
|
||||
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
|
||||
|
||||
import Loading from '../../Loading'
|
||||
|
||||
import Loadable from 'react-loadable';
|
||||
import { TPMIndexHOC } from '../tpm/TPMIndexHOC'
|
||||
import { SnackbarHOC } from 'educoder'
|
||||
|
||||
|
||||
const PackageIndex = Loadable({
|
||||
loader: () => import('../user/usersInfo/InfosTopics'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
|
||||
class Topic_bank extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="newMain clearfix">
|
||||
|
||||
<Switch>
|
||||
<Route path="/topicbank/:username/:topicstype"
|
||||
render={
|
||||
(props) => (<PackageIndex {...this.props} {...props} {...this.state} />)
|
||||
}
|
||||
></Route>
|
||||
</Switch>
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default SnackbarHOC() (TPMIndexHOC (Topic_bank)) ;
|
@ -0,0 +1,589 @@
|
||||
import React, { Component } from 'react';
|
||||
import { SnackbarHOC } from 'educoder';
|
||||
import {BrowserRouter as Router,Route,Switch,Link} from 'react-router-dom';
|
||||
import {Tooltip,Menu,Pagination,Spin, Dropdown,Checkbox} from 'antd';
|
||||
import axios from 'axios';
|
||||
import {getImageUrl,WordsBtn} from 'educoder';
|
||||
import moment from 'moment';
|
||||
import Modals from '../../modals/Modals';
|
||||
import SendTopics from '../../modals/SendTopics'
|
||||
import NoneData from '../../courses/coursesPublic/NoneData';
|
||||
import "./usersInfo.css";
|
||||
import Withoutpermission from './Withoutpermission.png';
|
||||
|
||||
|
||||
|
||||
class InfosTopics extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
isSpin:false,
|
||||
category:"normal",
|
||||
course_list_id:undefined,
|
||||
sort_by:"updated_at",
|
||||
sort_direction:"desc",
|
||||
page:1,
|
||||
data:undefined,
|
||||
checkBoxValues:[],
|
||||
per_page:15,
|
||||
isshowprofes:false
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
let types=this.props.match.params.topicstype;
|
||||
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
|
||||
|
||||
if(professional_certification===false&&types==="publicly"){
|
||||
this.setState({
|
||||
isshowprofes:true
|
||||
})
|
||||
}else{
|
||||
this.updataslist()
|
||||
}
|
||||
}
|
||||
componentDidUpdate(prevProps) {
|
||||
|
||||
if(prevProps.current_user!=this.props.current_user){
|
||||
let types=this.props.match.params.topicstype;
|
||||
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
|
||||
|
||||
console.log(professional_certification)
|
||||
if(professional_certification===false&&types==="publicly"){
|
||||
this.setState({
|
||||
isshowprofes:true
|
||||
})
|
||||
}else{
|
||||
this.updataslist()
|
||||
}
|
||||
}
|
||||
}
|
||||
updataslist=()=>{
|
||||
let types=this.props.match.params.topicstype;
|
||||
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
|
||||
this.searchAlldata(types,category,course_list_id,sort_by,sort_direction,page)
|
||||
}
|
||||
searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{
|
||||
|
||||
// if(this.props.current_user.login!=this.props.match.params.username){
|
||||
// return
|
||||
// }else{
|
||||
//
|
||||
// }
|
||||
this.setState({
|
||||
isSpin:true
|
||||
})
|
||||
let types=this.props.match.params.topicstype;
|
||||
let user_id="";
|
||||
|
||||
if(types==="publicly"){
|
||||
user_id=this.props.current_user&&this.props.current_user.login;
|
||||
}else{
|
||||
user_id=this.props.match.params&&this.props.match.params.username;
|
||||
}
|
||||
|
||||
if(user_id!=undefined){
|
||||
console.log(user_id)
|
||||
let {per_page}=this.state;
|
||||
let url=`/users/${user_id}/question_banks.json`;
|
||||
|
||||
axios.get(encodeURI(url),{params:{
|
||||
type,
|
||||
object_type:category,
|
||||
course_list_id,
|
||||
sort_by,
|
||||
sort_direction,
|
||||
page,
|
||||
per_page
|
||||
}
|
||||
}).then((response) => {
|
||||
this.setState({
|
||||
data:response.data,
|
||||
checkBoxValues:[],
|
||||
isSpin:false
|
||||
})
|
||||
}).catch((error) => {
|
||||
this.setState({
|
||||
isSpin:false
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
searchCategory=(type)=>{
|
||||
this.setState({
|
||||
category:type,
|
||||
course_list_id:undefined,
|
||||
})
|
||||
|
||||
let types=this.props.match.params.topicstype;
|
||||
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
|
||||
this.searchAlldata(types,type,undefined,sort_by,sort_direction,page)
|
||||
}
|
||||
|
||||
searchCourselistid=(id)=>{
|
||||
this.setState({
|
||||
course_list_id:id
|
||||
})
|
||||
|
||||
let types=this.props.match.params.topicstype;
|
||||
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
|
||||
this.searchAlldata(types,category,id,sort_by,sort_direction,page)
|
||||
}
|
||||
|
||||
onCheckBoxChange=(checkedValues)=>{
|
||||
if(checkedValues.length>15){
|
||||
this.props.showNotification("选择条数不能大于15条")
|
||||
}else{
|
||||
this.setState({
|
||||
checkBoxValues:checkedValues
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
updatedlist=(updatedtype)=>{
|
||||
let types=this.props.match.params.topicstype;
|
||||
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
|
||||
if(updatedtype===sort_by){
|
||||
if(sort_direction==="desc"){
|
||||
this.setState({
|
||||
sort_direction:"asc",
|
||||
sort_by:updatedtype
|
||||
})
|
||||
this.searchAlldata(types,category,course_list_id,updatedtype,"asc",page)
|
||||
}else{
|
||||
this.setState({
|
||||
sort_direction:"desc",
|
||||
sort_by:updatedtype
|
||||
})
|
||||
this.searchAlldata(types,category,course_list_id,updatedtype,"desc",page)
|
||||
}
|
||||
}else{
|
||||
this.setState({
|
||||
sort_direction:"desc",
|
||||
sort_by:updatedtype
|
||||
})
|
||||
this.searchAlldata(types,category,course_list_id,updatedtype,"desc",page)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
changePage=(pageNumber)=>{
|
||||
let types=this.props.match.params.topicstype;
|
||||
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
|
||||
this.searchAlldata(types,category,course_list_id,sort_by,sort_direction,pageNumber)
|
||||
this.setState({
|
||||
page:pageNumber,
|
||||
checkBoxValues:[]
|
||||
})
|
||||
}
|
||||
|
||||
deletecheckBoxValues=()=>{
|
||||
let {checkBoxValues}=this.state;
|
||||
|
||||
if(checkBoxValues.length===0){
|
||||
this.props.showNotification("请选择题库")
|
||||
}else{
|
||||
this.setState({
|
||||
Modalstype:true,
|
||||
Modalstopval:"是否确认删除?",
|
||||
ModalCancel:this.topicscancelmodel,
|
||||
ModalSave:this.topicssavedelete,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
topicssavedelete=()=>{
|
||||
let {checkBoxValues,category}=this.state;
|
||||
const url = `/question_banks/multi_delete.json`;
|
||||
axios.delete(url, { data: {
|
||||
object_id: checkBoxValues,
|
||||
object_type:category
|
||||
}})
|
||||
.then((response) => {
|
||||
if(response.data.status===0){
|
||||
this.updataslist()
|
||||
this.props.showNotification(response.data.message)
|
||||
}else{
|
||||
this.props.showNotification(response.data.message)
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
this.topicscancelmodel()
|
||||
}
|
||||
|
||||
|
||||
topicscancelmodel=()=>{
|
||||
this.setState({
|
||||
Modalstype:false,
|
||||
Loadtype:false,
|
||||
visible:false,
|
||||
Modalstopval:"",
|
||||
ModalCancel:"",
|
||||
ModalSave:"",
|
||||
checkBoxValues:[],
|
||||
checkedtype:false
|
||||
})
|
||||
|
||||
}
|
||||
openTopics=(id)=>{
|
||||
this.setState({
|
||||
Modalstype:true,
|
||||
Modalstopval:"公开后不能重设为私有",
|
||||
ModalsBottomval:"是否确认设为公开?",
|
||||
ModalCancel:this.topicscancelmodel,
|
||||
ModalSave:()=>this.topicssaveonOpen(id),
|
||||
})
|
||||
}
|
||||
|
||||
topicssaveonOpen=(id)=>{
|
||||
|
||||
let {category}=this.state;
|
||||
const url = `/question_banks/multi_public.json`;
|
||||
axios.post(url,{
|
||||
object_id:[id],
|
||||
object_type:category
|
||||
}).then((response) => {
|
||||
if(response.data.status===0){
|
||||
this.updataslist()
|
||||
this.props.showNotification(response.data.message)
|
||||
}else{
|
||||
this.props.showNotification(response.data.message)
|
||||
}
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
this.topicscancelmodel()
|
||||
}
|
||||
|
||||
|
||||
sendTopics=()=>{
|
||||
let {checkBoxValues}=this.state;
|
||||
if(checkBoxValues.length===0){
|
||||
this.props.showNotification("请选择题库")
|
||||
}else{
|
||||
this.setState({
|
||||
visible:true
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
render(){
|
||||
let{
|
||||
category,
|
||||
course_list_id,
|
||||
isSpin,
|
||||
data,
|
||||
page,
|
||||
sort_direction,
|
||||
sort_by,
|
||||
checkBoxValues,
|
||||
Modalstype,
|
||||
visible,
|
||||
isshowprofes
|
||||
} = this.state;
|
||||
let {
|
||||
is_current,
|
||||
current_user,
|
||||
}=this.props;
|
||||
|
||||
let categorylist=[
|
||||
{val:"普通作业",type:"normal"},
|
||||
{val:"分组作业",type:"group"},
|
||||
{val:"毕设选题",type:"gtopic"},
|
||||
{val:"毕设任务",type:"gtask"},
|
||||
{val:"试卷",type:"exercise"},
|
||||
{val:"问卷",type:"poll"},
|
||||
]
|
||||
|
||||
let types=this.props.match.params.topicstype;
|
||||
let username=this.props.match.params.username;
|
||||
|
||||
|
||||
//types===publicly 公共
|
||||
//types===personal 私有
|
||||
let user_id=this.props.current_user&&this.props.current_user.user_id;
|
||||
let user_type=this.props.current_user&&this.props.current_user.user_identity;
|
||||
let targetuserid=this.props.data&&this.props.data.id;
|
||||
|
||||
|
||||
|
||||
// console.log(is_current)
|
||||
// console.log(current_user)
|
||||
// console.log(current_user.is_teacher)
|
||||
// console.log(current_user.admin)
|
||||
const menu = (
|
||||
<Menu>
|
||||
<Menu.Item onClick={()=>this.updatedlist("updated_at")}>
|
||||
最近更新
|
||||
</Menu.Item>
|
||||
<Menu.Item onClick={()=>this.updatedlist("name")}>
|
||||
题目名称
|
||||
</Menu.Item>
|
||||
{types==="publicly"?<Menu.Item onClick={()=>this.updatedlist("contributor")}>
|
||||
贡献者
|
||||
</Menu.Item>:""}
|
||||
</Menu>
|
||||
);
|
||||
return(
|
||||
<div className="educontent mb50 mt40">
|
||||
{/*提示*/}
|
||||
<style>
|
||||
{
|
||||
`
|
||||
.mt40{
|
||||
margin-top: 40px !important;
|
||||
}
|
||||
`
|
||||
}
|
||||
</style>
|
||||
{Modalstype&&Modalstype===true?<Modals
|
||||
modalsType={this.state.Modalstype}
|
||||
modalsTopval={this.state.Modalstopval}
|
||||
modalCancel={this.state.ModalCancel}
|
||||
modalSave={this.state.ModalSave}
|
||||
modalsBottomval={this.state.ModalsBottomval}
|
||||
loadtype={this.state.Loadtype}
|
||||
/>:""}
|
||||
|
||||
{/*发送至弹窗*/}
|
||||
{
|
||||
visible&&visible===true?
|
||||
<SendTopics
|
||||
{...this.state}
|
||||
{...this.props}
|
||||
visible={visible}
|
||||
updataslist={()=>this.updataslist()}
|
||||
topicscancelmodel={()=>this.topicscancelmodel()}
|
||||
/>:""
|
||||
}
|
||||
<style>
|
||||
|
||||
{
|
||||
`
|
||||
::-webkit-scrollbar-thumb {
|
||||
background-color: #cde5fe;
|
||||
|
||||
box-shadow: 0px 0px black;
|
||||
}
|
||||
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.shaiContent li.shaiItem {
|
||||
padding: 0px 9px;
|
||||
float: left;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
margin-right: 15px !important;
|
||||
display: block;
|
||||
margin-bottom: 2px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.maxwidth900{
|
||||
max-width: 900px;
|
||||
overflow:hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space:nowrap
|
||||
}
|
||||
|
||||
.homepagePostSettingname{
|
||||
width:192px !important;
|
||||
}
|
||||
|
||||
.homepagePostSettingbox{
|
||||
width:139px !important;
|
||||
}
|
||||
.marright0{
|
||||
margin-right: 0px !important;
|
||||
}
|
||||
|
||||
.gongkais{
|
||||
min-width: 50px;
|
||||
height: 22px !important;
|
||||
line-height: 22px !important;
|
||||
color: #fff !important;
|
||||
margin-top: 4px;
|
||||
}
|
||||
`
|
||||
}
|
||||
</style>
|
||||
|
||||
<Spin size="large" spinning={isSpin}>
|
||||
<div className="clearfix topicsbox">
|
||||
{types==="publicly"?<div className={"topcschild"}>
|
||||
<a className={types==="personal"?"topicstopfont fr ":"topicstopfont fr topcsactive"}
|
||||
href={`/users/${this.props.current_user&&this.props.current_user.login}/topics/personal`}>我的题库</a>
|
||||
<div className={types==="publicly"?"topicstopfont fl ":"topicstopfont fl topcsactive"}
|
||||
>公共题库</div>
|
||||
</div>:<div className={"topcschild"}>
|
||||
<div className={types==="personal"?"topicstopfont fl ":"topicstopfont fl topcsactive"}
|
||||
>我的题库</div>
|
||||
<a className={types==="publicly"?"topicstopfont fr ":"topicstopfont fr topcsactive"}
|
||||
href={`/topicbank/${this.props.current_user&&this.props.current_user.login}/publicly`}
|
||||
>公共题库</a>
|
||||
</div>}
|
||||
|
||||
{isshowprofes===false?
|
||||
<div>
|
||||
|
||||
<div className={"topcsmid"}>
|
||||
{categorylist.map((item,key)=>{
|
||||
return(
|
||||
<span key={key} className={category===item.type?"topicsmidfont fl mr30 topcsactive":"topicsmidfont fl mr30"} onClick={()=>this.searchCategory(item.type)}>{item.val}</span>
|
||||
)
|
||||
})}
|
||||
|
||||
</div>
|
||||
|
||||
{data&&data.count===undefined?"":data&&data.count===0?"":<div className={data===undefined?"":data.course_list===undefined||data.course_list.length===0?"shaiContent mb45":"shaiContent"}>
|
||||
<li className={course_list_id===undefined?"shaiItem shixun_repertoire active fl":"shaiItem shixun_repertoire fl"} onClick={()=>this.searchCourselistid(undefined)}>全部</li>
|
||||
<div className="fl pr topicsItem mb20">
|
||||
{data===undefined?"":data.course_list===undefined||data.course_list.length===0?"":data.course_list.map((item,key)=>{
|
||||
return(
|
||||
<li key={key} className={course_list_id===item.id?"shaiItem shixun_repertoire active marright0":"shaiItem shixun_repertoire marright0"} onClick={()=>this.searchCourselistid(item.id)}>{item.name}</li>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>}
|
||||
|
||||
</div>:<div className={"professional_certificationbox"}>
|
||||
<p className="clearfix ">
|
||||
<div className={"stud-class-set pd115200 coursenavbox edu-back-white"}>
|
||||
<div className={"sumbtongs mb10"}><img className={"topicsItemimg"} src={Withoutpermission}/></div>
|
||||
<div className={"terraces mb5 topicsItemfont"}>通过职业认证的教师才能访问公共题库</div>
|
||||
<div className="clearfix mt30 mb30 padding251">
|
||||
<a className="defalutSubmitbtn fl ml60 defalutSubmitbtns" target="_blank" href="/account/certification">立即认证</a>
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</div>}
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{isshowprofes===false?data&&data.count===undefined?"":data&&data.count===0?"":<div className="clearfix font-12 mt20">
|
||||
<p className="font-12 ml5 fl">
|
||||
<span className="fl color-grey-9 mr20">共 <span className={"color-orange"}>{data&&data.count===undefined?0:data&&data.count}</span> 个</span>
|
||||
<span className="fr color-grey-9">已选择 <span className={"color-orange"}>{checkBoxValues.length}</span> 个 (不支持跨页勾选)</span>
|
||||
</p>
|
||||
<p className="font-12 alltopiscright ml25 fr">
|
||||
<style>
|
||||
{
|
||||
`
|
||||
.yslbottomsj{
|
||||
position: absolute;
|
||||
bottom: -8px;
|
||||
}
|
||||
`
|
||||
}
|
||||
</style>
|
||||
<Dropdown overlay={menu}>
|
||||
<span className="fr color-grey-9 mr10 pointer ">
|
||||
<span>{sort_by==="updated_at"?'最近更新':sort_by==="name"?'题目名称':sort_by==="contributor"?"贡献者":""}</span>
|
||||
<sapn className="relativef ml10" onClick={()=>this.updatedlist(sort_by)}>
|
||||
<i className={sort_direction==="asc"?
|
||||
"iconfont icon-sanjiaoxing-up font-12 topsj color-blue" :"iconfont icon-sanjiaoxing-up font-12 topsj"}></i>
|
||||
<i className={sort_direction==="desc"?
|
||||
"iconfont icon-sanjiaoxing-down font-12 yslbottomsj color-blue":"iconfont icon-sanjiaoxing-down font-12 yslbottomsj"}></i>
|
||||
</sapn>
|
||||
</span>
|
||||
</Dropdown>
|
||||
{user_type!="学生"?<span className="fr mr30 topcsactive pointer" onClick={()=>this.sendTopics()}>发送</span>:""}
|
||||
{types==="personal"?((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin)
|
||||
&&<span className="fr mr30 topcsactive pointer" onClick={()=>this.deletecheckBoxValues()}>删除</span>:""}
|
||||
</p>
|
||||
</div>:""}
|
||||
|
||||
|
||||
{isshowprofes===true?"":data===undefined?<NoneData></NoneData>:data.question_banks===undefined||data.question_banks.length===0?<NoneData></NoneData>:
|
||||
<Checkbox.Group style={{ width: '100%' ,minHeight:'297px'}} onChange={this.onCheckBoxChange} value={checkBoxValues}>
|
||||
{data.question_banks.map((item,key)=>{
|
||||
return(
|
||||
<div className="mt20 edu-back-white pd1323 relativef" key={key} >
|
||||
<div className="clearfix">
|
||||
<div className="item-body">
|
||||
|
||||
<div className="clearfix ds pr pt10 contentSection" >
|
||||
{user_type!="学生"?<Checkbox value={item.id} key={item.id} className={"fl mt5"}></Checkbox>:""}
|
||||
|
||||
|
||||
<a title={item.name.length>55?item.name:""} className="ml10 fl mt3 font-16 color-dark maxwidth900" href={
|
||||
category==="normal"?`/banks/normal/${item.id}/${types}?tab=0`:
|
||||
category==="group"?`/banks/group/${item.id}/${types}?tab=0`:
|
||||
category==="poll"?`/banks/poll/${item.id}/${types}`:
|
||||
category==="exercise"?`/banks/exercise/${item.id}/${types}`:
|
||||
category==="gtask"?`/banks/gtask/${item.id}/${types}`:
|
||||
category==="gtopic"?`/banks/gtopic/${item.id}/${types}`:""
|
||||
}
|
||||
>
|
||||
{item.name}
|
||||
</a>
|
||||
|
||||
{item.is_public===true?types==="publicly"?"":<span className="edu-filter-btn edu-filter-btn-4CACFF ml15 fl gongkais">公开</span>:""}
|
||||
|
||||
|
||||
|
||||
<div className="cl"></div>
|
||||
|
||||
<p className="color-grey panel-lightgrey mt16 fl">
|
||||
<span className={"topicswidth600"}>
|
||||
{types==="publicly"?<span className="topsics135 color-grey9 mr50">{item.creator_name}</span>:""}
|
||||
<span className="mr50 color-grey9">{item.quotes_count} 次引用</span>
|
||||
<span className="mr50 color-grey9">{item.solve_count} 次答题</span>
|
||||
<span className="mr50 color-grey9">{moment(item.updated_at).fromNow()}</span>
|
||||
</span>
|
||||
{item.course_list_name===null?"":<span className={"topsicrelative topsicinline"} title={item.course_list_name}>
|
||||
<div className={types==="personal"?"topicsbtn topsicsmax550":"topsicsmax550 topicsbtn"}>{item.course_list_name}</div>
|
||||
</span>}
|
||||
</p>
|
||||
|
||||
<div className="homepagePostSetting homepagePostSettingname topscisright">
|
||||
{types==="personal"?((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin)
|
||||
&&<a className="btn colorblue mr25 font-16 fr"
|
||||
href={category==="normal"?`/banks/normal/${item.id}/edit/${types}`:
|
||||
category==="group"?`/banks/group/${item.id}/edit/${types}`:
|
||||
category==="poll"?`/banks/poll/${item.id}/edit/${types}`:
|
||||
category==="exercise"?`/banks/exercise/${item.id}/edit/${types}`:
|
||||
category==="gtask"?`/banks/gtask/${item.id}/edit/${types}`:
|
||||
category==="gtopic"?`/banks/gtopic/${item.id}/edit/${types}`:""
|
||||
}
|
||||
>编辑</a>
|
||||
:""}
|
||||
{types==="personal"&&item.is_public===false?((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin)
|
||||
&&<a className="btn colorblue mr25 fr font-16" onClick={()=>this.openTopics(item.id)}>设为公开</a>:""}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
)})}
|
||||
</Checkbox.Group>
|
||||
}
|
||||
|
||||
{
|
||||
isshowprofes===true?"":data&&data.count >15 &&
|
||||
<div className="mt30 mb50 edu-txt-center">
|
||||
<Pagination showQuickJumper total={data&&data.count} onChange={this.changePage} pageSize={15} current={page}/>
|
||||
</div>
|
||||
}
|
||||
|
||||
</Spin>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default InfosTopics;
|
After Width: | Height: | Size: 7.9 KiB |
@ -0,0 +1,90 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import {BrowserRouter as Router,Route,Switch} from 'react-router-dom';
|
||||
|
||||
|
||||
import Loadable from 'react-loadable';
|
||||
import Loading from '../../../../Loading';
|
||||
|
||||
import BanksMenu from './banksMenu'
|
||||
// 毕设选题
|
||||
const GtopicBanks = Loadable({
|
||||
loader: () => import('./GtopicBanks'),
|
||||
loading: Loading,
|
||||
})
|
||||
// 问卷内容
|
||||
const PollBanks = Loadable({
|
||||
loader: () => import('./PollBanksContent'),
|
||||
loading: Loading,
|
||||
})
|
||||
// 试卷详情
|
||||
const ExerciseBanksDetail = Loadable({
|
||||
loader: () => import('./ExerciseBanksDetail'),
|
||||
loading: Loading,
|
||||
});
|
||||
|
||||
class BanksTabIndex extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
banksMenu:undefined
|
||||
}
|
||||
}
|
||||
|
||||
initPublic = (crumbData,menuData) =>{
|
||||
this.setState({
|
||||
banksMenu:menuData
|
||||
})
|
||||
this.props.initPublic(crumbData);
|
||||
}
|
||||
|
||||
render(){
|
||||
let{
|
||||
banksMenu
|
||||
}=this.state
|
||||
|
||||
const common={
|
||||
initPublic:this.initPublic,
|
||||
};
|
||||
console.log("BanksTabIndex");
|
||||
console.log(banksMenu);
|
||||
console.log(this.props);
|
||||
return(
|
||||
<React.Fragment>
|
||||
{
|
||||
banksMenu &&
|
||||
<BanksMenu
|
||||
banksMenu={banksMenu}
|
||||
{...this.props}
|
||||
{...this.state}
|
||||
{...common}
|
||||
></BanksMenu>
|
||||
}
|
||||
<Switch {...this.props}>
|
||||
<Route path={`/banks/exercise/:Id/:type`}
|
||||
render={
|
||||
(props) => {
|
||||
return (<ExerciseBanksDetail {...this.props} {...props} {...this.state} {...common}
|
||||
/>)
|
||||
}
|
||||
}></Route>
|
||||
|
||||
<Route path={`/banks/gtopic/:bankId/:type`}
|
||||
render={
|
||||
(props) => {
|
||||
return (<GtopicBanks {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
}></Route>
|
||||
<Route path={`/banks/poll/:bankId/:type`}
|
||||
render={
|
||||
(props) => {
|
||||
return (<PollBanks {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
}></Route>
|
||||
|
||||
</Switch>
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default (BanksTabIndex);
|
@ -0,0 +1,56 @@
|
||||
import React, { Component } from 'react';
|
||||
import axios from 'axios'
|
||||
|
||||
import ExerciseDisplay from '../../../courses/exercise/ExerciseDisplay'
|
||||
|
||||
class ExerciseBanksDetail extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount = () =>{
|
||||
|
||||
}
|
||||
detailFetchCallback = (result) => {
|
||||
let Id=this.props.match.params.Id;
|
||||
|
||||
const crumbData={
|
||||
title: result.data.exercise && result.data.exercise.name,
|
||||
is_public: result.data.exercise && result.data.exercise.is_public,
|
||||
crumbArray:[
|
||||
{content:'详情'},
|
||||
]
|
||||
}
|
||||
const menuData={
|
||||
tab:'0',//tab选中的index
|
||||
menuArray:[//tab以及tab路由
|
||||
{to:`/banks/exercise/${Id}/${this.props.match.params.type}?tab=0`,content:'内容详情'}
|
||||
],
|
||||
category:'exercise',//
|
||||
tos: `/banks/exercise/${Id}/edit/${this.props.match.params.type}`,
|
||||
id: Id,
|
||||
is_public: result.data.exercise && result.data.exercise.is_public,
|
||||
type:this.props.match.params.type,
|
||||
authorize:result && result.data && result.data.authorize,
|
||||
}
|
||||
this.props.initPublic(crumbData,menuData);
|
||||
}
|
||||
|
||||
render(){
|
||||
let { pollDetail } = this.state
|
||||
|
||||
return(
|
||||
<div>
|
||||
<ExerciseDisplay {...this.props} {...this.state}
|
||||
urlPath = {'exercise_banks'}
|
||||
detailFetchCallback={this.detailFetchCallback}
|
||||
>
|
||||
</ExerciseDisplay>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default ExerciseBanksDetail
|
@ -0,0 +1,71 @@
|
||||
import React, { Component } from 'react';
|
||||
import axios from 'axios'
|
||||
import { ActionBtn } from 'educoder'
|
||||
|
||||
|
||||
import ExerciseNewCommon from '../../../courses/exercise/ExerciseNewCommon'
|
||||
|
||||
class ExerciseBanksEdit extends Component {
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state = {
|
||||
isPublic: undefined,
|
||||
// isGroup: false
|
||||
}
|
||||
}
|
||||
componentDidMount = () =>{
|
||||
|
||||
|
||||
}
|
||||
|
||||
initData = (responseData) =>{
|
||||
const Id = this.props.match.params.Id;
|
||||
|
||||
const crumbData={
|
||||
title:'编辑',
|
||||
is_public: responseData && responseData.data && responseData.data.exercise.is_public,
|
||||
crumbArray:[
|
||||
{to:`/banks/exercise/${Id}/${this.props.match.params.type}`,content:'详情'},
|
||||
{content:'编辑'}
|
||||
]
|
||||
}
|
||||
this.props.initPublic(crumbData);
|
||||
}
|
||||
|
||||
render(){
|
||||
let { Id, type } = this.props.match.params
|
||||
const common = {
|
||||
// onCancel:this.onCancel,
|
||||
// isGroup: this.isGroup,
|
||||
// doNew: this.doNew,
|
||||
// doEdit: this.doEdit,
|
||||
initData: this.initData
|
||||
}
|
||||
return(
|
||||
<div className="courseForm">
|
||||
<style>
|
||||
{`
|
||||
.courseForm .ant-col-sm-24{
|
||||
text-align:left;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
<ExerciseNewCommon
|
||||
{...this.props}
|
||||
{...this.state}
|
||||
{...common}
|
||||
hidePreviewButton={true}
|
||||
wrappedComponentRef={(ref) => this.exerciseNewCommonRef = ref}
|
||||
isEdit={true}
|
||||
shixunsUrl={`/exercise_banks/choose_shixun.json`}
|
||||
exercise_url={'exercise_banks'}
|
||||
exercise_url_questions={'exercise_bank_questions'}
|
||||
bottomSection={<ActionBtn style="blue" className="fr" to={`/banks/exercise/${Id}/${this.props.match.params.type}`}>
|
||||
完成
|
||||
</ActionBtn>}
|
||||
></ExerciseNewCommon>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default ExerciseBanksEdit;
|
@ -0,0 +1,99 @@
|
||||
import React, { Component } from 'react';
|
||||
import axios from 'axios'
|
||||
import NewGtaskForm from './NewGtaskForm';
|
||||
import NewWorkForm from "./HomeworkBanksEdit";
|
||||
|
||||
class GtaskBanksEdit extends Component {
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state = {
|
||||
isPublic: undefined,
|
||||
isGroup: false
|
||||
}
|
||||
}
|
||||
componentDidMount = () =>{
|
||||
let workId = this.props.match.params.workId;
|
||||
this.initData(workId);
|
||||
}
|
||||
|
||||
initData = (workId) =>{
|
||||
|
||||
let url = `/task_banks/${workId}.json`;
|
||||
axios.get(url).then((result)=>{
|
||||
if(result){
|
||||
const crumbData={
|
||||
title:'编辑',
|
||||
is_public:result && result.data && result.data.is_public,
|
||||
crumbArray:[
|
||||
{to:`/banks/gtask/${workId}/${this.props.match.params.type}?tab=0`,content:'详情'},
|
||||
{content:'编辑'}
|
||||
]
|
||||
}
|
||||
this.props.initPublic(crumbData);
|
||||
result.data.isEdit = true;
|
||||
this.setState({ data:result.data})
|
||||
this.newWorkFormRef.initValue(result.data);
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
doNew = () => {
|
||||
}
|
||||
doEdit = (params) => {
|
||||
const workId = this.props.match.params.workId
|
||||
const newUrl = `/homework_banks/${workId}.json`
|
||||
|
||||
// const isGroup = this.props.isGroup()
|
||||
axios.put(newUrl, params)
|
||||
.then((response) => {
|
||||
if (response.data.status == 0) {
|
||||
this.props.showNotification('保存成功')
|
||||
this.toWorkDetail()
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
toWorkDetail = () => {
|
||||
this.props.history.push(`/banks/gtask/${this.props.match.params.workId}/${this.props.match.params.type}`);
|
||||
this.props.initPublic(undefined);
|
||||
}
|
||||
onCancel = () => {
|
||||
this.toWorkDetail()
|
||||
}
|
||||
isGroup = () => {
|
||||
return this.state.isGroup;
|
||||
}
|
||||
render(){
|
||||
|
||||
const common = {
|
||||
onCancel:this.onCancel,
|
||||
isGroup: this.isGroup,
|
||||
doNew: this.doNew,
|
||||
doEdit: this.doEdit,
|
||||
}
|
||||
return(
|
||||
<div className="courseForm">
|
||||
<style>
|
||||
{`
|
||||
.courseForm .ant-col-sm-24{
|
||||
text-align:left;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
<NewGtaskForm
|
||||
{...this.props}
|
||||
{...this.state}
|
||||
{...common}
|
||||
wrappedComponentRef={(ref) => this.newWorkFormRef = ref}
|
||||
topicId={this.props.match.params.workId}
|
||||
></NewGtaskForm>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default GtaskBanksEdit;
|
@ -0,0 +1,89 @@
|
||||
import React, { Component } from 'react';
|
||||
import axios from 'axios'
|
||||
|
||||
import GraduateTopicNewFrom from '../../../courses/graduation/topics/GraduateTopicNewFrom'
|
||||
|
||||
class GtopicBanksEdit extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state = {
|
||||
isPublic:undefined
|
||||
}
|
||||
}
|
||||
componentDidMount = () =>{
|
||||
let bankId = this.props.match.params.bankId;
|
||||
|
||||
this.initData(bankId);
|
||||
}
|
||||
|
||||
initData = (bankId) =>{
|
||||
let url = `/gtopic_banks/${bankId}/edit.json`;
|
||||
axios.get(url).then((result)=>{
|
||||
if(result){
|
||||
const crumbData={
|
||||
title:'编辑',
|
||||
is_public:result && result.data.selected_data && result.data.selected_data.is_public,
|
||||
crumbArray:[
|
||||
{to:`/banks/gtopic/${bankId}/${this.props.match.params.type}?tab=0`,content:'详情'},
|
||||
{content:'编辑'}
|
||||
]
|
||||
}
|
||||
this.props.initPublic(crumbData);
|
||||
|
||||
this.GraduateTopicNewFromRef.initValue(result);
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
// 编辑保存
|
||||
editSave = (param,attachments,bankId) =>{
|
||||
const url = `/gtopic_banks/${bankId}.json`;
|
||||
let params = {
|
||||
gtopic_bank:param,
|
||||
attachment_ids:attachments
|
||||
}
|
||||
axios.put(url,params).then((result)=>{
|
||||
if(result){
|
||||
this.props.showNotification('保存成功!');
|
||||
this.props.history.push(`/banks/gtopic/${bankId}/${this.props.match.params.type}`);
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
|
||||
// 取消
|
||||
editCancel = () =>{
|
||||
this.props.history.push(`/banks/gtopic/${this.props.match.params.bankId}/${this.props.match.params.type}`);
|
||||
this.props.initPublic(undefined);
|
||||
}
|
||||
|
||||
render(){
|
||||
let { bankId } = this.props.match.params
|
||||
const common = {
|
||||
editSave:this.editSave,
|
||||
editCancel:this.editCancel
|
||||
}
|
||||
return(
|
||||
<div className="courseForm">
|
||||
<style>
|
||||
{`
|
||||
.courseForm .ant-col-sm-24{
|
||||
text-align:left;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
<GraduateTopicNewFrom
|
||||
{...this.props}
|
||||
{...this.state}
|
||||
{...common}
|
||||
wrappedComponentRef={(ref) => this.GraduateTopicNewFromRef = ref}
|
||||
topicId={bankId}
|
||||
></GraduateTopicNewFrom>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default GtopicBanksEdit;
|
@ -0,0 +1,103 @@
|
||||
import React, { Component } from 'react';
|
||||
import axios from 'axios'
|
||||
|
||||
|
||||
import NewWorkForm from '../../../courses/busyWork/NewWorkForm'
|
||||
|
||||
class HomeworkBanksEdit extends Component {
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state = {
|
||||
isPublic: undefined,
|
||||
// isGroup: false
|
||||
}
|
||||
}
|
||||
componentDidMount = () =>{
|
||||
let workId = this.props.match.params.workId;
|
||||
|
||||
this.initData(workId);
|
||||
}
|
||||
|
||||
initData = (workId) =>{
|
||||
let url = `/homework_banks/${workId}.json`;
|
||||
axios.get(url).then((result)=>{
|
||||
if(result){
|
||||
const crumbData={
|
||||
title:'编辑',
|
||||
is_public:result && result.data && result.data.is_public,
|
||||
crumbArray:[
|
||||
{to:`/banks/${this.getModuleName()}/${workId}/${this.props.match.params.type}?tab=0`,content:'详情'},
|
||||
{content:'编辑'}
|
||||
]
|
||||
}
|
||||
this.props.initPublic(crumbData);
|
||||
result.data.isEdit = true;
|
||||
result.data.ref_attachments = result.data.reference_attachments
|
||||
// this.setState({ isGroup: result.data.min_num || result.data.max_num })
|
||||
this.newWorkFormRef.initValue(result.data);
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
doNew = () => {
|
||||
}
|
||||
doEdit = (params) => {
|
||||
const workId = this.props.match.params.workId
|
||||
const newUrl = `/homework_banks/${workId}.json`
|
||||
|
||||
// const isGroup = this.props.isGroup()
|
||||
axios.put(newUrl, params)
|
||||
.then((response) => {
|
||||
if (response.data.status == 0) {
|
||||
this.props.showNotification('保存成功')
|
||||
this.toWorkDetail()
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
getModuleName = () => {
|
||||
return this.props.isGroup ? 'group' : 'normal'
|
||||
}
|
||||
toWorkDetail = () => {
|
||||
this.props.history.push(`/banks/${this.getModuleName()}/${this.props.match.params.workId}/${this.props.match.params.type}`)
|
||||
this.props.initPublic(undefined);
|
||||
}
|
||||
onCancel = () => {
|
||||
this.toWorkDetail()
|
||||
}
|
||||
isGroup = () => {
|
||||
return this.props.isGroup;
|
||||
}
|
||||
render(){
|
||||
let { bankId } = this.props.match.params
|
||||
const common = {
|
||||
onCancel:this.onCancel,
|
||||
isGroup: this.isGroup,
|
||||
doNew: this.doNew,
|
||||
doEdit: this.doEdit,
|
||||
}
|
||||
return(
|
||||
<div className="courseForm">
|
||||
<style>
|
||||
{`
|
||||
.courseForm .ant-col-sm-24{
|
||||
text-align:left;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
<NewWorkForm
|
||||
{...this.props}
|
||||
{...this.state}
|
||||
{...common}
|
||||
wrappedComponentRef={(ref) => this.newWorkFormRef = ref}
|
||||
></NewWorkForm>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default HomeworkBanksEdit;
|
@ -0,0 +1,69 @@
|
||||
import React, { Component } from 'react';
|
||||
import axios from 'axios'
|
||||
|
||||
import PollDetailTabThirdInfo from '../../../courses/poll/PollDetailTabThirdInfo'
|
||||
|
||||
class PollBanksContent extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
pollDetail:undefined
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount = () =>{
|
||||
console.log("PollBanksContent");
|
||||
console.log(this.props)
|
||||
let bankId=this.props.match.params.bankId;
|
||||
let url = `/exercise_banks/${bankId}.json`
|
||||
axios.get(url).then((result)=>{
|
||||
if(result){
|
||||
let pollDetail = {
|
||||
poll:{
|
||||
id: result.data.poll && result.data.poll.id ,
|
||||
polls_description: result.data.poll && result.data.poll.description,
|
||||
polls_name: result.data.poll && result.data.poll.name,
|
||||
is_public:result.data.poll && result.data.poll.is_public
|
||||
},
|
||||
question_types:result.data.question_types,
|
||||
questions:result.data.questions,
|
||||
}
|
||||
const crumbData={
|
||||
title:result.data.poll && result.data.poll.name,
|
||||
is_public:result.data.poll && result.data.poll.is_public,
|
||||
crumbArray:[
|
||||
{content:'详情'},
|
||||
]
|
||||
}
|
||||
const menuData={
|
||||
tab:'0',//tab选中的index
|
||||
menuArray:[//tab以及tab路由
|
||||
{to:`/banks/poll/${bankId}/${this.props.match.params.type}`,content:'内容详情'}
|
||||
],
|
||||
category:'poll',//毕设选题
|
||||
tos:`/banks/poll/${bankId}/edit/${this.props.match.params.type}`,
|
||||
id:bankId,
|
||||
is_public:result.data.poll && result.data.poll.is_public,
|
||||
type:this.props.match.params.type,
|
||||
authorize:result && result.data && result.data.authorize,
|
||||
}
|
||||
this.props.initPublic(crumbData,menuData);
|
||||
this.setState({
|
||||
pollDetail
|
||||
})
|
||||
}
|
||||
}).catch((error)=>{
|
||||
console.log(error);
|
||||
})
|
||||
}
|
||||
|
||||
render(){
|
||||
let { pollDetail } = this.state
|
||||
return(
|
||||
<div>
|
||||
<PollDetailTabThirdInfo {...this.props} {...this.state} pollDetail = {pollDetail}></PollDetailTabThirdInfo>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default PollBanksContent
|
@ -0,0 +1,196 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import { Menu } from 'antd'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { WordsBtn } from 'educoder'
|
||||
import "../usersInfo.css"
|
||||
import "../../../courses/css/Courses.css"
|
||||
import "../../../courses/css/busyWork.css"
|
||||
import SendTopics from '../../../modals/SendTopics';
|
||||
import Modals from '../../../modals/Modals';
|
||||
import axios from 'axios';
|
||||
class BanksMenu extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
visible:false,
|
||||
tab:['0'],
|
||||
}
|
||||
}
|
||||
|
||||
//发送至相关
|
||||
sendTopics=()=>{
|
||||
this.setState({
|
||||
visible:true
|
||||
})
|
||||
}
|
||||
componentDidMount() {
|
||||
debugger
|
||||
try {
|
||||
const query = this.props.location.search;
|
||||
const type = query.split('?tab=');
|
||||
if(type[1]===undefined){
|
||||
this.setState({
|
||||
tab:['0'],
|
||||
});
|
||||
}else{
|
||||
if(type[1]==="0"){
|
||||
this.setState({
|
||||
tab:['0'],
|
||||
});
|
||||
}else if(type[1]==="1"){
|
||||
this.setState({
|
||||
tab:['1'],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}catch (e) {
|
||||
this.setState({
|
||||
tab:['0'],
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
topicscancelmodel=()=>{
|
||||
this.setState({
|
||||
Modalstype:false,
|
||||
Loadtype:false,
|
||||
visible:false,
|
||||
Modalstopval:"",
|
||||
ModalCancel:"",
|
||||
ModalSave:"",
|
||||
checkBoxValues:[],
|
||||
checkedtype:false
|
||||
})
|
||||
}
|
||||
|
||||
//删除相关
|
||||
|
||||
deletecheckBoxValues=(id,type)=>{
|
||||
|
||||
this.setState({
|
||||
Modalstype:true,
|
||||
Modalstopval:"是否确认删除?",
|
||||
ModalCancel:this.topicscancelmodel,
|
||||
ModalSave:()=>this.topicssavedelete(id,type),
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
topicssavedelete=(id,type)=>{
|
||||
console.log("删除了");
|
||||
console.log(id);
|
||||
console.log(type);
|
||||
const url = `/question_banks/multi_delete.json`;
|
||||
axios.delete(url, { data: {
|
||||
object_id: [id],
|
||||
object_type:type
|
||||
}})
|
||||
.then((response) => {
|
||||
console.log(response);
|
||||
if(response){
|
||||
if(response.data){
|
||||
if(response.data.status===0){
|
||||
this.props.showNotification(response.data.message)
|
||||
window.location.href=`/users/${this.props.current_user.login}/topics/personal`;
|
||||
}else{
|
||||
this.props.showNotification(response.data.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
this.topicscancelmodel()
|
||||
}
|
||||
changeTab=(e)=>{
|
||||
this.setState({
|
||||
tab:e.key
|
||||
})
|
||||
console.log(e.key);
|
||||
// if(e.key === 0){
|
||||
//
|
||||
// }else{
|
||||
//
|
||||
//
|
||||
// }
|
||||
}
|
||||
render(){
|
||||
let { banksMenu} = this.props;
|
||||
let {visible,tab}=this.state;
|
||||
// console.log("问卷预览");
|
||||
// console.log(visible);
|
||||
let user_id=this.props.current_user&&this.props.current_user.user_id;
|
||||
let user_type=this.props.current_user&&this.props.current_user.user_identity;
|
||||
let targetuserid=this.props.data&&this.props.data.id;
|
||||
// console.log("_____________________________");
|
||||
// console.log(this.props);
|
||||
// console.log("++++++++++++++++=");
|
||||
// console.log("banksMenubanksMenubanksMenubanksMenu");
|
||||
// console.log(banksMenu);
|
||||
return(
|
||||
<div className="clearfix bor-bottom-greyE edu-back-white" style={{padding:"0px 30px"}}>
|
||||
{this.state.Modalstype&&this.state.Modalstype===true?<Modals
|
||||
modalsType={this.state.Modalstype}
|
||||
modalsTopval={this.state.Modalstopval}
|
||||
modalCancel={this.state.ModalCancel}
|
||||
modalSave={this.state.ModalSave}
|
||||
modalsBottomval={this.state.ModalsBottomval}
|
||||
loadtype={this.state.Loadtype}
|
||||
/>:""}
|
||||
{/*发送至弹窗*/}
|
||||
{
|
||||
visible&&visible===true?
|
||||
<SendTopics
|
||||
{...this.state}
|
||||
{...this.props}
|
||||
visible={visible}
|
||||
category={banksMenu&&banksMenu.category}
|
||||
checkBoxValues={[banksMenu&&banksMenu.id]}
|
||||
topicscancelmodel={()=>this.topicscancelmodel()}
|
||||
/>:""
|
||||
}
|
||||
{
|
||||
banksMenu &&
|
||||
<div className="task_menu_ul fl">
|
||||
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}>
|
||||
{
|
||||
banksMenu.menuArray && banksMenu.menuArray.map((item,key)=>{
|
||||
console.log("BanksMenu");
|
||||
console.log(item);
|
||||
return(
|
||||
<Menu.Item key={key}><Link to={`${item.to}`}>{item.content}</Link></Menu.Item>
|
||||
)
|
||||
})
|
||||
}
|
||||
</Menu>
|
||||
</div>
|
||||
}
|
||||
|
||||
{
|
||||
banksMenu===undefined?
|
||||
<span className="fr mt18">
|
||||
<WordsBtn onClick={()=>this.deletecheckBoxValues(banksMenu&&banksMenu.id,banksMenu&&banksMenu.category)}style="blue" className="ml20 font-16">删除</WordsBtn>
|
||||
<WordsBtn to={ banksMenu.tos ? banksMenu.tos:""} style="blue" className="ml20 font-16">编辑</WordsBtn>
|
||||
<WordsBtn onClick={()=>this.sendTopics()} style="blue" className="ml20 font-16">发送</WordsBtn>
|
||||
</span>
|
||||
:banksMenu.authorize===true?
|
||||
<span className="fr mt18">
|
||||
<WordsBtn onClick={()=>this.deletecheckBoxValues(banksMenu&&banksMenu.id,banksMenu&&banksMenu.category)}style="blue" className="ml20 font-16">删除</WordsBtn>
|
||||
<WordsBtn to={ banksMenu.tos ? banksMenu.tos:""} style="blue" className="ml20 font-16">编辑</WordsBtn>
|
||||
<WordsBtn onClick={()=>this.sendTopics()} style="blue" className="ml20 font-16">发送</WordsBtn>
|
||||
</span>
|
||||
:
|
||||
<span className="fr mt18">
|
||||
<WordsBtn onClick={()=>this.sendTopics()} style="blue" className="ml20 font-16">发送</WordsBtn>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default BanksMenu;
|
Loading…
Reference in new issue