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
1d61b1de
Commit
1d61b1de
authored
Jan 08, 2020
by
FE
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pythonClass' of gitlab.julyedu.com:baiguangyao/mr-julyedu into pythonClass
parents
6331f0e3
d5c097cf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
4 deletions
+47
-4
src/components/python/index.js
+27
-4
src/components/python/pythomDes/index.js
+20
-0
No files found.
src/components/python/index.js
View file @
1d61b1de
import
React
,
{
Component
}
from
'react'
import
{
http
,
getParam
,
SendMessageToApp
}
from
'@/utils'
import
{
http
,
getParam
,
browser
}
from
'@/utils'
import
PythonDes
from
'./pythomDes'
import
PythonStudy
from
'./pythonStudy'
import
{
connect
}
from
"react-redux"
...
...
@@ -19,7 +19,8 @@ class Python extends Component {
this
.
state
=
{
isPay
:
''
,
userInfoList
:
[],
isAppUpdate
:
false
isAppUpdate
:
false
,
backwardVersion
:
false
,
// 默认是新版本
}
}
...
...
@@ -89,19 +90,41 @@ class Python extends Component {
http
.
get
(
`
${
API
.
home
}
/m/course/detail/
${
id
}
`
).
then
((
res
)
=>
{
const
{
data
,
code
}
=
res
.
data
if
(
code
===
200
)
{
let
version
=
getParam
(
'version'
)
if
(
version
)
{
version
=
version
.
replace
(
/
\.
/g
,
''
).
slice
(
0
,
3
)
if
(
browser
.
isAndroidApp
&&
version
<
453
)
{
// 安卓的低版本
this
.
setState
({
backwardVersion
:
true
,
isPay
:
0
,
})
}
else
{
this
.
setState
({
isPay
:
data
.
course_info
.
is_pay
})
}
if
(
browser
.
isIOSApp
&&
version
<
380
)
{
// ISO的低版本
this
.
setState
({
backwardVersion
:
true
,
isPay
:
0
,
})
}
else
{
this
.
setState
({
isPay
:
data
.
course_info
.
is_pay
})
}
}
}
})
}
render
()
{
const
{
isPay
,
isAppUpdate
}
=
this
.
state
const
{
isPay
,
isAppUpdate
,
backwardVersion
}
=
this
.
state
;
// 旧版本 无论购买未购买 都跳转到 未购买的详情页; 如果是已购买就提示更新APP
return
(
<
div
>
{
isPay
===
0
&&
<
PythonDes
history
=
{
this
.
props
.
history
}
isAppUpdate
=
{
isAppUpdate
}
><
/PythonDes
>
isPay
===
0
&&
<
PythonDes
history
=
{
this
.
props
.
history
}
isAppUpdate
=
{
isAppUpdate
}
backwardVersion
=
{
backwardVersion
}
isPay
=
{
isPay
}
><
/PythonDes
>
}
{
(
isPay
===
1
&&
!
getParam
(
'version'
))
&&
<
PythonStudy
isAppUpdate
=
{
isAppUpdate
}
/
>
...
...
src/components/python/pythomDes/index.js
View file @
1d61b1de
...
...
@@ -121,6 +121,7 @@ class PythonDes extends Component {
}
toLearn
=
()
=>
{
const
{
backwardVersion
,
isPay
}
=
this
.
props
;
http
.
post
(
`
${
API
[
'home'
]}
/m/it/user/trialCourse`
,
{
course_id
:
getParam
(
'id'
)}).
then
((
res
)
=>
{
const
{
code
,
msg
}
=
res
.
data
if
(
code
==
200
)
{
...
...
@@ -129,8 +130,12 @@ class PythonDes extends Component {
toApp
:
true
})
}
else
{
// APP
if
(
backwardVersion
)
{
Toast
.
info
(
'当前版本不支持该课程模式,请升级到最新版本或前往PC端体验'
,
2
)
}
else
{
SendMessageToApp
(
"toLearn"
)
}
}
}
else
{
Toast
.
info
(
msg
,
2
)
}
...
...
@@ -144,6 +149,7 @@ class PythonDes extends Component {
}
toDetail
=
()
=>
{
const
{
backwardVersion
,
isPay
}
=
this
.
props
;
const
id
=
getParam
(
'id'
)
if
(
!
getParam
(
'version'
))
{
// H5
http
.
get
(
`
${
API
[
'base-api'
]}
/m/cart/addtopreorder/[
${
id
}
]`
).
then
((
res
)
=>
{
...
...
@@ -154,9 +160,18 @@ class PythonDes extends Component {
}
})
}
else
{
// APP
if
(
backwardVersion
)
{
Toast
.
info
(
'当前版本不支持该课程模式,请升级到最新版本或前往PC端购买'
,
2
);
let
onlyoneUse
=
setTimeout
(()
=>
{
clearTimeout
(
onlyoneUse
);
onlyoneUse
=
null
;
SendMessageToApp
(
'toPay'
,
id
)
},
2000
);
}
else
{
SendMessageToApp
(
'toPay'
,
id
)
}
}
}
toLogin
=
()
=>
{
if
(
!
getParam
(
'version'
))
{
// H5
...
...
@@ -214,6 +229,11 @@ class PythonDes extends Component {
componentDidMount
()
{
this
.
getStatus
()
const
{
backwardVersion
,
isPay
}
=
this
.
props
;
if
(
backwardVersion
&&
isPay
===
1
)
{
Toast
.
info
(
'当前版本不支持该课程模式,请升级到最新版本或前往PC端学习'
,
2
);
}
}
...
...
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