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
6f816124
Commit
6f816124
authored
Dec 24, 2019
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登陆
parent
968a968f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
11 deletions
+79
-11
src/components/python/index.js
+79
-11
src/components/python/pythomDes/index.js
+0
-0
No files found.
src/components/python/index.js
View file @
6f816124
import
React
,
{
Component
}
from
'react'
import
{
http
,
getParam
}
from
'@/utils'
import
React
,
{
Component
}
from
'react'
import
{
http
,
getParam
,
SendMessageToApp
}
from
'@/utils'
import
PythonDes
from
'./pythomDes'
import
PythonStudy
from
'./pythonStudy'
import
{
Toast
}
from
'antd-mobile'
import
{
connect
}
from
"react-redux"
import
{
addDays
}
from
"date-fns"
import
cookie
from
"js-cookie"
import
{
setCurrentUser
,
startFetchUser
}
from
"@/store/userAction"
@
connect
(
state
=>
({
user
:
state
.
user
}),
{
setCurrentUser
,
startFetchUser
}
)
class
Python
extends
Component
{
constructor
(
props
)
{
super
(
props
);
super
(
props
)
this
.
state
=
{
isPay
:
''
,
userInfoList
:
[],
isAppUpdate
:
false
}
}
componentDidMount
()
{
this
.
fetchCourseInfo
();
const
_this
=
this
this
.
fetchCourseInfo
()
// 获取App登录信息
window
[
'loginInfo'
]
=
result
=>
{
_this
.
loginInfo
(
result
)
}
}
// 获取app登录数据
loginInfo
=
(
result
)
=>
{
this
.
setState
({
userInfoList
:
result
},
()
=>
{
if
(
this
.
state
.
userInfoList
.
length
)
{
this
.
props
.
startFetchUser
()
this
.
appLogin
()
}
})
}
// 保存cookie
appLogin
=
()
=>
{
let
expires
=
addDays
(
new
Date
(),
90
)
this
.
state
.
userInfoList
.
map
((
item
,
index
)
=>
{
cookie
.
set
(
"token"
,
item
.
token
,
{
expires
,
path
:
'/'
,
domain
:
'.julyedu.com'
})
cookie
.
set
(
"plat"
,
item
.
plat
,
{
expires
,
path
:
'/'
,
domain
:
'.julyedu.com'
})
cookie
.
set
(
"uid"
,
item
.
uid
,
{
expires
,
path
:
'/'
,
domain
:
'.julyedu.com'
})
cookie
.
set
(
"uname"
,
item
.
uname
,
{
expires
,
path
:
'/'
,
domain
:
'.julyedu.com'
})
cookie
.
set
(
"avatar_file"
,
item
.
avatar_file
,
{
expires
,
path
:
'/'
,
domain
:
'.julyedu.com'
})
})
if
(
cookie
.
get
(
"token"
)
&&
cookie
.
get
(
"uid"
))
{
this
.
setState
({
isAppUpdate
:
true
})
}
this
.
props
.
setCurrentUser
(
this
.
transformUser
(
this
.
state
.
userInfoList
))
}
transformUser
=
res
=>
{
let
payload
res
.
map
((
item
,
index
)
=>
{
payload
=
{
hasError
:
false
,
data
:
{
username
:
item
.
uname
,
avatar
:
item
.
avatar_file
,
token
:
item
.
token
,
uid
:
item
.
uid
},
isFetching
:
false
}
})
return
payload
}
fetchCourseInfo
=
()
=>
{
const
id
=
getParam
(
'id'
);
const
id
=
getParam
(
'id'
)
http
.
get
(
`
${
API
.
home
}
/m/course/detail/
${
id
}
`
).
then
((
res
)
=>
{
const
{
data
,
code
}
=
res
.
data
;
const
{
data
,
code
}
=
res
.
data
if
(
code
===
200
)
{
this
.
setState
({
isPay
:
data
.
course_info
.
is_pay
})
}
});
})
}
render
()
{
const
{
isPay
}
=
this
.
state
;
const
{
isPay
,
isAppUpdate
}
=
this
.
state
return
(
<
div
>
{
isPay
===
0
&&
<
PythonDes
history
=
{
this
.
props
.
history
}
><
/PythonDes
>
isPay
===
0
&&
<
PythonDes
history
=
{
this
.
props
.
history
}
isAppUpdate
=
{
isAppUpdate
}
><
/PythonDes
>
}
{
(
isPay
===
1
&&
!
getParam
(
'version'
))
&&
<
PythonStudy
/>
(
isPay
===
1
&&
!
getParam
(
'version'
))
&&
<
PythonStudy
isAppUpdate
=
{
isAppUpdate
}
/
>
}
<
/div
>
)
...
...
src/components/python/pythomDes/index.js
View file @
6f816124
This diff is collapsed.
Click to expand it.
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