Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
b2ae3942
Commit
b2ae3942
authored
Jun 03, 2019
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
class
parent
6f5fbe3c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
21 deletions
+22
-21
src/components/classify/courselist.js
+14
-11
src/components/classify/index.js
+8
-10
No files found.
src/components/classify/courselist.js
View file @
b2ae3942
...
@@ -3,7 +3,7 @@ import {VList} from '../../common';
...
@@ -3,7 +3,7 @@ import {VList} from '../../common';
import
{
Tabs
,
WhiteSpace
}
from
'antd-mobile'
;
import
{
Tabs
,
WhiteSpace
}
from
'antd-mobile'
;
import
'./courselist.scss'
;
import
'./courselist.scss'
;
import
HeaderSearch
from
'../../common/HeaderSearch/index'
import
HeaderSearch
from
'../../common/HeaderSearch/index'
import
{
api
}
from
"@/utils"
;
import
{
api
,
getParam
}
from
"@/utils"
;
class
Classify
extends
Component
{
class
Classify
extends
Component
{
...
@@ -14,20 +14,21 @@ class Classify extends Component {
...
@@ -14,20 +14,21 @@ class Classify extends Component {
display
:
'none'
,
display
:
'none'
,
arr
:
[{
basics
:
[]},
{
advanced
:
[]}],
arr
:
[{
basics
:
[]},
{
advanced
:
[]}],
allClass
:
[],
allClass
:
[],
data
:
[]
data
:
[]
,
}
}
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
getTabs
()
this
.
getTabs
()
this
.
getList
(
'20'
)
this
.
getList
(
getParam
(
'id'
))
console
.
log
(
this
.
props
)
}
}
// 获取tabs接口
// 获取tabs接口
getTabs
=
()
=>
{
getTabs
=
()
=>
{
let
data
=
0
let
data
=
0
api
.
get
(
`/m/course/classify/
${
data
}
`
,).
then
((
res
)
=>
{
api
.
get
(
`/m/course/classify/
${
data
}
`
,)
.
then
((
res
)
=>
{
const
_this
=
this
const
_this
=
this
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
data
.
common
.
length
>
0
)
{
if
(
res
.
data
.
data
.
common
.
length
>
0
)
{
...
@@ -37,7 +38,7 @@ class Classify extends Component {
...
@@ -37,7 +38,7 @@ class Classify extends Component {
arr
.
forEach
(
function
(
item
,
index
)
{
arr
.
forEach
(
function
(
item
,
index
)
{
arr2
[
item
]
=
res
.
data
.
data
.
common
[
index
]
arr2
[
item
]
=
res
.
data
.
data
.
common
[
index
]
res
.
data
.
data
.
common
[
index
].
list
.
forEach
(
function
(
item
,
index
)
{
res
.
data
.
data
.
common
[
index
].
list
.
forEach
(
function
(
item
,
index
)
{
arr3
.
push
({
'title'
:
item
.
c_name
,
'id'
:
item
.
c_id
})
arr3
.
push
({
'title'
:
item
.
c_name
,
'id'
:
item
.
c_id
})
})
})
})
})
_this
.
setState
({
_this
.
setState
({
...
@@ -47,6 +48,9 @@ class Classify extends Component {
...
@@ -47,6 +48,9 @@ class Classify extends Component {
}
}
}
}
})
})
.
catch
(
err
=>
{
console
.
log
(
err
)
})
}
}
// 获取课程接口
// 获取课程接口
...
@@ -79,13 +83,12 @@ class Classify extends Component {
...
@@ -79,13 +83,12 @@ class Classify extends Component {
}
}
// 弹窗里面tab点击查询
// 弹窗里面tab点击查询
labelclick
=
(
id
)
=>
{
labelclick
=
(
id
,
index
)
=>
{
this
.
getList
(
id
)
this
.
getList
(
id
)
this
.
setState
(
status
=>
({
this
.
setState
(
status
=>
({
ispull
:
!
status
.
ispull
,
ispull
:
!
status
.
ispull
,
display
:
status
.
ispull
?
'none'
:
'block'
display
:
status
.
ispull
?
'none'
:
'block'
}))
;
}))
}
}
render
()
{
render
()
{
...
@@ -111,7 +114,7 @@ class Classify extends Component {
...
@@ -111,7 +114,7 @@ class Classify extends Component {
>
>
<
div
className
=
'tabs'
>
<
div
className
=
'tabs'
>
<
ul
>
<
ul
>
{
this
.
state
.
data
&&
this
.
state
.
data
.
length
>
0
&&
this
.
state
.
data
.
map
((
item
,
index
)
=>
{
{
this
.
state
.
data
&&
this
.
state
.
data
.
length
>
0
&&
this
.
state
.
data
.
map
((
item
,
index
)
=>
{
const
Info
=
(
const
Info
=
(
<
div
className
=
"info"
>
<
div
className
=
"info"
>
<
p
className
=
'title'
>
{
item
.
course_title
}
<
/p
>
<
p
className
=
'title'
>
{
item
.
course_title
}
<
/p
>
...
@@ -175,7 +178,7 @@ function ClassCourse(props) {
...
@@ -175,7 +178,7 @@ function ClassCourse(props) {
{
{
props
.
data
&&
props
.
data
.
length
>
0
&&
props
.
data
.
map
((
item
,
index
)
=>
{
props
.
data
&&
props
.
data
.
length
>
0
&&
props
.
data
.
map
((
item
,
index
)
=>
{
return
(
return
(
<
span
key
=
{
index
}
onClick
=
{
e
=>
props
.
labelclick
(
item
.
c_id
)}
<
span
key
=
{
index
}
onClick
=
{
e
=>
props
.
labelclick
(
item
.
c_id
,
index
)}
className
=
'item-label'
>
{
item
.
c_name
}
<
/span
>
className
=
'item-label'
>
{
item
.
c_name
}
<
/span
>
)
)
})
})
...
...
src/components/classify/index.js
View file @
b2ae3942
...
@@ -2,6 +2,7 @@ import React, {Component} from 'react';
...
@@ -2,6 +2,7 @@ import React, {Component} from 'react';
import
{
WithTab
}
from
'@/HOCs'
import
{
WithTab
}
from
'@/HOCs'
import
'./index.scss'
;
import
'./index.scss'
;
import
{
api
}
from
"@/utils"
;
import
{
api
}
from
"@/utils"
;
import
{
Link
}
from
'react-router-dom'
class
Classify
extends
Component
{
class
Classify
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -38,19 +39,14 @@ class Classify extends Component {
...
@@ -38,19 +39,14 @@ class Classify extends Component {
})
})
}
}
toClassList
=
(
id
)
=>
{
console
.
log
(
id
)
// this.props.history.push({pathname: `/courselist?id=${id}`})
}
render
()
{
render
()
{
return
(
return
(
<
div
className
=
'class-box'
>
<
div
className
=
'class-box'
>
<
div
className
=
"class-title"
>
分类
<
/div
>
<
div
className
=
"class-title"
>
分类
<
/div
>
<
ClassCourseBox
data
=
{
this
.
state
.
camp
.
list
}
title
=
{
this
.
state
.
camp
.
name
}
type
=
{
1
}
/
>
<
ClassCourseBox
data
=
{
this
.
state
.
camp
.
list
}
title
=
{
this
.
state
.
camp
.
name
}
type
=
{
1
}
/
>
<
ClassCourseBox
data
=
{
this
.
state
.
employment
.
list
}
title
=
{
this
.
state
.
employment
.
name
}
type
=
{
1
}
/
>
<
ClassCourseBox
data
=
{
this
.
state
.
employment
.
list
}
title
=
{
this
.
state
.
employment
.
name
}
type
=
{
1
}
/
>
<
ClassCourseBox
data
=
{
this
.
state
.
basics
.
list
}
title
=
{
this
.
state
.
basics
.
name
}
type
=
{
2
}
toClassList
=
{
this
.
toClassList
}
/
>
<
ClassCourseBox
data
=
{
this
.
state
.
basics
.
list
}
title
=
{
this
.
state
.
basics
.
name
}
type
=
{
2
}
/
>
<
ClassCourseBox
data
=
{
this
.
state
.
advanced
.
list
}
title
=
{
this
.
state
.
advanced
.
name
}
type
=
{
2
}
toClassList
=
{
this
.
toClassList
}
/
>
<
ClassCourseBox
data
=
{
this
.
state
.
advanced
.
list
}
title
=
{
this
.
state
.
advanced
.
name
}
type
=
{
2
}
/
>
<
div
className
=
"vip"
>
<
div
className
=
"vip"
>
{
this
.
state
.
special
.
list
&&
this
.
state
.
special
.
list
.
length
>
0
&&
this
.
state
.
special
.
list
.
map
((
item
,
index
)
=>
{
{
this
.
state
.
special
.
list
&&
this
.
state
.
special
.
list
.
length
>
0
&&
this
.
state
.
special
.
list
.
map
((
item
,
index
)
=>
{
return
(
return
(
...
@@ -87,7 +83,9 @@ function ClassCourseB(props) {
...
@@ -87,7 +83,9 @@ function ClassCourseB(props) {
{
{
props
.
data
&&
props
.
data
.
length
>
0
&&
props
.
data
.
map
((
item
,
index
)
=>
{
props
.
data
&&
props
.
data
.
length
>
0
&&
props
.
data
.
map
((
item
,
index
)
=>
{
return
(
return
(
<
span
onClick
=
{
e
=>
props
.
toClassList
(
item
.
c_id
)}
key
=
{
index
}
className
=
'item-label'
>
{
item
.
c_name
}
<
/span
>
<
Link
to
=
{
`/courselist?id=
${
item
.
c_id
}
`
}
key
=
{
index
}
className
=
'item-label'
>
{
item
.
c_name
}
<
/Link
>
)
)
})
})
}
}
...
@@ -103,10 +101,10 @@ function ClassCourseBox(props) {
...
@@ -103,10 +101,10 @@ function ClassCourseBox(props) {
{
props
.
title
}
{
props
.
title
}
<
/p
>
<
/p
>
{
props
.
type
===
1
&&
{
props
.
type
===
1
&&
<
ClassCourseA
data
=
{
props
.
data
}
toClassList
=
{
props
.
toClassList
}
/
>
<
ClassCourseA
data
=
{
props
.
data
}
/
>
}
}
{
props
.
type
===
2
&&
{
props
.
type
===
2
&&
<
ClassCourseB
data
=
{
props
.
data
}
toClassList
=
{
props
.
toClassList
}
/
>
<
ClassCourseB
data
=
{
props
.
data
}
/
>
}
}
<
/div
>
<
/div
>
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment