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
1a7f8849
Commit
1a7f8849
authored
Sep 27, 2019
by
FE
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-20190920'
parents
79c23651
bdf2181b
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
146 additions
and
76 deletions
+146
-76
src/assets/css/index.scss
+3
-0
src/components/bargainMiddlePage/index.js
+55
-19
src/components/detail/bargain/index.js
+26
-9
src/components/search/index.js
+2
-2
src/components/search/search-result.js
+51
-44
src/components/search/search-result.scss
+8
-2
src/components/search/searchHead.js
+1
-0
No files found.
src/assets/css/index.scss
View file @
1a7f8849
...
...
@@ -28,6 +28,9 @@ $z-max: 999999; //为了应付某些插件z-index 值过高的问题
// --------------------------------------------------
//
body
{
position
:
relative
;
}
html
,
body
,
div
,
span
,
object
,
iframe
,
h1
,
h2
,
h3
,
h4
,
h5
,
h6
,
p
,
blockquote
,
pre
,
a
,
abbr
,
address
,
cite
,
code
,
del
,
dfn
,
em
,
img
,
ins
,
kbd
,
q
,
samp
,
small
,
strong
,
sub
,
sup
,
var
,
b
,
i
,
dl
,
dt
,
dd
,
ol
,
ul
,
li
,
fieldset
,
form
,
label
,
legend
,
table
,
caption
,
tbody
,
tfoot
,
thead
,
tr
,
th
,
td
{
border
:
0
none
;
font-size
:
inherit
;
...
...
src/components/bargainMiddlePage/index.js
View file @
1a7f8849
...
...
@@ -41,7 +41,7 @@ class BargainMiddlePage extends Component {
min
:
''
,
sec
:
''
,
day
:
''
,
amount
:
''
,
amount
:
''
,
// 每次砍掉的价格
firendBaigainPrice
:
true
,
isshowYindao
:
false
,
isLoaidng
:
true
,
...
...
@@ -124,7 +124,7 @@ class BargainMiddlePage extends Component {
}
// 获取助理好友
getBargainRankList
=
(
id
,
type
)
=>
{
getBargainRankList
=
(
id
=
''
,
type
)
=>
{
const
bargain_code
=
getParam
(
'bargaincode'
)
||
''
;
let
data
=
{
courseId
:
id
,
...
...
@@ -213,7 +213,8 @@ class BargainMiddlePage extends Component {
this
.
setState
({
isShowOverlay
:
true
,
status
:
5
,
})
});
this
.
getBargainInfo
();
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
)
}
...
...
@@ -236,6 +237,7 @@ class BargainMiddlePage extends Component {
}
http
.
post
(
`
${
API
.
home
}
/m/bargain/toBargain`
,
data
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
// is_success =0一切正常 =1 不能在砍了 =2关注公众号,可以再砍一刀!
this
.
setState
({
amount
:
res
.
data
.
data
.
amount
...
...
@@ -244,7 +246,9 @@ class BargainMiddlePage extends Component {
this
.
setState
({
isShowOverlay
:
true
,
status
:
6
})
});
this
.
getBargainInfo
();
this
.
getBargainRankList
(
''
,
1
);
}
if
(
res
.
data
.
data
.
is_success
===
1
)
{
...
...
@@ -513,6 +517,7 @@ class BargainMiddlePage extends Component {
toDetail
=
{
this
.
toCourseDetail
}
bottom
=
{
<
CourseBottom
user
=
{
this
.
props
.
user
}
item
=
{
item
}
toCartBottom
=
{
this
.
toCartBottom
.
bind
(
this
,
item
.
course_id
)}
toDetail
=
{
this
.
toCourseDetail
}
...
...
@@ -635,15 +640,36 @@ function CourseDes(props) {
}
function
CourseBottom
(
props
)
{
// bargain_status 砍价状态 0-砍价中,1砍价结束,待支付,2砍价过期(没有砍价记录没有砍价信息),3已购买
const
{
course_id
=
''
,
bargain_status
=
''
,
price1
=
''
,
pay_price
=
''
}
=
props
.
item
||
{};
const
{
user
:
{
data
=
{}
}
}
=
props
;
const
price
=
bargain_status
===
2
?
price1
:
pay_price
;
let
Buttons
if
(
data
.
uid
)
{
if
(
props
.
item
.
bargain_status
===
2
)
{
// Buttons = <Link to={`/detail?id=${props.item.course_id}`} className={'bargain'}>我要砍价</Link>
Buttons
=
<
a
onClick
=
{()
=>
props
.
toDetail
(
props
.
item
.
course_id
)}
className
=
{
'bargain bargian-study'
}
>
我要砍价
<
/a
>
}
else
if
(
props
.
item
.
bargain_status
===
3
)
{
Buttons
=
<
Link
to
=
{
`/play/video?id=
${
props
.
item
.
v_course_id
}
`
}
className
=
{
classnames
(
'bargain'
,
'button--study'
)}
>
去学习
<
/Link
>
if
(
props
.
item
.
course_id
===
139
)
{
Buttons
=
<
a
onClick
=
{()
=>
props
.
toDetail
(
props
.
item
.
course_id
)}
className
=
{
'bargain bargian-study'
}
>
我要砍价
<
/a
>
Buttons
=
(
<
div
className
=
""
>
<
a
onClick
=
{()
=>
props
.
toDetail
(
props
.
item
.
course_id
)}
className
=
{
'bargain bargian-study'
}
>
我要砍价
<
/a
>
<
/div
>
)
}
else
if
(
bargain_status
===
3
)
{
if
(
course_id
===
139
)
{
Buttons
=
(
<
a
onClick
=
{()
=>
props
.
toDetail
(
props
.
item
.
course_id
)}
className
=
{
'bargain bargian-study'
}
>
我要砍价
<
/a
>
);
}
else
{
Buttons
=
(
<
Link
to
=
{
`/play/video?id=
${
props
.
item
.
v_course_id
}
`
}
className
=
{
classnames
(
'bargain'
,
'button--study'
)}
>
去学习
<
/Link
>
);
}
}
else
{
Buttons
=
(
...
...
@@ -652,22 +678,32 @@ function CourseBottom(props) {
{
/*{props.item.bargain_status === 2 ? '砍价结束' : '继续砍价'}*/
}
{
/*</button>*/
}
{
props
.
item
.
bargain_status
===
1
&&
bargain_status
===
1
&&
<
button
className
=
'invalid'
>
砍价结束
<
/button
>
}
{
props
.
item
.
bargain_status
===
0
&&
<
a
onClick
=
{()
=>
props
.
toDetail
(
props
.
item
.
course_id
)}
className
=
{
'bargain-btn'
}
>
我要
砍价
<
/a
>
}
<
button
onClick
=
{()
=>
props
.
toCartBottom
(
props
.
item
.
course_id
)}
className
=
{
'purchase-btn'
}
>
¥
{
props
.
item
.
pay_
price
}
去支付
bargain_status
===
0
&&
<
a
onClick
=
{()
=>
props
.
toDetail
(
props
.
item
.
course_id
)}
className
=
{
'bargain-btn'
}
>
继续
砍价
<
/a
>
}
<
button
onClick
=
{()
=>
props
.
toCartBottom
(
props
.
item
.
course_id
)}
className
=
{
'purchase-btn'
}
>
¥
{
price
}
去支付
<
/button
>
<
/div
>
)
}
}
else
{
Buttons
=
(
<
a
onClick
=
{()
=>
props
.
toDetail
(
props
.
item
.
course_id
)}
className
=
{
'bargain bargian-study'
}
>
我要砍价
<
/a
>
);
}
return
(
<
div
className
=
"course-bottom"
>
<
div
className
=
{
'course-price'
}
>
...
...
src/components/detail/bargain/index.js
View file @
1a7f8849
...
...
@@ -9,6 +9,7 @@ import Ranking from "@/components/bargainMiddlePage/ranking"
import
{
compose
}
from
"redux"
import
{
withRouter
}
from
'react-router-dom'
import
{
connect
}
from
"react-redux"
;
import
{
Object
}
from
'core-js'
class
Bargain
extends
Component
{
...
...
@@ -25,7 +26,9 @@ class Bargain extends Component {
bargainCode
:
''
,
time
:
''
,
barInfo
:
{},
country
:
'86'
country
:
'86'
,
price
:
0
,
// 每次砍价砍掉的价格
sum
:
0
// 累计砍掉的价格
}
}
...
...
@@ -65,7 +68,7 @@ class Bargain extends Component {
//获取砍价信息
getBargainInfo
=
()
=>
{
getBargainInfo
=
(
isFetch
=
true
)
=>
{
let
data
=
{
courseId
:
getParam
(
'id'
)
}
...
...
@@ -78,7 +81,7 @@ class Bargain extends Component {
// limitPeople: res.data.data.limit_people,
// bargainCode: res.data.data.bargain_code
});
if
(
isFetch
)
{
// 砍价状态 0-砍价中,1砍价结束,待支付,2砍价过期(没有砍价记录没有砍价信息),3已购买
if
(
data
.
bargain_status
===
0
||
data
.
bargain_status
===
1
)
{
this
.
getBargainRankList
({
...
...
@@ -86,6 +89,7 @@ class Bargain extends Component {
bargain_code
:
data
.
bargain_code
});
}
}
}
else
{
Toast
.
info
(
msg
,
2
);
}
...
...
@@ -113,8 +117,9 @@ class Bargain extends Component {
if
(
res
.
data
.
code
===
200
)
{
this
.
setState
({
isShowOverlay
:
true
,
status
:
1
,
})
status
:
1
});
this
.
getBargainInfo
(
false
);
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
)
}
...
...
@@ -180,6 +185,13 @@ class Bargain extends Component {
this
.
setState
({
isShowOverlay
:
true
,
status
:
2
,
price
:
data
.
amount
,
sum
:
data
.
bargain_price
});
this
.
getBargainInfo
(
false
);
this
.
getBargainRankList
({
type
:
0
,
bargain_code
:
data
.
bargain_code
});
}
else
{
history
.
push
(
`/bargain-middle-page?id=
${
getParam
(
'id'
)}
&bargaincode=
${
data
.
bargain_code
}
&is_originator=1`
)
...
...
@@ -217,7 +229,7 @@ class Bargain extends Component {
}
render
()
{
const
{
list
,
outList
,
barInfo
,
country
}
=
this
.
state
;
const
{
list
,
outList
,
barInfo
,
country
,
price
,
sum
}
=
this
.
state
;
const
{
user
}
=
this
.
props
const
uid
=
user
&&
user
.
data
&&
user
.
data
.
uid
return
(
...
...
@@ -259,7 +271,11 @@ class Bargain extends Component {
{
/*使用砍价神器*/
}
{
this
.
state
.
status
===
2
&&
<
UseArtifact
toCart
=
{
this
.
toCart
}
/
>
<
UseArtifact
price
=
{
price
}
sum
=
{
sum
}
toCart
=
{
this
.
toCart
}
/
>
}
{
...
...
@@ -431,13 +447,14 @@ function Artifact(props) {
}
function
UseArtifact
(
props
)
{
const
{
sum
,
price
}
=
props
;
return
(
<
div
className
=
'use-artifact-box'
>
<
img
className
=
'top-img'
src
=
{
require
(
'./image/kanjia_cg_icon.png'
)}
alt
=
""
/>
<
p
className
=
'top-tip'
>
厉害了,又砍掉了
10
元!
<
/p
>
<
p
className
=
'top-tip'
>
厉害了,又砍掉了
{
price
}
元!
<
/p
>
<
p
className
=
'middle-tip'
>
你已经砍了
<
span
className
=
{
'indicator'
}
>
109
元
<
/span
>
<
span
className
=
{
'indicator'
}
>
{
sum
}
元
<
/span
>
没见过你这么能砍的人
...
<
/p
>
<
p
className
=
'btm-tip'
>
...
...
src/components/search/index.js
View file @
1a7f8849
...
...
@@ -24,7 +24,7 @@ class Search extends PureComponent {
if
(
errno
===
0
)
{
this
.
setState
({
hot_words
:
data
.
info
.
hot_words
,
defaultWord
:
data
.
info
.
recommend_word
,
value
:
data
.
info
.
recommend_word
,
isLoading
:
false
})
}
...
...
@@ -60,7 +60,7 @@ class Search extends PureComponent {
<
div
className
=
"search-page"
>
<
SearchHead
searchHistory
=
{
this
.
state
.
searchHistory
}
value
=
{
this
.
state
.
value
||
this
.
state
.
defaultWord
}
value
=
{
this
.
state
.
value
}
handleChange
=
{
this
.
handleChange
}
handleSearch
=
{
this
.
handleSearch
}
/
>
...
...
src/components/search/search-result.js
View file @
1a7f8849
...
...
@@ -32,7 +32,9 @@ class SearchResult extends PureComponent {
searchHistory
:
JSON
.
parse
(
localStorage
.
getItem
(
'searchHistory'
))
||
[],
fixedHeader
:
false
,
searchHeadStyle
:
{
top
:
0
},
swipeDirection
:
this
.
swipeUp
swipeDirection
:
this
.
swipeUp
,
isHide
:
false
,
basicTop
:
0
}
componentDidMount
()
{
...
...
@@ -76,61 +78,65 @@ class SearchResult extends PureComponent {
}
handleScroll
=
throttle
(()
=>
{
let
y
=
window
.
scrollY
,
headY
=
this
.
searchHead
.
current
.
offsetTop
;
console
.
log
(
headY
,
'headY'
);
console
.
log
(
document
.
querySelector
(
'body'
).
offsetHeight
);
// 向上滑动
if
(
y
<
this
.
prevScrollY
&&
y
>
0
)
{
console
.
log
(
0
);
console
.
log
(
this
.
state
.
swipeDirection
);
if
(
this
.
state
.
swipeDirection
===
this
.
swipeDown
)
{
console
.
log
(
1
);
y
<=
headY
&&
this
.
state
.
searchHeadStyle
.
position
!==
'fixed'
&&
this
.
setState
({
searchHeadStyle
:
{
top
:
`0`
,
position
:
'fixed'
}
})
}
else
{
console
.
log
(
2
);
this
.
setState
({
swipeDirection
:
this
.
swipeDown
},
()
=>
{
if
(
this
.
state
.
swipeDirection
===
this
.
swipeDown
)
{
let
h
=
y
>
document
.
querySelector
(
'body'
).
offsetHeight
?
document
.
querySelector
(
'body'
).
offsetHeight
:
y
;
let
h1
=
this
.
searchHead
.
current
.
offsetHeight
let
y
=
window
.
scrollY
<
0
?
0
:
window
.
scrollY
,
headY
=
this
.
searchHead
.
current
.
offsetTop
,
h
=
this
.
searchHead
.
current
.
offsetHeight
;
if
(
y
>
this
.
prevScrollY
)
{
this
.
setState
({
searchHeadStyle
:
{
// top: `${h > headY ? h - h1 : h}px`
top
:
`
${
y
}
px`
}
})
top
:
`
${
-
h
}
px`
}
})
});
}
}
else
{
console
.
log
(
3
);
this
.
state
.
swipeDirection
!==
this
.
swipeUp
&&
if
(
y
<
this
.
prevScrollY
)
{
this
.
setState
({
swipeDirection
:
this
.
swipeUp
,
searchHeadStyle
:
{
position
:
'absolute'
,
top
:
`
${
y
}
px`
top
:
0
}
})
})
;
}
// if (y < this.prevScrollY) {
// if (this.state.swipeDirection === this.swipeDown) {
// y <= headY && this.state.searchHeadStyle.position !== 'fixed' &&
// this.setState({
// searchHeadStyle: {
// top: `0`,
// position: 'fixed'
// }
// })
// } else {
// this.setState({
// swipeDirection: this.swipeDown
// }, () => {
// if (this.state.swipeDirection === this.swipeDown) {
// let h = y > document.querySelector('body').offsetHeight? document.querySelector('body').offsetHeight: y;
// let h1 = this.searchHead.current.offsetHeight
// this.setState({
// searchHeadStyle: {
// // top: `${h > headY ? h - h1 : h}px`
// top: `${y}px`
// }
// })
// }
// })
// }
// } else {
// this.state.swipeDirection !== this.swipeUp &&
// this.setState({
// swipeDirection: this.swipeUp,
// searchHeadStyle: {
// position: 'absolute',
// top: `${y}px`
// }
// })
// }
this
.
prevScrollY
=
y
;
},
0
)
render
()
{
const
{
courseList
}
=
this
.
state
const
{
courseList
,
isHide
}
=
this
.
state
;
return
(
<
div
...
...
@@ -142,6 +148,7 @@ class SearchResult extends PureComponent {
searchHistory
=
{
this
.
state
.
searchHistory
}
style
=
{
this
.
state
.
searchHeadStyle
}
ref
=
{
this
.
searchHead
}
isHide
=
{
isHide
}
/
>
{
...
...
src/components/search/search-result.scss
View file @
1a7f8849
.search-result
{
padding-top
:
44px
;
.search-head
{
position
:
absolute
;
.search-head
{
// position: absolute;
position
:
fixed
;
top
:
0
;
left
:
0
;
width
:
100%
;
z-index
:
10
;
transition
:
top
0
.5
ease
;
&
.hide
{
top
:
-44px
;
}
}
ul
{
...
...
src/components/search/searchHead.js
View file @
1a7f8849
...
...
@@ -41,6 +41,7 @@ class SearchHead extends PureComponent {
const
{
isFocus
}
=
this
.
state
;
const
cls
=
classnames
(
'submit-btn'
,
{
'submit-btn--active'
:
isFocus
})
return
(
<
div
className
=
"search-head"
style
=
{
this
.
props
.
style
}
ref
=
{
this
.
props
.
forwardedRef
}
>
<
div
className
=
"left"
onClick
=
{
this
.
returnPage
}
>
...
...
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