diff --git a/public/react/src/modules/paths/ShixunPathSearch.js b/public/react/src/modules/paths/ShixunPathSearch.js
index a7e944826..9ba9eec03 100644
--- a/public/react/src/modules/paths/ShixunPathSearch.js
+++ b/public/react/src/modules/paths/ShixunPathSearch.js
@@ -1,164 +1,178 @@
import React, { Component } from 'react';
import axios from 'axios';
-import {Dropdown,Menu} from 'antd';
-import {getImageUrl} from 'educoder';
+import { Dropdown, Menu } from 'antd';
+import { getImageUrl } from 'educoder';
import PathCard from "./ShixunPathCard";
import UpgradeModals from '../modals/UpgradeModals';
import Pagination from '@icedesign/base/lib/pagination';
import '@icedesign/base/lib/pagination/style.js';
import './ShixunPaths.css';
+import KeywordList from '../tpm/shixuns/shixun-keyword-list';
+import btnUrl from '../tpm/shixuns/btn-new.png';
-class ShixunPathSearch extends Component{
+class ShixunPathSearch extends Component {
constructor(props) {
- super(props)
- this.state = {
- order:"updated_at",
- select:undefined,
- search:"",
- page:1,
- pathList:null,
- sortList:'',
- total_count:0,
- sort:"desc",
- limit:16,
- discipline_id:undefined,
- sub_discipline_id:undefined
- }
+ super(props)
+ this.state = {
+ order: "updated_at",
+ select: undefined,
+ search: "",
+ page: 1,
+ pathList: null,
+ sortList: '',
+ total_count: 0,
+ sort: "desc",
+ limit: 16,
+ discipline_id: undefined,
+ sub_discipline_id: undefined
+ }
}
-
- //切换列表状态
- changeStatus=(value)=>{
-
- let {discipline_id,sub_discipline_id }=this.state;
+ //适配器
+ onChangeLabel(value) {
+ let rs = value === 'new' ? 'updated_at' : 'myshixuns_scount'
+ let { discipline_id, sub_discipline_id } = this.state;
this.setState({
- order:value,
- page:1
+ order: rs,
+ page: 1
})
- this.getList(value,discipline_id,sub_discipline_id,1);
+ this.getList(rs, discipline_id, sub_discipline_id, 1)
}
-
//选择页数
- onChange=(pageNumber)=> {
+ onChange = (pageNumber) => {
- let { order,discipline_id,sub_discipline_id }=this.state;
+ let { order, discipline_id, sub_discipline_id } = this.state;
this.setState({
- page:pageNumber
+ page: pageNumber
})
- this.getList(order,discipline_id,sub_discipline_id,pageNumber);
+ this.getList(order, discipline_id, sub_discipline_id, pageNumber);
}
//顶部分类
- changeSelect=(e,tag_id,sum)=>{
+ changeSelect = (e, tag_id, sum) => {
this.setState({
- order:"updated_at",
- discipline_id:tag_id,
- page:1,
- sub_discipline_id:undefined
+ order: "updated_at",
+ discipline_id: tag_id,
+ page: 1,
+ sub_discipline_id: undefined
})
- let { order }=this.state;
- this.getList(order,tag_id,undefined,1 );
+ let { order } = this.state;
+ this.getList(order, tag_id, undefined, 1);
e.stopPropagation();
}
- componentDidMount(){
- document.title="实践课程";
- const upsystem=`/users/system_update.json`;
- axios.get(upsystem).then((response)=>{
- let updata=response.data;
- this.setState({
- updata:updata
- })
- }).catch((error)=>{
- console.log(error);
- })
+ componentDidMount() {
+ document.title = "实践课程";
+ const upsystem = `/users/system_update.json`;
+ axios.get(upsystem).then((response) => {
+ let updata = response.data;
+ this.setState({
+ updata: updata
+ })
+ }).catch((error) => {
+ console.log(error);
+ })
this.getdisciplines()
- let { order,discipline_id,sub_discipline_id,page }=this.state;
- this.getList(order,discipline_id,sub_discipline_id,page );
+ let { order, discipline_id, sub_discipline_id, page } = this.state;
+ this.getList(order, discipline_id, sub_discipline_id, page);
}
- getdisciplines=()=>{
- let url='/disciplines.json';
- axios.get(url,{params:{
- source:"subject"
- }}).then((result)=>{
- if(result.status==200){
- // console.log(result.data.disciplines)
+ getdisciplines = () => {
+ let url = '/disciplines.json';
+ axios.get(url, {
+ params: {
+ source: "subject"
+ }
+ }).then((result) => {
+ if (result.status == 200) {
+ // console.log(result.data.disciplines)
this.setState({
- sortList:result.data.disciplines
+ sortList: result.data.disciplines
})
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
}
- getList=(order,discipline_id,sub_discipline_id,page )=>{
+ OnSearchInput = (value, type) => {
+ this.setState({
+ search: value,
+ page: 1
+ })
+ const { order, discipline_id, sub_discipline_id } = this.state
+ this.getList(order, discipline_id, sub_discipline_id, 1, value)
+ }
- let url='/paths.json';
- axios.get(url,{params:{
- sort:"desc",
- limit:16,
- order:order,
- page:page,
- discipline_id:discipline_id,
- sub_discipline_id:sub_discipline_id
- }}).then((result)=>{
- if(result.status==200){
+ getList = (order, discipline_id, sub_discipline_id, page, keyword = '') => {
+
+ let url = '/paths.json';
+ axios.get(url, {
+ params: {
+ sort: "desc",
+ limit: 16,
+ order: order,
+ keyword,
+ page: page,
+ discipline_id: discipline_id,
+ sub_discipline_id: sub_discipline_id
+ }
+ }).then((result) => {
+ if (result.status == 200) {
this.setState({
- pathList:result.data.subjects,
- total_count:result.data.total_count
+ pathList: result.data.subjects,
+ total_count: result.data.total_count
})
}
- }).catch((error)=>{
+ }).catch((error) => {
console.log(error);
})
}
//头部获取是否已经登录了
- getUser=(url,type)=>{
- if(this.props.checkIfLogin()===false){
+ getUser = (url) => {
+ if (this.props.checkIfLogin() === false) {
this.props.showLoginDialog()
return
}
- if(this.props.checkIfProfileCompleted()===false){
+ if (this.props.checkIfProfileCompleted() === false) {
this.props.showProfileCompleteDialog()
return
}
- if(url !== undefined || url!==""){
+ if (url !== undefined || url !== "") {
this.props.history.push(url);
}
}
- getshixunchildValues=(e,id,item)=>{
+ getshixunchildValues = (e, id, item) => {
this.setState({
- discipline_id:item.id,
- sub_discipline_id:id,
+ discipline_id: item.id,
+ sub_discipline_id: id,
})
- let { order,page }=this.state;
- this.getList(order,item.id,id,page );
+ let { order, page } = this.state;
+ this.getList(order, item.id, id, page);
e.stopPropagation();
}
- getmenu=(list,item)=>{
- return(
+ getmenu = (list, item) => {
+ return (