From 3ea9ebb0ef393d68c91460b69f5b6a10e7687683 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Sat, 13 Jul 2019 12:24:15 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=97=E5=8C=85=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/index.js | 3 +-
.../src/modules/projectPackages/MDEditors.js | 3 +-
.../PackageIndex/PackageConcent.js | 71 +++--
.../PackageIndexNEITaskDetails.js | 83 +++---
.../PackageIndexNEIBannerConcent.js | 257 +++++++++++++++---
5 files changed, 311 insertions(+), 106 deletions(-)
diff --git a/public/react/src/index.js b/public/react/src/index.js
index a1006955..8107571d 100644
--- a/public/react/src/index.js
+++ b/public/react/src/index.js
@@ -39,7 +39,8 @@ window.__useKindEditor = false;
// TODO 读取到package.json中的配置?
var proxy = "http://localhost:3000"
// proxy = "http://testbdweb.trustie.net"
- proxy = "http://testbdweb.educoder.net"
+// proxy = "http://testbdweb.educoder.net"
+ // proxy ="http://192.168.2.63:3000"
// 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 960203b3..030fb6cf 100644
--- a/public/react/src/modules/projectPackages/MDEditors.js
+++ b/public/react/src/modules/projectPackages/MDEditors.js
@@ -267,6 +267,7 @@ export default class MDEditors extends Component {
this.setState({showError: true})
}
onEditorChange = () => {
+ this.props.setcheckoutcontent()
if (!this.answers_editormd) return;
const val = this.answers_editormd.getValue();
try {
@@ -319,7 +320,7 @@ export default class MDEditors extends Component {
{/* padding10-20 */}
diff --git a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js
index 8e5bc4bd..2c895b50 100644
--- a/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js
+++ b/public/react/src/modules/projectPackages/PackageIndex/PackageConcent.js
@@ -6,29 +6,29 @@ import moment from 'moment';
import '../packageconcnet.css';
const { Search } = Input;
-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"},
-]
-
-function setcategorylist(val){
- let vals=""
- categorylist.some((item,key)=> {
- if (item.value === val) {
- vals=item.name
- return true
- }
- }
- )
-
- return vals
-}
+// 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"},
+// ]
+//
+// function setcategorylist(val){
+// let vals=""
+// categorylist.some((item,key)=> {
+// if (item.value === val) {
+// vals=item.name
+// return true
+// }
+// }
+// )
+//
+// return vals
+// }
@@ -44,6 +44,7 @@ class PackageConcent extends Component {
sort_direction:"desc",
page:1,
per_page:20,
+ categories:[]
}
}
//desc’, ‘desc’, ‘asc’
@@ -52,13 +53,24 @@ class PackageConcent extends Component {
componentDidMount() {
let {category,keyword,sort_by,sort_direction,page}=this.state
this.setdatas(category,keyword,sort_by,sort_direction,page)
+
+ let Url = `/api/v1/project_package_categories.json`;
+ axios.get(Url).then((response) => {
+ console.log(response)
+ this.setState({
+ categories:response.data.categories
+ })
+ }).catch((error) => {
+ console.log(error)
+ })
+
}
setdatas=(category,keyword,sort_by,sort_direction,page)=>{
let Url = `/api/v1/project_packages.json`;
axios.get(Url,{params:{
- category:category,
+ category_id:category,
keyword:keyword,
sort_by:sort_by,
sort_direction:sort_direction,
@@ -156,11 +168,10 @@ class PackageConcent extends Component {
类型:
- {categorylist.map((item,key)=>{
- console.log(category)
- console.log(item.value)
+
this.setcategory(undefined)}>全部
+ {this.state.categories.map((item,key)=>{
return(
-
this.setcategory(item.value)}>{item.name}
+
this.setcategory(item.id)}>{item.name}
)
})}
@@ -202,7 +213,7 @@ class PackageConcent extends Component {
-
+
@@ -225,7 +236,7 @@ class PackageConcent extends Component {
-
{setcategorylist(item.category)}
+
{item.category}
diff --git a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
index 17d1918a..b6ecdba6 100644
--- a/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
+++ b/public/react/src/modules/projectPackages/PackageIndexNEITaskDetails/PackageIndexNEITaskDetails.js
@@ -10,29 +10,29 @@ import './pds.css'
import gouxuan from './img/gouxuan.png'
import weigouxuan from './img/weigouxuan.png'
const { Search } = Input;
-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"},
-]
-
-function setcategorylist(val){
- let vals=""
- categorylist.some((item,key)=> {
- if (item.value === val) {
- vals=item.name
- return true
- }
- }
- )
-
- return vals
-}
+// 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"},
+// ]
+//
+// function setcategorylist(val){
+// let vals=""
+// categorylist.some((item,key)=> {
+// if (item.value === val) {
+// vals=item.name
+// return true
+// }
+// }
+// )
+//
+// return vals
+// }
class PackageIndexNEITaskDetails extends Component {
constructor(props) {
@@ -275,14 +275,14 @@ class PackageIndexNEITaskDetails extends Component {
{data&&data.creator.name}
- {this.props.current_user.login!=data&&data.creator&&data&&data.creator.login?
:""}
+
:"":""}
@@ -306,7 +306,7 @@ class PackageIndexNEITaskDetails extends Component {