dev_cs_new
parent
6b7eeb5a06
commit
2b70af1355
@ -1,251 +1,253 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { Redirect } from 'react-router';
|
import { Redirect } from 'react-router';
|
||||||
|
|
||||||
import { BrowserRouter as Router, Route} from "react-router-dom";
|
import { BrowserRouter as Router, Route} from "react-router-dom";
|
||||||
|
|
||||||
import { Switch ,Input,Tooltip,Icon} from 'antd';
|
import { Switch ,Input,Tooltip,Icon} from 'antd';
|
||||||
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
|
|
||||||
import 'antd/lib/switch/style/index.css'
|
import 'antd/lib/switch/style/index.css'
|
||||||
|
|
||||||
import './shixunCss/ShixunCardList.css';
|
import './shixunCss/ShixunCardList.css';
|
||||||
|
|
||||||
import { on, off } from 'educoder'
|
import { on, off } from 'educoder'
|
||||||
|
|
||||||
const $ = window.$;
|
const $ = window.$;
|
||||||
|
|
||||||
const Search = Input.Search;
|
const Search = Input.Search;
|
||||||
|
|
||||||
class ShixunCardList extends Component {
|
class ShixunCardList extends Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state={
|
this.state={
|
||||||
allevent:"desc",
|
allevent:"desc",
|
||||||
mine:0,
|
mine:0,
|
||||||
InputValue: props.keyword || "",
|
InputValue: props.keyword || "",
|
||||||
typemy:0,
|
typemy:0,
|
||||||
hots:0,
|
hots:0,
|
||||||
news:0,
|
news:0,
|
||||||
shixunid:"",
|
shixunid:"",
|
||||||
upcircle:false,
|
upcircle:false,
|
||||||
typekeyid:undefined,
|
typekeyid:undefined,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate = (prevProps, prevState) => {
|
componentDidUpdate = (prevProps, prevState) => {
|
||||||
if (this.props.keyword != prevProps.keyword) {
|
if (this.props.keyword != prevProps.keyword) {
|
||||||
this.setState({
|
this.setState({
|
||||||
InputValue: this.props.keyword
|
InputValue: this.props.keyword
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentDidMount = () => {
|
componentDidMount = () => {
|
||||||
on('searchKeywordChange', (event, data) => {
|
on('searchKeywordChange', (event, data) => {
|
||||||
// console.log(data)
|
// console.log(data)
|
||||||
this.Input_search(data)
|
this.Input_search(data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
componentWillUnmount = () => {
|
componentWillUnmount = () => {
|
||||||
off('searchKeywordChange')
|
off('searchKeywordChange')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
latestHot=(e,key)=>{
|
latestHot=(e,key)=>{
|
||||||
|
|
||||||
let{upcircle,typekeyid}=this.state;
|
let{upcircle,typekeyid}=this.state;
|
||||||
|
|
||||||
let id = e.target.id;
|
let id = e.target.id;
|
||||||
$("#"+id).siblings().removeClass("active");
|
$("#"+id).siblings().removeClass("active");
|
||||||
$("#"+id).addClass("active");
|
$("#"+id).addClass("active");
|
||||||
|
|
||||||
let type;
|
let type;
|
||||||
|
|
||||||
if(id==="all"){
|
if(id==="all"){
|
||||||
type="publish_time";
|
type="publish_time";
|
||||||
}
|
}
|
||||||
if(id==="hot"){
|
if(id==="hot"){
|
||||||
type="hot";
|
type="hot";
|
||||||
}else if(id==="new"){
|
}else if(id==="new"){
|
||||||
type="new";
|
type="new";
|
||||||
|
|
||||||
}
|
}
|
||||||
if(typekeyid===key){
|
if(typekeyid===key){
|
||||||
if(upcircle===true){
|
if(upcircle===true){
|
||||||
this.setState({
|
this.setState({
|
||||||
upcircle:false,
|
upcircle:false,
|
||||||
})
|
})
|
||||||
this.props.Shixunsupcircles("desc")
|
this.props.Shixunsupcircles("desc")
|
||||||
}else if(upcircle===false){
|
}else if(upcircle===false){
|
||||||
this.setState({
|
this.setState({
|
||||||
upcircle:true,
|
upcircle:true,
|
||||||
})
|
})
|
||||||
this.props.Shixunsupcircles("asc")
|
this.props.Shixunsupcircles("asc")
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.setState({
|
this.setState({
|
||||||
typekeyid:key
|
typekeyid:key
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//allevent
|
//allevent
|
||||||
this.props.ShixunsState(false,type);
|
this.props.ShixunsState(false,type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onSwitchChange=(e,key)=>{
|
onSwitchChange=(e,key)=>{
|
||||||
let id=e.target.id
|
let id=e.target.id
|
||||||
$("#"+id).siblings().removeClass("active");
|
$("#"+id).siblings().removeClass("active");
|
||||||
$("#"+id).addClass("active");
|
$("#"+id).addClass("active");
|
||||||
let {typemy,upcircle,typekeyid}=this.state;
|
let {typemy,upcircle,typekeyid}=this.state;
|
||||||
|
|
||||||
if(typekeyid===key){
|
if(typekeyid===key){
|
||||||
if(upcircle===true){
|
if(upcircle===true){
|
||||||
this.setState({
|
this.setState({
|
||||||
upcircle:false,
|
upcircle:false,
|
||||||
})
|
})
|
||||||
this.props.Shixunsupcircles("desc")
|
this.props.Shixunsupcircles("desc")
|
||||||
}else if(upcircle===false){
|
}else if(upcircle===false){
|
||||||
this.setState({
|
this.setState({
|
||||||
upcircle:true
|
upcircle:true
|
||||||
})
|
})
|
||||||
this.props.Shixunsupcircles("asc")
|
this.props.Shixunsupcircles("asc")
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.setState({
|
this.setState({
|
||||||
typekeyid:key
|
typekeyid:key
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(typemy===0){
|
if(typemy===0){
|
||||||
this.setState({
|
this.setState({
|
||||||
typemy:1
|
typemy:1
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
this.setState({
|
this.setState({
|
||||||
typemy:0
|
typemy:0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// allevent
|
// allevent
|
||||||
this.props.ShixunsSwitch();
|
this.props.ShixunsSwitch();
|
||||||
}
|
}
|
||||||
//输入框搜索
|
//输入框搜索
|
||||||
Input_search = (value) => {
|
Input_search = (value) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
InputValue: value
|
InputValue: value
|
||||||
})
|
})
|
||||||
this.props.OnSearchInput(value,true);
|
this.props.OnSearchInput(value,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Input_searchs = (e) => {
|
Input_searchs = (e) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
InputValue: e.target.value
|
InputValue: e.target.value
|
||||||
})
|
})
|
||||||
this.props.OnSearchInput(e.target.value,false);
|
this.props.OnSearchInput(e.target.value,false);
|
||||||
}
|
}
|
||||||
upcircles=(val)=>{
|
upcircles=(val)=>{
|
||||||
if(val==="asc"){
|
if(val==="asc"){
|
||||||
this.setState({
|
this.setState({
|
||||||
upcircle:false,
|
upcircle:false,
|
||||||
})
|
})
|
||||||
this.props.Shixunsupcircles("desc")
|
this.props.Shixunsupcircles("desc")
|
||||||
}else if(val==="desc"){
|
}else if(val==="desc"){
|
||||||
this.setState({
|
this.setState({
|
||||||
upcircle:true
|
upcircle:true
|
||||||
})
|
})
|
||||||
this.props.Shixunsupcircles("asc")
|
this.props.Shixunsupcircles("asc")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
render(){
|
render(){
|
||||||
let {mine,InputValue,upcircle}=this.state;
|
let {mine,InputValue,upcircle}=this.state;
|
||||||
return (
|
return (
|
||||||
<div className="educontent mt20">
|
<div className="educontent mt20">
|
||||||
<div className="clearfix">
|
<div className="clearfix">
|
||||||
|
|
||||||
<div className="fl mr20 font-16 bestChoose shixun_repertoire active"
|
<div className="fl mr20 font-16 bestChoose shixun_repertoire active"
|
||||||
id={"all"}
|
id={"all"}
|
||||||
onClick={(e)=>this.latestHot(e,1)}>全部
|
onClick={(e)=>this.latestHot(e,1)}>全部
|
||||||
</div>
|
</div>
|
||||||
<div className="fl mr20 font-16 bestChoose shixun_repertoire"
|
<div className="fl mr20 font-16 bestChoose shixun_repertoire"
|
||||||
id={mine}
|
id={mine}
|
||||||
onClick={(e)=>this.onSwitchChange(e,2)}>我的
|
onClick={(e)=>this.onSwitchChange(e,2)}>我的
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="fl mr20 font-16 bestChoose shixun_repertoire"
|
<div className="fl mr20 font-16 bestChoose shixun_repertoire"
|
||||||
id="hot"
|
id="new"
|
||||||
onClick={(e)=>this.latestHot(e,3)}>最热
|
onClick={(e)=>this.latestHot(e,4)}>最新
|
||||||
</div>
|
</div>
|
||||||
<div className="fl font-16 bestChoose shixun_repertoire"
|
|
||||||
id="new"
|
<div className="fl font-16 bestChoose shixun_repertoire"
|
||||||
onClick={(e)=>this.latestHot(e,4)}>最新
|
id="hot"
|
||||||
</div>
|
onClick={(e)=>this.latestHot(e,3)}>最热
|
||||||
|
</div>
|
||||||
<div className="fl font-16 bestChoose shixun_repertoire ml20 mt1"
|
|
||||||
style={{display:upcircle===true?"block":"none"}}
|
|
||||||
// onClick={()=>this.upcircles("asc")}
|
<div className="fl font-16 bestChoose shixun_repertoire ml20 mt1"
|
||||||
>
|
style={{display:upcircle===true?"block":"none"}}
|
||||||
<Tooltip placement="bottom" title={"升序"}>
|
// onClick={()=>this.upcircles("asc")}
|
||||||
<Icon type="up-circle" theme="twoTone" />
|
>
|
||||||
{/*<Icon type="sort-descending" />*/}
|
<Tooltip placement="bottom" title={"升序"}>
|
||||||
</Tooltip>
|
<Icon type="up-circle" theme="twoTone" />
|
||||||
</div>
|
{/*<Icon type="sort-descending" />*/}
|
||||||
<div className="fl font-16 bestChoose shixun_repertoire ml20 mt1"
|
</Tooltip>
|
||||||
// onClick={()=>this.upcircles("desc")}
|
</div>
|
||||||
style={{display:upcircle===true?"none":"block"}}
|
<div className="fl font-16 bestChoose shixun_repertoire ml20 mt1"
|
||||||
>
|
// onClick={()=>this.upcircles("desc")}
|
||||||
<Tooltip placement="bottom" title={"降序"}>
|
style={{display:upcircle===true?"none":"block"}}
|
||||||
<Icon type="down-circle" theme="twoTone" />
|
>
|
||||||
{/*<Icon type="sort-ascending" />*/}
|
<Tooltip placement="bottom" title={"降序"}>
|
||||||
</Tooltip>
|
<Icon type="down-circle" theme="twoTone" />
|
||||||
</div>
|
{/*<Icon type="sort-ascending" />*/}
|
||||||
|
</Tooltip>
|
||||||
<div className="fr mt3">
|
</div>
|
||||||
{/*<Search*/}
|
|
||||||
{/*style={{ width: 300 }}*/}
|
<div className="fr mt3">
|
||||||
{/*className="search-new-input fl"*/}
|
{/*<Search*/}
|
||||||
{/*placeholder="请输入创建者/实训/关卡名称进行搜索"*/}
|
{/*style={{ width: 300 }}*/}
|
||||||
{/*value={InputValue}*/}
|
{/*className="search-new-input fl"*/}
|
||||||
{/*onInput={this.Input_searchs}*/}
|
{/*placeholder="请输入创建者/实训/关卡名称进行搜索"*/}
|
||||||
{/*onSearch={value => this.Input_search(value)}*/}
|
{/*value={InputValue}*/}
|
||||||
{/*enterButton*/}
|
{/*onInput={this.Input_searchs}*/}
|
||||||
{/*/>*/}
|
{/*onSearch={value => this.Input_search(value)}*/}
|
||||||
|
{/*enterButton*/}
|
||||||
{/* <Search
|
{/*/>*/}
|
||||||
style={{ width: 300 }}
|
|
||||||
className="fl"
|
{/* <Search
|
||||||
placeholder="请输入创建者/实训/关卡名称进行搜索"
|
style={{ width: 300 }}
|
||||||
value={InputValue}
|
className="fl"
|
||||||
onInput={this.Input_searchs}
|
placeholder="请输入创建者/实训/关卡名称进行搜索"
|
||||||
onSearch={value => this.Input_search(value)}
|
value={InputValue}
|
||||||
autoComplete="off"
|
onInput={this.Input_searchs}
|
||||||
></Search> */}
|
onSearch={value => this.Input_search(value)}
|
||||||
</div>
|
autoComplete="off"
|
||||||
<div className="fr">
|
></Search> */}
|
||||||
<span className="fl color-grey-6 mr30 font-16 mt5" id="search_name">{
|
</div>
|
||||||
this.props.search_tags === null ? "" : this.props.search_tags
|
<div className="fr">
|
||||||
}</span>
|
<span className="fl color-grey-6 mr30 font-16 mt5" id="search_name">{
|
||||||
{/*<div className="fl mr5" style={{marginTop:'1px'}}>*/}
|
this.props.search_tags === null ? "" : this.props.search_tags
|
||||||
{/*/!* <div className="controlblue"></div>*/}
|
}</span>
|
||||||
{/*<span className="controlring"></span> *!/*/}
|
{/*<div className="fl mr5" style={{marginTop:'1px'}}>*/}
|
||||||
{/*<Switch*/}
|
{/*/!* <div className="controlblue"></div>*/}
|
||||||
{/*className="controlbtn mr10 mt10 pr"*/}
|
{/*<span className="controlring"></span> *!/*/}
|
||||||
{/*size="small"*/}
|
{/*<Switch*/}
|
||||||
{/*style={{marginTop:'1px'}}*/}
|
{/*className="controlbtn mr10 mt10 pr"*/}
|
||||||
{/*onChange={this.onSwitchChange}*/}
|
{/*size="small"*/}
|
||||||
{/*/>*/}
|
{/*style={{marginTop:'1px'}}*/}
|
||||||
{/*</div>*/}
|
{/*onChange={this.onSwitchChange}*/}
|
||||||
{/*<span className="fl font-16 cdefault" data-tip-down="隐藏我学习的实训">隐藏我的</span>*/}
|
{/*/>*/}
|
||||||
|
{/*</div>*/}
|
||||||
</div>
|
{/*<span className="fl font-16 cdefault" data-tip-down="隐藏我学习的实训">隐藏我的</span>*/}
|
||||||
<span className="fr color-grey-6 mr30 font-16" id="search_name"></span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<span className="fr color-grey-6 mr30 font-16" id="search_name"></span>
|
||||||
);
|
</div>
|
||||||
}
|
</div>
|
||||||
}
|
);
|
||||||
|
}
|
||||||
export default ShixunCardList;
|
}
|
||||||
|
|
||||||
|
export default ShixunCardList;
|
||||||
|
Loading…
Reference in new issue