|
|
|
@ -1,10 +1,12 @@
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
import { Pagination, Dropdown, Menu } from 'antd';
|
|
|
|
|
import { Dropdown, Menu } from 'antd';
|
|
|
|
|
import { getImageUrl } from 'educoder';
|
|
|
|
|
import PathCard from "./ShixunPathCard";
|
|
|
|
|
import UpgradeModals from '../modals/UpgradeModals';
|
|
|
|
|
import './ShixunPaths.css';
|
|
|
|
|
import KeywordList from '../tpm/shixuns/shixun-keyword-list';
|
|
|
|
|
import btnUrl from '../tpm/shixuns/btn-new.png';
|
|
|
|
|
|
|
|
|
|
class ShixunPathSearch extends Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
@ -23,18 +25,18 @@ class ShixunPathSearch extends Component {
|
|
|
|
|
sub_discipline_id: undefined
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//切换列表状态
|
|
|
|
|
changeStatus = (value) => {
|
|
|
|
|
|
|
|
|
|
//适配器
|
|
|
|
|
onChangeLabel(value) {
|
|
|
|
|
let rs = value === 'new' ? 'updated_at' : 'myshixuns_scount'
|
|
|
|
|
let { discipline_id, sub_discipline_id } = this.state;
|
|
|
|
|
this.setState({
|
|
|
|
|
order: value,
|
|
|
|
|
order: rs,
|
|
|
|
|
page: 1
|
|
|
|
|
})
|
|
|
|
|
this.getList(value, discipline_id, sub_discipline_id, 1);
|
|
|
|
|
this.getList(rs, discipline_id, sub_discipline_id, 1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//选择页数
|
|
|
|
|
onChange = (pageNumber) => {
|
|
|
|
|
|
|
|
|
@ -95,7 +97,16 @@ class ShixunPathSearch extends Component {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getList = (order, discipline_id, sub_discipline_id, page, keyword = '') => {
|
|
|
|
|
|
|
|
|
|
let url = '/paths.json';
|
|
|
|
|
axios.get(url, {
|
|
|
|
@ -103,6 +114,7 @@ class ShixunPathSearch extends Component {
|
|
|
|
|
sort: "desc",
|
|
|
|
|
limit: 16,
|
|
|
|
|
order: order,
|
|
|
|
|
keyword,
|
|
|
|
|
page: page,
|
|
|
|
|
discipline_id: discipline_id,
|
|
|
|
|
sub_discipline_id: sub_discipline_id
|
|
|
|
@ -120,7 +132,7 @@ class ShixunPathSearch extends Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//头部获取是否已经登录了
|
|
|
|
|
getUser = (url, type) => {
|
|
|
|
|
getUser = (url) => {
|
|
|
|
|
if (this.props.checkIfLogin() === false) {
|
|
|
|
|
this.props.showLoginDialog()
|
|
|
|
|
return
|
|
|
|
@ -238,26 +250,8 @@ class ShixunPathSearch extends Component {
|
|
|
|
|
</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>
|
|
|
|
|
<KeywordList btnUrl={btnUrl} onChangeLabel={this.onChangeLabel.bind(this)} OnSearchInput={this.OnSearchInput.bind(this)} onNewHandler={this.getUser.bind(this, '/paths/new')} btnStyle={{ top: '92px' }} />
|
|
|
|
|
|
|
|
|
|
<PathCard {...this.props} {...this.state}></PathCard>
|
|
|
|
|
{
|
|
|
|
|
this.state.pathList === null ? "" : total_count > 16 &&
|
|
|
|
|