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
618d120f
Commit
618d120f
authored
Oct 17, 2019
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add execute fn
parent
b64c2ec8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
11 deletions
+24
-11
src/components/python/index.js
+24
-11
No files found.
src/components/python/index.js
View file @
618d120f
...
...
@@ -13,6 +13,7 @@ class PythonClass extends Component {
isWechat
:
browser
.
isWeixin
,
isShare
:
true
,
entryMode
:
1
,
// 0:扫码页,1:落地页,2:直接进入
isExecute
:
false
,
isCopy
:
false
,
command
:
'http://m.julyedu.com/python?from=python'
}
...
...
@@ -35,7 +36,7 @@ class PythonClass extends Component {
}
handleFetchInfo
=
()
=>
{
const
id
=
getParam
(
id
)
||
17
;
const
id
=
getParam
(
'id'
)
||
10
;
http
.
get
(
`
${
API
.
home
}
/web/python/share/help/
${
id
}
`
).
then
(
res
=>
{
console
.
log
(
res
);
})
...
...
@@ -47,12 +48,8 @@ class PythonClass extends Component {
this
.
setState
({
entryMode
:
1
});
history
.
push
(
'/python?from=python'
);
}
else
{
history
.
push
(
`/python?id=
${
getParam
(
'id'
)}
&from=python`
);
}
console
.
log
(
this
.
props
);
}
copyToSuccess
=
()
=>
{
...
...
@@ -62,8 +59,14 @@ class PythonClass extends Component {
});
}
handleToExecute
=
()
=>
{
this
.
setState
({
isExecute
:
true
});
}
render
()
{
const
{
isWechat
,
isShare
,
entryMode
,
command
,
isCopy
}
=
this
.
state
;
const
{
isWechat
,
isShare
,
isExecute
,
entryMode
,
command
,
isCopy
}
=
this
.
state
;
return
(
<>
<
HeaderBar
...
...
@@ -71,12 +74,15 @@ class PythonClass extends Component {
arrow
=
{
true
}
home
=
{
true
}
/
>
{
entryMode
}
<
PythonContent
isWechat
=
{
isWechat
}
isShare
=
{
isShare
}
isExecute
=
{
isExecute
}
entryMode
=
{
entryMode
}
isCopy
=
{
isCopy
}
command
=
{
command
}
handleToExecute
=
{
this
.
handleToExecute
}
handleToSend
=
{
this
.
handleToSend
}
copyToSuccess
=
{
this
.
copyToSuccess
}
/
>
...
...
@@ -86,7 +92,7 @@ class PythonClass extends Component {
}
function
PythonContent
(
props
)
{
const
{
isWechat
,
isShare
,
entryMode
,
isCopy
,
command
,
handleToSend
,
copyToSuccess
}
=
props
;
const
{
isWechat
,
isShare
,
isExecute
,
entryMode
,
isCopy
,
command
,
handleToSend
,
copyToSuccess
,
handleToExecute
}
=
props
;
return
(
<
div
className
=
"python-container"
>
...
...
@@ -168,10 +174,17 @@ function PythonContent(props) {
<
/div
>
<
h4
className
=
"python-code__title"
>
代码
<
/h4
>
<
div
className
=
"python-code__content"
>
code
{
(
entryMode
!==
1
&&
isShare
)
&&
<
button
className
=
"python-button python-button__execute"
>
运行看看
<
/button
>
entryMode
===
0
&&
<
p
>
code
<
/p
>
}
{
entryMode
!==
0
&&
<
p
>
{
isExecute
?
'code'
:
''
}
<
/p
>
}
{
(
entryMode
!==
0
&&
isShare
&&
!
isExecute
)
&&
<
button
className
=
"python-button python-button__execute"
onClick
=
{
handleToExecute
}
>
运行看看
<
/button
>
}
<
/div
>
<
/div
>
...
...
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