Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

video_transcode
cxt 5 years ago
commit 7ef4b837f6

@ -1,8 +1,8 @@
class HackSet < ApplicationRecord
validates_length_of :input, maximum: 1000, message: "不能超过1000个字符"
validates_length_of :output, maximum: 1000, message: "不能超过1000个字符"
validates :input, presence: { message: "测试集输入不能为空" }
validates :output, presence: { message: "测试集输出不能为空" }
#validates :input, presence: { message: "测试集输入不能为空" }
validates_presence_of :output, message: "不能为空"
validates_uniqueness_of :input, scope: [:hack_id, :input], message: "多个测试集的输入不能相同"
# 编程题测试集
belongs_to :hack

@ -0,0 +1,5 @@
class AddUserIdIndexForGames < ActiveRecord::Migration[5.2]
def change
add_index :games, :user_id
end
end

@ -2,7 +2,7 @@ desc "统计每个学校使用数据"
namespace :static_all do
task :repo => :environment do
school_alls = School.includes(:courses, user_extensions: :user).all
school_alls = School.includes(courses: [:homework_commons, :attachments, :course_videos], user_extensions: :user).all
proc_num = ENV['processes'].blank? ? 5 : ENV['processes'].to_i
school_alls.find_in_batches(batch_size: 50) do |schools|
Parallel.each(schools, in_processes: proc_num) do |school|

