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
24903ff9
Commit
24903ff9
authored
Jun 04, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
差没有搜索结果UI
parent
3c56787e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
5 deletions
+87
-5
src/common/VList/index.js
+0
-1
src/components/search/search-result.js
+53
-1
src/components/search/search-result.scss
+30
-0
src/components/search/searchHead.js
+4
-3
No files found.
src/common/VList/index.js
View file @
24903ff9
...
@@ -2,7 +2,6 @@ import React from 'react';
...
@@ -2,7 +2,6 @@ import React from 'react';
import
'./index.scss'
import
'./index.scss'
const
VList
=
(
props
)
=>
{
const
VList
=
(
props
)
=>
{
console
.
log
(
props
)
return
(
return
(
<
li
className
=
'v-list-item'
onClick
=
{
e
=>
props
.
handleClick
(
props
.
id
)}
>
<
li
className
=
'v-list-item'
onClick
=
{
e
=>
props
.
handleClick
(
props
.
id
)}
>
<
div
className
=
"content"
>
<
div
className
=
"content"
>
...
...
src/components/search/search-result.js
View file @
24903ff9
import
React
,
{
PureComponent
}
from
'react'
;
import
React
,
{
PureComponent
}
from
'react'
;
import
SearchHeader
from
'./searchHead'
import
SearchHeader
from
'./searchHead'
import
VList
from
'@/common/VList'
import
{
http
,
api
,
getParam
}
from
'@/utils'
import
'./search-result.scss'
const
Bottom
=
({
item
})
=>
{
return
(
<
div
className
=
'bottom'
>
<
span
className
=
'price'
>
¥
{
item
.
price1
}
<
/span
>
<
span
className
=
'stale-price'
>
¥
{
item
.
price0
}
<
/span
>
<
/div
>
)
}
class
SearchResult
extends
PureComponent
{
class
SearchResult
extends
PureComponent
{
componentDidMount
(){
state
=
{
courseList
:
[]
}
componentDidMount
()
{
http
.
get
(
`
${
api
[
'search-api'
]}
/search/
${
encodeURIComponent
(
getParam
(
'word'
))}
?type=course&page=1`
)
.
then
(
res
=>
{
const
data
=
res
.
data
if
(
data
.
errno
===
0
)
{
this
.
setState
({
courseList
:
data
.
data
.
info
.
search_data
.
course
});
}
})
}
}
render
()
{
render
()
{
const
{
courseList
}
=
this
.
state
return
(
return
(
<
div
className
=
'search-result'
>
<
div
className
=
'search-result'
>
<
SearchHeader
/>
<
SearchHeader
/>
<
ul
>
{
courseList
&&
courseList
.
length
>
0
?
courseList
.
map
(
item
=>
{
const
Info
=
(
<
div
className
=
"info"
>
<
p
className
=
'title'
>
{
item
.
course_title
}
<
/p
>
<
p
className
=
'des'
>
{
item
.
simpledescription
}
<
/p
>
<
Bottom
item
=
{
item
}
/
>
<
/div
>
)
return
(
<
VList
img
=
{
item
.
image_name
}
handleClick
=
{
this
.
handleClick
}
key
=
{
item
.
course_id
}
info
=
{
Info
}
/
>
)
})
:
null
}
<
/ul
>
<
/div
>
<
/div
>
);
);
}
}
...
...
src/components/search/search-result.scss
View file @
24903ff9
.search-result
{
.search-result
{
ul
{
list-style
:
none
;
}
.info
{
display
:
flex
;
flex-wrap
:
wrap
;
.des
{
font-size
:
$font_14
;
line-height
:
16px
;
align-self
:
flex-start
;
}
.price
{
color
:
$red
;
font-size
:
$font_16
;
margin-right
:
14px
;
}
.stale-price
{
text-decoration
:
line-through
;
color
:
$color_999
;
font-size
:
$font_12
;
}
.bottom
{
align-self
:
flex-end
;
}
}
}
}
\ No newline at end of file
src/components/search/searchHead.js
View file @
24903ff9
import
React
,
{
PureComponent
}
from
'react'
import
React
,
{
PureComponent
}
from
'react'
import
{
SearchBar
}
from
'antd-mobile'
import
{
SearchBar
}
from
'antd-mobile'
import
{
withRouter
}
from
'react-router-dom'
import
'./search_header.scss'
import
'./search_header.scss'
...
@@ -15,7 +16,7 @@ class SearchHead extends PureComponent {
...
@@ -15,7 +16,7 @@ class SearchHead extends PureComponent {
// 返回某个页面
// 返回某个页面
returnPage
()
{
returnPage
()
{
console
.
log
(
111
);
this
.
props
.
history
.
go
(
-
1
)
}
}
//组件装载完毕
//组件装载完毕
...
@@ -58,4 +59,4 @@ class SearchHead extends PureComponent {
...
@@ -58,4 +59,4 @@ class SearchHead extends PureComponent {
}
}
}
}
export
default
SearchHead
export
default
withRouter
(
SearchHead
)
\ No newline at end of file
\ No newline at end of file
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