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
db7aed83
Commit
db7aed83
authored
Sep 10, 2019
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pull pre
parent
429a2a21
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
160 additions
and
66 deletions
+160
-66
package-lock.json
+46
-42
src/App.js
+18
-5
src/common/HeaderBar/index.js
+6
-1
src/components/search/search-result.js
+71
-12
src/components/search/search-result.scss
+10
-0
src/components/search/searchHead.js
+2
-2
src/components/video/index.js
+7
-4
No files found.
package-lock.json
View file @
db7aed83
...
...
@@ -1508,11 +1508,6 @@
"minimist"
:
"^1.2.0"
}
},
"lodash"
:
{
"version"
:
"4.17.11"
,
"resolved"
:
"https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz"
,
"integrity"
:
"sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
},
"resolve"
:
{
"version"
:
"1.10.0"
,
"resolved"
:
"https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz"
,
...
...
@@ -1598,6 +1593,11 @@
"resolved"
:
"https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz"
,
"integrity"
:
"sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA=="
},
"lodash"
:
{
"version"
:
"4.17.15"
,
"resolved"
:
"https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz"
,
"integrity"
:
"sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A=="
},
"ms"
:
{
"version"
:
"2.1.1"
,
"resolved"
:
"https://registry.npmjs.org/ms/-/ms-2.1.1.tgz"
,
...
...
@@ -3984,6 +3984,14 @@
"resolved"
:
"https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz"
,
"integrity"
:
"sha1-Z29us8OZl8LuGsOpJP1hJHSPV40="
},
"copy-to-clipboard"
:
{
"version"
:
"3.2.0"
,
"resolved"
:
"https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.2.0.tgz"
,
"integrity"
:
"sha512-eOZERzvCmxS8HWzugj4Uxl8OJxa7T2k1Gi0X5qavwydHIfuSHq2dTD09LOg/XyGq4Zpb5IsR/2OJ5lbOegz78w=="
,
"requires"
:
{
"toggle-selection"
:
"^1.0.6"
}
},
"core-js"
:
{
"version"
:
"2.6.5"
,
"resolved"
:
"https://registry.npmjs.org/core-js/-/core-js-2.6.5.tgz"
,
...
...
@@ -5405,9 +5413,12 @@
}
},
"eslint-utils"
:
{
"version"
:
"1.3.1"
,
"resolved"
:
"https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz"
,
"integrity"
:
"sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q=="
"version"
:
"1.4.2"
,
"resolved"
:
"https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.2.tgz"
,
"integrity"
:
"sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q=="
,
"requires"
:
{
"eslint-visitor-keys"
:
"^1.0.0"
}
},
"eslint-visitor-keys"
:
{
"version"
:
"1.0.0"
,
...
...
@@ -9252,9 +9263,9 @@
"integrity"
:
"sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4="
},
"lodash.mergewith"
:
{
"version"
:
"4.6.
1
"
,
"resolved"
:
"https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.
1
.tgz"
,
"integrity"
:
"sha512-
eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNd
Q=="
"version"
:
"4.6.
2
"
,
"resolved"
:
"https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.
2
.tgz"
,
"integrity"
:
"sha512-
GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboy
Q=="
},
"lodash.sortby"
:
{
"version"
:
"4.7.0"
,
...
...
@@ -9736,9 +9747,9 @@
}
},
"mixin-deep"
:
{
"version"
:
"1.3.
1
"
,
"resolved"
:
"https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.
1
.tgz"
,
"integrity"
:
"sha512-
8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ
=="
,
"version"
:
"1.3.
2
"
,
"resolved"
:
"https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.
2
.tgz"
,
"integrity"
:
"sha512-
WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA
=="
,
"requires"
:
{
"for-in"
:
"^1.0.2"
,
"is-extendable"
:
"^1.0.1"
...
...
@@ -12068,6 +12079,15 @@
}
}
},
"react-copy-to-clipboard"
:
{
"version"
:
"5.0.1"
,
"resolved"
:
"https://registry.npmjs.org/react-copy-to-clipboard/-/react-copy-to-clipboard-5.0.1.tgz"
,
"integrity"
:
"sha512-ELKq31/E3zjFs5rDWNCfFL4NvNFQvGRoJdAKReD/rUPA+xxiLPQmZBZBvy2vgH7V0GE9isIQpT9WXbwIVErYdA=="
,
"requires"
:
{
"copy-to-clipboard"
:
"^3"
,
"prop-types"
:
"^15.5.8"
}
},
"react-dev-utils"
:
{
"version"
:
"8.0.0"
,
"resolved"
:
"https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-8.0.0.tgz"
,
...
...
@@ -13325,9 +13345,9 @@
"integrity"
:
"sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"set-value"
:
{
"version"
:
"2.0.
0
"
,
"resolved"
:
"https://registry.npmjs.org/set-value/-/set-value-2.0.
0
.tgz"
,
"integrity"
:
"sha512-
hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg
=="
,
"version"
:
"2.0.
1
"
,
"resolved"
:
"https://registry.npmjs.org/set-value/-/set-value-2.0.
1
.tgz"
,
"integrity"
:
"sha512-
JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw
=="
,
"requires"
:
{
"extend-shallow"
:
"^2.0.1"
,
"is-extendable"
:
"^0.1.1"
,
...
...
@@ -14472,6 +14492,11 @@
"repeat-string"
:
"^1.6.1"
}
},
"toggle-selection"
:
{
"version"
:
"1.0.6"
,
"resolved"
:
"https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz"
,
"integrity"
:
"sha1-bkWxJj8gF/oKzH2J14sVuL932jI="
},
"topo"
:
{
"version"
:
"2.0.2"
,
"resolved"
:
"https://registry.npmjs.org/topo/-/topo-2.0.2.tgz"
,
...
...
@@ -14657,35 +14682,14 @@
}
},
"union-value"
:
{
"version"
:
"1.0.
0
"
,
"resolved"
:
"https://registry.npmjs.org/union-value/-/union-value-1.0.
0
.tgz"
,
"integrity"
:
"sha
1-XHHDTLW61dzr4+oM0IIHulqhrqQ
="
,
"version"
:
"1.0.
1
"
,
"resolved"
:
"https://registry.npmjs.org/union-value/-/union-value-1.0.
1
.tgz"
,
"integrity"
:
"sha
512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg=
="
,
"requires"
:
{
"arr-union"
:
"^3.1.0"
,
"get-value"
:
"^2.0.6"
,
"is-extendable"
:
"^0.1.1"
,
"set-value"
:
"^0.4.3"
},
"dependencies"
:
{
"extend-shallow"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz"
,
"integrity"
:
"sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8="
,
"requires"
:
{
"is-extendable"
:
"^0.1.0"
}
},
"set-value"
:
{
"version"
:
"0.4.3"
,
"resolved"
:
"https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz"
,
"integrity"
:
"sha1-fbCPnT0i3H945Trzw79GZuzfzPE="
,
"requires"
:
{
"extend-shallow"
:
"^2.0.1"
,
"is-extendable"
:
"^0.1.1"
,
"is-plain-object"
:
"^2.0.1"
,
"to-object-path"
:
"^0.3.0"
}
}
"set-value"
:
"^2.0.1"
}
},
"uniq"
:
{
...
...
src/App.js
View file @
db7aed83
...
...
@@ -43,7 +43,9 @@ class App extends Component {
script
.
src
=
'https://s22.cnzz.com/z_stat.php?id=1265696973&web_id=1265696973'
;
script
.
language
=
'JavaScript'
;
document
.
body
.
appendChild
(
script
);
this
.
setNavigationRecord
(
this
.
props
.
location
)
//平台信息
cookie
.
set
(
'plat'
,
'5'
,
{
domain
:
'.julyedu.com'
})
...
...
@@ -56,8 +58,9 @@ class App extends Component {
const
routeMatchRule
=
/binding-tel|forgot|set-password/
const
{
history
}
=
this
.
props
history
.
listen
(
location
=>
{
if
(
cookie
.
get
(
'uid'
)
&&
this
.
props
.
user
.
hasError
){
history
.
listen
((
location
,
action
)
=>
{
this
.
setNavigationRecord
(
location
)
if
(
cookie
.
get
(
'uid'
)
&&
this
.
props
.
user
.
hasError
)
{
this
.
getUser
()
}
const
{
pathname
}
=
location
...
...
@@ -70,9 +73,19 @@ class App extends Component {
})
}
setNavigationRecord
=
(
location
)
=>
{
let
{
location
:
_location
}
=
this
.
props
let
{
state
:
_state
=
{}}
=
_location
let
{
state
=
{}}
=
location
location
.
state
=
{
...
state
,
...{
record
:
_state
.
record
?
[...
_state
.
record
,
{
pathname
:
location
.
pathname
}]
:
[{
pathname
:
location
.
pathname
}]
}
}
}
getUser
=
()
=>
{
...
...
src/common/HeaderBar/index.js
View file @
db7aed83
...
...
@@ -9,10 +9,15 @@ class HeaderBar extends Component {
}
goBack
=
()
=>
{
const
{
state
}
=
this
.
props
.
location
if
(
browser
.
isWeixin
&&
getParam
(
'code'
)
&&
getParam
(
'state'
)){
window
.
history
.
go
(
-
2
)
}
window
.
history
.
go
(
-
1
);
if
(
state
.
record
&&
state
.
record
.
length
>
1
){
window
.
history
.
go
(
-
1
);
}
else
{
window
.
location
.
href
=
window
.
location
.
origin
}
}
toLink
=
()
=>
{
...
...
src/components/search/search-result.js
View file @
db7aed83
import
React
,
{
PureComponent
}
from
'react'
;
import
{
connect
}
from
'react-redux'
;
import
SearchHeader
from
'./searchHead'
import
VList
from
'@/common/VList'
import
{
http
,
getParam
}
from
'@/utils'
import
'./search-result.scss'
import
Recommendation
from
'./recommendation'
import
{
getCourses
}
from
'./../detail/actions'
;
import
throttle
from
'lodash/throttle'
const
ForwardRefSearchHead
=
React
.
forwardRef
((
props
,
ref
)
=>
{
return
<
SearchHeader
{...
props
}
forwardedRef
=
{
ref
}
/
>
})
const
Bottom
=
({
item
})
=>
{
return
(
...
...
@@ -16,17 +20,28 @@ const Bottom = ({item}) => {
)
}
@
connect
()
class
SearchResult
extends
PureComponent
{
prevScrollY
=
0
searchHead
=
React
.
createRef
()
swipeUp
=
'up'
swipeDown
=
'down'
state
=
{
courseList
:
[],
value
:
''
,
searchHistory
:
JSON
.
parse
(
localStorage
.
getItem
(
'searchHistory'
))
||
[]
value
:
decodeURIComponent
(
getParam
(
'word'
))
||
''
,
searchHistory
:
JSON
.
parse
(
localStorage
.
getItem
(
'searchHistory'
))
||
[],
fixedHeader
:
false
,
searchHeadStyle
:
{
top
:
0
},
swipeDirection
:
this
.
swipeUp
}
componentDidMount
()
{
this
.
getCourses
(
getParam
(
'word'
))
document
.
addEventListener
(
'scroll'
,
this
.
handleScroll
)
}
componentWillUnmount
()
{
document
.
removeEventListener
(
'scroll'
,
this
.
handleScroll
)
}
...
...
@@ -56,22 +71,65 @@ class SearchResult extends PureComponent {
}
toCourseDetail
=
(
id
)
=>
{
const
{
dispatch
,
history
}
=
this
.
props
;
// dispatch(getCourses(id, () => {
history
.
push
(
`/detail?id=
${
id
}
`
)
// }));
const
{
history
}
=
this
.
props
;
history
.
push
(
`/detail?id=
${
id
}
`
)
}
handleScroll
=
throttle
(()
=>
{
let
y
=
window
.
scrollY
,
headY
=
this
.
searchHead
.
current
.
offsetTop
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
)
{
this
.
setState
({
searchHeadStyle
:
{
top
:
`
${
y
>
headY
?
y
-
44
:
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
return
(
<
div
className
=
'search-result'
>
<
SearchHeader
<
div
className
=
{
'search-result'
}
>
<
ForwardRefSearchHead
handleSearch
=
{
this
.
handleSearch
}
value
=
{
this
.
state
.
value
}
handleChange
=
{
this
.
handleChange
}
searchHistory
=
{
this
.
state
.
searchHistory
}
style
=
{
this
.
state
.
searchHeadStyle
}
ref
=
{
this
.
searchHead
}
/
>
{
...
...
@@ -115,7 +173,8 @@ class SearchResult extends PureComponent {
抱歉!没有搜到相关内容
<
/div
>
}
<
Recommendation
/>
<
Recommendation
/>
<
/div
>
);
}
...
...
src/components/search/search-result.scss
View file @
db7aed83
.search-result
{
padding-top
:
44px
;
.search-head
{
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
z-index
:
10
;
}
ul
{
list-style
:
none
;
}
...
...
src/components/search/searchHead.js
View file @
db7aed83
...
...
@@ -38,9 +38,8 @@ class SearchHead extends PureComponent {
render
()
{
const
{
isFocus
}
=
this
.
state
;
const
cls
=
classnames
(
'submit-btn'
,
{
'submit-btn--active'
:
isFocus
})
console
.
log
(
isFocus
);
return
(
<
div
className
=
"search-head"
>
<
div
className
=
"search-head"
style
=
{
this
.
props
.
style
}
ref
=
{
this
.
props
.
forwardedRef
}
>
<
div
className
=
"left"
onClick
=
{
this
.
returnPage
}
>
<
i
className
=
"iconfont iconiconfront-68"
/>
...
...
@@ -57,6 +56,7 @@ class SearchHead extends PureComponent {
placeholder
=
"搜索课程"
onFocus
=
{()
=>
this
.
changeFontColor
(
true
)}
onBlur
=
{()
=>
this
.
changeFontColor
(
false
)}
onSubmit
=
{
this
.
search
}
/
>
<
/div
>
<
div
className
=
"right right-btn"
onClick
=
{
this
.
search
}
>
...
...
src/components/video/index.js
View file @
db7aed83
...
...
@@ -403,7 +403,7 @@ class Video extends Component {
//告诉服务端计算进度 普通课程不发送
countSchedule
=
()
=>
{
const
{
videoList
,
activeIndex
,
vCourseId
,
course
=
{}}
=
this
.
state
if
(
!
this
.
state
.
course
.
course_id
)
{
if
(
Number
(
course
.
course_id
)
===
0
||
course
.
course_id
===
''
)
{
console
.
log
(
'免费课程 拦截'
);
return
;
}
...
...
@@ -433,7 +433,7 @@ class Video extends Component {
sendWatchTime
=
(
sec
,
rate
)
=>
{
const
{
videoList
,
activeIndex
,
vCourseId
,
course
=
{}}
=
this
.
state
// 免费课程不发送
if
(
!
course
.
course_id
)
{
if
(
Number
(
course
.
course_id
)
===
0
||
course
.
course_id
===
''
)
{
console
.
log
(
'免费课程 拦截'
);
return
;
}
...
...
@@ -493,7 +493,6 @@ class Video extends Component {
this
.
player
.
addChild
(
'CustomPlayButtonCover'
)
this
.
player
.
on
(
'ready'
,
()
=>
{
this
.
recordSocket
.
emit
(
'load'
,
this
.
recordUserInfo
())
this
.
countSchedule
();
})
this
.
player
.
on
(
'ratechange'
,
()
=>
{
this
.
currentPlaybackRate
=
this
.
player
.
playbackRate
()
...
...
@@ -503,6 +502,7 @@ class Video extends Component {
})
this
.
player
.
on
(
'ended'
,
()
=>
{
this
.
sendWatchTime
(
this
.
watchSec
,
this
.
currentPlaybackRate
)
this
.
countSchedule
();
// 计算进度
this
.
getShareProgressInfo
()
clearInterval
(
this
.
timer
)
})
...
...
@@ -589,9 +589,12 @@ class Video extends Component {
playSetup
=
()
=>
{
// is_aist,是否AI特训营
const
{
course
=
{}
}
=
this
.
state
;
if
(
course
.
is_aist
)
{
if
(
Number
(
course
.
course_id
)
===
0
||
course
.
course_id
===
''
)
{
console
.
log
(
'免费课程 拦截'
);
}
else
{
this
.
setupWS
();
this
.
setupTimer
();
this
.
countSchedule
();
}
let
index
=
this
.
getLastVideoIndex
(
course
.
last_video_id
);
index
=
index
>=
0
?
index
:
0
;
...
...
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