@ -221,7 +221,7 @@ function generateNewIndexJsp() {
// <script type="text/javascript" src="/js/js_min_all.js"></script>
var result = data
.replace(jsMinAllRegex, code)
.replace(flvMinAllRegex)
.replace(flvMinAllRegex,'')
// .replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`)
// .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`)

@ -1,8 +1,7 @@
import React, {Component} from 'react';
import React, { Component } from 'react';
import './public-path';
import logo from './logo.svg';
import './App.css';
import {ConfigProvider} from 'antd'
import { ConfigProvider } from 'antd'
import zhCN from 'antd/lib/locale-provider/zh_CN';
import {
BrowserRouter as Router,
@ -21,9 +20,7 @@ import Trialapplicationreview from './modules/user/Trialapplicationreview';
import Addcourses from "./modules/courses/coursesPublic/Addcourses";
import AccountProfile from "./modules/user/AccountProfile";
import Accountnewprofile from './modules/user/Accountnewprofile';
import Trialapplication from './modules/login/Trialapplication';
import Certifiedprofessional from './modules/modals/Certifiedprofessional';
import NotFoundPage from './NotFoundPage'
import Loading from './Loading'
@ -32,18 +29,18 @@ import Loadable from 'react-loadable';
import moment from 'moment'
import {MuiThemeProvider, createMuiTheme} from 'material-ui/styles';
import { MuiThemeProvider, createMuiTheme } from 'material-ui/styles';
// import './AppConfig'
import history from './history';
import {SnackbarHOC} from 'educoder'
import {initAxiosInterceptors} from './AppConfig'
import { SnackbarHOC } from 'educoder'
import { initAxiosInterceptors } from './AppConfig'
import { Provider } from 'react-redux';
import configureStore from './redux/stores/configureStore';
// tpi需要这个来加载css
import {TPMIndexHOC} from './modules/tpm/TPMIndexHOC';
import { TPMIndexHOC } from './modules/tpm/TPMIndexHOC';
const store = configureStore();
const theme = createMuiTheme({
@ -52,7 +49,7 @@ const theme = createMuiTheme({
main: '#4CACFF',
contrastText: 'rgba(255, 255, 255, 0.87)'
},
secondary: {main: '#4CACFF'}, // #11cb5f This is just green.A700 as hex.
secondary: { main: '#4CACFF' }, // #11cb5f This is just green.A700 as hex.
},
});
//
@ -68,23 +65,23 @@ const EducoderLogin = Loadable({
//微信登录
const Otherlogin=Loadable({
const Otherlogin = Loadable({
loader: () => import('./modules/login/Otherlogin'),
loading: Loading,
})
//微信登录
const Loginqq=Loadable({
const Loginqq = Loadable({
loader: () => import('./modules/login/Loginqq'),
loading: Loading,
})
const Otherloginstart=Loadable({
const Otherloginstart = Loadable({
loader: () => import('./modules/login/Otherloginstart'),
loading: Loading,
})
const Otherloginsqq=Loadable({
const Otherloginsqq = Loadable({
loader: () => import('./modules/login/Otherloginqq'),
loading: Loading,
})
@ -103,24 +100,6 @@ const CommentComponent = Loadable({
loading: Loading,
})
// const TestMaterialDesignComponent = Loadable({
// loader: () => import('./modules/test/md/TestMaterialDesign'),
// loading: Loading,
// })
// const TestCodeMirrorComponent = Loadable({
// loader: () => import('./modules/test/codemirror/TestCodeMirror'),
// loading: Loading,
// })
// const TestComponent = Loadable({
// loader: () => import('./modules/test/TestRC'),
// loading: Loading,
// })
// const TestUrlQueryComponent = Loadable({
// loader: () => import('./modules/test/urlquery/TestUrlQuery'),
// loading: Loading,
// })
const TPMIndexComponent = Loadable({
loader: () => import('./modules/tpm/TPMIndex'),
loading: Loading,
@ -254,7 +233,7 @@ const BanksIndex = Loadable({
// 教学案例
const MoopCases = Loadable({
const MoopCases = Loadable({
loader: () => import('./modules/moop_cases/index'),
loading: Loading,
})
@ -272,23 +251,23 @@ const Interestpage = Loadable({
// })
//竞赛
const NewCompetitions=Loadable({
const NewCompetitions = Loadable({
loader: () => import('./modules/competitions/Competitions'),
loading: Loading,
})
//黑客松定制竞赛
const Osshackathon=Loadable({
const Osshackathon = Loadable({
loader: () => import('./modules/osshackathon/Osshackathon'),
loading: Loading,
})
const Messagerouting= Loadable({
const Messagerouting = Loadable({
loader: () => import('./modules/message/js/Messagerouting'),
loading: Loading,
})
const Topicbank= Loadable({
const Topicbank = Loadable({
loader: () => import('./modules/topic_bank/Topic_bank'),
loading: Loading,
})
@ -321,28 +300,28 @@ const Questionitem_banks = Loadable({
})
//试卷库
const Testpaperlibrary= Loadable({
const Testpaperlibrary = Loadable({
loader: () => import('./modules/testpaper/Testpaperlibrary'),
loading: Loading
})
//试卷编辑
const Paperlibraryeditid= Loadable({
const Paperlibraryeditid = Loadable({
loader: () => import('./modules/testpaper/Paperlibraryeditid'),
loading: Loading
})
//试卷查看
const Paperlibraryseeid= Loadable({
const Paperlibraryseeid = Loadable({
loader: () => import('./modules/testpaper/Paperlibraryseeid'),
loading: Loading
})
//人工组卷
const Paperreview= Loadable({
const Paperreview = Loadable({
loader: () => import('./modules/question/Paperreview'),
loading: Loading
})
//智能组卷
const Integeneration= Loadable({
const Integeneration = Loadable({
loader: () => import('./modules/testpaper/Intecomponents'),
loading: Loading
})
@ -387,44 +366,44 @@ class App extends Component {
constructor(props) {
super(props)
this.state = {
Addcoursestype:false,
Addcoursestypes:false,
mydisplay:false,
occupation:0,
Addcoursestype: false,
Addcoursestypes: false,
mydisplay: false,
occupation: 0,
mygetHelmetapi: null,
}
}
HideAddcoursestypess=(i)=>{
HideAddcoursestypess = (i) => {
console.log("调用了");
this.setState({
Addcoursestype:false,
Addcoursestypes:false,
mydisplay:true,
occupation:i,
Addcoursestype: false,
Addcoursestypes: false,
mydisplay: true,
occupation: i,
})
};
hideAddcoursestypes=()=>{
hideAddcoursestypes = () => {
this.setState({
Addcoursestypes:false
Addcoursestypes: false
})
};
ModalCancelsy=()=>{
ModalCancelsy = () => {
this.setState({
mydisplay:false,
mydisplay: false,
})
window.location.href = "/";
};
ModalshowCancelsy=()=>{
ModalshowCancelsy = () => {
this.setState({
mydisplay:true,
mydisplay: true,
})
};
disableVideoContextMenu = () => {
window.$( "body" ).on( "mousedown", "video", function(event) {
if(event.which === 3) {
window.$('video').bind('contextmenu',function () { return false; });
window.$("body").on("mousedown", "video", function (event) {
if (event.which === 3) {
window.$('video').bind('contextmenu', function () { return false; });
} else {
window.$('video').unbind('contextmenu');
}
@ -442,7 +421,7 @@ class App extends Component {
});
initAxiosInterceptors(this.props);
this.getAppdata();
this.getAppdata();
//
// axios.interceptors.response.use((response) => {
// // console.log("response"+response);
@ -464,9 +443,9 @@ class App extends Component {
});
}
//修改登录方法
Modifyloginvalue=()=>{
Modifyloginvalue = () => {
this.setState({
isRender:false,
isRender: false,
})
};
@ -500,20 +479,20 @@ class App extends Component {
}
document.head.appendChild(link);
}
//获取当前定制信息
getAppdata=()=>{
//获取当前定制信息
getAppdata = () => {
let url = "/setting.json";
axios.get(url).then((response) => {
// console.log("app.js开始请求/setting.json");
// console.log("获取当前定制信息");
if(response){
if(response.data){
if (response) {
if (response.data) {
this.setState({
mygetHelmetapi:response.data.setting
mygetHelmetapi: response.data.setting
});
//存储配置到游览器
localStorage.setItem('chromesetting',JSON.stringify(response.data.setting));
localStorage.setItem('chromesettingresponse',JSON.stringify(response));
localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
localStorage.setItem('chromesettingresponse', JSON.stringify(response));
try {
if (response.data.setting.tab_logo_url) {
this.gettablogourldata(response);
@ -543,57 +522,57 @@ class App extends Component {
};
render() {
let{mygetHelmetapi}=this.state;
let { mygetHelmetapi } = this.state;
// console.log("appappapp");
// console.log(mygetHelmetapi);
return (
<Provider store={store}>
<ConfigProvider locale={zhCN}>
<MuiThemeProvider theme={theme}>
<Accountnewprofile {...this.props}{...this.state}/>
<LoginDialog {...this.props} {...this.state} Modifyloginvalue={()=>this.Modifyloginvalue()}></LoginDialog>
<Accountnewprofile {...this.props}{...this.state} />
<LoginDialog {...this.props} {...this.state} Modifyloginvalue={() => this.Modifyloginvalue()}></LoginDialog>
<Notcompletedysl {...this.props} {...this.state}></Notcompletedysl>
<Trialapplicationysl {...this.props} {...this.state}></Trialapplicationysl>
<Trialapplicationreview {...this.props} {...this.state}></Trialapplicationreview>
<Addcourses {...this.props} {...this.state} HideAddcoursestypess={(i)=>this.HideAddcoursestypess(i)}/>
<AccountProfile {...this.props} {...this.state} />
<Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.ModalCancelsy} ModalshowCancelsy={this.ModalshowCancelsy}/>
<Addcourses {...this.props} {...this.state} HideAddcoursestypess={(i) => this.HideAddcoursestypess(i)} />
<AccountProfile {...this.props} {...this.state} />
<Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.ModalCancelsy} ModalshowCancelsy={this.ModalshowCancelsy} />
<Router>
<Switch>
{/*题库*/}
<Route path="/topicbank/:username/:topicstype"
render={
(props) => {
render={
(props) => {
return (<Topicbank {...this.props} {...props} {...this.state} />)
}
}></Route>
return (<Topicbank {...this.props} {...props} {...this.state} />)
}
}></Route>
{/*题库*/}
<Route path="/topicbank/:topicstype"
render={
(props) => {
render={
(props) => {
return (<Topicbank {...this.props} {...props} {...this.state} />)
}
}></Route>
return (<Topicbank {...this.props} {...props} {...this.state} />)
}
}></Route>
{/*/!*众包创新*!/*/}
{/*<Route path={"/crowdsourcing"} component={ProjectPackages}/>*/}
{/*竞赛*/}
<Route path={"/competitions"}
render={
(props) => {
render={
(props) => {
return (<NewCompetitions {...this.props} {...props} {...this.state} />)
}
}></Route>
return (<NewCompetitions {...this.props} {...props} {...this.state} />)
}
}></Route>
{/*黑客松定制竞赛*/}
<Route
path={"/osshackathon"}
render={
(props)=>{
return(
(props) => {
return (
<Osshackathon {...this.props} {...props} {...this.state} />
)
}
@ -601,17 +580,17 @@ class App extends Component {
/>
{/*认证*/}
<Route path="/account" component={AccountPage}/>
<Route path="/account" component={AccountPage} />
{/*403*/}
<Route path="/403" component={Shixunauthority}/>
<Route path="/403" component={Shixunauthority} />
<Route path="/500" component={http500}/>
<Route path="/500" component={http500} />
{/*404*/}
<Route path="/nopage" component={Shixunnopage}/>
<Route path="/nopage" component={Shixunnopage} />
<Route path="/compatibility" component={CompatibilityPageLoadable}/>
<Route path="/compatibility" component={CompatibilityPageLoadable} />
<Route
path="/login"
render={
@ -649,19 +628,19 @@ class App extends Component {
return (<InfosIndex {...this.props} {...props} {...this.state} />)
}
}></Route>
}></Route>
<Route path="/banks"
render={
(props) => {
return (<BanksIndex {...this.props} {...props} {...this.state} />)
}
}></Route>
}></Route>
{/*<Route*/}
{/*path="/personalcompetit"*/}
{/*render={*/}
{/*(props) => (<PersonalCompetit {...this.props} {...props} {...this.state}></PersonalCompetit>)*/}
{/*}*/}
{/*path="/personalcompetit"*/}
{/*render={*/}
{/*(props) => (<PersonalCompetit {...this.props} {...props} {...this.state}></PersonalCompetit>)*/}
{/*}*/}
{/*/>*/}
<Route
path="/changepassword"
@ -679,93 +658,82 @@ class App extends Component {
<Route path="/shixuns/new" component={Newshixuns}>
</Route>
<Route path="/colleges/:id/statistics"
render={
(props) => (<College {...this.props} {...props} {...this.state} />)
}/>
render={
(props) => (<College {...this.props} {...props} {...this.state} />)
} />
{/* jupyter */}
<Route path="/tasks/:identifier/jupyter/"
render={
(props) => {
return (<JupyterTPI {...this.props} {...props} {...this.state}/>)
return (<JupyterTPI {...this.props} {...props} {...this.state} />)
}
}
/>
<Route path="/tasks/:stageId" component={IndexWrapperComponent}/>
<Route path="/tasks/:stageId" component={IndexWrapperComponent} />
{/*<Route path="/shixuns/:shixunId" component={TPMIndexComponent}>*/}
{/*</Route>*/}
<Route path="/shixuns/:shixunId"
render={
(props)=>(<TPMIndexComponent {...this.props} {...props} {...this.state}></TPMIndexComponent>)
}
render={
(props) => (<TPMIndexComponent {...this.props} {...props} {...this.state}></TPMIndexComponent>)
}
></Route>
{/*列表页 实训项目列表*/}
{/*<Route path="/shixuns" component={TPMShixunsIndexComponent}/>*/}
<Route path="/shixuns"
render={
(props)=>(<TPMShixunsIndexComponent {...this.props} {...props} {...this.state}></TPMShixunsIndexComponent>)
}
render={
(props) => (<TPMShixunsIndexComponent {...this.props} {...props} {...this.state}></TPMShixunsIndexComponent>)
}
></Route>
{/*实训课程(原实训路径)*/}
<Route path="/paths" component={ShixunPaths}></Route>
<Route path="/search"
render={
(props)=>(<SearchPage {...this.props} {...props} {...this.state}></SearchPage>)
}
render={
(props) => (<SearchPage {...this.props} {...props} {...this.state}></SearchPage>)
}
></Route>
{/*课堂*/}
<Route path="/courses" component={CoursesIndex} {...this.props} {...this.state}></Route>
{/* <Route path="/forums" component={ForumsIndexComponent}>
</Route> */}
{/* 教学案例 */}
<Route path="/moop_cases"render={
(props) => (<MoopCases {...this.props} {...props} {...this.state} />)
}/>
<Route path="/moop_cases" render={
(props) => (<MoopCases {...this.props} {...props} {...this.state} />)
} />
<Route path="/forums"
render={
(props)=>(<ForumsIndexComponent {...this.props} {...props} {...this.state}></ForumsIndexComponent>)
(props) => (<ForumsIndexComponent {...this.props} {...props} {...this.state}></ForumsIndexComponent>)
}
>
</Route>
<Route path="/comment" component={CommentComponent}/>
<Route path="/comment" component={CommentComponent} />
{/*<Route path="/testMaterial" component={TestMaterialDesignComponent}/>*/}
{/*<Route path="/test" component={TestIndex}/>*/}
{/*<Route path="/testCodeMirror" component={TestCodeMirrorComponent}/>*/}
{/*<Route path="/testRCComponent" component={TestComponent}/>*/}
{/*<Route path="/testUrlQuery" component={TestUrlQueryComponent}/>*/}
{/*<Route*/}
{/*path="/registration"*/}
{/*render={*/}
{/*(props) => (<Registration {...this.props} {...props} {...this.state}></Registration>)*/}
{/*}*/}
{/*path="/registration"*/}
{/*render={*/}
{/*(props) => (<Registration {...this.props} {...props} {...this.state}></Registration>)*/}
{/*}*/}
{/*/>*/}
<Route path="/messages"
render={
(props)=>(<Messagerouting {...this.props} {...props} {...this.state}></Messagerouting>)
}
render={
(props) => (<Messagerouting {...this.props} {...props} {...this.state}></Messagerouting>)
}
></Route>
<Route path="/help/:type"
render={
(props)=>(<Help {...this.props} {...props} {...this.state}></Help>)
}/>
render={
(props) => (<Help {...this.props} {...props} {...this.state}></Help>)
} />
<Route path="/ecs"
render={
(props)=>(<Ecs {...this.props} {...props} {...this.state}></Ecs>)
}/>
render={
(props) => (<Ecs {...this.props} {...props} {...this.state}></Ecs>)
} />
<Route path="/problems/new/:id?"
render={
@ -776,9 +744,9 @@ class App extends Component {
/>
<Route path="/myproblems/record_detail/:id"
render={
(props) => (<RecordDetail {...this.props} {...props} {...this.state} />)
}
render={
(props) => (<RecordDetail {...this.props} {...props} {...this.state} />)
}
/>
<Route
path="/problems/:id/edit"
@ -786,71 +754,71 @@ class App extends Component {
(props) => (<NewOrEditTask {...this.props} {...props} {...this.state} />)
} />
<Route path="/Integeneration/:type/:id"
render={
(props) => (<Paperreview {...this.props} {...props} {...this.state} />)
}/>
render={
(props) => (<Paperreview {...this.props} {...props} {...this.state} />)
} />
<Route path="/paperreview/:type"
render={
(props) => (<Paperreview {...this.props} {...props} {...this.state} />)
}/>
render={
(props) => (<Paperreview {...this.props} {...props} {...this.state} />)
} />
<Route path="/paperlibrary/edit/:id"
render={
(props) => (<Paperlibraryeditid {...this.props} {...props} {...this.state} />)
}/>
render={
(props) => (<Paperlibraryeditid {...this.props} {...props} {...this.state} />)
} />
<Route path="/paperlibrary/see/:id"
render={
(props) => (<Paperlibraryseeid {...this.props} {...props} {...this.state} />)
}/>
render={
(props) => (<Paperlibraryseeid {...this.props} {...props} {...this.state} />)
} />
<Route path="/myproblems/:id/:tab?"
render={
(props) => (<StudentStudy {...this.props} {...props} {...this.state} />)
} />
<Route path="/question/edit/:id"
render={
(props) => (<Questionitem_banks {...this.props} {...props} {...this.state} />)
} />
<Route path="/question/newitem"
render={
(props) => (<Questionitem_banks {...this.props} {...props} {...this.state} />)
} />
<Route path="/question/:type"
render={
(props) => (<Headplugselection {...this.props} {...props} {...this.state} />)
} />
render={
(props) => (<StudentStudy {...this.props} {...props} {...this.state} />)
} />
<Route path="/problemset/edit/:id"
render={
(props) => (<Questionitem_banks {...this.props} {...props} {...this.state} />)
} />
<Route path="/problemset/newitem"
render={
(props) => (<Questionitem_banks {...this.props} {...props} {...this.state} />)
} />
<Route path="/problemset/:type"
render={
(props) => (<Headplugselection {...this.props} {...props} {...this.state} />)
} />
<Route path="/paperlibrary"
render={
(props) => (<Testpaperlibrary {...this.props} {...props} {...this.state} />)
}/>
render={
(props) => (<Testpaperlibrary {...this.props} {...props} {...this.state} />)
} />
<Route path="/Integeneration"
render={
(props) => (<Integeneration {...this.props} {...props} {...this.state} />)
}/>
render={
(props) => (<Integeneration {...this.props} {...props} {...this.state} />)
} />
<Route path="/problems"
render={
(props) => (<Developer {...this.props} {...props} {...this.state} />)
}/>
<Route path="/question"
render={
(props) => (<Headplugselection {...this.props} {...props} {...this.state} />)
}/>
render={
(props) => (<Developer {...this.props} {...props} {...this.state} />)
} />
<Route path="/problemset"
render={
(props) => (<Headplugselection {...this.props} {...props} {...this.state} />)
} />
{/*<Route path="/wxcode/:identifier?" component={WXCode}*/}
{/* render={*/}
{/* (props)=>(<WXCode {...this.props} {...props} {...this.state}></WXCode>)*/}
{/* }*/}
{/*/>*/}
<Route exact path="/"
// component={ShixunsHome}
render={
(props)=>(<ShixunsHome {...this.props} {...props} {...this.state}></ShixunsHome>)
}
// component={ShixunsHome}
render={
(props) => (<ShixunsHome {...this.props} {...props} {...this.state}></ShixunsHome>)
}
/>
<Route component={Shixunnopage}/>
<Route component={Shixunnopage} />
</Switch>
</Router>
@ -972,4 +940,4 @@ moment.defineLocale('zh-cn', {
doy: 4 // The week that contains Jan 4th is the first week of the year.
}
});
export default SnackbarHOC()(App) ;
export default SnackbarHOC()(App);

@ -1,31 +1,25 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import { Modal} from 'antd';
import axios from 'axios';
import { getImageUrl } from 'educoder';
import { Modal } from 'antd';
import '../modules/user/account/common.css';
import './gotoqqgroup.css'
class GotoQQgroup extends Component {
constructor(props) {
super(props);
this.state={
}
}
modalCancel=()=>{
modalCancel = () => {
try {
this.props.setgoshowqqgtounp(false);
}catch (e) {
} catch (e) {
}
}
setDownload=()=>{
//立即联系
setDownload = () => {
try {
this.props.setgoshowqqgtounp(false);
}catch (e) {
} catch (e) {
}
}
@ -33,7 +27,7 @@ class GotoQQgroup extends Component {
render() {
return(
return (
<Modal
keyboard={false}
closable={false}
@ -41,16 +35,16 @@ class GotoQQgroup extends Component {
destroyOnClose={true}
title="提示"
centered={true}
visible={this.props.goshowqqgtounp===undefined?false:this.props.goshowqqgtounp}
visible={this.props.goshowqqgtounp === undefined ? false : this.props.goshowqqgtounp}
width="530px"
>
<div className="educouddiv intermediatecenter verticallayout">
<div className="tabeltext-alignleft mt10"><p>您可以在QQ服务群向管理员申请获得继续操作的权限</p></div>
<img width={"200px"} className="mt10" src={getImageUrl("images/educoder/qqqun20191230.png")}/>
<img width={"200px"} className="mt10" src={getImageUrl("images/educoder/qqqun20191230.png")} />
<div className="tabeltext-alignleft mt10"><p>群号612934990</p></div>
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30" onClick={()=>this.modalCancel()}>取消</a>
<a className="task-btn mr30" onClick={() => this.modalCancel()}>取消</a>
<a className="task-btn task-btn-orange" target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd">立即联系</a>
</div>
</div>

@ -275,12 +275,13 @@ class Addcourses extends Component{
});
if(response.data.course_id!=undefined){
this.submitasyn(response.data.course_id)
}else{
// 无返回课程id则是选择的教师或者助教身份成功后跳转到课堂首页
// console.log(this.props);
// console.log(this.props.history.push);
window.location.href="/courses";
}
// else{
// // 无返回课程id则是选择的教师或者助教身份成功后跳转到课堂首页
// // console.log(this.props);
// // console.log(this.props.history.push);
// window.location.href="/courses";
// }
if(Addcoursestype===true){
this.props.hideAddcoursestype();
}

@ -1,7 +1,7 @@
/*
* @Description: 新建或编辑任务
* @Author: tangjiang
* @Date: 2019-11-15 16:38:34
* @Author: tangjiang
* @Date: 2019-11-15 16:38:34
* @Last Modified by: tangjiang
* @Last Modified time: 2019-11-19 23:23:41
*/
@ -20,7 +20,7 @@ import actions from '../../../redux/actions';
// import {ModalConfirm} from '../../../common/components/ModalConfirm';
const NewOrEditTask = (props) => {
const {
const {
publishLoading,
handlePublish,
// testCases = [],
@ -41,7 +41,7 @@ const NewOrEditTask = (props) => {
courseQuestions
// updateTestAndValidate,
} = props;
// 表单提交
const handleSubmitForm = () => {
// 改变loading状态
@ -53,7 +53,7 @@ const NewOrEditTask = (props) => {
props.handleFormSubmit(props); // 提交表单
}
};
useEffect(() => {
// 获取用户信息
getUserInfoForNew();
@ -121,7 +121,7 @@ const NewOrEditTask = (props) => {
// 清空描述信息
toStore('oj_description', '');
// props.history.push('/problems');
props.history.push(`/question?${props.searchParams}`);
props.history.push(`/problemset?${props.searchParams}`);
}
// 发布
@ -163,8 +163,8 @@ const NewOrEditTask = (props) => {
onClick={handleClickCancel}
style={{ background: '#666666', color: '#fff', border: 'none' }}
>取消</Button>
<Button
type="primary"
<Button
type="primary"
loading={submitLoading}
onClick={handleSubmitForm}
>保存</Button>
@ -174,14 +174,14 @@ const NewOrEditTask = (props) => {
// 发布/模拟挑战
const renderPubOrFight = () => {
const pubButton = isPublish
? (<Button
? (<Button
style={{ background: 'rgba(102,102,102,1)', border: 'none' }}
type="primary"
type="primary"
loading={publishLoading}
onClick={handleClickCancelPublish}
>撤销发布</Button>)
: (<Button
type="primary"
: (<Button
type="primary"
loading={publishLoading}
onClick={handleClickPublish}
>立即发布</Button>);
@ -191,13 +191,13 @@ const NewOrEditTask = (props) => {
) : (
<Button type="primary" onClick={imitationChallenge}>模拟挑战</Button>
);
if (isPublish) {
return (
<React.Fragment>
{pubButton}
<Button
type="primary"
<Button
type="primary"
loading={submitLoading}
onClick={handleSubmitForm}
>保存</Button>
@ -207,8 +207,8 @@ const NewOrEditTask = (props) => {
} else {
return (
<React.Fragment>
<Button
type="primary"
<Button
type="primary"
loading={submitLoading}
onClick={handleSubmitForm}
>保存</Button>
@ -217,7 +217,7 @@ const NewOrEditTask = (props) => {
</React.Fragment>
);
}
}
// 渲染退出
@ -296,7 +296,7 @@ const mapDispatchToProps = (dispatch) => ({
clearOJFormStore: () => dispatch(actions.clearOJFormStore()),
// 按钮状态
changeSubmitLoadingStatus: (flag) => dispatch(actions.changeSubmitLoadingStatus(flag)),
// 发布按钮状态
// 发布按钮状态
changePublishLoadingStatus: (flag) => dispatch(actions.changePublishLoadingStatus(flag)),
// 测试用例及验证
updateTestAndValidate: (obj) => dispatch(actions.updateTestAndValidate(obj)),

@ -1,7 +1,7 @@
/*
* @Description: 添加测试用例
* @Author: tangjiang
* @Github:
* @Github:
* @Date: 2019-11-21 09:19:38
* @LastEditors : tangjiang
* @LastEditTime : 2019-12-27 10:37:41
@ -19,14 +19,14 @@ const AddTestDemo = (props) => {
const {
// key,
// onSubmitTest,
onDeleteTest,
onDeleteTest,
testCase,
testCaseValidate,
isOpen
} = props;
// const [isEditor, setIsEditor] = useState(false); // 是否是编辑
// 删除操作
const handleDeletePanel = (e) => {
// console.log('点击的删除按钮')
@ -63,7 +63,7 @@ const AddTestDemo = (props) => {
const value = e.target.value;
testCaseOutputChange(value, index);
}
// 右侧删除图标
const genExtra = () => (
<Icon
@ -127,7 +127,7 @@ const AddTestDemo = (props) => {
* 文本输入框可编辑的情况
* 1. 新增时
* 2. isAdd false isEditor 为true
* @param {*} testCase
* @param {*} testCase
*/
// const isDisabled = (testCase) => {
// return !testCase.isAdd && !isEditor;
@ -138,21 +138,19 @@ const AddTestDemo = (props) => {
// defaultActiveKey: [isOpen ? '1' : '']
// };
// console.log(activePane);
// 切换手风琴
const handleChangeCollapse = () => {
const {index, updateOpenTestCaseIndex} = props;
updateOpenTestCaseIndex(index);
}
return (
<Collapse className={'collapse_area'} activeKey={isOpen?'1':''} onChange={() => handleChangeCollapse()}>
<Panel header={`测试用例${props.index + 1}`} extra={genExtra()} key="1">
<Form>
<FormItem
label={<span className={'label_text'}>输入</span>}
validateStatus={testCaseValidate.input.validateStatus}
help={testCaseValidate.input.errMsg}
colon={ false }
>
<TextArea

@ -119,7 +119,7 @@ function StudentStudy (props) {
changeShowOrHideControl(false);
props.saveEditorCodeForDetail('');
props.clearOjForUserReducer();
props.history.push(`/problems/${identifier}/edit?{searchParams}`);
props.history.push(`/problems/${identifier}/edit`);
}
// 处理退出
const handleClickQuit = () => {
@ -129,7 +129,7 @@ function StudentStudy (props) {
changeShowOrHideControl(false);
props.saveEditorCodeForDetail('');
// props.history.push('/problems');
props.history.push(`/question?${searchParams}`);
props.history.push(`/problemset?${searchParams}`);
}
return (

@ -12,9 +12,13 @@ class Bottomsubmit extends Component {
cannelfun = () => {
// window.location.href=
if(this.props.Cohetepaperbool===true){
this.props.setCohetepaperbool(false);
}else {
try {
if(this.props.Cohetepaperbool===true){
this.props.setCohetepaperbool(false);
}else {
this.props.history.replace(this.props.url);
}
}catch (e) {
this.props.history.replace(this.props.url);
}

@ -1,164 +1,178 @@
import React, { Component } from 'react';
import axios from 'axios';
import {Dropdown,Menu} from 'antd';
import {getImageUrl} from 'educoder';
import { Dropdown, Menu } from 'antd';
import { getImageUrl } from 'educoder';
import PathCard from "./ShixunPathCard";
import UpgradeModals from '../modals/UpgradeModals';
import Pagination from '@icedesign/base/lib/pagination';
import '@icedesign/base/lib/pagination/style.js';
import './ShixunPaths.css';
import KeywordList from '../tpm/shixuns/shixun-keyword-list';
import btnUrl from '../tpm/shixuns/btn-new.png';
class ShixunPathSearch extends Component{
class ShixunPathSearch extends Component {
constructor(props) {
super(props)
this.state = {
order:"updated_at",
select:undefined,
search:"",
page:1,
pathList:null,
sortList:'',
total_count:0,
sort:"desc",
limit:16,
discipline_id:undefined,
sub_discipline_id:undefined
}
super(props)
this.state = {
order: "updated_at",
select: undefined,
search: "",
page: 1,
pathList: null,
sortList: '',
total_count: 0,
sort: "desc",
limit: 16,
discipline_id: undefined,
sub_discipline_id: undefined
}
}
//切换列表状态
changeStatus=(value)=>{
let {discipline_id,sub_discipline_id }=this.state;
//适配器
onChangeLabel(value) {
let rs = value === 'new' ? 'updated_at' : 'myshixuns_scount'
let { discipline_id, sub_discipline_id } = this.state;
this.setState({
order:value,
page:1
order: rs,
page: 1
})
this.getList(value,discipline_id,sub_discipline_id,1);
this.getList(rs, discipline_id, sub_discipline_id, 1)
}
//选择页数
onChange=(pageNumber)=> {
onChange = (pageNumber) => {
let { order,discipline_id,sub_discipline_id }=this.state;
let { order, discipline_id, sub_discipline_id } = this.state;
this.setState({
page:pageNumber
page: pageNumber
})
this.getList(order,discipline_id,sub_discipline_id,pageNumber);
this.getList(order, discipline_id, sub_discipline_id, pageNumber);
}
//顶部分类
changeSelect=(e,tag_id,sum)=>{
changeSelect = (e, tag_id, sum) => {
this.setState({
order:"updated_at",
discipline_id:tag_id,
page:1,
sub_discipline_id:undefined
order: "updated_at",
discipline_id: tag_id,
page: 1,
sub_discipline_id: undefined
})
let { order }=this.state;
this.getList(order,tag_id,undefined,1 );
let { order } = this.state;
this.getList(order, tag_id, undefined, 1);
e.stopPropagation();
}
componentDidMount(){
document.title="实践课程";
const upsystem=`/users/system_update.json`;
axios.get(upsystem).then((response)=>{
let updata=response.data;
this.setState({
updata:updata
})
}).catch((error)=>{
console.log(error);
})
componentDidMount() {
document.title = "实践课程";
const upsystem = `/users/system_update.json`;
axios.get(upsystem).then((response) => {
let updata = response.data;
this.setState({
updata: updata
})
}).catch((error) => {
console.log(error);
})
this.getdisciplines()
let { order,discipline_id,sub_discipline_id,page }=this.state;
this.getList(order,discipline_id,sub_discipline_id,page );
let { order, discipline_id, sub_discipline_id, page } = this.state;
this.getList(order, discipline_id, sub_discipline_id, page);
}
getdisciplines=()=>{
let url='/disciplines.json';
axios.get(url,{params:{
source:"subject"
}}).then((result)=>{
if(result.status==200){
// console.log(result.data.disciplines)
getdisciplines = () => {
let url = '/disciplines.json';
axios.get(url, {
params: {
source: "subject"
}
}).then((result) => {
if (result.status == 200) {
// console.log(result.data.disciplines)
this.setState({
sortList:result.data.disciplines
sortList: result.data.disciplines
})
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
getList=(order,discipline_id,sub_discipline_id,page )=>{
OnSearchInput = (value, type) => {
this.setState({
search: value,
page: 1
})
const { order, discipline_id, sub_discipline_id } = this.state
this.getList(order, discipline_id, sub_discipline_id, 1, value)
}
let url='/paths.json';
axios.get(url,{params:{
sort:"desc",
limit:16,
order:order,
page:page,
discipline_id:discipline_id,
sub_discipline_id:sub_discipline_id
}}).then((result)=>{
if(result.status==200){
getList = (order, discipline_id, sub_discipline_id, page, keyword = '') => {
let url = '/paths.json';
axios.get(url, {
params: {
sort: "desc",
limit: 16,
order: order,
keyword,
page: page,
discipline_id: discipline_id,
sub_discipline_id: sub_discipline_id
}
}).then((result) => {
if (result.status == 200) {
this.setState({
pathList:result.data.subjects,
total_count:result.data.total_count
pathList: result.data.subjects,
total_count: result.data.total_count
})
}
}).catch((error)=>{
}).catch((error) => {
console.log(error);
})
}
//头部获取是否已经登录了
getUser=(url,type)=>{
if(this.props.checkIfLogin()===false){
getUser = (url) => {
if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog()
return
}
if(this.props.checkIfProfileCompleted()===false){
if (this.props.checkIfProfileCompleted() === false) {
this.props.showProfileCompleteDialog()
return
}
if(url !== undefined || url!==""){
if (url !== undefined || url !== "") {
this.props.history.push(url);
}
}
getshixunchildValues=(e,id,item)=>{
getshixunchildValues = (e, id, item) => {
this.setState({
discipline_id:item.id,
sub_discipline_id:id,
discipline_id: item.id,
sub_discipline_id: id,
})
let { order,page }=this.state;
this.getList(order,item.id,id,page );
let { order, page } = this.state;
this.getList(order, item.id, id, page);
e.stopPropagation();
}
getmenu=(list,item)=>{
return(
getmenu = (list, item) => {
return (
<Menu>
<Menu.Item>
<div className="mt5 subshaicontent-part">
<div className="sub-Item clearfix">
{
list.map((tag,e)=>{
return(
<a className={parseInt(this.state.sub_discipline_id)===tag.id?"shixun_repertoire mr20 color-blue":"shixun_repertoire mr20"}
key={e} id={tag.id} name={tag.id} rel="subshaicontent" onClick={(e)=>this.getshixunchildValues(e,tag.id,item)}>{tag.name}</a>
list.map((tag, e) => {
return (
<a className={parseInt(this.state.sub_discipline_id) === tag.id ? "shixun_repertoire mr20 color-blue" : "shixun_repertoire mr20"}
key={e} id={tag.id} name={tag.id} rel="subshaicontent" onClick={(e) => this.getshixunchildValues(e, tag.id, item)}>{tag.name}</a>
)
})
}
@ -166,18 +180,18 @@ class ShixunPathSearch extends Component{
</div>
</Menu.Item>
</Menu>
)
)
}
render() {
let { order,sortList,search,page,total_count,discipline_id }=this.state;
let pathstype=false;
if(this.props&&this.props.mygetHelmetapi!=null){
let paths="/paths";
this.props.mygetHelmetapi.navbar.map((item,key)=>{
render() {
let { order, sortList, search, page, total_count, discipline_id } = this.state;
let pathstype = false;
if (this.props && this.props.mygetHelmetapi != null) {
let paths = "/paths";
this.props.mygetHelmetapi.navbar.map((item, key) => {
var reg = RegExp(item.link);
if(paths.match(reg)){
if(item.hidden===true){
pathstype=true
if (paths.match(reg)) {
if (item.hidden === true) {
pathstype = true
}
}
@ -185,21 +199,21 @@ class ShixunPathSearch extends Component{
}
return (
<div>
{this.state.updata===undefined?"":<UpgradeModals
{...this.state}
/>}
<div>
{this.state.updata === undefined ? "" : <UpgradeModals
{...this.state}
/>}
<style>
{
`
<style>
{
`
::-webkit-scrollbar {
width: 0px !important;
}
.pathImg{
width: 100%;
height: 300px;
background-image: url(${getImageUrl(this.props.mygetHelmetapi&&this.props.mygetHelmetapi.subject_banner_url===null?`images/path/path.png`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.subject_banner_url)});
background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.subject_banner_url === null ? `images/path/path.png` : this.props.mygetHelmetapi && this.props.mygetHelmetapi.subject_banner_url)});
background-color: #000a4f;
/* background-size: cover; */
background-position: center;
@ -217,57 +231,39 @@ class ShixunPathSearch extends Component{
}
a{text-decoration:none !important;}
`
}
</style>
<div className="pr">
<div className="pathImg"></div>
<div className="edu-back-white padding20 pathIndexNav">
<ul className="educontent clearfix">
<li className={discipline_id > 0 ? "" : "active"}><a onClick={(e)=>this.changeSelect(e,undefined)}>全部</a></li>
{
sortList && sortList.map((item,key)=>{
return(
<li className={discipline_id == `${item.id}` ? "active" : ""} onClick={(e)=>this.changeSelect(e,`${item.id}`,item.sub_disciplines.length)} key={key}>
<Dropdown disabled={item.sub_disciplines.length===0} overlay={()=>this.getmenu(item.sub_disciplines,item)} placement="bottomCenter">
<a value={item.id}>{item.name}</a>
</Dropdown>
</li>
)
})
}
</ul>
</div>
</div>
<div className="mt20 educontent mb20 clearfix mainPageArray">
{/*<a href="javascript:void(0)" className={ order == "publish_time" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("publish_time")}>全部</a>*/}
{/*<a href="javascript:void(0)" className={ order == "mine" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} onClick={ () => this.changeStatus("mine")}>我的</a>*/}
<span className={ order == "updated_at" ? "active" : ""} onClick={ () => this.changeStatus("updated_at")}>最新</span>
<span className={ order == "myshixuns_count" ? "active" : ""} onClick={ () => this.changeStatus("myshixuns_count")}>最热</span>
{this.props.user&&this.props.user.main_site===false?"":this.props.Headertop===undefined?"":<a className={ "fr font-16 bestChoose color-blue" } onClick={(url)=>this.getUser("/paths/new")}>+新建实践课程</a>}
{this.props.user&&this.props.user.main_site===true?"":this.props.Headertop===undefined?"":
pathstype===true?"":this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.is_teacher===true||this.props.user&&this.props.user.business===true?<a className={ "fr font-16 bestChoose color-blue" } onClick={(url)=>this.getUser("/paths/new")}>+新建实践课程</a>:""
}
{/*<div className="fr mr5 search-new">*/}
{/*/!* <Search*/}
{/*placeholder="请输入路径名称进行搜索"*/}
{/*id="subject_search_input"*/}
{/*value={search}*/}
{/*onInput={this.inputSearchValue}*/}
{/*onSearch={this.searchValue}*/}
{/*autoComplete="off"*/}
{/*></Search> *!/*/}
{/*</div>*/}
}
</style>
<div className="pr">
<div className="pathImg"></div>
<div className="edu-back-white padding20 pathIndexNav">
<ul className="educontent clearfix">
<li className={discipline_id > 0 ? "" : "active"}><a onClick={(e) => this.changeSelect(e, undefined)}>全部</a></li>
{
sortList && sortList.map((item, key) => {
return (
<li className={discipline_id == `${item.id}` ? "active" : ""} onClick={(e) => this.changeSelect(e, `${item.id}`, item.sub_disciplines.length)} key={key}>
<Dropdown disabled={item.sub_disciplines.length === 0} overlay={() => this.getmenu(item.sub_disciplines, item)} placement="bottomCenter">
<a value={item.id}>{item.name}</a>
</Dropdown>
</li>
)
})
}
</ul>
</div>
<PathCard {...this.props} {...this.state}></PathCard>
{
this.state.pathList===null?"":total_count > 16 &&
</div>
<KeywordList btnUrl={btnUrl} onChangeLabel={this.onChangeLabel.bind(this)} OnSearchInput={this.OnSearchInput.bind(this)} onNewHandler={this.getUser.bind(this, '/paths/new')} btnStyle={{ top: '92px' }} />
<PathCard {...this.props} {...this.state}></PathCard>
{
this.state.pathList === null ? "" : total_count > 16 &&
<div className="educontent mb80 edu-txt-center mt10">
<Pagination current={page} total={ total_count || 1299 } type="mini" pageSize={16} onChange={this.onChange} />
<Pagination current={page} total={total_count || 1299} type="mini" pageSize={16} onChange={this.onChange} />
</div>
}
}
</div>
)
</div>
)
}
}
export default ShixunPathSearch;

@ -216,7 +216,8 @@ const App = (props) => {
useEffect(() => {
changeParams({
page: 1
page: 1,
type: "subject_info"
});
pathId && staticList(pathId);
}, []);

@ -236,7 +236,9 @@ class Paperreview extends Component {
.then((result) => {
if (result.data.status === 0) {
// this.props.showNotification(`组卷成功`);
this.props.history.replace('/paperlibrary');
// console.log(result.data.exam_id);
//本来调试卷库首页的
this.props.history.replace('/paperlibrary/see/'+result.data.exam_id);
}
}).catch((error) => {
//console.log(error);
@ -418,7 +420,7 @@ class Paperreview extends Component {
artificialtype==="artificial"?
<Breadcrumb separator=">">
<Breadcrumb.Item >试题库</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshou"} href="/question">人工组卷</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshou"} href="/problemset">人工组卷</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshout"}>试卷预览</Breadcrumb.Item>
</Breadcrumb>
:
@ -429,7 +431,7 @@ class Paperreview extends Component {
</Breadcrumb>
:
<Breadcrumb separator=">">
<Breadcrumb.Item href="/question">试题库</Breadcrumb.Item>
<Breadcrumb.Item href="/problemset">试题库</Breadcrumb.Item>
<Breadcrumb.Item className={"xiaoshou"}>新增试卷</Breadcrumb.Item>
</Breadcrumb>
}
@ -461,7 +463,8 @@ class Paperreview extends Component {
<Bottomsubmit {...this.props} {...this.state} bottomvalue={Cohetepaperbool===false?"保存组卷":"完成"}
setCohetepaperbool={(bool)=>this.setCohetepaperbool(bool)}
onSubmits={() => this.preservation()} url={ artificialtype==="artificial"?'/question':'/paperlibrary'}></Bottomsubmit>
Cohetepaperbool={this.state.Cohetepaperbool}
onSubmits={() => this.preservation()} url={ artificialtype==="artificial"?'/problemset':'/paperlibrary'}></Bottomsubmit>
</div>
)

@ -463,7 +463,7 @@ class Paperreview_item extends Component {
}
jixuxuantioncli = () => {
this.props.history.replace("/question");
this.props.history.replace("/problemset");
}
showparagraphs = (e,name) => {

@ -940,6 +940,15 @@ class Question extends Component {
return (
<div className="newMain clearfix" ref={this.saveContainer}>
<style>{
`
.newHeaders{
position: fixed;
top: 0px;
z-index: 999 !important;
}
`
}</style>
{
mydisplay===true?
<Certifiedprofessional {...this.props} {...this.state} ModalCancelsy={this.mydisplayHidedel} />
@ -966,11 +975,7 @@ class Question extends Component {
<style>
{
`
.newHeaders{
position: fixed;
top: 0px;
z-index: 999 !important;
}
.ant-drawer {
z-index: 800 !important;
}
@ -982,18 +987,17 @@ class Question extends Component {
position: relative;
z-index: 9999999 ;
}
`
}
</style>
:""
}
{
visible===true?
<div
style={{
marginTop: "81px"
}}></div>
:""}
{
modalsTypes===true?
<QuestionModals {...this.props}{...this.state} modalsTypes={modalsTypes} modalCancels={() => this.modalCancels()}

@ -312,7 +312,7 @@ class Questionitem_banks extends Component {
if (result.data.status == 0) {
// this.props.showNotification(`新增单选题成功`);
this.restricte=true;
this.props.history.replace('/question');
this.props.history.replace('/problemset');
}
}).catch((error) => {
@ -324,7 +324,7 @@ class Questionitem_banks extends Component {
if (result.data.status == 0) {
// this.props.showNotification(`编辑单选题成功`);
this.restricte=true;
this.props.history.replace('/question');
this.props.history.replace('/problemset');
}
@ -392,7 +392,7 @@ class Questionitem_banks extends Component {
if (result.data.status == 0) {
// this.props.showNotification(`新增多选题成功`);
this.restricte=true;
this.props.history.replace('/question');
this.props.history.replace('/problemset');
}
@ -406,7 +406,7 @@ class Questionitem_banks extends Component {
if (result.data.status == 0) {
// this.props.showNotification(`编辑多选题成功`);
this.restricte=true;
this.props.history.replace('/question');
this.props.history.replace('/problemset');
}
@ -461,7 +461,7 @@ class Questionitem_banks extends Component {
if (result.data.status == 0) {
// this.props.showNotification(`新增判断题成功`);
this.restricte=true;
this.props.history.replace('/question');
this.props.history.replace('/problemset');
}
}).catch((error) => {
@ -474,7 +474,7 @@ class Questionitem_banks extends Component {
if (result.data.status == 0) {
// this.props.showNotification(`编辑判断题成功`);
this.restricte=true;
this.props.history.replace('/question');
this.props.history.replace('/problemset');
}
}).catch((error) => {
@ -561,7 +561,7 @@ class Questionitem_banks extends Component {
<div className="w1200mss">
<div className="w100s mt30">
<Breadcrumb separator=">">
<Breadcrumb.Item href="/question">试题库</Breadcrumb.Item>
<Breadcrumb.Item href="/problemset">试题库</Breadcrumb.Item>
<Breadcrumb.Item>{JSON.stringify(params) === "{}" ? "新增" : "编辑"}试题</Breadcrumb.Item>
</Breadcrumb>
</div>
@ -627,7 +627,7 @@ class Questionitem_banks extends Component {
""
:
<Bottomsubmit {...this.props} {...this.state} bottomvalue={item_type === "PROGRAM" ? "创建" : "保存"}
onSubmits={() => this.preservation()} url={'/question'}></Bottomsubmit>
onSubmits={() => this.preservation()} url={'/problemset'}></Bottomsubmit>
}
</div>
)

@ -229,22 +229,9 @@ class ChoquesEditor extends Component{
var texts;
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try {
texts=JSON.stringify(value);
}catch (e) {
texts="";
}
} else {
if(_text.length>=500){
var result = _text.substring(0,450);
@ -298,66 +285,46 @@ class ChoquesEditor extends Component{
// debugger
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
this.setState({
question_titleysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try {
this.setState({
question_titleysl: JSON.stringify(value)
})
}catch (e) {
this.setState({
question_titleysl:""
})
}
} else {
// 提交到后台的内容需要处理一下;
let texts="";
texts = JSON.stringify(value);
this.setState({
question_titleysl:texts
})
try {
let texts = JSON.stringify(value);
this.setState({
question_titleysl:texts
})
}catch (e) {
this.setState({
question_titleysl:""
})
}
}
}
onContentChanges=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
this.setState({
question_titlesysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try {
this.setState({
question_titlesysl: JSON.stringify(value)
})
}catch (e) {
this.setState({
question_titlesysl:""
})
}
} else {
// 提交到后台的内容需要处理一下;
let texts="";
try {
let texts = JSON.stringify(value);
this.setState({
question_titlesysl:texts
})
}catch (e) {
this.setState({
question_titlesysl:""
})
}
texts = JSON.stringify(value);
this.setState({
question_titlesysl:texts
})
}
}

@ -201,7 +201,7 @@ class Contentpart extends Component {
}
this.props.history.push("/question/newitem?pages="+this.props.pages+urls);
this.props.history.push("/problemset/newitem?pages="+this.props.pages+urls);
}
render() {
@ -348,11 +348,12 @@ class Contentpart extends Component {
.xaxisreverseorder .ant-input-group-addon{
width: 48px !important;
}
.xaxisreverseorder .ant-input-lg {
height: 41px !important;}
.xaxisreverseorder .ant-input-wrapper .ant-input-group-addon button .ant-input-lg {
height: 39px !important;
}
.xaxisreverseorder .ant-popover{
top: 30px !important;
@ -362,7 +363,7 @@ class Contentpart extends Component {
.xaxisreverseorder .ant-popover-inner-content {
padding:0px !important;
}
`
}
</style>

@ -305,7 +305,7 @@ class Headplugselections extends Component {
}
<div className="fl pr shaiAllItem mt1">
<li className={this.state.tixing===null?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.settixingtixing(null)}>全部</li>
<li className={this.state.tixing==="PROGRAM"?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.settixingtixing("PROGRAM")}>编程题</li>
{/*<li className={this.state.tixing==="PROGRAM"?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.settixingtixing("PROGRAM")}>编程题</li>*/}
<li className={this.state.tixing==="SINGLE"?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.settixingtixing("SINGLE")}>单选题</li>
<li className={this.state.tixing==="MULTIPLE"?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.settixingtixing("MULTIPLE")}>多选题</li>
<li className={this.state.tixing==="JUDGMENT"?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.settixingtixing("JUDGMENT")}>判断题</li>

@ -805,7 +805,7 @@ class Itembankstop extends Component {
)(
<Select style={{width: '270px'}} disabled={this.state.boolnews} onChange={this.handleFormtixing}
placeholder="请选择...">
<Option value="PROGRAM">编程题</Option>
{/*<Option value="PROGRAM">编程题</Option>*/}
<Option value="SINGLE">单选题</Option>
<Option value="MULTIPLE">多选题</Option>
<Option value="JUDGMENT">判断题</Option>

@ -303,72 +303,50 @@ class JudquestionEditor extends Component{
// console.log(quill);
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
// console.log(_text);
// console.log(_text.length);
if(this.isNull(_text)===true){
this.setState({
question_titleysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try {
this.setState({
question_titleysl:JSON.stringify(value)
question_titleysl:""
})
// console.log("空");
} else {
// 提交到后台的内容需要处理一下;
try {
let texts = JSON.stringify(value);
this.setState({
question_titleysl:texts
})
}catch (e) {
this.setState({
question_titleysl:""
})
}
// console.log("空");
} else {
// console.log("有");
// 提交到后台的内容需要处理一下;
let texts="";
texts = JSON.stringify(value);
this.setState({
question_titleysl:texts
})
}
}
onContentChanges=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
this.setState({
question_titlesysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try {
this.setState({
question_titlesysl:JSON.stringify(value)
})
}catch (e) {
this.setState({
question_titlesysl:""
})
}
} else {
// 提交到后台的内容需要处理一下;
let texts="";
try {
texts = JSON.stringify(value);
this.setState({
question_titlesysl:texts
})
let texts = JSON.stringify(value);
this.setState({
question_titlesysl:texts
})
}catch (e) {
this.setState({
question_titlesysl:""
})
}
}
}
render() {

@ -25,6 +25,28 @@ const tagArrays = [
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
]
const questionType = [
{
type:'SINGLE',
color:'typeGreen',
name:'单选题'
},
{
type:'MULTIPLE',
color:'typeBlue',
name:'多选题'
},
{
type:'JUDGMENT',
color:'typeRed',
name:'判断题'
},
{
type:'PROGRAM',
color:'typeYellow',
name:'编程题'
}
]
//Paperreview_single.js Paperlibraryseeid_items.js
class Listjihe extends Component {
constructor(props) {
@ -233,10 +255,10 @@ class Listjihe extends Component {
}catch (e) {
}
const types = questionType.filter(item=>item.type === items.item_type);
return (
<div key={keindex}
className={chakanjiexiboolindex === keindex ? "w100s borderwds283 pd20 mb20 listjihecolors" : " borderwds pd20 mb20 listjihecolors"}>
className={chakanjiexiboolindex === keindex ? "w100s borderwds283 pd20 mb20 listjihecolors" : "borderwds pd20 mb20 listjihecolors"}>
{/*顶部*/}
{
mydisplay===true?
@ -301,6 +323,7 @@ class Listjihe extends Component {
}
</style>
<div className="w100s sortinxdirection">
<span className={`typesBtn ${types && types[0].color}`}>{types && types[0].name}</span>
<div className="listjihetixingstitsy" style={{
fontWeight:"bold"
}} >
@ -310,11 +333,11 @@ class Listjihe extends Component {
</div>
{
items.item_type==="PROGRAM"?
<a onClick={()=>this.seturls(`/problems/${items.program_attr.identifier}/edit`)} >
<div className="ml10 w100s " style={{wordBreak: "break-word",fontWeight:"bold"}} dangerouslySetInnerHTML={{__html: markdownToHTML(items&&items.name).replace(/▁/g, "▁▁▁")}}></div>
<a onClick={()=>this.seturls(`/problems/${items.program_attr.identifier}/edit`)} className="ml10 flex1 mt2">
<div style={{wordBreak: "break-word",fontWeight:"bold"}} dangerouslySetInnerHTML={{__html: markdownToHTML(items&&items.name).replace(/▁/g, "▁▁▁")}}></div>
</a>
:
<div className="ml10 w100s markdown-body" style={{wordBreak: "break-word",fontWeight:"bold"}}>
<div className="ml10 flex1 markdown-body mt2" style={{wordBreak: "break-word",fontWeight:"bold"}}>
{ items===undefined||items===null||items===""?"":
items.name === undefined || items.name === null || items.name === "" ?
@ -485,7 +508,7 @@ class Listjihe extends Component {
this.props.Isitapopup&&this.props.Isitapopup==="true"?
""
:
<a onClick={()=>this.seturls(`/problems/${items.program_attr.identifier}/edit?editoj=1&pages=`+this.props.pages)}>
<a onClick={()=>this.seturls(`/problems/${items.program_attr.identifier}/edit`)}>
<p className="viewparsings xiaoshou mr25">
<i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>编辑</span>
@ -495,7 +518,7 @@ class Listjihe extends Component {
this.props.Isitapopup&&this.props.Isitapopup==="true"?
""
:
<a onClick={()=>this.seturls(`/question/edit/${items.id}`)}>
<a onClick={()=>this.seturls(`/problemset/edit/${items.id}`)}>
<p className="viewparsings xiaoshou mr25">
<i className="iconfont icon-bianji2 font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
<span>编辑</span>

@ -117,7 +117,7 @@ class SiderBars extends Component {
{this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?<div>
{
mypath&&mypath==="/question"&&swsilan===true?
mypath&&mypath==="/problemset"&&swsilan===true?
<Tooltip placement="left" title={"试题库"}>
<div className="feedback feedbackdivcolor xiaoshou shitikus" onClick={()=>this.props.showDrawer()} >

@ -140,7 +140,13 @@ class SingleEditor extends Component{
// this.refs['titleEditor'].showError()
this.props.showNotification('请您输入题干');
return editordata;
}else{
console.log("question_titleysl");
console.log(question_titleysl);
}
for(let i = 0; i < question_choices.length; i++) {
if (!question_choices[i]) {
// this.refs[`optionEditor${i}`].showError()
@ -244,6 +250,7 @@ class SingleEditor extends Component{
this.setState({ standard_answers })
}
onOptionContentChange = (value,quill,index) => {
debugger
if (index >= this.state.question_choices.length) {
// TODO 新建然后删除CD选项再输入题干会调用到这里且index是3
return;
@ -251,18 +258,9 @@ class SingleEditor extends Component{
var texts;
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try {
texts= JSON.stringify(value)
}catch (e) {
texts="";
}
} else {
if(_text.length>=500){
var result = _text.substring(0,450);
@ -315,61 +313,47 @@ class SingleEditor extends Component{
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
this.setState({
question_titleysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
try {
this.setState({
question_titleysl: JSON.stringify(value)
})
}catch (e) {
this.setState({
question_titleysl:""
})
}
} else {
try {
let texts = JSON.stringify(value);
this.setState({
question_titleysl:texts
})
this.setState({
question_titleysl:texts===undefined|| null?"":texts
})
}catch (e) {
this.setState({
question_titleysl:""
})
}
}
}
onContentChanges=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if(this.isNull(_text)===true){
this.setState({
question_titlesysl:""
})
return
}
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
question_titlesysl:""
})
} else {
try {
let texts = JSON.stringify(value);
this.setState({
question_titlesysl:JSON.stringify(value)
question_titlesysl:texts===undefined|| null?"":texts
})
}catch (e) {
this.setState({
question_titlesysl:""
})
}
} else {
let texts = JSON.stringify(value);
this.setState({
question_titlesysl:texts
})
}
}
handleShowImage = (url) => {

@ -329,7 +329,7 @@
.listjihetixingstitsy {
color: #333333;
font-size: 14px;
line-height: 20px !important;
line-height: 25px !important;
height: 25px !important;
}
@ -419,10 +419,10 @@
color: #4CACFF;
}
.xiaoshou{
cursor:pointer;
cursor:pointer !important;
}
.xiaoshout{
cursor:default;
cursor:default !important;
}
.mt40{
margin-top: 40px;
@ -1118,3 +1118,27 @@
.text-indents50{
text-indent: 50px
}
.typesBtn{
padding:0px 10px;
height:24px;
line-height:24px;
border-radius:2px;
margin-right:10px;
font-size: 13px;
}
.typeGreen{
color:#15DB7A;
border:1px solid #15DB7A;
}
.typeBlue{
color:#0CB9F1;
border:1px solid #0CB9F1;
}
.typeRed{
color:#FF5555;
border:1px solid #FF5555;
}
.typeYellow{
color:#FFB538;
border:1px solid #FFB538;
}

@ -73,7 +73,7 @@ class Contentpart extends Component {
}
//跳转人工组卷
Mantegeneration=()=>{
this.props.history.push('/question');
this.props.history.push('/problemset');
}
@ -368,18 +368,24 @@ class Contentpart extends Component {
<div className="xaxisreverseorder" style={{
width:"50%"
}}>
<a onClick={()=>this.xinzenw('/Integeneration')}>
<a onClick={()=>this.xinzenw('/problemset')}>
<div className="newbutoonss">
<p className="newbutoontess" >智能组卷</p>
</div>
</a>
<a onClick={()=>this.xinzenw('/question')}>
<div className="newbutoons mr39">
<p className="newbutoontess" >人工组卷</p>
</div>
</a>
{/*<a onClick={()=>this.xinzenw('/Integeneration')}>*/}
{/* <div className="newbutoonss">*/}
{/* <p className="newbutoontess" >智能组卷</p>*/}
{/* </div>*/}
{/*</a>*/}
{/*<a onClick={()=>this.xinzenw('/problemset')}>*/}
{/* <div className="newbutoons mr39">*/}
{/* <p className="newbutoontess" >人工组卷</p>*/}
{/* </div>*/}
{/*</a>*/}
</div>
:""
}

@ -286,7 +286,7 @@ class Paperreview_item extends Component {
}
jixuxuantioncli = () => {
this.props.history.replace("/question");
this.props.history.replace("/problemset");
}
showparagraphs = (e,name) => {

@ -361,7 +361,7 @@ class Paperlibraryseeid_itemss extends Component {
}
jixuxuantioncli = () => {
this.props.history.replace("/question");
this.props.history.replace("/problemset");
}
showparagraphs = (e,name) => {

@ -26,7 +26,7 @@ class Seeoagertit extends Component {
onChange=(e)=> {
}
jixuxuantioncli = () => {
this.props.history.replace("/question");
this.props.history.replace("/problemset");
}
render() {

@ -400,13 +400,13 @@
color: #4CACFF;
}
.xiaoshou{
cursor:pointer;
cursor:pointer !important;
}
.xiaoshout{
cursor:default;
cursor:default !important;
}
.shubiao{
cursor:default;
cursor:default !important;
}
.mt40{
margin-top: 40px;

@ -1267,7 +1267,9 @@ submittojoinclass=(value)=>{
{/* p 老师 l 学生 */}
{shixuntype===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/shixuns`}>我的实训项目</Link></li>}
{pathstype===true?"":<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/paths`}>{this.props.user&&this.props.user.main_site===false?"我的课程":"我的实践课程"}</Link></li>}
{this.props.user&&this.props.user.main_site===true?<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/projects`}>我的开发项目</Link></li>:""}
{this.props.user&&this.props.user.main_site===true?<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/projects`}>我的开发项目</Link></li>:""}
{ Periofters === true &&<li><Link to ={`/problemset`}>我的试题库</Link></li> }
{ Periofters === true &&<li><Link to ={`/paperlibrary`}>我的试卷库</Link></li> }
{/*<li><Link to={`/users/${this.props.current_user===undefined?"":this.props.current_user.login}/package`}>我的众包</Link></li>*/}
<li style={{display: this.props.Headertop === undefined ? 'none' : this.props.Headertop.customer_management_url===null || this.props.Headertop.customer_management_url===""? 'none' : 'block'}}>
<a href={this.props.Headertop === undefined ? '' : this.props.Headertop.customer_management_url}>客户管理</a>

@ -769,7 +769,7 @@ export function TPMIndexHOC(WrappedComponent) {
{...this.dialogObj}
/>:""}
{
mypath&&mypath==="/question"?
mypath&&mypath==="/problemset"?
""
:
<SiderBar

@ -1,244 +0,0 @@
import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Rating ,Pagination} from "@icedesign/base";
import {getImageUrl,setImagesUrl, toPath,getUrl} from 'educoder';
import { Spin,Icon,Tooltip ,Rate} from 'antd';
import LoadingSpin from '../../../common/LoadingSpin';
import './shixunCss/shixunCard.css';
// 引入业务组件样式
import axios from 'axios';
const $ = window.$;
class ShixunCard extends Component {
constructor(props) {
super(props)
this.state = {
startValue:[],
order_by:"",
page:1,
limit:16,
keyword:"",
status:0,
diff:0,
hideme:false,
tag_level:3,
tag_id:''
}
}
PaginationonChange=(pageNumber)=> {
this.props.shixunsPage(pageNumber);
}
render() {
let {middleshixundata, pagination, typepvisible, pages, totalcount} = this.props;
const MyRate = ({ defaultValue, ...rest }) => {
let myValue = defaultValue;
// console.log(myValue-Math.floor(myValue))
// if (myValue < Math.ceil(myValue)) {
// myValue = Math.floor(myValue) + 0.5;
// }
return <Rating {...rest} value={myValue} />;
};
return (
<div className="educontent mb80">
<Spin spinning={typepvisible} tip="正在获取相关数据..." size="large" style={{marginTop:'15%'}}>
{ middleshixundata === undefined?"":middleshixundata.length === 0 ?<div className="edu-tab-con-box clearfix edu-txt-center">
<style>
{`
.edu-tab-con-box{
padding:100px 0px;
}
.ant-modal-body .edu-tab-con-box{
padding:0px!important;
}
img.edu-nodata-img{
margin: 40px auto 20px;
}
`}
</style>
<img className="edu-nodata-img mb20" src={getUrl("/images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">暂时还没有相关数据哦</p>
</div>:""}
<div className="mb20 clearfix"
// style={{display: middleshixundata === undefined || middleshixundata.length === 0 ? "none" : "block"}}
>
<style>
{
`
.square-list{
margin-top:5px;
}
`
}
</style>
<div className="shixun_list_content">
<div className="square-list clearfix">
{middleshixundata === undefined || middleshixundata.length === 0?" ":middleshixundata.map((item,key)=>{
return(
<div className="square-Item" key={key} id={item.id}>
<style>
{
`
.tag-green {
position: absolute;
left: 10px;
bottom: 125px;
}
.tag-org{
position: absolute;
left: 0px;
top: 20px;
}
.tag-org-name{
width:66px;
height:28px;
background:#FF6802;
width:66px;
height:28px;
border-radius:0px 20px 20px 0px;
}
.tag-org-name-test{
width:45px;
height:23px;
font-size:14px;
color:#FFFFFF;
line-height:19px;
margin-right: 6px;
}
.intermediatecenter{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
`
}
</style>
{
item.tag_name === null ? "":
<div className="tag-green">
<span className="tag-name"> {item.tag_name}</span>
{/*<img style={{display:'block',height: '28px'}} src={require(`./shixunCss/tag2.png`)}/>*/}
</div>
}
{
item.is_jupyter===true?
<div className="tag-org">
<p className="tag-org-name intermediatecenter"> <span className="tag-org-name-test">Jupyter</span></p>
{/*<img style={{display:'block',height: '28px'}} 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={getImageUrl("images/"+item.pic+"?1540534846")}/>*/}
<img src={setImagesUrl(`${item.pic}`)}/>
</a>
{/*target="_blank"*/}
<div className="square-main">
<p className="task-hide">
<a href={"/shixuns/"+item.identifier+"/challenges"} className="justify color-grey-name" title={item.name} target="_blank">
{item.name}
</a>
</p>
{/*target="_blank"*/}
{/*<style>*/}
{/*{*/}
{/*`*/}
{/*.anticon-star{*/}
{/*font-size:16px;*/}
{/*}*/}
{/*.pathInfo{*/}
{/*margin-right:-5px;*/}
{/*}*/}
{/*.ant-rate{*/}
{/*color: #FFA800;*/}
{/*}*/}
{/*`*/}
{/*}*/}
{/*</style>*/}
<p className="clearfix mt8 ml-3">
<span className="rateYoStar fl" style={{padding: '0px',height: '20px',lineHeight: '19px',cursor: 'default'}} title="">
{/*<Rate allowHalf value={item.score_info===null?5:item.score_info} disabled key={key} />*/}
<MyRate key={key} allowHalf defaultValue={item.score_info===null?5:item.score_info} disabled/>
</span>
<span className="fl ml25 font-12 color-grey-9 lineh-12 mt5">{item.score_info===null?"5分":item.score_info+"分"}</span>
</p>
<p className="clearfix mt8 font-12 color-grey-B4">
{item.is_jupyter===false?<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 className="both"></div>
{/*totalcount*/}
<div className={"ml425"}
//className={totalcount < 22 ? "ml425" : "ml425"}
style={{display: pagination ? "block" : "none"}}>
{/*<Pagination showQuickJumper defaultCurrent={1} current={pages} total={totalcount} pageSize={12} onChange={this.PaginationonChange} />*/}
{/* 不加参数请求的时候,没返回总数了。加了个比较大的数字,让他可以翻页 */}
<Pagination defaultCurrent={1} current={pages} total={ totalcount || 1299 } type="mini" pageSize={16} onChange={this.PaginationonChange} />
</div>
</div>
</div>
</Spin>
</div>
)
}
}
export default ShixunCard;

@ -1,316 +0,0 @@
import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { BrowserRouter as Router, Route} from "react-router-dom";
import { Switch ,Input,Tooltip,Icon} from 'antd';
import PropTypes from 'prop-types';
import classNames from 'classnames'
import 'antd/lib/switch/style/index.css'
import './shixunCss/ShixunCardList.css';
import GotoQQgroup from '../../../modal/GotoQQgroup'
import { on, off } from 'educoder'
const $ = window.$;
const Search = Input.Search;
class ShixunCardList extends Component {
constructor(props) {
super(props);
this.state={
allevent:"desc",
mine:0,
InputValue: props.keyword || "",
typemy:0,
hots:0,
news:0,
shixunid:"",
upcircle:false,
typekeyid:undefined,
goshowqqgtounp:false,
}
}
componentDidUpdate = (prevProps, prevState) => {
if (this.props.keyword != prevProps.keyword) {
this.setState({
InputValue: this.props.keyword
})
}
}
componentDidMount = () => {
on('searchKeywordChange', (event, data) => {
// console.log(data)
this.Input_search(data)
})
}
componentWillUnmount = () => {
off('searchKeywordChange')
}
latestHot=(e,key)=>{
let{upcircle,typekeyid}=this.state;
let id = e.target.id;
$("#"+id).siblings().removeClass("active");
$("#"+id).addClass("active");
let type;
// if(id==="all"){
// type="publish_time";
// }
if(id==="hot"){
type="hot";
}else if(id==="new"){
type="new";
}
if(typekeyid===key){
if(upcircle===true){
this.setState({
upcircle:false,
})
// this.props.Shixunsupcircles("desc")
}else if(upcircle===false){
this.setState({
upcircle:true,
})
// this.props.Shixunsupcircles("desc")
}
}else{
this.setState({
typekeyid:key
})
}
this.props.ShixunsState(false,type,"desc");
}
onSwitchChange=(e,key)=>{
let id=e.target.id
$("#"+id).siblings().removeClass("active");
$("#"+id).addClass("active");
let {typemy,upcircle,typekeyid}=this.state;
if(typekeyid===key){
if(upcircle===true){
this.setState({
upcircle:false,
})
this.props.Shixunsupcircles("desc")
}else if(upcircle===false){
this.setState({
upcircle:true
})
this.props.Shixunsupcircles("asc")
}
}else{
this.setState({
typekeyid:key
})
}
if(typemy===0){
this.setState({
typemy:1
})
}else{
this.setState({
typemy:0
})
}
// allevent
this.props.ShixunsSwitch();
}
//输入框搜索
Input_search = (value) => {
this.setState({
InputValue: value
})
this.props.OnSearchInput(value,true);
}
Input_searchs = (e) => {
this.setState({
InputValue: e.target.value
})
this.props.OnSearchInput(e.target.value,false);
}
upcircles=(val)=>{
if(val==="asc"){
this.setState({
upcircle:false,
})
this.props.Shixunsupcircles("desc")
}else if(val==="desc"){
this.setState({
upcircle:true
})
this.props.Shixunsupcircles("asc")
}
}
//头部获取是否已经登录了
getUser=(url,type)=>{
if(this.props.checkIfLogin()===false){
this.props.showLoginDialog()
return
}
if(this.props.checkIfProfileCompleted()===false){
this.props.showProfileCompleteDialog()
return
}
if(this.props&&this.props.current_user&&this.props.current_user.is_shixun_marker===false){
this.setgoshowqqgtounp(true);
return;
}
if(url !== undefined || url!==""){
window.location.href = url;
}
}
// 处理弹框
setgoshowqqgtounp=(bool)=>{
this.setState({
goshowqqgtounp:bool
})
}
render(){
let {mine,InputValue,upcircle,goshowqqgtounp}=this.state;
// console.log("NewHeadermygetHelmetapi123123123123");
let shixuntype=false;
if(this.props&&this.props.mygetHelmetapi!=null){
let shixun="/shixuns";
let paths="/paths";
let courses="/courses";
this.props.mygetHelmetapi.navbar.map((item,key)=>{
var reg = RegExp(item.link);
if(shixun.match(reg)){
if(item.hidden===true){
shixuntype=true
}
}
})
}
return (
<div className="educontent mt20">
<div className="clearfix">
{
goshowqqgtounp===true?
<GotoQQgroup {...this.state} {...this.props} setgoshowqqgtounp={(bool)=>this.setgoshowqqgtounp(bool)}></GotoQQgroup>
:
""
}
{/*<div className="fl mr20 font-16 bestChoose shixun_repertoire active"*/}
{/*id={"all"}*/}
{/*onClick={(e)=>this.latestHot(e,1)}>全部*/}
{/*</div>*/}
{/*<div className="fl mr20 font-16 bestChoose shixun_repertoire"*/}
{/*id={mine}*/}
{/*onClick={(e)=>this.onSwitchChange(e,2)}>我的*/}
{/*</div>*/}
<div className="fl mr20 font-16 bestChoose shixun_repertoire active"
id="new"
onClick={(e)=>this.latestHot(e,4)}>最新
</div>
<div className="fl font-16 bestChoose shixun_repertoire"
id="hot"
onClick={(e)=>this.latestHot(e,3)}>最热
</div>
{shixuntype===true?"":<span className={ "fr font-16 bestChoose color-blue" } onClick={(url)=>this.getUser("/shixuns/new")}>+新建实训项目</span>}
<div className="fr mr20 mt3">
{
this.props.middleshixundata&&this.props.middleshixundata.search_tags
}
</div>
{/*<div className="fl font-16 bestChoose shixun_repertoire ml20 mt1"*/}
{/*style={{display:upcircle===true?"block":"none"}}*/}
{/*// onClick={()=>this.upcircles("asc")}*/}
{/*>*/}
{/*<Tooltip placement="bottom" title={"升序"}>*/}
{/*<Icon type="up-circle" theme="twoTone" />*/}
{/*/!*<Icon type="sort-descending" />*!/*/}
{/*</Tooltip>*/}
{/*</div>*/}
{/*<div className="fl font-16 bestChoose shixun_repertoire ml20 mt1"*/}
{/*// onClick={()=>this.upcircles("desc")}*/}
{/*style={{display:upcircle===true?"none":"block"}}*/}
{/*>*/}
{/*<Tooltip placement="bottom" title={"降序"}>*/}
{/*<Icon type="down-circle" theme="twoTone" />*/}
{/*/!*<Icon type="sort-ascending" />*!/*/}
{/*</Tooltip>*/}
{/*</div>*/}
{/*<div className="fr mt3">*/}
{/*<Search*/}
{/*style={{ width: 300 }}*/}
{/*className="search-new-input fl"*/}
{/*placeholder="请输入创建者/实训/关卡名称进行搜索"*/}
{/*value={InputValue}*/}
{/*onInput={this.Input_searchs}*/}
{/*onSearch={value => this.Input_search(value)}*/}
{/*enterButton*/}
{/*/>*/}
{/* <Search
style={{ width: 300 }}
className="fl"
placeholder="请输入创建者/实训/关卡名称进行搜索"
value={InputValue}
onInput={this.Input_searchs}
onSearch={value => this.Input_search(value)}
autoComplete="off"
></Search> */}
{/*</div>*/}
{/*<div className="fr">*/}
{/*<span className="fl color-grey-6 mr30 font-16 mt5" id="search_name">{*/}
{/*this.props.search_tags === null ? "" : this.props.search_tags*/}
{/*}</span>*/}
{/*<div className="fl mr5" style={{marginTop:'1px'}}>*/}
{/*/!* <div className="controlblue"></div>*/}
{/*<span className="controlring"></span> *!/*/}
{/*<Switch*/}
{/*className="controlbtn mr10 mt10 pr"*/}
{/*size="small"*/}
{/*style={{marginTop:'1px'}}*/}
{/*onChange={this.onSwitchChange}*/}
{/*/>*/}
{/*</div>*/}
{/*<span className="fl font-16 cdefault" data-tip-down="隐藏我学习的实训">隐藏我的</span>*/}
{/*</div>*/}
{/*<span className="fr color-grey-6 mr30 font-16" id="search_name"></span>*/}
</div>
</div>
);
}
}
export default ShixunCardList;

@ -1,301 +0,0 @@
import React, { Component } from 'react';
import { Select, Input,Menu, Dropdown } from 'antd';
import 'antd/lib/style/index.css';
import 'antd/lib/select/style/index.css';
import 'antd/lib/input/style/index.css';
import './shixunCss/ShixunSearchBar.css';
import axios from 'axios';
const $ = window.$;
const Option = Select.Option;
const Search = Input.Search;
class ShixunSearchBar extends Component {
constructor(props) {
super(props)
this.state = {
status: undefined,
diff: 0,
InputValue: undefined,
shixunhoverData: [],
shixunchildValues:'',
shixunsearchAllvalue:"a",
openStatus:false,
openLevel:false
}
}
//状态筛选
status_search = (value) => {
let newvalue = value;
if (newvalue === "0") {
newvalue = " "
} else if (newvalue === "1") {
newvalue = 2
} else if (newvalue === "2") {
newvalue = 1
} else if (newvalue === "3") {
newvalue = 3
}
this.setState({
status: newvalue,
openStatus:false
})
let list = [{'type': 1}, {'value': newvalue}];
this.props.StatusEnquiry(list);
}
//难度筛选
diff_search = (value) => {
this.setState({
diff: value,
openLevel:false
})
let list=[{'type':2},{'value':value}];
this.props.StatusEnquiry(list);
}
//输入框搜索
Input_search = (value) => {
this.setState({
InputValue: value
})
this.props.OnSearchInput(value);
}
//查询
shixunsearchAll = (e) => {
let{shixunsearchAllvalue}=this.state;
let id = e.target.value;
if(shixunsearchAllvalue===id){
return
}
if(id===0){
id=" "
this.setState({
InputValue: " "
})
this.props.OnSearchInput("");
}
let list=[{'tag_level':1},{'tag_id':id}];
if(id!=undefined){
this.setState({
shixunsearchAllvalue:id,
shixunchildValues:""
})
this.props.Updatasearchlist(list);
}
}
shixunsearchall=(e)=>{
let{shixunsearchAllvalue}=this.state;
let id = "a";
if(shixunsearchAllvalue===id){
return
}
this.setState({
shixunsearchAllvalue:"a",
shixunchildValues:""
})
this.props.allUpdatashixunlist();
}
//选择Tab页详情
getshixunchildValue = (e) => {
let id = e.target.name;
let newid=e.target.id;
let list=[{'tag_level':2},{'tag_id':id}];
if(id!=undefined||newid!=undefined){
this.setState({
shixunsearchAllvalue:newid
})
this.props.Updatasearchlist(list);
}
}
getshixunchildValues = (e) => {
let id = e.target.id;
let newid=e.target.name;
let list=[{'tag_level':3},{'tag_id':id}];
if(id!=undefined||newid!=undefined){
this.setState({
shixunchildValues:id,
shixunsearchAllvalue:newid
})
this.props.Updatasearchlist(list);
}
}
componentDidMount() {
let hoverUrlArr = [];
let hoverUrl = `/shixuns/menus.json`;
axios.get(hoverUrl
).then((response) => {
hoverUrlArr = response.data;
// hoverUrlArr.reverse();
this.setState({
shixunhoverData: hoverUrlArr
})
}).catch((error) => {
console.log(error)
})
}
render() {
let {shixunhoverData, shixunchildValues, shixunsearchAllvalue, InputValue,openStatus,openLevel} = this.state;
let {typepvisible} = this.props;
// //实训首页筛选的移入和点击事件
// $(".shaiItem").hover(function(){
// var hei=parseInt($(".shaiAllItem").height())-2;
// $(this).find(".subshaicontent").css("top", '34px');
// $(this).find(".subshaicontent").show();
// },function(){
// $(this).find(".subshaicontent").hide();
// });
//
// $(".shaiItem").live("click",function(){
// $(".shaiItem").removeClass("active");
// $(this).addClass("active");
// $(".subshaicontent").hide();
// });
//
// $(".subshaicontent").live("click", function(event){
// $(".subshaicontent").hide();
// event.stopPropagation();
// });
let overlaymenu=(item,id)=>(
<Menu>
{
item.map((list,k)=>{
return(
<Menu.Item>
<div className="mt5 subshaicontent-part" key={k}>
<a style={{ height: '20px' }} className={ "mb15 shixun_repertoire color-dark"} name={list.id} id={id} onClick={this.getshixunchildValue}>{list.name}</a>
<div className="sub-Item clearfix">
{
list.tags.map((tag,e)=>{
return(
<a className={parseInt(shixunchildValues)===tag.id?"shixun_repertoire active":"shixun_repertoire"} key={e} id={tag.id} name={id} rel="subshaicontent" onClick={this.getshixunchildValues}>{tag.name}</a>
)
})
}
</div>
</div>
</Menu.Item>
)
})
}
</Menu>
)
return (
<div className="edu-back-white" >
<div className="educontent">
<div className="pt_b_26">
<div className="clearfix mb20 shaiContent">
<span className="shaiTitle fl">方向</span>
<div className="fl pr shaiAllItem">
<li className={shixunsearchAllvalue==="a"?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} value= "a" onClick={this.shixunsearchall}>全部</li>
<style>
{
`
.ant-dropdown{
width: 800px;
}
.shixun_repertoire{
cursor: pointer;
float: left;
margin-right: 20px;
color: #999;
cursor: pointer;
margin-bottom:10px;
}
.ant-dropdown-menu-item, .ant-dropdown-menu-submenu-title{
padding: 0px 12px;
}
.ant-dropdown-menu-item:hover, .ant-dropdown-menu-submenu-title:hover{
background:transparent !important;
}
`
}
</style>
{
shixunhoverData.map((item,key)=>{
return(
<Dropdown overlay={overlaymenu(item.sub_repertoires,item.id)} key={key} placement={item.id<4?"bottomRight":item.id>=8?"bottomLeft":"bottomCenter"}>
<li key={key} className={parseInt(shixunsearchAllvalue)===item.id?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} value={item.id} onClick={this.shixunsearchAll}>
{item.name}
</li>
</Dropdown>
)
})
}
</div>
</div>
<div className="clearfix">
<span className="shaiTitle fl">筛选</span>
{
<style>
{`
.shaiContent li.shaiItem{
padding:0px 15px;
line-height:32px;
height:32px
}
.shaiTitle{
height:32px;
line-height:32px;
}
.shaiItems{
padding:0px 15px;
line-height:32px;
height:32px;
float: left;
border-radius: 4px;
color: #4C4C4C;
cursor: pointer;
margin-right: 15px;
display: block;
float:left;
}
.shaiItems.active {
background-color: #4CACFF!important;
color: #fff!important;
}
`}
</style>
}
<div className="fl pr shaiAllItem mt1">
<li className={this.state.diff===0?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(0)}>全部难度</li>
<li className={this.state.diff===1?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(1)}>初级</li>
<li className={this.state.diff===2?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(2)}>中级</li>
<li className={this.state.diff===3?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(3)}>中高级</li>
<li className={this.state.diff===4?"shaiItems shixun_repertoire active":"shaiItems shixun_repertoire"} onClick={()=>this.diff_search(4)}>高级</li>
</div>
</div>
</div>
</div>
</div>
);
}
}
export default ShixunSearchBar;

@ -1,115 +1,101 @@
import React, { Component } from 'react';
import { Redirect } from 'react-router';
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,getImageUrl} from 'educoder';
import ShixunCardList from './ShixunCardList';
import ShixunSearchBar from './ShixunSearchBar';
import ShixunCard from './ShixunCard';
import { SnackbarHOC, getImageUrl } from 'educoder';
import ShixunCardList from './shixun-keyword-list';
import ShixunSearchBar from './shixun-search-bar';
import ShixunCard from './shixun-card';
import UpgradeModals from '../../modals/UpgradeModals';
import GotoQQgroup from '../../../modal/GotoQQgroup'
const queryString = require('query-string');
const $ = window.$;
import btnUrl from './btn-new.png'
class ShixunsIndex extends Component {
constructor(props) {
super(props)
this.state={
this.state = {
order_by: "new",
page:1,
limit:16,
keyword:"",
status:0,
diff:0,
showQQ: false,
page: 1,
limit: 16,
keyword: "",
status: 0,
diff: 0,
tag_level: 1,
tag_id:'',
middleshixundata:[],
typepvisible:true,
pages:1,
search_tags:null,
parsedid:undefined,
newtag_level:undefined,
newpalce:undefined,
sort:"desc"
tag_id: '',
middleshixundata: [],
typepvisible: true,
pages: 1,
search_tags: null,
parsedid: undefined,
newtag_level: undefined,
newpalce: undefined,
sort: "desc"
}
}
componentDidMount(){
componentDidMount() {
const upsystem=`/users/system_update.json`;
axios.get(upsystem).then((response)=>{
let updata=response.data;
this.setState({
updata:updata
})
}).catch((error)=>{
console.log(error);
})
const upsystem = `/users/system_update.json`;
axios.get(upsystem).then((response) => {
let updata = response.data;
this.setState({
updata: updata
})
}).catch((error) => {
console.log(error);
})
let _keyword;
let _keyword;
if (window.__headSearchKeyword) {
this.setState({ keyword: window.__headSearchKeyword })
_keyword = window.__headSearchKeyword
delete window.__headSearchKeyword
}
const parsed = queryString.parse(this.props.location.search);
if(parsed.id===undefined&&parsed.type===undefined){
let {order_by, tag_level, tag_id, page, limit, keyword, status, diff} = this.state;
let params={
order_by:order_by,
tag_level:tag_level,
tag_id:tag_id,
page:page,
limit:limit,
keyword: _keyword || keyword ,
status:status,
diff:diff,
if (parsed.id === undefined && parsed.type === undefined) {
let { order_by, tag_level, tag_id, page, limit, keyword, status, diff } = this.state;
let params = {
order_by: order_by,
tag_level: tag_level,
tag_id: tag_id,
page: page,
limit: limit,
keyword: _keyword || keyword,
status: status,
diff: diff,
sort: "desc"
}
this.shixunresultend(params);
}else{
let {order_by,page, limit, keyword, status, diff} = this.state;
let nawparsed=parsed.type;
let newpalce=parsed.palce;
if(nawparsed==="rep"){
nawparsed=1
} else {
let { order_by, page, limit, keyword, status, diff } = this.state;
let nawparsed = parsed.type;
let newpalce = parsed.palce;
if (nawparsed === "rep") {
nawparsed = 1
}
else if(nawparsed==="sub"){
nawparsed=2
}else if(nawparsed==="tag"){
nawparsed=3
else if (nawparsed === "sub") {
nawparsed = 2
} else if (nawparsed === "tag") {
nawparsed = 3
}
let params={
order_by:order_by,
tag_level:nawparsed,
tag_id:parsed.id,
page:page,
limit:limit,
let params = {
order_by: order_by,
tag_level: nawparsed,
tag_id: parsed.id,
page: page,
limit: limit,
keyword: _keyword || keyword,
status:status,
diff:diff,
status: status,
diff: diff,
sort: "desc"
}
this.setState({
parsedid:parsed.id,
newtag_level:nawparsed,
tag_level:nawparsed,
newpalce:newpalce,
tag_id:parsed.id,
parsedid: parsed.id,
newtag_level: nawparsed,
tag_level: nawparsed,
newpalce: newpalce,
tag_id: parsed.id,
keyword: _keyword || keyword,
})
this.shixunresultend(params);
@ -117,221 +103,219 @@ class ShixunsIndex extends Component {
}
allUpdatashixunlist=()=>{
let{sort,order_by}=this.state;
allUpdatashixunlist = () => {
let { sort, order_by } = this.state;
this.setState({
tag_level: 1,
tag_id:'',
tag_id: '',
page: 1,
limit: 16,
keyword:'',
keyword: '',
status: 0,
diff: 0,
})
let params={
order_by:order_by,
let params = {
order_by: order_by,
tag_level: 1,
tag_id:'',
tag_id: '',
page: 1,
limit: 16,
keyword:'',
keyword: '',
status: 0,
diff: 0,
sort:sort
sort: sort
}
this.shixunresultend(params)
}
Updatasearchlist=(value)=>{
Updatasearchlist = (value) => {
if (value[1].tag_id === " ") {
this.setState({
keyword: ""
})
}
this.setState({
tag_level:value[0].tag_level,
tag_id:value[1].tag_id,
typepvisible:true
tag_level: value[0].tag_level,
tag_id: value[1].tag_id,
typepvisible: true
})
let {order_by, sort, limit, keyword, status, diff} = this.state;
let params={
order_by:order_by,
tag_level:value[0].tag_level,
tag_id:value[1].tag_id,
page:1,
limit:limit,
keyword:keyword,
status:status,
diff:diff,
sort:sort
let { order_by, sort, limit, keyword, status, diff } = this.state;
let params = {
order_by: order_by,
tag_level: value[0].tag_level,
tag_id: value[1].tag_id,
page: 1,
limit: limit,
keyword: keyword,
status: status,
diff: diff,
sort: sort
}
this.shixunresultend(params)
}
StatusEnquiry=(key)=>{
let Vrl=`/shixuns.json`;
StatusEnquiry = (key) => {
let newstatus;
let newdiff;
if(key[0].type===1){
if (key[0].type === 1) {
this.setState({
status: key[1].value,
typepvisible:true
typepvisible: true
})
newstatus=key[1].value;
newdiff=this.state.diff;
}else if(key[0].type===2){
newstatus = key[1].value;
newdiff = this.state.diff;
} else if (key[0].type === 2) {
this.setState({
diff: key[1].value,
typepvisible:true
typepvisible: true
})
newdiff=key[1].value;
newstatus=this.state.status;
newdiff = key[1].value;
newstatus = this.state.status;
}
let params= {
order_by:this.state.order_by,
tag_level:this.state.tag_level,
tag_id:this.state.tag_id,
page:1,
limit:this.state.limit,
keyword:this.state.keyword,
status:newstatus,
diff:newdiff,
let params = {
order_by: this.state.order_by,
tag_level: this.state.tag_level,
tag_id: this.state.tag_id,
page: 1,
limit: this.state.limit,
keyword: this.state.keyword,
status: newstatus,
diff: newdiff,
}
this.shixunresultend(params)
}
OnSearchInput=(value,type)=>{
if(type===true){
this.setState({
keyword:value,
typepvisible:true,
pages:1
})
let {order_by, tag_level, tag_id, sort, limit, status, diff} = this.state;
let params= {
order_by:order_by,
tag_level:tag_level,
tag_id:tag_id,
page:1,
limit:limit,
keyword:value,
status:status,
diff:diff,
sort:sort
OnSearchInput = (value, type) => {
if (type === true) {
this.setState({
keyword: value,
typepvisible: true,
pages: 1
})
let { order_by, tag_level, tag_id, sort, limit, status, diff } = this.state;
let params = {
order_by: order_by,
tag_level: tag_level,
tag_id: tag_id,
page: 1,
limit: limit,
keyword: value,
status: status,
diff: diff,
sort: sort
}
this.shixunresultend(params)
} else {
this.setState({
keyword: value,
pages: 1
})
}
this.shixunresultend(params)
}else{
this.setState({
keyword:value,
pages:1
})
}
}
ShixunsSwitch=()=>{
ShixunsSwitch = () => {
//types
this.setState({
order_by:"mine",
typepvisible:true,
pages:1,
order_by: "mine",
typepvisible: true,
pages: 1,
})
let{tag_level,tag_id,page,limit,keyword,status,diff,sort}=this.state;
let newsort=sort;
if(newsort===undefined){
newsort="desc"
let { tag_level, tag_id, page, limit, keyword, status, diff, sort } = this.state;
let newsort = sort;
if (newsort === undefined) {
newsort = "desc"
}
let params= {
order_by:"mine",
tag_level:tag_level,
tag_id:tag_id,
page:1,
limit:limit,
keyword:keyword,
status:status,
diff:diff,
sort:newsort
let params = {
order_by: "mine",
tag_level: tag_level,
tag_id: tag_id,
page: 1,
limit: limit,
keyword: keyword,
status: status,
diff: diff,
sort: newsort
}
this.shixunresultend(params)
}
shixunsPage=(value)=>{
shixunsPage = (value) => {
this.setState({
page:value,
typepvisible:true,
pages:value
page: value,
typepvisible: true,
pages: value
})
let {order_by, tag_level, tag_id, limit, keyword, status, diff,sort} = this.state;
let params= {
order_by:order_by,
tag_level:tag_level,
tag_id:tag_id,
page:value,
limit:limit,
keyword:keyword,
status:status,
diff:diff,
sort:sort
let { order_by, tag_level, tag_id, limit, keyword, status, diff, sort } = this.state;
let params = {
order_by: order_by,
tag_level: tag_level,
tag_id: tag_id,
page: value,
limit: limit,
keyword: keyword,
status: status,
diff: diff,
sort: sort
}
let Url=`/shixuns.json`;
axios.get(Url,{
let Url = `/shixuns.json`;
axios.get(Url, {
params
}).then((response)=> {
if(response.status===200){
}).then((response) => {
if (response.status === 200) {
this.setState({
middleshixundata: response.data,
typepvisible:false,
typepvisible: false,
});
}
}).catch((error)=>{
}).catch((error) => {
console.log(error)
});
}
ShixunsState=(val,type,sorts)=>{
ShixunsState = (type, sorts) => {
// sort,
let {tag_level, tag_id, page, limit, keyword, status, diff,sort} = this.state;
let newsort=sorts?sorts:sort;
let { tag_level, tag_id, page, limit, keyword, status, diff, sort } = this.state;
let newsort = sorts ? sorts : sort;
this.setState({
order_by:type,
typepvisible:true,
pages:1,
sort:sorts?sorts:sort
order_by: type,
typepvisible: true,
pages: 1,
sort: sorts ? sorts : sort
})
let params
// let vals=false
if(newsort===undefined){
newsort="desc"
}else{
newsort=sorts?sorts:sort
}
params= {
order_by:type,
tag_level:tag_level,
tag_id:tag_id,
page:1,
limit:limit,
keyword:keyword,
status:status,
diff:diff,
sort:newsort
if (newsort === undefined) {
newsort = "desc"
} else {
newsort = sorts ? sorts : sort
}
params = {
order_by: type,
tag_level: tag_level,
tag_id: tag_id,
page: 1,
limit: limit,
keyword: keyword,
status: status,
diff: diff,
sort: newsort
}
this.shixunresultend(params)
}
Shixunsupcircles=(sort)=>{
Shixunsupcircles = (sort) => {
console.log(sort)
this.setState({
sort:sort
sort: sort
})
let {
order_by,
@ -345,115 +329,139 @@ class ShixunsIndex extends Component {
let params= {
order_by:order_by,
tag_level:tag_level,
tag_id:tag_id,
page:1,
limit:limit,
keyword:keyword,
status:status,
diff:diff,
sort:sort
let params = {
order_by: order_by,
tag_level: tag_level,
tag_id: tag_id,
page: 1,
limit: limit,
keyword: keyword,
status: status,
diff: diff,
sort: sort
}
this.shixunresultend(params)
}
onNewHandler() {
const { checkIfLogin, showLoginDialog, checkIfProfileCompleted, showProfileCompleteDialog, current_user } = this.props
if (!checkIfLogin()) {
showLoginDialog()
return
}
if (!checkIfProfileCompleted()) {
showProfileCompleteDialog()
return
}
if (current_user && current_user.is_shixun_marker === false) {
this.setState(
{ showQQ: true }
)
return
}
window.location.href = '/shixuns/new'
}
setShowQQ(v) {
this.setState({
showQQ: v
})
}
shixunresultend=(params)=>{
let Url=`/shixuns.json`;
axios.get(Url,{
shixunresultend = (params) => {
let Url = `/shixuns.json`;
axios.get(Url, {
params
}).then((response)=> {
}).then((response) => {
// TODO 有keyword返回值时 显示一共有多少条记录
if(response.status===200){
if (response.status === 200) {
this.setState({
search_tags:response.data.search_tags,
search_tags: response.data.search_tags,
middleshixundata: response.data,
typepvisible:false,
pages:1
typepvisible: false,
pages: 1
});
}
}).catch((error)=>{
}).catch((error) => {
console.log(error)
});
}
render() {
let {middleshixundata, typepvisible, pages, search_tags, keyword,parsedid,newtag_level,newpalce} = this.state;
let { middleshixundata, typepvisible, pages, search_tags, keyword, parsedid, newtag_level, newpalce, showQQ } = this.state;
// console.log(this.state.updata)
return (
<div className="newMain clearfix backFAFAFA">
{this.state.updata===undefined?"":<UpgradeModals
{...this.state}
/>}
<style>
{
` ::-webkit-scrollbar {
{this.state.updata === undefined ? "" : <UpgradeModals
{...this.state}
/>}
<style>
{
` ::-webkit-scrollbar {
width: 0px !important;
}
.myshixin-head{
width: 100%;
height: 240px;
background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.shixun_banner_url === null ?`images/educoder/courses/courses.jpg`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.shixun_banner_url)});
background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.shixun_banner_url === null ? `images/educoder/courses/courses.jpg` : this.props.mygetHelmetapi && this.props.mygetHelmetapi.shixun_banner_url)});
background-color: #081C4B;
background-position: center;
background-repeat: no-repeat;
}
`
}
</style>
{
this.props.mygetHelmetapi&&this.props.mygetHelmetapi.shixun_banner_url?
<div className="myshixin-head pr" >
<div className="edu-txt-center pathNavLine">
<div className="inline path-nav">
</div>
</div>
</div>
:
""
}
{/*<Spin spinning={typepvisible} size="large" style={{marginTop:'15%'}}>*/}
<ShixunSearchBar
Updatasearchlist={this.Updatasearchlist.bind(this)}
allUpdatashixunlist={this.allUpdatashixunlist}
StatusEnquiry={this.StatusEnquiry.bind(this)}
OnSearchInput={this.OnSearchInput.bind(this)}
keyword={keyword}
parsedid={parsedid}
newtag_level={newtag_level}
newpalce={newpalce}
{...this.props}
{...this.state}
/>
<ShixunCardList
ShixunsState={this.ShixunsState.bind(this)}
ShixunsSwitch={this.ShixunsSwitch.bind(this)}
Shixunsupcircles={this.Shixunsupcircles.bind(this)}
allUpdatashixunlist={this.allUpdatashixunlist}
{...this.props}
{...this.state}
OnSearchInput={this.OnSearchInput.bind(this)}
/>
{/*下方图片*/}
<ShixunCard
typepvisible={typepvisible}
middleshixundata={middleshixundata.shixuns}
totalcount={middleshixundata.total_count}
pagination={middleshixundata.pagination}
pages={pages}
shixunsPage={this.shixunsPage.bind(this)}
/>
}
</style>
{
this.props.mygetHelmetapi && this.props.mygetHelmetapi.shixun_banner_url ?
<div className="myshixin-head pr" >
<div className="edu-txt-center pathNavLine">
<div className="inline path-nav">
</div>
</div>
</div>
:
""
}
<ShixunSearchBar
Updatasearchlist={this.Updatasearchlist.bind(this)}
allUpdatashixunlist={this.allUpdatashixunlist}
StatusEnquiry={this.StatusEnquiry.bind(this)}
OnSearchInput={this.OnSearchInput.bind(this)}
keyword={keyword}
parsedid={parsedid}
newtag_level={newtag_level}
newpalce={newpalce}
{...this.props}
{...this.state}
/>
{
showQQ ? <GotoQQgroup goshowqqgtounp={showQQ} setgoshowqqgtounp={this.setShowQQ.bind(this)}></GotoQQgroup> :
""
}
<ShixunCardList
onChangeLabel={this.ShixunsState.bind(this)}
ShixunsSwitch={this.ShixunsSwitch.bind(this)}
Shixunsupcircles={this.Shixunsupcircles.bind(this)}
onNewHandler={this.onNewHandler.bind(this)}
btnUrl={btnUrl}
OnSearchInput={this.OnSearchInput.bind(this)}
/>
{/*下方图片*/}
<ShixunCard
typepvisible={typepvisible}
middleshixundata={middleshixundata.shixuns}
totalcount={middleshixundata.total_count}
pagination={middleshixundata.pagination}
pages={pages}
shixunsPage={this.shixunsPage.bind(this)}
/>
{/*</Spin>*/}
</div>
);
}
}
export default SnackbarHOC() (TPMIndexHOC ( ShixunsIndex ));
export default SnackbarHOC()(TPMIndexHOC(ShixunsIndex));

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -0,0 +1,97 @@
import React from 'react';
import { getImageUrl, setImagesUrl, getUrl } from 'educoder';
import { Spin, Tooltip, Rate, Pagination } from 'antd';
import './shixunCss/shixunCard.scss';
export default ({ middleshixundata, pagination, typepvisible, pages, totalcount, shixunsPage }) => {
function onPageChange(number) {
shixunsPage(number)
}
return (
<div className="educontent mb80 shixun-card">
<Spin spinning={typepvisible} tip="正在获取相关数据..." size="large" style={{ marginTop: '15%' }}>
{middleshixundata === undefined ? "" : middleshixundata.length === 0 ? <div className="edu-tab-con-box clearfix edu-txt-center">
<img className="edu-nodata-img mb20" src={getUrl("/images/educoder/nodata.png")} />
<p className="edu-nodata-p mb20">暂时还没有相关数据哦</p>
</div> : ""}
<div className="mb20 clearfix">
<div className="shixun_list_content">
<div className="square-list clearfix">
{middleshixundata === undefined || middleshixundata.length === 0 ? " " : middleshixundata.map((item, key) => {
return (
<div className="square-Item" key={item.id} id={item.id}>
{
item.tag_name === null ? "" :
<div className="tag-green">
<span className="tag-name"> {item.tag_name}</span>
</div>
}
{
item.is_jupyter === true ?
<div className="tag-org">
<p className="tag-org-name intermediatecenter"> <span className="tag-org-name-test">Jupyter</span></p>
</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={setImagesUrl(`${item.pic}`)} />
</a>
<div className="square-main">
<p className="task-hide">
<a href={"/shixuns/" + item.identifier + "/challenges"} className="justify color-grey-name" title={item.name} target="_blank">
{item.name}
</a>
</p>
<p className="clearfix mt8 ml-3">
<span className="rateYoStar fl" style={{ padding: '0px', height: '20px', lineHeight: '19px', cursor: 'default' }} title="">
<Rate key={key} allowHalf defaultValue={item.score_info === null ? 5 : item.score_info} disabled />
</span>
<span className="fl ml25 font-12 color-grey-9 lineh-12 mt5">{item.score_info === null ? "5分" : item.score_info + "分"}</span>
</p>
<p className="clearfix mt8 font-12 color-grey-B4">
{item.is_jupyter === false ? <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" 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 className="both"></div>
<div className={"ml425"}
style={{ display: pagination ? "block" : "none" }}>
<Pagination defaultCurrent={1} current={pages} total={totalcount || 1299} type="mini" pageSize={16} onChange={onPageChange} />
</div>
</div>
</div>
</Spin>
</div>
)
}

@ -0,0 +1,61 @@
import React, { useState, Fragment } from 'react';
import { Input, Icon } from 'antd'
import './shixun-keyword-list.scss'
function AddonAfter({ callback }) {
return <a className='btn-search' onClick={callback}>
<Icon type='search' />
<span>搜索</span>
</a>
}
export default ({ onChangeLabel, btnUrl, OnSearchInput, onNewHandler, btnStyle =
{} }) => {
const [data, setData] = useState({
type: 'new',
keyword: '',
})
function onChangeTag(e) {
const id = e.target.id
setData({ ...data, type: id })
onChangeLabel(id, "desc")
}
function onSetKeyword(e) {
setData({ ...data, keyword: e.target.value })
}
function callback() {
if (keyword) {
OnSearchInput(keyword, true)
}
}
function onNewShiXun() {
if (onNewHandler) {
onNewHandler()
return
}
}
const { type, keyword } = data
return (
<Fragment>
<div className="wrapper">
<div className="educontent search-keyword-container">
<div className="btn-groups">
<a id='new' className={type === 'new' ? 'active' : ''} onClick={onChangeTag} title='最新'>最新</a>
<a id='hot' className={type === 'hot' ? 'active' : ''} onClick={onChangeTag} title='最热'>最热</a>
</div>
<div className='search-container'>
<Input onChange={onSetKeyword} value={keyword} addonAfter={<AddonAfter callback={callback} />} defaultValue="" placeholder='请输入课程名称进行搜索' />
</div>
</div>
<a className="btn-new" onClick={onNewShiXun} style={btnStyle}>
<img src={btnUrl} width={40} alt="创建实训" />
</a>
</div>
</Fragment>
)
}

@ -0,0 +1,70 @@
.search-keyword-container {
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
align-items: center;
padding: 20px 0;
.ant-input-group-addon {
background-color: #4CACFF;
}
.ant-input:focus+.ant-input-group-addon {
background-color: #4CACFF !important;
}
.search-container {
width: 320px;
}
.btn-search {
display: block;
text-align: center;
color: #fff;
span {
margin-left: 5px;
}
}
.btn-groups {
display: flex;
flex-flow: row nowrap;
align-items: center;
justify-content: start;
a {
display: block;
width: 60px;
border-radius: 14px;
text-align: center;
height: 28px;
line-height: 28px;
&:first-child {
margin-right: 20px;
}
color: #999;
background-color: #eee;
&.active {
color: #fff;
background-color: #4CACFF;
}
}
}
}
.wrapper {
position: relative;
}
.btn-new {
position: absolute;
width: 40px;
right: 39px;
top: 76px;
z-index: 10;
}

@ -0,0 +1,11 @@
import React from 'react'
export default ({
activeId, id, callback, text
}) => {
function onClickHandler() {
callback(id)
}
return (
<a className={id === activeId ? "shaiItems shixun_repertoire active" : "shaiItems shixun_repertoire"} onClick={onClickHandler}>{text}</a>
)
}

@ -0,0 +1,121 @@
import React, { useState, useEffect } from 'react'
import { Menu, Dropdown } from 'antd'
import 'antd/lib/style/index.css';
import '../shixunCss/shixun-search-bar.scss'
import axios from 'axios'
import A from './A.jsx'
const DiffObject = [
{ id: 0, text: '全部难度' },
{ id: 1, text: '初级' },
{ id: 2, text: '中级' },
{ id: 3, text: '中高级' },
{ id: 4, text: '高级' }
]
export default ({ StatusEnquiry, allUpdatashixunlist, Updatasearchlist }) => {
const [data, setData] = useState({
diff: 0,
searchValue: 'a',
navs: [],
searchKey: '',
childValue: ''
})
const { diff, searchValue, navs, childValue, searchKey } = data
function diffSearch(diff) {
setData({
...data,
diff
})
StatusEnquiry([{ 'type': 2 }, { 'value': diff }])
}
function onSearchAll() {
if (searchValue !== 'a') {
setData({ ...data, searchValue: 'a', childValue: '' })
allUpdatashixunlist()
}
}
function getChildValue(e) {
let id = e.target.name
let newid = e.target.id
if (id || newid) {
setData({ ...data, searchValue: newid })
Updatasearchlist([{ 'tag_level': 2 }, { 'tag_id': id }])
}
}
function getChildValues(e) {
let id = e.target.id;
let newid = e.target.name;
if (id || newid) {
setData({ ...data, searchValue: newid, childValue: id })
Updatasearchlist([{ 'tag_level': 3 }, { 'tag_id': id }])
}
}
function onSearchBranch(e) {
const id = e.target.value
if (id != searchValue) {
setData({ ...data, searchValue: id, childValue: '' })
Updatasearchlist([{ 'tag_level': 1 }, { 'tag_id': id }])
}
}
function overlayMenu(item, id) {
return <Menu>
{
item.map((list, k) => <Menu.Item>
<div className="mt5 subshaicontent-part" key={k}>
<a style={{ height: '20px' }} className={"mb15 shixun_repertoire color-dark"} name={list.id} id={id} onClick={getChildValue}>{list.name}</a>
<div className="sub-Item clearfix">
{
list.tags.map((tag, e) => <a className={childValue === tag.id ? "shixun_repertoire active" : "shixun_repertoire"} key={e} id={tag.id} name={id} rel="subshaicontent" onClick={getChildValues}>{tag.name}</a>
)
}
</div>
</div>
</Menu.Item>
)
}
</Menu>
}
useEffect(() => {
async function init() {
const response = await axios.get('/shixuns/menus.json')
setData({ ...data, navs: response.data })
}
init()
}, [])
return (
<div className="edu-back-white shixun-search-bar" >
<div className="educontent">
<div className="pt_b_26">
<div className="clearfix mb20 shaiContent">
<span className="shaiTitle fl">方向</span>
<div className="fl pr shaiAllItem">
<a className={searchValue === "a" ? "shaiItem shixun_repertoire active" : "shaiItem shixun_repertoire"} value="a" onClick={onSearchAll}>全部</a>
{
navs.map((item, key) => {
return (
<Dropdown overlay={overlayMenu(item.sub_repertoires, item.id)} key={key} placement={item.id < 4 ? "bottomRight" : item.id >= 8 ? "bottomLeft" : "bottomCenter"}>
<li key={item.id} className={searchValue == item.id ? "shaiItem shixun_repertoire active" : "shaiItem shixun_repertoire"} value={item.id} onClick={onSearchBranch}>
{item.name}
</li>
</Dropdown>
)
})
}
</div>
</div>
<div className="clearfix">
<span className="shaiTitle fl">筛选</span>
<div className="fl pr shaiAllItem mt1">
{DiffObject.map(item => <A {...item} callback={diffSearch} activeId={diff} />)}
</div>
</div>
</div>
</div>
</div>
)
}

@ -1,23 +1,26 @@
.iconfontShixunSearchBar{
z-index: 1000;
position: absolute;
right: 3px;
top: 0px;
.iconfontShixunSearchBar {
z-index: 1000;
position: absolute;
right: 3px;
top: 0px;
}
.pt_b_26{
padding:26px 0px;
.pt_b_26 {
padding: 26px 0px;
}
.diffSelect {
margin-left: 20px !important;
}
.diffSelect{
margin-left:20px !important;
}
.ant-input-search-button{
/*margin-right: 10px;*/
border: 1px solid transparent;
}
.Mousebox{
width: 800px !important;
.ant-input-search-button {
border: 1px solid transparent;
}
.subshaicontent a{
height:30px;
.Mousebox {
width: 800px !important;
}
.subshaicontent a {
height: 30px;
}

@ -0,0 +1,78 @@
.iconfontShixunSearchBar {
z-index: 1000;
position: absolute;
right: 3px;
top: 0px;
}
.pt_b_26 {
padding: 26px 0px;
}
.diffSelect {
margin-left: 20px !important;
}
.ant-input-search-button {
border: 1px solid transparent;
}
.Mousebox {
width: 800px !important;
}
.subshaicontent a {
height: 30px;
}
.ant-dropdown {
width: 800px;
}
.shixun_repertoire {
cursor: pointer;
float: left;
margin-right: 20px;
color: #999;
cursor: pointer;
margin-bottom: 10px;
}
.ant-dropdown-menu-item,
.ant-dropdown-menu-submenu-title {
padding: 0px 12px;
}
.ant-dropdown-menu-item:hover,
.ant-dropdown-menu-submenu-title:hover {
background: transparent !important;
}
.shaiContent li.shaiItem {
padding: 0px 15px;
line-height: 32px;
height: 32px
}
.shaiTitle {
height: 32px;
line-height: 32px;
}
.shaiItems {
padding: 0px 15px;
line-height: 32px;
height: 32px;
float: left;
border-radius: 4px;
color: #4C4C4C;
cursor: pointer;
margin-right: 15px;
display: block;
float: left;
}
.shaiItems.active {
background-color: #4CACFF !important;
color: #fff !important;
}

@ -6,29 +6,32 @@
margin-left: 32%;
}
.square-img{
min-height: 210px;
.square-img {
min-height: 210px;
}
.task-hide{
.task-hide {
margin-bottom: 0em;
}
.backFAFAFA{
background:#FAFAFA;
.backFAFAFA {
background: #FAFAFA;
}
.demo {
width: 500px;
background-color: #0dcecb;
text-align: center;
padding:50px;
padding: 50px;
}
.next-loading {
margin-bottom: 5px;
width:100%;
width: 100%;
}
.next-rating-overlay .next-icon{
color: #FFA800!important;
.next-rating-overlay .next-icon {
color: #FFA800 !important;
}
.custom-pagination {
@ -36,7 +39,7 @@
margin-left: 10px;
}
.ml425{
margin-left:42.5%;
margin-top:20px;
.ml425 {
margin-left: 42.5%;
margin-top: 20px;
}

@ -0,0 +1,101 @@
.ml350 {
margin-left: 40%;
}
.ml32 {
margin-left: 32%;
}
.square-img {
min-height: 210px;
}
.task-hide {
margin-bottom: 0em;
}
.backFAFAFA {
background: #FAFAFA;
}
.demo {
width: 500px;
background-color: #0dcecb;
text-align: center;
padding: 50px;
}
.next-loading {
margin-bottom: 5px;
width: 100%;
}
.next-rating-overlay .next-icon {
color: #FFA800 !important;
}
.custom-pagination {
display: inline-block;
margin-left: 10px;
}
.ml425 {
margin-left: 42.5%;
margin-top: 20px;
}
.shixun-card {
.edu-tab-con-box {
padding: 100px 0px;
}
.ant-modal-body .edu-tab-con-box {
padding: 0px !important;
}
img.edu-nodata-img {
margin: 40px auto 20px;
}
.square-list {
margin-top: 5px;
}
.tag-green {
position: absolute;
left: 10px;
bottom: 125px;
}
.tag-org {
position: absolute;
left: 0px;
top: 20px;
}
.tag-org-name {
width: 66px;
height: 28px;
background: #FF6802;
width: 66px;
height: 28px;
border-radius: 0px 20px 20px 0px;
}
.tag-org-name-test {
width: 45px;
height: 23px;
font-size: 14px;
color: #FFFFFF;
line-height: 19px;
margin-right: 6px;
}
.intermediatecenter {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
}

@ -1,17 +1,17 @@
/*
* @Description:
* @Description:
* @Author: tangjiang
* @Github:
* @Github:
* @Date: 2019-11-27 13:42:11
* @LastEditors : tangjiang
* @LastEditTime : 2020-02-10 18:17:00
*/
import types from "./actionTypes";
import { Base64 } from 'js-base64';
import {
import {
fetchStartProgram,
fetchUserProgramDetail,
fetchDebuggerCode,
fetchDebuggerCode,
fetchCodeSubmit,
fetchUserCommitRecord,
fetchUserCommitRecordDetail,
@ -26,7 +26,6 @@ import { notification } from "antd";
export const startProgramQuestion = (id, props) => {
return (dispatch, getState) => {
const {searchParams} = getState().ojFormReducer;
console.log(searchParams);
fetchStartProgram(id).then(res => {
const { status, data } = res;
if (status === 200) {
@ -50,7 +49,7 @@ export const startProgramQuestion = (id, props) => {
// console.log(path);
// props.history.push(`/myproblems/${identifier}`);
props.history.push({
pathname: `/myproblems/${identifier}?${searchParams}`,
pathname: `/myproblems/${identifier}`,
});
}
}
@ -90,7 +89,7 @@ export const getUserProgramDetail = (identifier, type) => {
type: types.SAVE_USE_TEST_CASE_VALUE,
payload: data.test_case || {}
});
// 代码是否更新
// 代码是否更新
let _modify_code = false;
if (data.hack) {
_modify_code = data.hack.modify_code;
@ -145,7 +144,7 @@ export const saveUserCodeForInterval = (identifier, code) => {
/**
* @description 保存或更新之前先更新代码
* @param {*} identifier
* @param {*} identifier
* @param {*} inputValue 输入值: 自定义 | 系统返回的
* @param {*} type 测评类型 debug | submit
*/
@ -157,7 +156,7 @@ export const updateCode = (identifier, inputValue, type) => {
fetchUpdateCode(identifier, {
code: Base64.encode(userCode)
}).then(res => {
// 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现
// 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现
// TODO 需要优化
if (res.data.status === 401) {
dispatch({ // 改变 loading 值
@ -187,7 +186,7 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus,
let count = 1;
/**
* @param {*} excuteTime 执行时间
* @param {*} finalTime 总时间
* @param {*} finalTime 总时间
* @param {*} count 执行次数
* @param {*} timer 定时器
*/
@ -199,7 +198,7 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus,
if (+status === 0 || (excuteTime / 1000) > (finalTime + 1)) {
clearInterval(timer); // 清除定时器
timer = null;
let returnData = null;
let returnData = null;
if (status === 1) { // 结果没有返回
returnData = {
error_line: -1,
@ -221,7 +220,7 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus,
payload: {
type,
data: returnData
}
}
});
if (!type || type === 'debug') {
dispatch({ // 改变 loading 值
@ -287,13 +286,13 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus,
/**
* @description 调试代码
* @param {*} identifier
* @param {*} identifier
* @param {*} inputValue 输入值: 自定义 | 系统返回的
* @param {*} type 测评类型 debug | submit
*/
export const debuggerCode = (identifier,value, type) => {
return (dispatch, getState) => {
// 调用之前 先保存 code
// 调用之前 先保存 code
// TODO
// console.log(identifier, value);
const { hack } = getState().ojForUserReducer;
@ -398,7 +397,7 @@ export const changeUserCodeTab = (key) => {
/**
* @description 用户提交代码 先调用保存代码接口再调提交接口成功后调用调试接口
* @param {*} identifier
* @param {*} identifier
*/
export const submitUserCode = (identifier, inputValue, type) => {
return (dispatch, getState) => {
@ -430,7 +429,7 @@ export const submitUserCode = (identifier, inputValue, type) => {
fetchUpdateCode(identifier, {
code: userCode
}).then(res => {
// 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现
// 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现
// TODO 需要优化
if (res.data.status === 401) {
dispatch({
@ -495,7 +494,7 @@ export const saveOpacityType = (type) => {
type: types.CLICK_OPERATE_TYPE,
payload: type
}
}
}
export const clearOjForUserReducer = () => {

@ -1,14 +1,14 @@
/*
* @Description: 开发者社区编辑模块
* @Author: tangjiang
* @Github:
* @Github:
* @Date: 2019-11-20 16:35:46
* @LastEditors : tangjiang
* @LastEditTime : 2020-02-11 16:29:32
*/
import types from './actionTypes';
import CONST from '../../constants';
import {
import {
fetchPostOjForm,
fetchGetOjById,
publishTask,
@ -18,7 +18,7 @@ import {
} from '../../services/ojService';
import { Base64 } from 'js-base64';
import { notification } from 'antd';
import { toStore } from 'educoder';
import { toStore } from 'educoder';
// import { startProgramQuestion } from ''
const { jcLabel } = CONST;
// 表单字段映射
@ -124,7 +124,7 @@ export const validateOjForm = (props, type, cb) => {
hasSuccess = false;
dispatch(
{
type: maps[key].type,
type: maps[key].type,
payload: payloadInfo(key, value, errMsg, validateResult[key])
}
)
@ -142,7 +142,7 @@ export const validateOjForm = (props, type, cb) => {
let validateResult = emptyValidate(key, value);
const errMsg = validateResult[key].errMsg;
if (errMsg) {
hasSuccess = false;
// hasSuccess = false;
} else {
// 唯一性校验
const bool = testCases.some((item, j) => {
@ -154,7 +154,7 @@ export const validateOjForm = (props, type, cb) => {
});
if (bool) {
hasSuccess = false;
// hasSuccess = false;
validateResult = {
[key]: {
validateStatus: 'error',
@ -168,14 +168,14 @@ export const validateOjForm = (props, type, cb) => {
tcValidResult.push(tempObj);
});
if (testCases.length === 0) {
hasSuccess = false;
notification['error']({
message: '提示',
description: '测试用例必须输入!'
});
}
// if (testCases.length === 0) {
// hasSuccess = false;
// notification['error']({
// message: '提示',
// description: '测试用例必须输入!'
// });
// }
// if (!code) {
// hasSuccess = false;
// notification['error']({
@ -300,7 +300,7 @@ export const validateOjForm = (props, type, cb) => {
cb && cb();
} else {
const {identifier} = res.data;
// message.success(paramsObj['submitType'] === 'update' ? '更新成功' : '保存成功');
notification.success({
message: '提示',
@ -311,7 +311,7 @@ export const validateOjForm = (props, type, cb) => {
type: types.SAVE_OJ_FORM_ID,
payload: identifier
});
// console.log(identifier , props.identifier);
if (identifier || props.identifier) {
dispatch(getOJFormById(identifier || props.identifier));
@ -443,7 +443,7 @@ export const saveOjFormCode = (value) => {
payload: value
};
}
// 验证任务名称
// 验证任务名称
export const validateOJName = (value) => {
const validate = emptyValidate('name', value)['name'];
const errMsg = validate.errMsg;
@ -735,9 +735,9 @@ export const saveKnowledge = (values) => {
}
/**
* 新增时跳转到OJ时带的默认参数:
* @param {}} params
* {
* 新增时跳转到OJ时带的默认参数:
* @param {}} params
* {
* difficult: '', // 难易度
* sub_discipline_id: '' // 课程方向
* tag_discipline_id [] 知识点
@ -767,7 +767,7 @@ export const tagDisciplines = (params) => {
}
});
}
}
}
// 保存地址栏参数
export const saveSearchParams = (params) => {

@ -12,7 +12,7 @@ import { fetchStaticList } from "../../services/staticService";
export const staticList = (id) => {
return (dispatch, getState) => {
const { params, total_count, other_info } = getState().staticReducer;
// console.log('统计数据=====>>>>>', params);
console.log('统计数据=====>>>>>', params);
// if (total_count !== 0 && total_count === other_info.length) return;
fetchStaticList(id, params).then(res => {
// console.log('统计数据=====>>>>>', res);

@ -1,7 +1,7 @@
/*
* @Description: 开发者社区接口
* @Author: tangjiang
* @Github:
* @Github:
* @Date: 2019-11-20 10:55:38
* @LastEditors : tangjiang
* @LastEditTime : 2020-01-07 15:23:19
@ -34,7 +34,7 @@ export async function fetchPostOjForm (paramsObj) {
// if (identifier) {
// return axios.post(url, params);
// } else {
// return
// return
// }
return identifier ? axios.put(url, params) : axios.post(url, params);
}
@ -136,7 +136,7 @@ export async function fetchUploadImage (file) {
export async function fetchUploadImageUrl (id) {
const url = `/attachments/${id}`;
return axios.get(url);
}
}
// 添加笔记
export async function fetchAddNotes (identifier, params) {

Loading…
Cancel
Save