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

video_transcode
daiao 5 years ago
commit d096575b14

@ -135,6 +135,7 @@ class PollsController < ApplicationController
:course_id => @course.id, :course_id => @course.id,
:polls_status => 1, :polls_status => 1,
:polls_type => "Course", :polls_type => "Course",
:un_anonymous => true
} }
@poll = Poll.create!(poll_options) @poll = Poll.create!(poll_options)
end end

@ -27,7 +27,7 @@ class Weapps::AttendancesController < ApplicationController
tip_exception(403) if @user_course_identity >= Course::STUDENT tip_exception(403) if @user_course_identity >= Course::STUDENT
current_date = Date.current current_date = Date.current
current_end_time = Time.current.strftime("%H:%M:%S") current_end_time = Time.current.strftime("%H:%M:%S")
@current_attendance = @course.course_attendances.where("attendance_date = '#{current_date}' and end_time > '#{current_end_time}'") @current_attendance = @course.course_attendances.where("attendance_date > '#{current_date}' or (attendance_date = '#{current_date}' and end_time > '#{current_end_time}')")
.order("attendance_date asc, start_time asc") .order("attendance_date asc, start_time asc")
all_attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or (attendance_date = '#{current_date}' and end_time < '#{current_end_time}')") all_attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or (attendance_date = '#{current_date}' and end_time < '#{current_end_time}')")

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

@ -0,0 +1,46 @@
function Mediator(obj) {
const channels = {}
const mediator = {
subscribe: function (channel, cb) {
if (!channels[channel]) {
channels[channel] = []
}
channels[channel].push(cb)
return this.unsubscribe.bind(null, channel, cb)
},
unsubscribe: function (channel, cb) {
let rs = channels[channel]
let index = -1
if (rs) {
for (let i = 0; i < rs.length; i++) {
if (rs[i].name === cb.name) {
index = i
break
}
}
if (index >= 0) {
channels[channel].splice(index, 1)
return true
}
}
return false
},
publish: function (channel) {
if (!channels[channel]) {
return false
}
const args = Array.prototype.slice.call(arguments, 1)
channels[channel].forEach(subscription => {
subscription.apply(null, args)
})
return this
},
}
return obj ? Object.assign(obj, mediator) : mediator
}
const mediator = new Mediator()
export default mediator

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

