From 7c92a2849421c2e77c3489952552c3e500319fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 12 Jul 2019 14:38:19 +0800 Subject: [PATCH] b --- public/react/src/common/DateUtil.js | 2 +- public/react/src/index.js | 2 +- .../src/modules/projectPackages/MDEditors.js | 12 +- .../PackageIndex/PackageConcent.js | 135 +++++++++-- .../PackageIndexNEIBannerConcent.js | 215 +++++++++++++----- .../projectPackages/packageconcnet.css | 8 + 6 files changed, 290 insertions(+), 84 deletions(-) diff --git a/public/react/src/common/DateUtil.js b/public/react/src/common/DateUtil.js index 652b72eb..5ad02a7c 100644 --- a/public/react/src/common/DateUtil.js +++ b/public/react/src/common/DateUtil.js @@ -15,7 +15,7 @@ export function handleDateString(dateString) { if (miniute < 60) { // 加一个小时 const tempStr = [ar[0], '00'].join(':'); - const format = "YYYY-MM-DD HH:mm"; + const format = "YYYY-MM-DD HH:mm:ss"; const _moment = moment(tempStr, format) _moment.add(1, 'hours') return _moment.format(format) diff --git a/public/react/src/index.js b/public/react/src/index.js index 38ac53e1..78f76b68 100644 --- a/public/react/src/index.js +++ b/public/react/src/index.js @@ -40,7 +40,7 @@ window.__useKindEditor = false; var proxy = "http://localhost:3000" // proxy = "http://testbdweb.trustie.net" // proxy = "http://testbdweb.educoder.net" -// proxy = 'http://192.168.0.195:3000' + proxy = 'http://192.168.2.63:3001/' // proxy='https://www.educoder.net' const requestMap={}; // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; diff --git a/public/react/src/modules/projectPackages/MDEditors.js b/public/react/src/modules/projectPackages/MDEditors.js index c91c4d16..3174389a 100644 --- a/public/react/src/modules/projectPackages/MDEditors.js +++ b/public/react/src/modules/projectPackages/MDEditors.js @@ -120,16 +120,16 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV // mine toolbarIcons: function (mdEditor) { - - let react_id = `react_${id}`; - const __that = window[react_id] + // + // let react_id = `react_${id}`; + // const __that = window[react_id] // Or return editormd.toolbarModes[name]; // full, simple, mini // Using "||" set icons align right. const icons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]; - if (__that.props.showNullButton) { - icons.push('nullBtton') - } + // if (__that.props.showNullButton) { + // icons.push('nullBtton') + // } return icons diff --git a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js index e74a2cd1..615e1a39 100644 --- a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js +++ b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js @@ -6,22 +6,106 @@ import '../packageconcnet.css'; const { Search } = Input; - - class PackageConcent extends Component { constructor(props) { super(props) this.state = { - + data:undefined, + project_packages:undefined, + category:undefined, + keyword:undefined, + sort_by:"recently", + sort_direction:"desc", + page:1, + per_page:20, } } + //desc’, ‘desc’, ‘asc’ + //否 string 排序,默认最新, ‘recently’, ‘price’ + // 否 string 类型, front,backend,mobile,database, cloud_compute_and_big_data,devops_and_test,ai,other componentDidMount() { + let {category,keyword,sort_by,sort_direction,page}=this.state + this.setdatas(category,keyword,sort_by,sort_direction,page) + } + + setdatas=(category,keyword,sort_by,sort_direction,page)=>{ + + let Url = `/api/v1/project_packages.json`; + axios.get(Url,{params:{ + category:category, + keyword:keyword, + sort_by:sort_by, + sort_direction:sort_direction, + page:page, + per_page:20, + }} + ).then((response) => { + this.setState({ + data:response.data, + project_packages:response.data.project_packages + }) + }).catch((error) => { + console.log(error) + }) + } + + setdatafuns=(value)=>{ + let {category,keyword,sort_by,sort_direction,page}=this.state + this.setState({ + keyword:value + }) + this.setdatas(category,value,sort_by,sort_direction,page) + } + setcategory=(value)=>{ + let {category,keyword,sort_by,sort_direction,page}=this.state + this.setState({ + category:value + }) + this.setdatas(value,keyword,sort_by,sort_direction,page) } + setsort_byfun=(value)=>{ + let {category,keyword,sort_by,sort_direction,page}=this.state + + this.setState({ + sort_by:value + }) + let sort_directionvalue; + if(value===sort_by){ + if(sort_direction==="desc"){ + this.setState({ + sort_direction:"asc" + }) + sort_directionvalue="asc"; + }else{ + this.setState({ + sort_direction:"desc" + }) + sort_directionvalue="desc"; + } + }else{ + this.setState({ + sort_direction:"desc" + }) + sort_directionvalue="desc"; + } + this.setdatas(category,keyword,value,sort_directionvalue,page) + } render() { + let {data,page,category,sort_by,sort_direction}=this.state; + let categorylist=[ + {name:"全部",value:undefined}, + {name:"前端开发",value:"front"}, + {name:"后端开发",value:"backend"}, + {name:"移动开发",value:"mobile"}, + {name:"数据库",value:"database"}, + {name:"云计算和大数据",value:"cloud_compute_and_big_data"}, + {name:"人工智能",value:"ai"}, + {name:"其他",value:"other"}, + ] return (
类型:
排序: -
@@ -259,18 +357,16 @@ class PackageIndexNEIBannerConcent extends Component { this.editmodels()}>
-+ {modalCancel===true?
{/*未注册才显示!*/}
@@ -279,10 +375,9 @@ class PackageIndexNEIBannerConcent extends Component {
@@ -290,28 +385,32 @@ class PackageIndexNEIBannerConcent extends Component {