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
a8c5d649
Commit
a8c5d649
authored
Sep 27, 2019
by
FE
Browse files
Options
Browse Files
Download
Plain Diff
del build
parents
1a7f8849
241193c5
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
376 additions
and
143 deletions
+376
-143
package-lock.json
+5
-22
src/App.js
+53
-56
src/common/CallApp/index.js
+0
-6
src/common/VList/index.js
+1
-0
src/components/bargainMiddlePage/barcode/index.js
+0
-1
src/components/coupons/Coupon/index.js
+14
-1
src/components/coupons/myCoupons/index.js
+89
-21
src/components/coupons/myCoupons/index.scss
+86
-1
src/components/detail/index.js
+15
-2
src/components/detail/outline/index.js
+20
-3
src/components/my/edit.js
+1
-1
src/components/passport/index.js
+25
-18
src/components/preferential/index.js
+10
-4
src/components/purchased/index.js
+5
-0
src/components/purchased/index.scss
+15
-1
src/components/scholarship/index.js
+12
-1
src/components/study/myCourses/index.js
+5
-0
src/components/study/myCourses/my-courses.scss
+15
-0
src/router/route-middle-page.js
+3
-3
src/router/router-config.js
+2
-2
No files found.
package-lock.json
View file @
a8c5d649
...
...
@@ -3692,6 +3692,11 @@
"resolved"
:
"https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz"
,
"integrity"
:
"sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk="
},
"clipboard-copy"
:
{
"version"
:
"3.1.0"
,
"resolved"
:
"https://registry.npmjs.org/clipboard-copy/-/clipboard-copy-3.1.0.tgz"
,
"integrity"
:
"sha512-Xsu1NddBXB89IUauda5BIq3Zq73UWkjkaQlPQbLNvNsd5WBMnTWPNKYR6HGaySOxGYZ+BKxP2E9X4ElnI3yiPA=="
},
"cliui"
:
{
"version"
:
"4.1.0"
,
"resolved"
:
"https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz"
,
...
...
@@ -3984,14 +3989,6 @@
"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"
,
...
...
@@ -12087,15 +12084,6 @@
}
}
},
"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"
,
...
...
@@ -14514,11 +14502,6 @@
"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"
,
...
...
src/App.js
View file @
a8c5d649
import
React
,
{
Component
}
from
'react'
import
React
,
{
Component
}
from
'react'
import
Routes
from
'./router'
import
cookie
from
'js-cookie'
import
{
connect
}
from
"react-redux"
;
import
{
setCurrentUser
,
startFetchUser
}
from
"@/store/userAction"
;
import
{
withRouter
}
from
'react-router-dom'
import
{
compose
}
from
'redux'
import
{
getParam
,
http
,
browser
}
from
"@/utils"
;
import
{
Toast
}
from
"antd-mobile"
;
import
{
addDays
}
from
'date-fns'
import
{
connect
}
from
"react-redux"
import
{
setCurrentUser
,
startFetchUser
}
from
"@/store/userAction"
import
{
withRouter
}
from
'react-router-dom'
import
{
compose
}
from
'redux'
import
{
getParam
,
http
,
browser
}
from
"@/utils"
import
{
Toast
}
from
"antd-mobile"
import
{
addDays
}
from
'date-fns'
//拦截ajax请求,返回mock数据
...
...
@@ -16,39 +16,26 @@ mock()*/
// 默认样式
import
'./assets/css/index.scss'
;
import
'./assets/css/index.scss'
// iconfont
import
'./assets/font/iconfont.css'
;
import
'./assets/font/iconfont.css'
class
App
extends
Component
{
previousLocation
=
{
...{
state
:
{
from
:
{
pathname
:
this
.
props
.
location
.
pathname
,
search
:
this
.
props
.
location
.
search
,
hash
:
this
.
props
.
location
.
hash
}
}
},
...
this
.
props
.
location
}
static
displayName
=
'App'
previousLocation
=
{
pathname
:
'/'
,
search
:
''
,
hash
:
''
}
records
=
[]
pathnameBlacklist
=
[
'/country'
,
'/passport'
]
firstLoad
=
true
componentDidMount
()
{
// 友盟统计
const
script
=
document
.
createElement
(
'script'
);
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
,
this
.
props
.
history
.
action
)
this
.
umengStatistic
()
//平台信息
...
...
@@ -57,23 +44,37 @@ class App extends Component {
if
(
browser
.
isWeixin
&&
browser
.
isIOS
)
{
sessionStorage
.
setItem
(
'enter_url'
,
window
.
location
.
href
)
}
this
.
getUser
()
this
.
utm
()
const
routeMatchRule
=
/binding-tel|forgot|set-password/
const
{
history
}
=
this
.
props
this
.
setNavigationRecord
(
this
.
props
.
location
,
this
.
props
.
history
.
action
)
this
.
setPreviousLocation
()
history
.
listen
((
location
,
action
)
=>
{
this
.
utm
()
this
.
firstLoad
=
false
this
.
setNavigationRecord
(
location
,
action
)
this
.
utm
()
if
(
cookie
.
get
(
'uid'
)
&&
this
.
props
.
user
.
hasError
)
{
this
.
getUser
()
}
const
{
pathname
}
=
location
const
{
pathname
,
state
}
=
location
if
(
pathname
.
startsWith
(
'/passport'
))
{
if
(
routeMatchRule
.
test
(
pathname
))
{
return
location
.
state
=
{
...
state
,
...{
from
:
{
pathname
:
this
.
previousLocation
.
pathname
,
search
:
this
.
previousLocation
.
search
,
hash
:
this
.
previousLocation
.
hash
}
}
}
location
.
state
=
{...
location
.
state
,
...{
from
:
this
.
previousLocation
}};
}
else
{
this
.
removeShareCodeCookie
()
}
...
...
@@ -82,6 +83,14 @@ class App extends Component {
}
umengStatistic
=
()
=>
{
// 友盟统计
const
script
=
document
.
createElement
(
'script'
)
script
.
src
=
'https://s22.cnzz.com/z_stat.php?id=1265696973&web_id=1265696973'
script
.
language
=
'JavaScript'
document
.
body
.
appendChild
(
script
)
}
removeShareCodeCookie
=
()
=>
{
cookie
.
remove
(
'share_code'
,
{
path
:
'/'
,
domain
:
'.julyedu.com'
})
}
...
...
@@ -89,6 +98,7 @@ class App extends Component {
setNavigationRecord
=
(
location
,
action
)
=>
{
const
{
pathname
,
search
,
hash
}
=
location
let
isLastRecord
=
location
.
pathname
===
(
this
.
records
.
length
&&
this
.
records
[
this
.
records
.
length
-
1
].
pathname
)
switch
(
action
)
{
case
'POP'
:
this
.
firstLoad
?
this
.
records
.
push
({
pathname
,
search
,
hash
})
:
this
.
records
.
pop
()
...
...
@@ -102,7 +112,7 @@ class App extends Component {
location
.
state
&&
location
.
state
.
records
?
(
location
.
state
.
records
=
this
.
records
)
:
location
.
state
?
location
.
state
=
{...
location
.
state
,
records
:
this
.
records
}
:
location
.
state
?
location
.
state
=
{...
location
.
state
,
records
:
this
.
records
}
:
(
location
.
state
=
{
records
:
this
.
records
})
}
...
...
@@ -133,7 +143,7 @@ class App extends Component {
}
getUser
=
()
=>
{
//获取用户信息
this
.
props
.
startFetchUser
()
http
.
get
(
`
${
API
.
home
}
/m/user_info`
).
then
(
res
=>
{
this
.
props
.
setCurrentUser
(
this
.
transformUser
(
res
))
...
...
@@ -170,30 +180,17 @@ class App extends Component {
componentDidUpdate
()
{
this
.
setPreviousLocation
()
if
(
!
this
.
props
.
user
.
hasError
&&
getParam
(
'redirect'
))
{
window
.
location
.
href
=
getParam
(
'redirect'
)
}
}
setPreviousLocation
=
()
=>
{
const
{
location
,
history
:
{
action
}}
=
this
.
props
if
(
location
.
pathname
.
startsWith
(
'/passport'
))
{
/*let index = this.records.findIndex(item => item.pathname.startsWith('/passport'))
this.previousLocation = index > 0
? this.records[index - 1]
: this.records.length
? this.records[this.records.length - 1]
: null*/
}
else
{
if
(
action
===
'POP'
||
action
===
'REPLACE'
)
{
let
index
=
this
.
records
.
findIndex
(
item
=>
item
.
pathname
.
startsWith
(
'/passport'
))
this
.
previousLocation
=
index
>
0
?
this
.
records
[
index
-
1
]
:
this
.
records
[
this
.
records
.
length
-
1
]
}
else
{
this
.
previousLocation
=
location
}
}
const
{
location
}
=
this
.
props
let
isInBlacklist
=
this
.
pathnameBlacklist
.
some
(
item
=>
location
.
pathname
.
startsWith
(
item
))
!
isInBlacklist
&&
(
this
.
previousLocation
=
location
)
}
transformUser
=
res
=>
{
...
...
src/common/CallApp/index.js
View file @
a8c5d649
...
...
@@ -31,12 +31,6 @@ class OpenApp extends Component {
text
:
'在APP打开'
}
componentWillMount
()
{
// this.callApp = new CallApp({});
}
handleClick
=
()
=>
{
this
.
callApp
.
open
({
path
:
''
,
...
...
src/common/VList/index.js
View file @
a8c5d649
...
...
@@ -12,6 +12,7 @@ const VList = (props) => {
<
div
className
=
"content"
>
<
div
className
=
"cover"
>
{
props
.
status
}
{
props
.
courseExpire
}
{
props
.
toDetail
?
(
<
img
src
=
{
props
.
img
}
alt
=
""
/>
)
:
(
<
img
src
=
{
props
.
img
}
alt
=
""
/>
)
...
...
src/components/bargainMiddlePage/barcode/index.js
View file @
a8c5d649
...
...
@@ -27,7 +27,6 @@ class FollowBarcode extends Component {
const
_this
=
this
;
return
new
Promise
(
resolve
=>
{
QRCode
.
toDataURL
(
data
.
url
,
{},
function
(
err
,
url
)
{
console
.
log
(
url
);
_this
.
setState
({
codeUrl
:
url
});
...
...
src/components/coupons/Coupon/index.js
View file @
a8c5d649
...
...
@@ -7,11 +7,15 @@ class Coupon extends PureComponent {
pick
=
()
=>
{
let
{
useCoupon
,
invalid
}
=
this
.
props
!
invalid
&&
useCoupon
&&
useCoupon
(
this
.
props
.
id
)
}
GoToUse
=
()
=>
{
this
.
props
.
useCoupon
(
this
.
props
.
id
)
}
ExchangeCourse
=
(
e
)
=>
{
this
.
props
.
toExchangeCourse
(
e
,
this
.
props
.
code
)
}
render
()
{
let
{
...
...
@@ -22,6 +26,7 @@ class Coupon extends PureComponent {
invalid
,
course_title
,
id
,
code
,
selectedCouponId
,
showUseButton
}
=
this
.
props
...
...
@@ -56,13 +61,21 @@ class Coupon extends PureComponent {
limit_course
===
0
?
'可用于大于代金券金额的课程'
:
`仅适用于《
${
course_title
}
》`
}
<
/span
>
{
showUseButton
&&
showUseButton
&&
ctype
==
1
&&
<
button
className
=
'use'
onClick
=
{
this
.
GoToUse
}
>
立即使用
<
/button
>
}
{
showUseButton
&&
ctype
==
2
&&
<
button
className
=
'use'
onClick
=
{(
e
)
=>
this
.
ExchangeCourse
(
e
)}
>
立即兑换
<
/button
>
}
<
/div
>
<
/li
>
...
...
src/components/coupons/myCoupons/index.js
View file @
a8c5d649
import
React
,
{
PureComponent
}
from
'react'
;
import
React
,
{
PureComponent
}
from
'react'
;
import
'./index.scss'
import
RedeemBar
from
"../RedeemBar"
;
import
Coupon
from
'../Coupon'
import
{
http
,
getParam
}
from
'@/utils'
import
{
WithFullSize
}
from
'@/HOCs'
import
{
Toast
}
from
'antd-mobile'
import
{
isEmpty
}
from
'lodash'
import
{
connect
}
from
'react-redux'
;
import
{
http
,
getParam
}
from
'@/utils'
import
{
WithFullSize
}
from
'@/HOCs'
import
{
Toast
}
from
'antd-mobile'
import
{
isEmpty
}
from
'lodash'
import
{
connect
}
from
'react-redux'
;
@
connect
()
class
UseCoupon
extends
PureComponent
{
...
...
@@ -19,11 +19,12 @@ class UseCoupon extends PureComponent {
valid_coupons
:
[],
invalid_coupons
:
[],
courseId
:
getParam
(
'id'
),
showUseButton
:
false
showUseButton
:
false
,
courseCouponExchange
:
false
,
// 课程券兑换弹窗
courseCouponData
:
''
// 兑换课程信息
}
componentDidMount
()
{
const
{
history
,
location
}
=
this
.
props
const
{
state
}
=
this
.
props
.
location
...
...
@@ -47,6 +48,7 @@ class UseCoupon extends PureComponent {
this
.
setState
({
redeemCode
:
value
})
}
// 兑换
exchange
=
()
=>
{
const
{
location
:
{
state
=
{}}}
=
this
.
props
;
if
(
this
.
state
.
redeemCode
!==
''
)
{
...
...
@@ -59,6 +61,13 @@ class UseCoupon extends PureComponent {
const
coupon
=
data
.
data
if
(
coupon
[
'ctype'
]
==
2
)
{
this
.
setState
({
courseCouponData
:
coupon
,
courseCouponExchange
:
true
,
redeemCode
:
''
})
}
else
{
if
(
this
.
state
.
showUseButton
)
{
this
.
setState
({
couponList
:
[...
this
.
state
.
couponList
,
coupon
],
...
...
@@ -67,21 +76,11 @@ class UseCoupon extends PureComponent {
}
else
{
const
coupon
=
data
.
data
if
(
coupon
[
'ctype'
]
==
2
&&
coupon
[
'limit_course'
]
!=
this
.
state
.
courseId
)
{
this
.
setState
({
invalid_coupons
:
[...
this
.
state
.
invalid_coupons
,
coupon
],
showUseButton
:
null
});
}
else
{
this
.
setState
({
valid_coupons
:
[...
this
.
state
.
valid_coupons
,
coupon
],
redeemCode
:
''
})
}
}
Toast
.
info
(
'兑换成功'
)
if
(
state
.
from
===
'/my'
)
{
this
.
getMyCoupons
()
...
...
@@ -89,6 +88,7 @@ class UseCoupon extends PureComponent {
if
(
state
.
from
===
'/order'
)
{
this
.
getAllCoupons
()
}
}
}
else
{
Toast
.
info
(
data
.
msg
)
}
...
...
@@ -135,6 +135,24 @@ class UseCoupon extends PureComponent {
})
}
// 立即兑换课程
toExchangeCourse
=
(
e
,
code
)
=>
{
e
.
stopPropagation
();
http
.
post
(
`
${
API
[
'base-api'
]}
/pay/miandan/
${
code
}
`
,
{
}).
then
(
res
=>
{
const
data
=
res
.
data
if
(
data
.
errno
===
200
)
{
this
.
setState
({
courseCouponExchange
:
true
,
courseCouponData
:
res
.
data
.
data
})
this
.
getMyCoupons
()
}
else
{
Toast
.
info
(
data
.
msg
)
}
})
}
useCoupon
=
val
=>
{
const
{
history
,
dispatch
}
=
this
.
props
const
coupon
=
this
.
state
.
couponList
.
find
(
item
=>
item
.
id
===
val
)
...
...
@@ -142,13 +160,11 @@ class UseCoupon extends PureComponent {
if
(
val
)
{
if
(
this
.
state
.
showUseButton
)
{
if
(
coupon
[
'
ctype'
]
===
1
)
{
if
(
coupon
[
'
limit_course'
]
===
0
)
{
history
.
push
(
`/classify`
)
}
else
{
// dispatch(getCourses(coupon['limit_course'], () => {
history
.
push
(
`/detail?id=
${
coupon
[
'limit_course'
]}
`
);
return
false
;
// }));
}
}
else
{
...
...
@@ -206,6 +222,26 @@ class UseCoupon extends PureComponent {
}
// 开始学习
toStudy
=
(
vCourseId
,
isHaveVideo
)
=>
{
const
{
history
}
=
this
.
props
;
if
(
isHaveVideo
==
0
)
{
Toast
.
info
(
'尚未开课,开课后立即上传课程~'
,
2
)
}
else
{
history
.
push
(
`/play/video?id=
${
vCourseId
}
`
)
}
this
.
setState
({
courseCouponExchange
:
false
})
}
// 关闭弹窗
closeFreeCourse
=
()
=>
{
this
.
setState
({
courseCouponExchange
:
false
})
}
render
()
{
const
{
state
}
=
this
.
props
.
location
const
{
showUseButton
,
selectedCouponId
}
=
this
.
state
...
...
@@ -227,6 +263,7 @@ class UseCoupon extends PureComponent {
selectedCouponId
=
{
selectedCouponId
}
select
=
{
this
.
select
}
useCoupon
=
{
this
.
useCoupon
}
toExchangeCourse
=
{
this
.
toExchangeCourse
}
/
>
{
this
.
state
.
invalid_coupons
.
length
>
0
&&
...
...
@@ -244,6 +281,11 @@ class UseCoupon extends PureComponent {
)
}
<
/div
>
{
this
.
state
.
courseCouponExchange
&&
<
FreeCouponCourse
toStudy
=
{
this
.
toStudy
}
closeFreeCourse
=
{
this
.
closeFreeCourse
}
courseCouponData
=
{
this
.
state
.
courseCouponData
}
/
>
}
<
/div
>
);
}
...
...
@@ -275,4 +317,29 @@ function Content({coupons, ...rest}) {
)
}
function
FreeCouponCourse
(
props
)
{
const
{
toStudy
,
closeFreeCourse
,
courseCouponData
}
=
props
return
(
<
div
className
=
"free-coupon-box"
>
<
div
className
=
"free-coupon-content"
>
<
div
className
=
"coures-content-success"
><
i
className
=
{
'iconfont icondanseshixintubiao-5'
}
/></
div
>
<
div
className
=
"coures-content-title"
>
恭喜你课程兑换成功
!
赶快去学习吧
~<
/div
>
<
img
className
=
"coures-content-img"
src
=
{
courseCouponData
.
image_name
}
alt
=
""
/>
{
courseCouponData
.
course_expire
!=
0
&&
<
div
className
=
"coures-content-tip"
><
i
className
=
{
'iconfont icondanseshixintubiao-8'
}
/><span>课程有效期:自今日起{courseCouponData.course_expire}天内,请在有效期内学习该课程哦~</
span
>
<
/div
>
}
<
a
className
=
'toStudy'
onClick
=
{()
=>
toStudy
(
courseCouponData
.
v_course_id
,
courseCouponData
.
is_is_start
)}
>
去学习
<
/a
>
<
/div
>
<
div
className
=
"free-coupon-close"
>
<
i
className
=
{
'iconfont iconiconfront-2'
}
onClick
=
{()
=>
closeFreeCourse
()}
/
>
<
/div
>
<
/div
>
)
}
export
default
WithFullSize
(
UseCoupon
);
\ No newline at end of file
src/components/coupons/myCoupons/index.scss
View file @
a8c5d649
...
...
@@ -17,11 +17,95 @@
text-align
:
center
;
}
.invalid-title
{
.invalid-title
{
text-align
:
center
;
font-size
:
$font_12
;
line-height
:
52px
;
color
:
$color_999
;
}
}
.free-coupon-box
{
position
:
fixed
;
width
:
100%
;
top
:
0
;
left
:
0
;
right
:
0
;
bottom
:
0
;
text-align
:
center
;
background
:
rgba
(
0
,
0
,
0
,.
6
);
z-index
:
11
;
.free-coupon-content
{
width
:
290px
;
border-radius
:
10px
;
background-color
:
#fff
;
padding
:
20px
;
margin
:
150px
auto
0
auto
;
.coures-content-success
{
height
:
30px
;
line-height
:
30px
;
i
{
font-size
:
34px
;
color
:
#09f
;
}
}
.coures-content-title
{
font-size
:
15px
;
color
:
#333
;
margin-top
:
10px
;
}
.coures-content-img
{
width
:
150px
;
height
:
108px
;
border-radius
:
3px
;
margin-top
:
20px
;
}
.coures-content-tip
{
color
:
#FF3131
;
font-size
:
12px
;
margin-top
:
20px
;
text-align
:
left
;
line-height
:
15px
;
height
:
30px
;
i
{
display
:
inline-block
;
color
:
#FF3131
;
font-size
:
18px
;
position
:
relative
;
top
:
6px
;
}
span
{
display
:
inline-block
;
margin-left
:
20px
;
position
:
relative
;
top
:
-15px
;
}
}
.toStudy
{
display
:
inline-block
;
width
:
138px
;
height
:
30px
;
line-height
:
30px
;
background-color
:
#09f
;
border-radius
:
15px
;
margin-top
:
20px
;
font-size
:
15px
;
color
:
#fff
;
}
}
.free-coupon-close
{
margin-top
:
30px
;
i
{
font-size
:
26px
;
color
:
#fff
;
}
}
}
}
\ No newline at end of file
src/components/detail/index.js
View file @
a8c5d649
...
...
@@ -18,6 +18,7 @@ import {bindActionCreators} from "redux";
import
{
delCountryNum
}
from
'./../country/countryRedux'
;
import
RedPacket
from
'./redPacket'
;
import
{
Link
}
from
"react-router-dom"
;
class
Detail
extends
Component
{
...
...
@@ -318,13 +319,25 @@ class Detail extends Component {
}
// 点击子组件试听按钮
toAudition
=
(
v
_course_id
,
video_i
d
)
=>
{
toAudition
=
(
v
CourseId
,
videoI
d
)
=>
{
const
{
user
}
=
this
.
props
const
uid
=
user
&&
user
.
data
&&
user
.
data
.
uid
if
(
!
uid
)
{
this
.
props
.
history
.
push
(
'/passport/login'
)
}
else
{
this
.
props
.
history
.
push
(
`/play/video?id=
${
v_course_id
}
&video_id=
${
video_id
}
`
);
if
(
videoId
==
''
||
videoId
==
0
||
videoId
==
undefined
){
return
false
;
}
http
.
post
(
`
${
API
[
'base-api'
]}
/sys/get_class_audition?video_id=
${
videoId
}
`
).
then
((
res
)
=>
{
if
(
res
.
data
.
errno
==
200
)
{
this
.
props
.
history
.
push
(
`/play/video?id=
${
vCourseId
+
'&video_id='
+
videoId
}
`
)
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
);
}
})
// this.setState({
// auditionBox: true,
// })
}
}
// 点击子组件单集购买按钮
...
...
src/components/detail/outline/index.js
View file @
a8c5d649
...
...
@@ -11,7 +11,8 @@ class OutLine extends Component {
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
stageInfo
:
[]
stageInfo
:
[],
tab
:
0
,
}
}
...
...
@@ -44,6 +45,12 @@ class OutLine extends Component {
})
}
changeTab
=
(
tab
,
index
)
=>
{
this
.
setState
({
tab
:
index
})
}
render
()
{
const
tabs
=
[
{
title
:
'介绍'
},
...
...
@@ -60,16 +67,25 @@ class OutLine extends Component {
<
Tabs
tabs
=
{
tabs
}
initialPage
=
{
0
}
swipeable
=
{
false
}
renderTabBar
=
{
RenderTabBar
}
onTabClick
=
{(
tab
,
index
)
=>
this
.
changeTab
(
tab
,
index
)}
// renderTabBar={RenderTabBar}
>
<
/Tabs
>
{
/*介绍*/
}
{
this
.
state
.
tab
===
0
?
(
<
div
className
=
'introduce'
>
<
p
>
讲师:
{
introduce
.
teachers
}
<
/p
>
<
p
>
课时:
{
introduce
.
course_hour
}
<
/p
>
<
p
>
时间:
{
introduce
.
start_time
}
<
/p
>
<
div
className
=
'dec'
dangerouslySetInnerHTML
=
{{
__html
:
this
.
htmlDecode
(
introduce
.
intro
)}}
><
/div
>
<
/div
>
)
:
null
}
{
/*大纲*/
}
{
this
.
state
.
tab
===
1
?
(
<
div
className
=
'outline'
>
{
this
.
state
.
stageInfo
&&
this
.
state
.
stageInfo
.
length
>
0
&&
this
.
state
.
stageInfo
.
map
((
item
,
index
)
=>
{
...
...
@@ -201,7 +217,8 @@ class OutLine extends Component {
})
}
<
/div
>
<
/Tabs
>
)
:
null
}
<
/StickyContainer
>
<
WhiteSpace
/>
<
/div
>
...
...
src/components/my/edit.js
View file @
a8c5d649
...
...
@@ -40,7 +40,7 @@ class MyEdut extends PureComponent {
// 退出登录
outLogin
=
()
=>
{
this
.
props
.
logout
()
Toast
.
info
(
'已退出'
,
2
)
Toast
.
info
(
'已退出'
,
2
,
null
,
false
)
this
.
props
.
history
.
push
(
'/my'
)
}
...
...
src/components/passport/index.js
View file @
a8c5d649
...
...
@@ -9,9 +9,9 @@ import ForgotPassword from './forgotPassword'
import
SetPassword
from
'./setPassword'
import
BindingTel
from
'./bindingTel'
import
ForgotPasswordEmail
from
'./forgotPasswordEmail'
import
{
connect
}
from
"react-redux"
;
import
{
compose
}
from
"redux"
;
import
{
getParam
}
from
"@/utils"
;
import
{
connect
}
from
"react-redux"
import
{
compose
}
from
"redux"
import
{
getParam
}
from
"@/utils"
import
account
from
'./icons/account.png'
import
qq
from
'./icons/qq.png'
...
...
@@ -22,12 +22,13 @@ import wechat from './icons/wechat.png'
class
Passport
extends
Component
{
redirectURL
=
'/'
count
=
1
constructor
(
props
)
{
super
(
props
)
;
super
(
props
)
const
{
location
}
=
props
const
{
pathname
,
search
,
hash
}
=
location
const
{
from
}
=
location
.
state
||
{
from
:
{
pathname
:
pathname
,
search
:
search
,
hash
:
hash
}
}
const
from
=
location
.
state
&&
location
.
state
.
from
||
{
pathname
:
pathname
,
search
:
search
,
hash
:
hash
}
this
.
redirectURL
=
window
.
location
.
origin
+
from
.
pathname
+
from
.
search
+
from
.
hash
this
.
state
=
{
loginWays
:
[
...
...
@@ -60,27 +61,33 @@ class Passport extends Component {
componentDidMount
()
{
this
.
routeWhenUserLoggedIn
()
const
{
history
}
=
this
.
props
if
(
!
window
.
passportHistoryListener
)
{
this
.
unlisten
=
history
.
listen
((
location
,
action
)
=>
{
window
.
passportHistoryListener
=
this
.
unlisten
location
.
pathname
!==
'/country'
&&
!
location
.
pathname
.
startsWith
(
'/passport'
)
&&
this
.
unlisten
()
if
(
action
===
'PUSH'
)
{
this
.
count
++
}
else
if
(
action
===
'POP'
)
{
this
.
count
--
}
})
}
}
componentDidUpdate
()
{
this
.
routeWhenUserLoggedIn
()
}
routeWhenUserLoggedIn
=
()
=>
{
let
{
history
,
location
}
=
this
.
props
let
{
data
}
=
this
.
props
.
user
if
(
data
&&
Object
.
values
(
data
).
filter
(
item
=>
!!
item
).
length
)
{
if
(
history
.
action
===
'POP'
&&
history
.
length
<=
3
)
{
history
.
push
(
'/'
)
}
else
{
if
(
!
(
this
.
props
.
user
&&
this
.
props
.
user
.
stage
))
{
const
from
=
location
.
state
&&
location
.
state
.
from
||
{
pathname
:
'/'
,
search
:
''
};
let
{
hasError
}
=
this
.
props
.
user
if
(
!
hasError
)
{
const
redirectURI
=
getParam
(
'redirect'
)
redirectURI
?
(
window
.
location
.
href
=
redirectURI
)
:
history
.
replace
(
from
);
}
}
redirectURI
?
(
window
.
location
.
href
=
redirectURI
)
:
this
.
props
.
history
.
go
(
-
this
.
count
)
}
}
...
...
src/components/preferential/index.js
View file @
a8c5d649
...
...
@@ -43,7 +43,8 @@ class Preferential extends Component {
http
.
get
(
`
${
API
.
home
}
/m/home/bargainZone`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
this
.
setState
({
dataList
:
res
.
data
.
data
dataList
:
res
.
data
.
data
,
isLoading
:
false
,
})
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
)
...
...
@@ -55,7 +56,8 @@ class Preferential extends Component {
http
.
get
(
`
${
API
.
home
}
/m/home/grouponList`
).
then
((
res
)
=>
{
if
(
res
.
data
.
code
===
200
)
{
this
.
setState
({
dataList
:
res
.
data
.
data
dataList
:
res
.
data
.
data
,
isLoading
:
false
,
})
}
else
{
Toast
.
info
(
res
.
data
.
msg
,
2
)
...
...
@@ -64,7 +66,10 @@ class Preferential extends Component {
}
// tab 切换
ontabclick
=
(
tab
,
index
)
=>
{
this
.
state
.
courseStatus
=
index
this
.
setState
({
courseStatus
:
index
,
isLoading
:
true
,
})
switch
(
index
)
{
case
0
:
this
.
specialSale
()
...
...
@@ -104,10 +109,12 @@ class Preferential extends Component {
animated
=
{
false
}
onChange
=
{(
tab
,
index
)
=>
this
.
ontabclick
(
tab
,
index
)}
swipeable
=
{
false
}
page
=
{
this
.
state
.
courseStatus
}
renderTabBar
=
{
props
=>
<
div
className
=
{
'custom-tab-bar'
}
>
<
Tabs
.
DefaultTabBar
{...
props
}
/
>
<
/div>
}
>
<
/Tabs
>
<
div
className
=
'tabs'
>
<
ul
>
{
this
.
state
.
dataList
.
map
((
item
,
index
)
=>
{
...
...
@@ -163,7 +170,6 @@ class Preferential extends Component {
<
/ul
>
<
/div
>
<
/Tabs
>
<
WhiteSpace
/>
<
/div
>
<
/Loading
>
...
...
src/components/purchased/index.js
View file @
a8c5d649
...
...
@@ -82,6 +82,10 @@ class Purchased extends Component {
const
status
=
(
item
.
is_aist
&&
<
span
className
=
'status'
>
返现
<
/span
>
)
const
courseExpire
=
(
item
.
course_expire
&&
item
.
course_expire
!=
''
&&
<
span
className
=
'course-expire'
>
{
item
.
course_expire
}
<
/span
>
)
return
(
<
VList
key
=
{
index
}
...
...
@@ -89,6 +93,7 @@ class Purchased extends Component {
id
=
{
item
.
course_id
}
info
=
{
Info
}
status
=
{
status
}
courseExpire
=
{
courseExpire
}
toDetail
=
{
this
.
toCourseDetail
}
/
>
)
...
...
src/components/purchased/index.scss
View file @
a8c5d649
...
...
@@ -110,5 +110,18 @@ html, body, #root {
color
:
#fff
;
background
:
linear-gradient
(
to
bottom
,
#FF4000
,
#FD7700
);
}
.course-expire
{
display
:
inline-block
;
text-align
:
center
;
position
:
absolute
;
bottom
:
10px
;
left
:
0
;
width
:
92px
;
height
:
20px
;
line-height
:
21px
;
background-color
:
#FF3A3A
;
border-radius
:
0
10px
10px
0
;
color
:
#fff
;
font-size
:
12px
;
}
}
\ No newline at end of file
src/components/scholarship/index.js
View file @
a8c5d649
...
...
@@ -31,6 +31,7 @@ class _Scholarship extends Component {
isLoading
:
false
,
showNoData
:
false
,
hasMore
:
true
,
tab
:
0
,
}
this
.
downImage
=
React
.
createRef
();
this
.
tabIndex
=
0
;
...
...
@@ -307,6 +308,7 @@ class _Scholarship extends Component {
isLoading
:
false
,
hasMore
:
true
,
dataSource
:
this
.
state
.
dataSource
.
cloneWithRows
(
this
.
rData
),
tab
:
index
,
},
()
=>
{
this
.
onEndReached
();
...
...
@@ -314,6 +316,9 @@ class _Scholarship extends Component {
);
}}
>
<
/Tabs
>
{
this
.
state
.
tab
===
0
?
(
<
div
style
=
{{
marginTop
:
'15px'
,
backgroundColor
:
'#FFF'
}}
>
{
this
.
state
.
dataSource
.
_cachedRowCount
!==
0
?
(
...
...
@@ -332,6 +337,11 @@ class _Scholarship extends Component {
}
<
/div
>
)
:
null
}
{
this
.
state
.
tab
===
1
?
(
<
div
>
<
Flex
justify
=
'center'
align
=
'center'
className
=
{
'runtimeList'
}
>
榜单实时更新,仅显示前
50
名
<
/Flex
>
{
...
...
@@ -350,7 +360,8 @@ class _Scholarship extends Component {
)
}
<
/div
>
<
/Tabs
>
)
:
null
}
<
/div
>
<
/div
>
...
...
src/components/study/myCourses/index.js
View file @
a8c5d649
...
...
@@ -152,6 +152,10 @@ class MyCourses extends Component {
const
status
=
(
item
.
is_aist
&&
<
span
className
=
'status'
>
返现
<
/span
>
)
const
courseExpire
=
(
item
.
course_expire
&&
item
.
course_expire
!=
''
&&
<
span
className
=
'course-expire'
>
{
item
.
course_expire
}
<
/span
>
)
return
(
<
VList
img
=
{
item
.
image_name
}
handleClick
=
{
this
.
handleClick
}
...
...
@@ -159,6 +163,7 @@ class MyCourses extends Component {
key
=
{
index
}
info
=
{
Info
}
status
=
{
status
}
courseExpire
=
{
courseExpire
}
id
=
{
item
[
'v_course_id'
]}
/
>
)
...
...
src/components/study/myCourses/my-courses.scss
View file @
a8c5d649
...
...
@@ -150,4 +150,18 @@
color
:
#fff
;
background
:
linear-gradient
(
to
bottom
,
#FF4000
,
#FD7700
);
}
.course-expire
{
display
:
inline-block
;
text-align
:
center
;
position
:
absolute
;
bottom
:
10px
;
left
:
0
;
width
:
92px
;
height
:
20px
;
line-height
:
21px
;
background-color
:
#FF3A3A
;
border-radius
:
0
10px
10px
0
;
color
:
#fff
;
font-size
:
12px
;
}
}
\ No newline at end of file
src/router/route-middle-page.js
View file @
a8c5d649
...
...
@@ -14,15 +14,15 @@ function RouteMiddlePage(props) {
if
(
!
user
.
isFetching
)
{
if
(
user
.
hasError
)
{
history
.
replace
(
'/passport'
,
{
from
:
location
})
history
.
push
(
'/passport'
,
{
from
:
location
})
setLoadingState
(
false
)
}
else
{
let
{
data
}
=
user
||
{
data
:
{}}
if
(
data
&&
Object
.
values
(
data
).
every
(
item
=>
!!
item
))
{
history
.
replace
(
location
.
pathname
)
history
.
push
(
location
.
pathname
)
setLoadingState
(
false
)
}
else
{
history
.
replace
(
'/passport'
,
{
from
:
location
})
history
.
push
(
'/passport'
,
{
from
:
location
})
}
}
}
...
...
src/router/router-config.js
View file @
a8c5d649
...
...
@@ -29,8 +29,8 @@ const MyEdit = loadable(() => import(/* webpackChunkName: 'MyEdit'*/'@/component
const
Classify
=
loadable
(()
=>
import
(
/* webpackChunkName: 'Classify'*/
'@/components/classify'
))
const
CampTest
=
loadable
(()
=>
import
(
/* webpackChunkName: 'Classify'*/
'@/components/video/camp/campTest'
))
const
CampResolve
=
loadable
(()
=>
import
(
/* webpackChunkName: 'Classify'*/
'@/components/video/camp/campResolve'
))
const
ShareCourse
=
loadable
(()
=>
import
(
'@/components/ShareCourse/index'
))
const
Country
=
loadable
(()
=>
import
(
'@/components/country/index'
))
const
ShareCourse
=
loadable
(()
=>
import
(
/* webpackChunkName: 'ShareCourse'*/
'@/components/ShareCourse/index'
))
const
Country
=
loadable
(()
=>
import
(
/* webpackChunkName: 'Country' */
'@/components/country/index'
))
export
default
[
{
path
:
'/'
,
...
...
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