@ -1,118 +1,117 @@
import React, { Component } from 'react'; import React, { Component, Fragment } from 'react';
import {getImageUrl} from 'educoder'; import { getImageUrl } from 'educoder';
import CoursesHomeCard from "./CoursesHomeCard.js" import CoursesHomeCard from "./CoursesHomeCard.js"
import axios from 'axios'; import axios from 'axios';
import {Input,Tooltip} from 'antd'; import { Pagination } from 'antd';
import LoadingSpin from '../../../common/LoadingSpin'; import LoadingSpin from '../../../common/LoadingSpin';
import UpgradeModals from '../../modals/UpgradeModals'; import UpgradeModals from '../../modals/UpgradeModals';
import './css/CoursesHome.css'; import './css/CoursesHome.css';
import Pagination from '@icedesign/base/lib/pagination'; import '../../tpm/shixuns/shixun-keyword-list.scss';
import '@icedesign/base/lib/pagination/style.js'; import btnNew from './btn-new.png'
import btnJoin from './btn-join.png'
class CoursesHome extends Component {
const Search = Input.Search;
class CoursesHome extends Component{
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
limit:16, limit: 16,
page:1, page: 1,
order:"created_at", order: "created_at",
coursesHomelist:undefined, coursesHomelist: undefined,
search:"", search: "",
} }
} }
//切换列表状态 //切换列表状态
changeStatus=(value)=>{ changeStatus = (value) => {
this.setState({ this.setState({
order:value, order: value,
page:1, page: 1,
coursesHomelist:undefined coursesHomelist: undefined
}) })
this.searchcourses(16,1,value,"") this.searchcourses(16, 1, value, "")
} }
//搜索输入 //搜索输入
inputSearchValue=(e)=>{ inputSearchValue = (e) => {
this.setState({ this.setState({
search:e.target.value, search: e.target.value,
page:1 page: 1
}) })
} }
//搜索 //搜索
searchValue=(e)=>{ searchValue = (e) => {
let { search ,order}=this.state; let { search, order } = this.state;
this.setState({ this.setState({
order:order, order: order,
page:1 page: 1
}) })
this.searchcourses(16,1,order,search) this.searchcourses(16, 1, order, search)
} }
componentDidMount(){ componentDidMount() {
document.title="教学课堂"; document.title = "教学课堂";
const upsystem=`/users/system_update.json`; const upsystem = `/users/system_update.json`;
axios.get(upsystem).then((response)=>{ axios.get(upsystem).then((response) => {
let updata=response.data; let updata = response.data;
this.setState({ this.setState({
updata:updata updata: updata
}) })
}).catch((error)=>{ }).catch((error) => {
console.log(error); console.log(error);
}) })
this.searchcourses(16,1,"all","") this.searchcourses(16, 1, "all", "")
} }
onChange=(pageNumber)=> { onChange = (pageNumber) => {
this.setState({ this.setState({
page:pageNumber page: pageNumber
}) })
let {limit,order,search}=this.state; let { limit, order, search } = this.state;
this.searchcourses(limit,pageNumber,order,search) this.searchcourses(limit, pageNumber, order, search)
} }
searchcourses=(limit,page,order,search)=>{ searchcourses = (limit, page, order, search) => {
let url="/courses.json"; let url = "/courses.json";
axios.get(url,{ axios.get(url, {
params: { params: {
limit:limit, limit: limit,
page:page, page: page,
order:order, order: order,
search:search search: search
} }
}).then((result)=>{ }).then((result) => {
if(result.data.status===401){ if (result.data.status === 401) {
}else{ } else {
this.setState({ this.setState({
coursesHomelist:result.data coursesHomelist: result.data
}) })
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error); console.log(error);
}) })
} }
getUser=(url,type)=>{ getUser = (url, type) => {
if(this.props.checkIfLogin()===false){ if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog() this.props.showLoginDialog()
return return
} }
if(this.props.checkIfProfileCompleted()===false){ if (this.props.checkIfProfileCompleted() === false) {
this.props.showProfileCompleteDialog() this.props.showProfileCompleteDialog()
return return
} }
if(url !== undefined || url!==""){ if (url !== undefined || url !== "") {
this.props.history.push(url); this.props.history.push(url);
} }
@ -120,79 +119,71 @@ class CoursesHome extends Component{
} }
render() { render() {
let { order,search,page,coursesHomelist }=this.state; const { order, page, coursesHomelist } = this.state;
//console.log(this.props) const { user, tojoinclass } = this.props
console.log(tojoinclass, '--------------s')
return ( return (
<div> <div>
{this.state.updata===undefined?"":<UpgradeModals {this.state.updata === undefined ? "" : <UpgradeModals
{...this.state} {...this.state}
/>} />}
<div className="newMain clearfix"> <div className="newMain clearfix">
<style> <style>
{ {
` ::-webkit-scrollbar { ` ::-webkit-scrollbar {
width: 0px !important; width: 0px !important;
} }
.courses-head{ .courses-head{
width: 100%; width: 100%;
height: 300px; height: 300px;
background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.course_banner_url === null ?`images/educoder/courses/courses.jpg`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.course_banner_url)}); background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.course_banner_url === null ? `images/educoder/courses/courses.jpg` : this.props.mygetHelmetapi && this.props.mygetHelmetapi.course_banner_url)});
background-color: #081C4B; background-color: #081C4B;
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
` `
} }
</style> </style>
<div className="courses-head pr" > <div className="courses-head pr" >
<div className="edu-txt-center pathNavLine"> <div className="edu-txt-center pathNavLine">
<div className="inline path-nav"> <div className="inline path-nav">
</div> </div>
</div>
</div> </div>
</div>
<div className="mt20 educontent mb20 clearfix">
{/*<a className={ order == "all" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}*/} <div className="wrapper">
{/*onClick={ () => this.changeStatus("all")}>全部</a>*/} <div className="educontent search-keyword-container" style={{ padding: '20px 0 0 0' }}>
{/*<a className={ order == "mine" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}*/} <div className="btn-groups">
{/*onClick={ () => this.changeStatus("mine")}>我的</a>*/} <a id='new' className={order === 'created_at' ? 'active' : ''} onClick={() => this.changeStatus("created_at")} title='最新'>最新</a>
<a className={ order == "created_at" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"} <a id='hot' className={order === 'visits' ? 'active' : ''} onClick={() => this.changeStatus("visits")} title='最热'>最热</a>
onClick={ () => this.changeStatus("created_at")}>最新</a> </div>
<a className={ order == "visits" ? "fl mr20 font-16 bestChoose active" : "fl mr20 font-16 bestChoose"}
onClick={ () => this.changeStatus("visits")}>最热</a>
{this.props.user&&this.props.user.user_identity==="学生"?"":<span className={ "fr font-16 bestChoose color-blue" } onClick={(url)=>this.getUser("/courses/new")}>+新建教学课堂</span>}
{/*<div className="fr mr5 search-new">*/}
{/*/!* <Search*/}
{/*placeholder="课堂名称/教师姓名/学校名称"*/}
{/*id="subject_search_input"*/}
{/*value={search}*/}
{/*onInput={this.inputSearchValue}*/}
{/*onSearch={this.searchValue}*/}
{/*autoComplete="off"*/}
{/*></Search> *!/*/}
{/*</div>*/}
</div> </div>
{user && user.user_identity !== '学生' ?
{coursesHomelist===undefined?<LoadingSpin/>:<CoursesHomeCard {...this.props} {...this.state} <Fragment>
coursesHomelist={coursesHomelist}></CoursesHomeCard>} <a className="btn-new" style={{ top: '67px' }} onClick={() => { this.getUser("/courses/new") }} > <img src={btnNew} width={40} alt="创建教学课堂" /> </a>
<a className="btn-join" style={{ top: '123px' }} onClick={() => { window._header_componentHandler.tojoinclass() }} > <img src={btnJoin} width={40} alt="加入教学课堂" /> </a>
{coursesHomelist===undefined?"":coursesHomelist.courses.length===0?<div className="edu-tab-con-box clearfix edu-txt-center mb50"> </Fragment> : null
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
<p className="edu-nodata-p mb20">暂时还没有相关数据哦</p>
</div>:""}
{
coursesHomelist===undefined?"":coursesHomelist.courses_count > 16?
<div className="educontent mb80 edu-txt-center mt10">
<Pagination current={page} total={ coursesHomelist.courses_count || 1299 } type="mini" pageSize={16} onChange={this.onChange} />
</div>:""
} }
</div>
{coursesHomelist === undefined ? <LoadingSpin /> : <CoursesHomeCard {...this.props} {...this.state}
coursesHomelist={coursesHomelist}></CoursesHomeCard>}
{coursesHomelist === undefined ? "" : coursesHomelist.courses.length === 0 ? <div className="edu-tab-con-box clearfix edu-txt-center mb50">
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")} />
<p className="edu-nodata-p mb20">暂时还没有相关数据哦</p>
</div> : ""}
{
coursesHomelist === undefined ? "" : coursesHomelist.courses_count > 16 ?
<div className="educontent mb80 edu-txt-center mt10">
<Pagination current={page} total={coursesHomelist.courses_count || 1299} type="mini" pageSize={16} onChange={this.onChange} />
</div> : ""
}
</div> </div>
</div> </div>
) )
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -1,164 +1,178 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import axios from 'axios'; import axios from 'axios';
import {Dropdown,Menu} from 'antd'; import { Dropdown, Menu } from 'antd';
import {getImageUrl} from 'educoder'; import { getImageUrl } from 'educoder';
import PathCard from "./ShixunPathCard"; import PathCard from "./ShixunPathCard";
import UpgradeModals from '../modals/UpgradeModals'; import UpgradeModals from '../modals/UpgradeModals';
import Pagination from '@icedesign/base/lib/pagination'; import Pagination from '@icedesign/base/lib/pagination';
import '@icedesign/base/lib/pagination/style.js'; import '@icedesign/base/lib/pagination/style.js';
import './ShixunPaths.css'; 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) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
order:"updated_at", order: "updated_at",
select:undefined, select: undefined,
search:"", search: "",
page:1, page: 1,
pathList:null, pathList: null,
sortList:'', sortList: '',
total_count:0, total_count: 0,
sort:"desc", sort: "desc",
limit:16, limit: 16,
discipline_id:undefined, discipline_id: undefined,
sub_discipline_id:undefined sub_discipline_id: undefined
} }
} }
//适配器
//切换列表状态 onChangeLabel(value) {
changeStatus=(value)=>{ let rs = value === 'new' ? 'updated_at' : 'myshixuns_scount'
let { discipline_id, sub_discipline_id } = this.state;
let {discipline_id,sub_discipline_id }=this.state;
this.setState({ this.setState({
order:value, order: rs,
page:1 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({ 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({ this.setState({
order:"updated_at", order: "updated_at",
discipline_id:tag_id, discipline_id: tag_id,
page:1, page: 1,
sub_discipline_id:undefined sub_discipline_id: undefined
}) })
let { order }=this.state; let { order } = this.state;
this.getList(order,tag_id,undefined,1 ); this.getList(order, tag_id, undefined, 1);
e.stopPropagation(); e.stopPropagation();
} }
componentDidMount(){ componentDidMount() {
document.title="实践课程"; document.title = "实践课程";
const upsystem=`/users/system_update.json`; const upsystem = `/users/system_update.json`;
axios.get(upsystem).then((response)=>{ axios.get(upsystem).then((response) => {
let updata=response.data; let updata = response.data;
this.setState({ this.setState({
updata:updata updata: updata
}) })
}).catch((error)=>{ }).catch((error) => {
console.log(error); console.log(error);
}) })
this.getdisciplines() this.getdisciplines()
let { order,discipline_id,sub_discipline_id,page }=this.state; let { order, discipline_id, sub_discipline_id, page } = this.state;
this.getList(order,discipline_id,sub_discipline_id,page ); this.getList(order, discipline_id, sub_discipline_id, page);
} }
getdisciplines=()=>{ getdisciplines = () => {
let url='/disciplines.json'; let url = '/disciplines.json';
axios.get(url,{params:{ axios.get(url, {
source:"subject" params: {
}}).then((result)=>{ source: "subject"
if(result.status==200){ }
// console.log(result.data.disciplines) }).then((result) => {
if (result.status == 200) {
// console.log(result.data.disciplines)
this.setState({ this.setState({
sortList:result.data.disciplines sortList: result.data.disciplines
}) })
} }
}).catch((error)=>{ }).catch((error) => {
console.log(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'; getList = (order, discipline_id, sub_discipline_id, page, keyword = '') => {
axios.get(url,{params:{
sort:"desc", let url = '/paths.json';
limit:16, axios.get(url, {
order:order, params: {
page:page, sort: "desc",
discipline_id:discipline_id, limit: 16,
sub_discipline_id:sub_discipline_id order: order,
}}).then((result)=>{ keyword,
if(result.status==200){ page: page,
discipline_id: discipline_id,
sub_discipline_id: sub_discipline_id
}
}).then((result) => {
if (result.status == 200) {
this.setState({ this.setState({
pathList:result.data.subjects, pathList: result.data.subjects,
total_count:result.data.total_count total_count: result.data.total_count
}) })
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error); console.log(error);
}) })
} }
//头部获取是否已经登录了 //头部获取是否已经登录了
getUser=(url,type)=>{ getUser = (url) => {
if(this.props.checkIfLogin()===false){ if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog() this.props.showLoginDialog()
return return
} }
if(this.props.checkIfProfileCompleted()===false){ if (this.props.checkIfProfileCompleted() === false) {
this.props.showProfileCompleteDialog() this.props.showProfileCompleteDialog()
return return
} }
if(url !== undefined || url!==""){ if (url !== undefined || url !== "") {
this.props.history.push(url); this.props.history.push(url);
} }
} }
getshixunchildValues=(e,id,item)=>{ getshixunchildValues = (e, id, item) => {
this.setState({ this.setState({
discipline_id:item.id, discipline_id: item.id,
sub_discipline_id:id, sub_discipline_id: id,
}) })
let { order,page }=this.state; let { order, page } = this.state;
this.getList(order,item.id,id,page ); this.getList(order, item.id, id, page);
e.stopPropagation(); e.stopPropagation();
} }
getmenu=(list,item)=>{ getmenu = (list, item) => {
return( return (
<Menu> <Menu>
<Menu.Item> <Menu.Item>
<div className="mt5 subshaicontent-part"> <div className="mt5 subshaicontent-part">
<div className="sub-Item clearfix"> <div className="sub-Item clearfix">
{ {
list.map((tag,e)=>{ list.map((tag, e) => {
return( return (
<a className={parseInt(this.state.sub_discipline_id)===tag.id?"shixun_repertoire mr20 color-blue":"shixun_repertoire mr20"} <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> 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> </div>
</Menu.Item> </Menu.Item>
</Menu> </Menu>
) )
} }
render() { render() {
let { order,sortList,search,page,total_count,discipline_id }=this.state; let { order, sortList, search, page, total_count, discipline_id } = this.state;
let pathstype=false; let pathstype = false;
if(this.props&&this.props.mygetHelmetapi!=null){ if (this.props && this.props.mygetHelmetapi != null) {
let paths="/paths"; let paths = "/paths";
this.props.mygetHelmetapi.navbar.map((item,key)=>{ this.props.mygetHelmetapi.navbar.map((item, key) => {
var reg = RegExp(item.link); var reg = RegExp(item.link);
if(paths.match(reg)){ if (paths.match(reg)) {
if(item.hidden===true){ if (item.hidden === true) {
pathstype=true pathstype = true
} }
} }
@ -185,21 +199,21 @@ class ShixunPathSearch extends Component{
} }
return ( return (
<div> <div>
{this.state.updata===undefined?"":<UpgradeModals {this.state.updata === undefined ? "" : <UpgradeModals
{...this.state} {...this.state}
/>} />}
<style> <style>
{ {
` `
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 0px !important; width: 0px !important;
} }
.pathImg{ .pathImg{
width: 100%; width: 100%;
height: 300px; 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-color: #000a4f;
/* background-size: cover; */ /* background-size: cover; */
background-position: center; background-position: center;
@ -217,57 +231,39 @@ class ShixunPathSearch extends Component{
} }
a{text-decoration:none !important;} a{text-decoration:none !important;}
` `
} }
</style> </style>
<div className="pr"> <div className="pr">
<div className="pathImg"></div> <div className="pathImg"></div>
<div className="edu-back-white padding20 pathIndexNav"> <div className="edu-back-white padding20 pathIndexNav">
<ul className="educontent clearfix"> <ul className="educontent clearfix">
<li className={discipline_id > 0 ? "" : "active"}><a onClick={(e)=>this.changeSelect(e,undefined)}>全部</a></li> <li className={discipline_id > 0 ? "" : "active"}><a onClick={(e) => this.changeSelect(e, undefined)}>全部</a></li>
{ {
sortList && sortList.map((item,key)=>{ sortList && sortList.map((item, key) => {
return( return (
<li className={discipline_id == `${item.id}` ? "active" : ""} onClick={(e)=>this.changeSelect(e,`${item.id}`,item.sub_disciplines.length)} key={key}> <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"> <Dropdown disabled={item.sub_disciplines.length === 0} overlay={() => this.getmenu(item.sub_disciplines, item)} placement="bottomCenter">
<a value={item.id}>{item.name}</a> <a value={item.id}>{item.name}</a>
</Dropdown> </Dropdown>
</li> </li>
) )
}) })
} }
</ul> </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>*/}
</div> </div>
<PathCard {...this.props} {...this.state}></PathCard> </div>
{ <KeywordList btnUrl={btnUrl} onChangeLabel={this.onChangeLabel.bind(this)} OnSearchInput={this.OnSearchInput.bind(this)} onNewHandler={this.getUser.bind(this, '/paths/new')} btnStyle={{ top: '92px' }} />
this.state.pathList===null?"":total_count > 16 &&
<PathCard {...this.props} {...this.state}></PathCard>
{
this.state.pathList === null ? "" : total_count > 16 &&
<div className="educontent mb80 edu-txt-center mt10"> <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> </div>
) )
} }
} }
export default ShixunPathSearch; export default ShixunPathSearch;

@ -24,6 +24,7 @@ import QuestionModalys from "./component/QuestionModalys";
//exam_id 试卷的id //exam_id 试卷的id
var Undoclickable=true; var Undoclickable=true;
var myGrandtotal=false;
class NewMyShixunModel extends Component { class NewMyShixunModel extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -70,6 +71,7 @@ class NewMyShixunModel extends Component {
isVisible: false, isVisible: false,
selectionbools:false, selectionbools:false,
chakanjiexiboolindex:"无", chakanjiexiboolindex:"无",
} }
} }
@ -367,7 +369,9 @@ class NewMyShixunModel extends Component {
//计算 //计算
getdataslen=(arr)=>{ getdataslen=(arr)=>{
var contes=0; myGrandtotal=false;
let contes=0;
let Grandtotal=0;
for(let data of arr) { for(let data of arr) {
if(data.item_type==="PROGRAM"){ if(data.item_type==="PROGRAM"){
//编程题 //编程题
@ -376,8 +380,10 @@ class NewMyShixunModel extends Component {
}else{ }else{
//未选用 //未选用
if(data.program_attr.status===1){ if(data.program_attr.status===1){
//已发布 //已发布1 未发布0
contes=contes+1; contes=contes+1;
}else {
Grandtotal=Grandtotal+1;
} }
} }
@ -399,11 +405,28 @@ class NewMyShixunModel extends Component {
selectionbools:false, selectionbools:false,
selectallquestionsonthispages:false, selectallquestionsonthispages:false,
}) })
}else { }
this.setState({ else {
selectionbools:true, try {
selectallquestionsonthispages:true, if(arr.length===Grandtotal){
}) myGrandtotal=true;
this.setState({
selectionbools:false,
selectallquestionsonthispages:false,
})
}else{
this.setState({
selectionbools:true,
selectallquestionsonthispages:true,
})
}
}catch (e) {
this.setState({
selectionbools:true,
selectallquestionsonthispages:true,
})
}
} }
} }
@ -870,6 +893,10 @@ class NewMyShixunModel extends Component {
} }
//全选试题库 //全选试题库
selectallquestionsonthispage=(bool)=>{ selectallquestionsonthispage=(bool)=>{
if(myGrandtotal===true){
this.props.showNotification(`本页全部试题未发布,不能选择`);
return
}
var item_idsdata=[]; var item_idsdata=[];
var arr= this.state.Contentdata.items; var arr= this.state.Contentdata.items;

@ -24,6 +24,7 @@ import QuestionModalys from "./component/QuestionModalys";
import Certifiedprofessional from "../modals/Certifiedprofessional"; import Certifiedprofessional from "../modals/Certifiedprofessional";
var Undoclickable=true; var Undoclickable=true;
var myGrandtotal=false;
class Question extends Component { class Question extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -302,7 +303,9 @@ class Question extends Component {
//计算 //计算
getdataslen=(arr)=>{ getdataslen=(arr)=>{
var contes=0; myGrandtotal=false;
let contes=0;
let Grandtotal=0;
for(let data of arr) { for(let data of arr) {
if(data.item_type==="PROGRAM"){ if(data.item_type==="PROGRAM"){
//编程题 //编程题
@ -311,8 +314,10 @@ class Question extends Component {
}else{ }else{
//未选用 //未选用
if(data.program_attr.status===1){ if(data.program_attr.status===1){
//已发布 //已发布1 未发布0
contes=contes+1; contes=contes+1;
}else{
Grandtotal=Grandtotal+1;
} }
} }
@ -334,11 +339,27 @@ class Question extends Component {
selectionbools:false, selectionbools:false,
selectallquestionsonthispages:false, selectallquestionsonthispages:false,
}) })
}else { } else {
this.setState({ try {
selectionbools:true, if(arr.length===Grandtotal){
selectallquestionsonthispages:true, myGrandtotal=true;
}) this.setState({
selectionbools:false,
selectallquestionsonthispages:false,
})
}else{
this.setState({
selectionbools:true,
selectallquestionsonthispages:true,
})
}
}catch (e) {
this.setState({
selectionbools:true,
selectallquestionsonthispages:true,
})
}
} }
} }
@ -767,6 +788,12 @@ class Question extends Component {
} }
//全选试题库 //全选试题库
selectallquestionsonthispage=(bool)=>{ selectallquestionsonthispage=(bool)=>{
if(myGrandtotal===true){
this.props.showNotification(`本页全部试题未发布,不能选择`);
return
}
var item_idsdata=[]; var item_idsdata=[];
var arr= this.state.Contentdata.items; var arr= this.state.Contentdata.items;

@ -441,12 +441,12 @@ class Contentpart extends Component {
<div className=" w100s mb10"> <div className=" w100s mb10">
{ {
defaultActiveKey===1||defaultActiveKey==="1"? defaultActiveKey===1||defaultActiveKey==="1"?
<Contentquestionbank {...this.props} {...this.state} selectallquestionsonthispage={(bool)=>this.props.selectallquestionsonthispage(bool)} ></Contentquestionbank> <Contentquestionbank {...this.props} {...this.state} selectallquestionsonthispages={this.props.selectallquestionsonthispages} selectallquestionsonthispage={(bool)=>this.props.selectallquestionsonthispage(bool)} ></Contentquestionbank>
:"" :""
} }
{ {
defaultActiveKey===0||defaultActiveKey==="0"? defaultActiveKey===0||defaultActiveKey==="0"?
<Contentquestionbank {...this.props} {...this.state} selectallquestionsonthispage={(bool)=>this.props.selectallquestionsonthispage(bool)}></Contentquestionbank> <Contentquestionbank {...this.props} {...this.state} selectallquestionsonthispages={this.props.selectallquestionsonthispages} selectallquestionsonthispage={(bool)=>this.props.selectallquestionsonthispage(bool)}></Contentquestionbank>
:"" :""
} }
</div> </div>

@ -305,7 +305,7 @@ class Headplugselections extends Component {
} }
<div className="fl pr shaiAllItem mt1"> <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===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==="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==="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> <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} <Select style={{width: '270px'}} disabled={this.state.boolnews} onChange={this.handleFormtixing}
placeholder="请选择..."> placeholder="请选择...">
{/*<Option value="PROGRAM">编程题</Option>*/} <Option value="PROGRAM">编程题</Option>
<Option value="SINGLE">单选题</Option> <Option value="SINGLE">单选题</Option>
<Option value="MULTIPLE">多选题</Option> <Option value="MULTIPLE">多选题</Option>
<Option value="JUDGMENT">判断题</Option> <Option value="JUDGMENT">判断题</Option>

@ -472,7 +472,7 @@ class Listjihe extends Component {
<div className="w50s xaxisreverseorder"> <div className="w50s xaxisreverseorder">
{ {
items.choosed === true ? items.choosed === true ?
<p className="selectionss xiaoshou" onClick={() => this.Selectingpracticaltrainings(items.id)}> <p className="selectionssradiu xiaoshou" onClick={() => this.Selectingpracticaltrainings(items.id)}>
{/*<i className="iconfont icon-jianhao font-12 lg ml7 lh30 icontianjiadaohangcolor mr5"></i>*/} {/*<i className="iconfont icon-jianhao font-12 lg ml7 lh30 icontianjiadaohangcolor mr5"></i>*/}
<span className=" lh30">撤销</span></p> <span className=" lh30">撤销</span></p>
: :

@ -391,6 +391,15 @@
line-height: 30px; line-height: 30px;
color: #FFFFFF; color: #FFFFFF;
} }
.selectionssradiu{
width:88px;
height:30px;
background:#DC143C;
border-radius:4px;
text-align: center;
line-height: 30px;
color: #FFFFFF;
}
.lh30{ .lh30{
line-height: 30px; line-height: 30px;

File diff suppressed because it is too large Load Diff

@ -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 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 axios from 'axios';
import { Spin } from 'antd';
import { TPMIndexHOC } from '../TPMIndexHOC'; import { TPMIndexHOC } from '../TPMIndexHOC';
import { SnackbarHOC, getImageUrl } from 'educoder';
import { SnackbarHOC,getImageUrl} from 'educoder'; import ShixunCardList from './shixun-keyword-list';
import ShixunSearchBar from './shixun-search-bar';
import ShixunCardList from './ShixunCardList'; import ShixunCard from './shixun-card';
import ShixunSearchBar from './ShixunSearchBar';
import ShixunCard from './ShixunCard';
import UpgradeModals from '../../modals/UpgradeModals'; import UpgradeModals from '../../modals/UpgradeModals';
import GotoQQgroup from '../../../modal/GotoQQgroup'
import btnUrl from './btn-new.png'
const queryString = require('query-string'); const queryString = require('query-string');
const $ = window.$;
class ShixunsIndex extends Component { class ShixunsIndex extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state={ this.state = {
order_by: "new", order_by: "new",
page:1, showQQ: false,
limit:16, page: 1,
keyword:"", limit: 16,
status:0, keyword: "",
diff:0, status: 0,
diff: 0,
tag_level: 1, tag_level: 1,
tag_id:'', tag_id: '',
middleshixundata:[], middleshixundata: [],
typepvisible:true, typepvisible: true,
pages:1, pages: 1,
search_tags:null, search_tags: null,
parsedid:undefined, parsedid: undefined,
newtag_level:undefined, newtag_level: undefined,
newpalce:undefined, newpalce: undefined,
sort:"desc" sort: "desc"
} }
} }
componentDidMount(){ componentDidMount() {
const upsystem=`/users/system_update.json`; const upsystem = `/users/system_update.json`;
axios.get(upsystem).then((response)=>{ axios.get(upsystem).then((response) => {
let updata=response.data; let updata = response.data;
this.setState({ this.setState({
updata:updata updata: updata
}) })
}).catch((error)=>{ }).catch((error) => {
console.log(error); console.log(error);
}) })
let _keyword; let _keyword;
if (window.__headSearchKeyword) { if (window.__headSearchKeyword) {
this.setState({ keyword: window.__headSearchKeyword }) this.setState({ keyword: window.__headSearchKeyword })
_keyword = window.__headSearchKeyword _keyword = window.__headSearchKeyword
delete window.__headSearchKeyword delete window.__headSearchKeyword
} }
const parsed = queryString.parse(this.props.location.search); const parsed = queryString.parse(this.props.location.search);
if(parsed.id===undefined&&parsed.type===undefined){ if (parsed.id === undefined && parsed.type === undefined) {
let {order_by, tag_level, tag_id, page, limit, keyword, status, diff} = this.state; let { order_by, tag_level, tag_id, page, limit, keyword, status, diff } = this.state;
let params={ let params = {
order_by:order_by, order_by: order_by,
tag_level:tag_level, tag_level: tag_level,
tag_id:tag_id, tag_id: tag_id,
page:page, page: page,
limit:limit, limit: limit,
keyword: _keyword || keyword , keyword: _keyword || keyword,
status:status, status: status,
diff:diff, diff: diff,
sort: "desc" sort: "desc"
} }
this.shixunresultend(params); this.shixunresultend(params);
}else{ } else {
let {order_by,page, limit, keyword, status, diff} = this.state; let { order_by, page, limit, keyword, status, diff } = this.state;
let nawparsed=parsed.type; let nawparsed = parsed.type;
let newpalce=parsed.palce; let newpalce = parsed.palce;
if(nawparsed==="rep"){ if (nawparsed === "rep") {
nawparsed=1 nawparsed = 1
} }
else if(nawparsed==="sub"){ else if (nawparsed === "sub") {
nawparsed=2 nawparsed = 2
}else if(nawparsed==="tag"){ } else if (nawparsed === "tag") {
nawparsed=3 nawparsed = 3
} }
let params={ let params = {
order_by:order_by, order_by: order_by,
tag_level:nawparsed, tag_level: nawparsed,
tag_id:parsed.id, tag_id: parsed.id,
page:page, page: page,
limit:limit, limit: limit,
keyword: _keyword || keyword, keyword: _keyword || keyword,
status:status, status: status,
diff:diff, diff: diff,
sort: "desc" sort: "desc"
} }
this.setState({ this.setState({
parsedid:parsed.id, parsedid: parsed.id,
newtag_level:nawparsed, newtag_level: nawparsed,
tag_level:nawparsed, tag_level: nawparsed,
newpalce:newpalce, newpalce: newpalce,
tag_id:parsed.id, tag_id: parsed.id,
keyword: _keyword || keyword, keyword: _keyword || keyword,
}) })
this.shixunresultend(params); this.shixunresultend(params);
@ -117,221 +103,219 @@ class ShixunsIndex extends Component {
} }
allUpdatashixunlist=()=>{ allUpdatashixunlist = () => {
let{sort,order_by}=this.state; let { sort, order_by } = this.state;
this.setState({ this.setState({
tag_level: 1, tag_level: 1,
tag_id:'', tag_id: '',
page: 1, page: 1,
limit: 16, limit: 16,
keyword:'', keyword: '',
status: 0, status: 0,
diff: 0, diff: 0,
}) })
let params={ let params = {
order_by:order_by, order_by: order_by,
tag_level: 1, tag_level: 1,
tag_id:'', tag_id: '',
page: 1, page: 1,
limit: 16, limit: 16,
keyword:'', keyword: '',
status: 0, status: 0,
diff: 0, diff: 0,
sort:sort sort: sort
} }
this.shixunresultend(params) this.shixunresultend(params)
} }
Updatasearchlist=(value)=>{ Updatasearchlist = (value) => {
if (value[1].tag_id === " ") { if (value[1].tag_id === " ") {
this.setState({ this.setState({
keyword: "" keyword: ""
}) })
} }
this.setState({ this.setState({
tag_level:value[0].tag_level, tag_level: value[0].tag_level,
tag_id:value[1].tag_id, tag_id: value[1].tag_id,
typepvisible:true typepvisible: true
}) })
let {order_by, sort, limit, keyword, status, diff} = this.state; let { order_by, sort, limit, keyword, status, diff } = this.state;
let params={ let params = {
order_by:order_by, order_by: order_by,
tag_level:value[0].tag_level, tag_level: value[0].tag_level,
tag_id:value[1].tag_id, tag_id: value[1].tag_id,
page:1, page: 1,
limit:limit, limit: limit,
keyword:keyword, keyword: keyword,
status:status, status: status,
diff:diff, diff: diff,
sort:sort sort: sort
} }
this.shixunresultend(params) this.shixunresultend(params)
} }
StatusEnquiry=(key)=>{ StatusEnquiry = (key) => {
let Vrl=`/shixuns.json`;
let newstatus; let newstatus;
let newdiff; let newdiff;
if(key[0].type===1){ if (key[0].type === 1) {
this.setState({ this.setState({
status: key[1].value, status: key[1].value,
typepvisible:true typepvisible: true
}) })
newstatus=key[1].value; newstatus = key[1].value;
newdiff=this.state.diff; newdiff = this.state.diff;
}else if(key[0].type===2){ } else if (key[0].type === 2) {
this.setState({ this.setState({
diff: key[1].value, diff: key[1].value,
typepvisible:true typepvisible: true
}) })
newdiff=key[1].value; newdiff = key[1].value;
newstatus=this.state.status; newstatus = this.state.status;
} }
let params= { let params = {
order_by:this.state.order_by, order_by: this.state.order_by,
tag_level:this.state.tag_level, tag_level: this.state.tag_level,
tag_id:this.state.tag_id, tag_id: this.state.tag_id,
page:1, page: 1,
limit:this.state.limit, limit: this.state.limit,
keyword:this.state.keyword, keyword: this.state.keyword,
status:newstatus, status: newstatus,
diff:newdiff, diff: newdiff,
} }
this.shixunresultend(params) this.shixunresultend(params)
} }
OnSearchInput=(value,type)=>{ OnSearchInput = (value, type) => {
if(type===true){ if (type === true) {
this.setState({ this.setState({
keyword:value, keyword: value,
typepvisible:true, typepvisible: true,
pages:1 pages: 1
}) })
let {order_by, tag_level, tag_id, sort, limit, status, diff} = this.state; let { order_by, tag_level, tag_id, sort, limit, status, diff } = this.state;
let params= { let params = {
order_by:order_by, order_by: order_by,
tag_level:tag_level, tag_level: tag_level,
tag_id:tag_id, tag_id: tag_id,
page:1, page: 1,
limit:limit, limit: limit,
keyword:value, keyword: value,
status:status, status: status,
diff:diff, diff: diff,
sort:sort 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 //types
this.setState({ this.setState({
order_by:"mine", order_by: "mine",
typepvisible:true, typepvisible: true,
pages:1, pages: 1,
}) })
let{tag_level,tag_id,page,limit,keyword,status,diff,sort}=this.state; let { tag_level, tag_id, page, limit, keyword, status, diff, sort } = this.state;
let newsort=sort; let newsort = sort;
if(newsort===undefined){ if (newsort === undefined) {
newsort="desc" newsort = "desc"
} }
let params= { let params = {
order_by:"mine", order_by: "mine",
tag_level:tag_level, tag_level: tag_level,
tag_id:tag_id, tag_id: tag_id,
page:1, page: 1,
limit:limit, limit: limit,
keyword:keyword, keyword: keyword,
status:status, status: status,
diff:diff, diff: diff,
sort:newsort sort: newsort
} }
this.shixunresultend(params) this.shixunresultend(params)
} }
shixunsPage=(value)=>{ shixunsPage = (value) => {
this.setState({ this.setState({
page:value, page: value,
typepvisible:true, typepvisible: true,
pages:value pages: value
}) })
let {order_by, tag_level, tag_id, limit, keyword, status, diff,sort} = this.state; let { order_by, tag_level, tag_id, limit, keyword, status, diff, sort } = this.state;
let params= { let params = {
order_by:order_by, order_by: order_by,
tag_level:tag_level, tag_level: tag_level,
tag_id:tag_id, tag_id: tag_id,
page:value, page: value,
limit:limit, limit: limit,
keyword:keyword, keyword: keyword,
status:status, status: status,
diff:diff, diff: diff,
sort:sort sort: sort
} }
let Url=`/shixuns.json`; let Url = `/shixuns.json`;
axios.get(Url,{ axios.get(Url, {
params params
}).then((response)=> { }).then((response) => {
if(response.status===200){ if (response.status === 200) {
this.setState({ this.setState({
middleshixundata: response.data, middleshixundata: response.data,
typepvisible:false, typepvisible: false,
}); });
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
ShixunsState=(val,type,sorts)=>{ ShixunsState = (type, sorts) => {
// sort, // sort,
let {tag_level, tag_id, page, limit, keyword, status, diff,sort} = this.state; let { tag_level, tag_id, page, limit, keyword, status, diff, sort } = this.state;
let newsort=sorts?sorts:sort; let newsort = sorts ? sorts : sort;
this.setState({ this.setState({
order_by:type, order_by: type,
typepvisible:true, typepvisible: true,
pages:1, pages: 1,
sort:sorts?sorts:sort sort: sorts ? sorts : sort
}) })
let params let params
// let vals=false // let vals=false
if(newsort===undefined){ if (newsort === undefined) {
newsort="desc" newsort = "desc"
}else{ } else {
newsort=sorts?sorts:sort newsort = sorts ? sorts : sort
} }
params= { params = {
order_by:type, order_by: type,
tag_level:tag_level, tag_level: tag_level,
tag_id:tag_id, tag_id: tag_id,
page:1, page: 1,
limit:limit, limit: limit,
keyword:keyword, keyword: keyword,
status:status, status: status,
diff:diff, diff: diff,
sort:newsort sort: newsort
} }
this.shixunresultend(params) this.shixunresultend(params)
} }
Shixunsupcircles=(sort)=>{ Shixunsupcircles = (sort) => {
console.log(sort) console.log(sort)
this.setState({ this.setState({
sort:sort sort: sort
}) })
let { let {
order_by, order_by,
@ -345,115 +329,139 @@ class ShixunsIndex extends Component {
let params= { let params = {
order_by:order_by, order_by: order_by,
tag_level:tag_level, tag_level: tag_level,
tag_id:tag_id, tag_id: tag_id,
page:1, page: 1,
limit:limit, limit: limit,
keyword:keyword, keyword: keyword,
status:status, status: status,
diff:diff, diff: diff,
sort:sort sort: sort
} }
this.shixunresultend(params) 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) => {
shixunresultend=(params)=>{ let Url = `/shixuns.json`;
let Url=`/shixuns.json`; axios.get(Url, {
axios.get(Url,{
params params
}).then((response)=> { }).then((response) => {
// TODO 有keyword返回值时 显示一共有多少条记录 // TODO 有keyword返回值时 显示一共有多少条记录
if(response.status===200){ if (response.status === 200) {
this.setState({ this.setState({
search_tags:response.data.search_tags, search_tags: response.data.search_tags,
middleshixundata: response.data, middleshixundata: response.data,
typepvisible:false, typepvisible: false,
pages:1 pages: 1
}); });
} }
}).catch((error)=>{ }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
render() { 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) // console.log(this.state.updata)
return ( return (
<div className="newMain clearfix backFAFAFA"> <div className="newMain clearfix backFAFAFA">
{this.state.updata===undefined?"":<UpgradeModals {this.state.updata === undefined ? "" : <UpgradeModals
{...this.state} {...this.state}
/>} />}
<style> <style>
{ {
` ::-webkit-scrollbar { ` ::-webkit-scrollbar {
width: 0px !important; width: 0px !important;
} }
.myshixin-head{ .myshixin-head{
width: 100%; width: 100%;
height: 240px; 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-color: #081C4B;
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
` `
} }
</style> </style>
{ {
this.props.mygetHelmetapi&&this.props.mygetHelmetapi.shixun_banner_url? this.props.mygetHelmetapi && this.props.mygetHelmetapi.shixun_banner_url ?
<div className="myshixin-head pr" > <div className="myshixin-head pr" >
<div className="edu-txt-center pathNavLine"> <div className="edu-txt-center pathNavLine">
<div className="inline path-nav"> <div className="inline path-nav">
</div> </div>
</div> </div>
</div> </div>
: :
"" ""
} }
{/*<Spin spinning={typepvisible} size="large" style={{marginTop:'15%'}}>*/} <ShixunSearchBar
<ShixunSearchBar Updatasearchlist={this.Updatasearchlist.bind(this)}
Updatasearchlist={this.Updatasearchlist.bind(this)} allUpdatashixunlist={this.allUpdatashixunlist}
allUpdatashixunlist={this.allUpdatashixunlist} StatusEnquiry={this.StatusEnquiry.bind(this)}
StatusEnquiry={this.StatusEnquiry.bind(this)} OnSearchInput={this.OnSearchInput.bind(this)}
OnSearchInput={this.OnSearchInput.bind(this)} keyword={keyword}
keyword={keyword} parsedid={parsedid}
parsedid={parsedid} newtag_level={newtag_level}
newtag_level={newtag_level} newpalce={newpalce}
newpalce={newpalce} {...this.props}
{...this.props} {...this.state}
{...this.state} />
/>
{
<ShixunCardList showQQ ? <GotoQQgroup goshowqqgtounp={showQQ} setgoshowqqgtounp={this.setShowQQ.bind(this)}></GotoQQgroup> :
ShixunsState={this.ShixunsState.bind(this)} ""
ShixunsSwitch={this.ShixunsSwitch.bind(this)} }
Shixunsupcircles={this.Shixunsupcircles.bind(this)} <ShixunCardList
allUpdatashixunlist={this.allUpdatashixunlist} onChangeLabel={this.ShixunsState.bind(this)}
{...this.props} ShixunsSwitch={this.ShixunsSwitch.bind(this)}
{...this.state} Shixunsupcircles={this.Shixunsupcircles.bind(this)}
OnSearchInput={this.OnSearchInput.bind(this)} onNewHandler={this.onNewHandler.bind(this)}
/> btnUrl={btnUrl}
{/*下方图片*/} OnSearchInput={this.OnSearchInput.bind(this)}
<ShixunCard />
typepvisible={typepvisible} {/*下方图片*/}
middleshixundata={middleshixundata.shixuns} <ShixunCard
totalcount={middleshixundata.total_count} typepvisible={typepvisible}
pagination={middleshixundata.pagination} middleshixundata={middleshixundata.shixuns}
pages={pages} totalcount={middleshixundata.total_count}
shixunsPage={this.shixunsPage.bind(this)} pagination={middleshixundata.pagination}
/> pages={pages}
shixunsPage={this.shixunsPage.bind(this)}
/>
{/*</Spin>*/} {/*</Spin>*/}
</div> </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,78 @@
.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: 77px;
z-index: 10;
}
.btn-join {
position: absolute;
width: 40px;
right: 39px;
top: 133px;
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{ .iconfontShixunSearchBar {
z-index: 1000; z-index: 1000;
position: absolute; position: absolute;
right: 3px; right: 3px;
top: 0px; top: 0px;
} }
.pt_b_26{
padding:26px 0px; .pt_b_26 {
padding: 26px 0px;
}
.diffSelect {
margin-left: 20px !important;
} }
.diffSelect{ .ant-input-search-button {
margin-left:20px !important; border: 1px solid transparent;
}
.ant-input-search-button{
/*margin-right: 10px;*/
border: 1px solid transparent;
}
.Mousebox{
width: 800px !important;
} }
.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%; margin-left: 32%;
} }
.square-img{ .square-img {
min-height: 210px; min-height: 210px;
} }
.task-hide{
.task-hide {
margin-bottom: 0em; margin-bottom: 0em;
} }
.backFAFAFA{
background:#FAFAFA; .backFAFAFA {
background: #FAFAFA;
} }
.demo { .demo {
width: 500px; width: 500px;
background-color: #0dcecb; background-color: #0dcecb;
text-align: center; text-align: center;
padding:50px; padding: 50px;
} }
.next-loading { .next-loading {
margin-bottom: 5px; margin-bottom: 5px;
width:100%; width: 100%;
} }
.next-rating-overlay .next-icon{ .next-rating-overlay .next-icon {
color: #FFA800!important; color: #FFA800 !important;
} }
.custom-pagination { .custom-pagination {
@ -36,7 +39,7 @@
margin-left: 10px; margin-left: 10px;
} }
.ml425{ .ml425 {
margin-left:42.5%; margin-left: 42.5%;
margin-top:20px; 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;
}
}
Loading…
Cancel
Save