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
b64c2ec8
Commit
b64c2ec8
authored
Oct 17, 2019
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add api
parent
978a7ae5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
116 additions
and
28 deletions
+116
-28
src/components/python/index.js
+103
-26
src/components/python/index.scss
+13
-2
No files found.
src/components/python/index.js
View file @
b64c2ec8
import
React
,
{
Component
}
from
'react'
;
import
classnames
from
'classnames'
;
import
{
CopyToClipboard
}
from
'react-copy-to-clipboard'
;
import
{
Toast
}
from
"antd-mobile"
import
{
HeaderBar
}
from
'@/common'
;
import
{
browser
}
from
'@/utils'
;
import
{
browser
,
http
,
getParam
}
from
'@/utils'
;
import
'./index.scss'
;
class
PythonClass
extends
Component
{
...
...
@@ -9,14 +10,60 @@ class PythonClass extends Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
isWechat
:
browser
.
isWe
chat
,
isWechat
:
browser
.
isWe
ixin
,
isShare
:
true
,
entryMode
:
1
,
// 0:扫码页,1:落地页
entryMode
:
1
,
// 0:扫码页,1:落地页,2:直接进入
isCopy
:
false
,
command
:
'http://m.julyedu.com/python?from=python'
}
}
componentDidMount
()
{
this
.
handleFetchInfo
();
if
(
getParam
(
'from'
)
===
'barcode'
)
{
this
.
setState
({
entryMode
:
0
});
}
if
(
getParam
(
'from'
)
===
'python'
)
{
this
.
setState
({
entryMode
:
2
});
}
}
handleFetchInfo
=
()
=>
{
const
id
=
getParam
(
id
)
||
17
;
http
.
get
(
`
${
API
.
home
}
/web/python/share/help/
${
id
}
`
).
then
(
res
=>
{
console
.
log
(
res
);
})
}
handleToSend
=
()
=>
{
const
{
history
}
=
this
.
props
;
if
(
browser
.
isWeixin
)
{
this
.
setState
({
entryMode
:
1
});
history
.
push
(
'/python?from=python'
);
}
else
{
}
console
.
log
(
this
.
props
);
}
copyToSuccess
=
()
=>
{
Toast
.
info
(
'已复制链接,快去粘贴发给好友吧~'
);
this
.
setState
({
isCopy
:
true
});
}
render
()
{
const
{
isWechat
,
isShare
,
entryMode
}
=
this
.
state
;
const
{
isWechat
,
isShare
,
entryMode
,
command
,
isCopy
}
=
this
.
state
;
return
(
<>
<
HeaderBar
...
...
@@ -28,6 +75,10 @@ class PythonClass extends Component {
isWechat
=
{
isWechat
}
isShare
=
{
isShare
}
entryMode
=
{
entryMode
}
isCopy
=
{
isCopy
}
command
=
{
command
}
handleToSend
=
{
this
.
handleToSend
}
copyToSuccess
=
{
this
.
copyToSuccess
}
/
>
<
/
>
);
...
...
@@ -35,30 +86,36 @@ class PythonClass extends Component {
}
function
PythonContent
(
props
)
{
const
{
isWechat
,
isShare
,
entryMode
}
=
props
;
const
{
isWechat
,
isShare
,
entryMode
,
isCopy
,
command
,
handleToSend
,
copyToSuccess
}
=
props
;
return
(
<
div
className
=
{
classnames
(
"python-container"
,
{
'python-container--page'
:
entryMode
===
1
})}
>
<
div
className
=
"python-container"
>
{
/* 微信 */
}
{
(
entryMode
===
0
&&
isWechat
)
&&
<
div
className
=
"python-header"
>
<
p
className
=
"python-wechat__title"
>
请点击右上角分享
<
/p
>
<
i
className
=
"iconfont iconyindao"
><
/i
>
<
/div
>
//
(entryMode === 0 && isWechat) &&
//
<div className="python-header">
//
<p className="python-wechat__title">请点击右上角分享</p>
//
<i className="iconfont iconyindao"></i>
//
</div>
}
{
/* 非微信 */
}
{
(
entryMode
===
0
&&
!
isWechat
)
&&
<
div
className
=
"python-header"
>
<
p
className
=
"python-wechat__title"
>
{
isShare
?
'快分享给好友吧'
:
'快发给好友求助吧'
}
<
/p
>
// (entryMode === 0 && !isWechat) &&
// <div className="python-header">
// <p className="python-wechat__title">
// {isShare? '快分享给好友吧' : '快发给好友求助吧'}
// </p>
// </div>
}
{
(
entryMode
===
1
&&
isWechat
)
&&
<
div
className
=
"python-popup"
>
<
div
className
=
"python-header"
>
<
p
className
=
"python-wechat__title"
>
请点击右上角分享
<
/p
>
<
i
className
=
"iconfont iconyindao"
><
/i
>
<
/div
>
<
/div
>
}
<
div
className
=
"python-content"
>
...
...
@@ -77,7 +134,7 @@ function PythonContent(props) {
<
/p
>
}
{
(
entryMode
===
1
&&
isShare
)
&&
(
entryMode
!==
0
&&
isShare
)
&&
<
p
className
=
"python-user__desc"
>
在
<
span
>
【练习
-
听见无脸男的声音】
<
/span>完成了<br /
>
...
...
@@ -95,7 +152,7 @@ function PythonContent(props) {
<
/p
>
}
{
(
entryMode
===
1
&&
!
isShare
)
&&
(
entryMode
!==
0
&&
!
isShare
)
&&
<
p
className
=
"python-user__desc"
>
在
<
span
>
【练习
-
听见无脸男的声音】
<
/span>的<br /
>
...
...
@@ -104,7 +161,7 @@ function PythonContent(props) {
}
<
/div
>
<
h4
className
=
"python-code__title"
>
{
entryMode
===
1
&&
isShare
?
'这是Ta的第723行代码'
:
'运行结果'
}
{
entryMode
!==
0
&&
isShare
?
'这是Ta的第723行代码'
:
'运行结果'
}
<
/h4
>
<
div
className
=
"python-code__content"
>
code
...
...
@@ -113,14 +170,34 @@ function PythonContent(props) {
<
div
className
=
"python-code__content"
>
code
{
(
entryMode
=
==
1
&&
isShare
)
&&
(
entryMode
!
==
1
&&
isShare
)
&&
<
button
className
=
"python-button python-button__execute"
>
运行看看
<
/button
>
}
<
/div
>
<
/div
>
{
entryMode
===
1
&&
(
entryMode
===
0
&&
isWechat
)
&&
<
button
className
=
"python-button python-button__study"
onClick
=
{
handleToSend
}
>
发给好友
<
/button
>
}
{
(
entryMode
===
0
&&
!
isWechat
&&
!
isCopy
)
&&
<
CopyToClipboard
text
=
{
command
}
onCopy
=
{
copyToSuccess
}
>
<
button
className
=
"python-button python-button__study"
>
发给好友
<
/button
>
<
/CopyToClipboard
>
}
{
(
entryMode
===
0
&&
!
isWechat
&&
isCopy
)
&&
<
button
className
=
"python-button python-button__study"
>
已复制链接,快去粘贴发给好友吧~
<
/button
>
}
{
entryMode
!==
0
&&
<
button
className
=
"python-button python-button__study"
>
我也要学
Python
<
/button
>
}
<
/div
>
...
...
src/components/python/index.scss
View file @
b64c2ec8
.python-container
{
padding
:
0
8px
29px
;
padding
:
50px
8px
29px
;
background-image
:
url('https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/pythonCourse/h5/python-bg.png')
;
background-size
:
cover
;
}
.python-container--page
{
padding-top
:
50px
;
//
padding-top: 50px;
}
.python-header
{
...
...
@@ -150,4 +150,14 @@
color
:
#fff
;
line-height
:
32px
;
background-color
:
#0099FF
;
}
.python-popup
{
position
:
fixed
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
background-color
:
rgba
(
0
,
0
,
0
,
.3
);
z-index
:
99
;
}
\ No newline at end of file
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