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
818707fa
Commit
818707fa
authored
Sep 16, 2019
by
FE
Browse files
Options
Browse Files
Download
Plain Diff
pull master and solve conflict
parents
d66ee095
975419f3
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
87 additions
and
44 deletions
+87
-44
src/App.js
+5
-1
src/components/Index/index.js
+10
-10
src/components/detail/index.js
+1
-2
src/components/passport/accountLogin/index.js
+9
-9
src/components/passport/index.js
+3
-4
src/components/passport/login/index.js
+8
-3
src/components/study/myCourses/index.js
+1
-1
src/components/video/index.js
+46
-11
src/store/index.js
+1
-1
src/store/userReducer.js
+3
-2
No files found.
src/App.js
View file @
818707fa
...
...
@@ -58,7 +58,7 @@ class App extends Component {
const
routeMatchRule
=
/binding-tel|forgot|set-password/
const
{
history
}
=
this
.
props
history
.
listen
((
location
,
action
)
=>
{
history
.
listen
((
location
)
=>
{
this
.
setNavigationRecord
(
location
)
if
(
cookie
.
get
(
'uid'
)
&&
this
.
props
.
user
.
hasError
)
{
this
.
getUser
()
...
...
@@ -127,6 +127,10 @@ class App extends Component {
const
{
location
}
=
this
.
props
this
.
previousLocation
=
location
.
pathname
.
startsWith
(
'/passport'
)
?
this
.
previousLocation
.
pathname
===
'/'
?
location
:
this
.
previousLocation
:
location
if
(
!
this
.
props
.
user
.
hasError
&&
getParam
(
'redirect'
))
{
window
.
location
.
href
=
getParam
(
'redirect'
)
}
}
...
...
src/components/Index/index.js
View file @
818707fa
...
...
@@ -109,10 +109,10 @@ class Index extends Component {
}
toCourseDetail
=
(
id
)
=>
{
const
{
dispatch
,
history
}
=
this
.
props
;
const
{
dispatch
,
history
}
=
this
.
props
;
// dispatch(getCourses(id, () => {
history
.
push
(
`/detail?id=
${
id
}
`
);
return
false
;
history
.
push
(
`/detail?id=
${
id
}
`
);
return
false
;
// }));
}
...
...
@@ -138,7 +138,7 @@ class Index extends Component {
<
div
className
=
'index-swiper'
>
{
this
.
state
.
banner
&&
this
.
state
.
banner
.
length
>
0
&&
<
TopSwiper
bannerList
=
{
this
.
state
.
banner
}
/
>
<
TopSwiper
bannerList
=
{
this
.
state
.
banner
}
/
>
}
<
/div
>
...
...
@@ -148,10 +148,10 @@ class Index extends Component {
this
.
state
.
tabdata
.
map
((
item
,
index
)
=>
{
return
(
<
li
key
=
{
index
}
>
<
Link
to
=
{
item
.
href
}
>
<
img
src
=
{
item
.
src
}
alt
=
""
/>
<
a
href
=
{
item
.
href
}
>
<
img
src
=
{
item
.
src
}
alt
=
""
/>
<
span
>
{
item
.
name
}
<
/span
>
<
/
Link
>
<
/
a
>
<
/li
>
)
})
...
...
@@ -159,7 +159,7 @@ class Index extends Component {
<
/ul
>
<
/div
>
<
p
className
=
"borderTop"
/>
<
p
className
=
"borderTop"
/>
{
...
...
@@ -181,7 +181,7 @@ class Index extends Component {
modules
=
{
item
}
toDetail
=
{
this
.
toCourseDetail
}
/
>
<
p
className
=
"borderTop"
/>
<
p
className
=
"borderTop"
/>
<
/div
>
)
})
:
null
...
...
@@ -366,7 +366,7 @@ function ScrollBox(props) {
{
/*公开课需预约、付费课不需要预约*/
}
{
(
item
.
is_prepare
||
item
.
is_free
===
0
)
&&
item
.
live_status
===
0
&&
(
item
.
is_prepare
||
item
.
is_free
===
0
)
&&
item
.
live_status
===
0
&&
<
p
className
=
"item-time"
>
时间:
{
item
.
live_start_time
}
<
/p
>
}
{
...
...
src/components/detail/index.js
View file @
818707fa
...
...
@@ -579,8 +579,7 @@ class Detail extends Component {
<
ShareRank
courseInfo
=
{
course_info
}
/
>
}
{
/**
{
/**
* 拼团
* is_aist: 是否AI特训营
* group_status: 团状态,3:课程有小团 用户没参加小团;4:用户参加了小团
...
...
src/components/passport/accountLogin/index.js
View file @
818707fa
...
...
@@ -74,15 +74,15 @@ const formikConfig = {
const
{
props
,
props
:
{
history
}}
=
formikBag
props
.
accountLogin
({
username
,
password
})
// .then(res =>
{
// if (!res.hasError) {
// let {from} = props.location.state || {from: {pathname: '/', search: ''}}
//
history.replace({pathname: from.pathname, search: from.search || ''})
//
} else {
//
Toast.info(res.msg, 2, null, false)
//
}
// })
})
/*.then(res => {
if (!res.hasError)
{
let {from} = props.location.state || {from: {pathname: '/', search: ''}}
console.log(from, 'account');
history.replace({pathname: from.pathname, search: from.search || ''})
} else {
Toast.info(res.msg, 2, null, false)
}
})*/
}
}
...
...
src/components/passport/index.js
View file @
818707fa
...
...
@@ -15,6 +15,7 @@ import account from './account.png'
import
qq
from
'./qq.png'
import
sina
from
'./sina.png'
import
wechat
from
'./wechat.png'
import
{
getParam
}
from
"@/utils"
;
class
Passport
extends
Component
{
...
...
@@ -59,8 +60,6 @@ class Passport extends Component {
componentDidUpdate
()
{
this
.
routeWhenUserLoggedIn
()
// console.log(this.props.location);
}
...
...
@@ -72,8 +71,8 @@ class Passport extends Component {
history
.
push
(
'/'
)
}
else
{
const
{
from
}
=
location
.
state
||
{
from
:
{
pathname
:
'/'
,
search
:
''
}};
history
.
replace
(
from
);
// history.go(-1)
const
redirectURI
=
getParam
(
'redirect'
)
redirectURI
?
(
window
.
location
.
href
=
redirectURI
)
:
history
.
replace
(
from
);
}
}
}
...
...
src/components/passport/login/index.js
View file @
818707fa
...
...
@@ -12,7 +12,7 @@ import { connect } from 'react-redux';
import
{
compose
}
from
'redux'
;
import
{
isEmpty
}
from
'lodash'
import
{
Toast
}
from
'antd-mobile'
;
import
{
validateTel
}
from
"@/utils"
;
import
{
validateTel
,
getParam
}
from
"@/utils"
;
import
{
HeaderBar
}
from
"@/common"
;
...
...
@@ -27,11 +27,16 @@ class Login extends Component {
const
item
=
loginWays
.
find
(
item
=>
item
.
text
===
method
)
let
{
from
}
=
location
.
state
||
{
from
:
{
pathname
:
'/'
,
search
:
''
,
hash
:
''
}};
let
from
=
location
.
state
&&
location
.
state
.
from
||
{
pathname
:
'/'
,
search
:
window
.
location
.
search
,
hash
:
''
};
const
redirectURI
=
window
.
location
.
origin
+
from
.
pathname
+
from
.
search
+
from
.
hash
;
switch
(
method
)
{
case
'账号登录'
:
history
.
push
(
'/passport/account-login'
,
location
.
state
)
history
.
push
(
{
pathname
:
'/passport/account-login'
,
search
:
window
.
location
.
search
}
,
location
.
state
)
break
;
case
'微信'
:
window
.
location
.
assign
(
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=
${
encodeURIComponent
(
redirectURI
)}
&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
)
...
...
src/components/study/myCourses/index.js
View file @
818707fa
...
...
@@ -167,7 +167,7 @@ class MyCourses extends Component {
:
<
div
className
=
"empty"
>
<
p
><
i
className
=
'iconfont iconfish'
/><
/p
>
<
p
className
=
'empty-prompt'
>
还是咸鱼一条,快去翻身
~<
/p
>
<
p
className
=
'empty-prompt'
>
您还没有课程哦,赶快去选课吧
~<
/p
>
<
p
>
<
Link
className
=
'select-course'
to
=
'/classify'
>
去选课
<
/Link
>
<
/p
>
...
...
src/components/video/index.js
View file @
818707fa
...
...
@@ -75,6 +75,7 @@ class Video extends Component {
previousPlaybackRate
=
1
currentPlaybackRate
=
1
reconnect
=
true
timeEnough
=
false
recordSocket
recordTimer
...
...
@@ -382,12 +383,24 @@ class Video extends Component {
})
this
.
ws
.
addEventListener
(
'message'
,
e
=>
{
const
data
=
JSON
.
parse
(
e
.
data
);
data
.
code
==
4040
&&
(
this
.
reconnect
=
false
)
data
.
code
==
4040
&&
(
this
.
reconnect
=
false
);
data
.
code
==
5001
&&
(
this
.
timeEnough
=
true
);
})
}
sendMessage
=
message
=>
{
this
.
ws
&&
this
.
ws
.
readyState
===
1
&&
this
.
ws
.
send
(
JSON
.
stringify
(
message
))
let
readyState
=
this
.
ws
.
readyState
,
_this
=
this
;
if
(
readyState
===
1
)
{
this
.
ws
&&
this
.
ws
.
send
(
JSON
.
stringify
(
message
))
}
else
if
(
readyState
===
3
)
{
this
.
ws
.
close
();
this
.
ws
=
null
;
let
reconnect
=
setTimeout
(
function
()
{
clearTimeout
(
reconnect
);
reconnect
=
null
;
_this
.
ws
=
new
WebSocket
(
PROCESS_URL
);
},
500
);
}
}
//视频结束请求接口
...
...
@@ -408,6 +421,11 @@ class Video extends Component {
console
.
log
(
'免费课程 拦截'
);
return
;
}
// 时间足够不发送
if
(
this
.
timeEnough
)
{
console
.
log
(
'5001 时间足够'
);
return
;
}
if
(
course
.
is_aist
)
{
// 返现课程
this
.
sendMessage
({
...
...
@@ -424,7 +442,7 @@ class Video extends Component {
token
:
this
.
token
,
platform
:
5
,
video_id
:
videoList
[
activeIndex
][
'id'
],
course_id
:
this
.
courseID
,
course_id
:
this
.
state
.
courseId
,
v_course_id
:
vCourseId
,
})
}
...
...
@@ -442,6 +460,11 @@ class Video extends Component {
if
(
Number
(
sec
)
===
0
)
{
return
;
}
// 时间足够不发送
if
(
this
.
timeEnough
)
{
console
.
log
(
'5001 时间足够'
);
return
;
}
let
info_type
=
'c_watch_time'
;
if
(
course
.
is_aist
)
{
info_type
=
'watch_time'
;
...
...
@@ -451,11 +474,11 @@ class Video extends Component {
rate
,
time
:
sec
,
video_id
:
videoList
[
activeIndex
][
'id'
],
course_id
:
this
.
courseID
,
course_id
:
this
.
state
.
courseId
,
v_course_id
:
vCourseId
,
uid
:
this
.
props
.
user
.
data
.
uid
,
token
:
this
.
token
,
platform
:
0
platform
:
5
})
}
...
...
@@ -502,10 +525,14 @@ class Video extends Component {
this
.
previousPlaybackRate
=
this
.
currentPlaybackRate
})
this
.
player
.
on
(
'ended'
,
()
=>
{
console
.
log
(
'ended'
);
this
.
sendWatchTime
(
this
.
watchSec
,
this
.
currentPlaybackRate
)
this
.
countSchedule
();
// 计算进度
this
.
getShareProgressInfo
()
clearInterval
(
this
.
timer
)
// 返现课程才出现打卡记录
if
(
this
.
state
.
course
.
is_aist
)
{
this
.
getShareProgressInfo
()
}
clearInterval
(
this
.
timer
);
})
this
.
player
.
on
(
'seeked'
,
()
=>
{
this
.
sendRecord
()
...
...
@@ -535,8 +562,10 @@ class Video extends Component {
if
(
index
===
this
.
state
.
activeIndex
)
{
return
}
console
.
log
(
'selectVideo 先发送时间 在发送进度 在重置定时器'
);
this
.
sendWatchTime
(
this
.
watchSec
,
this
.
currentPlaybackRate
)
this
.
countSchedule
();
// 计算进度
this
.
setupTimer
();
this
.
setState
(
{
...
...
@@ -551,7 +580,7 @@ class Video extends Component {
this
.
getCoursePrice
();
}
}
)
)
;
}
getLastVideoIndex
=
lastIndex
=>
{
...
...
@@ -592,10 +621,16 @@ class Video extends Component {
const
{
course
=
{}}
=
this
.
state
;
if
(
Number
(
course
.
course_id
)
===
0
||
course
.
course_id
===
''
)
{
console
.
log
(
'免费课程 拦截'
);
}
else
{
}
else
{
let
_this
=
this
;
this
.
setupWS
();
this
.
setupTimer
();
this
.
countSchedule
();
console
.
log
(
'playSetup'
);
let
scheduleTime
=
setTimeout
(
function
()
{
clearTimeout
(
scheduleTime
);
scheduleTime
=
null
;
_this
.
countSchedule
();
},
1000
);
}
let
index
=
this
.
getLastVideoIndex
(
course
.
last_video_id
);
index
=
index
>=
0
?
index
:
0
;
...
...
src/store/index.js
View file @
818707fa
...
...
@@ -2,7 +2,7 @@ import { combineReducers } from 'redux';
import
myCourses
from
'@/components/study/myCourses/reducers'
import
courseInfo
from
'@/components/detail/reducers'
import
user
from
'./userReducer'
import
country
from
'@/components/country/countryRedux'
;
import
country
from
'@/components/country/countryRedux'
const
reducer
=
combineReducers
({
...
...
src/store/userReducer.js
View file @
818707fa
import
{
SET_CURRENT_USER
,
UPDATE_USER
,
START_FETCH_USER
}
from
'@/store/userAction'
;
import
{
merge
}
from
'lodash'
const
notLoggedIn
=
4030
const
initialState
=
{
hasError
:
fals
e
,
code
:
0
,
hasError
:
tru
e
,
code
:
notLoggedIn
,
msg
:
''
,
data
:
{
username
:
''
,
...
...
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