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
b7d7d99b
Commit
b7d7d99b
authored
Nov 26, 2019
by
FE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
share and help complete
parent
117b84fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
34 deletions
+58
-34
src/components/pythonShare/index.js
+26
-18
src/components/pythonShare/index.scss
+10
-0
yarn.lock
+22
-16
No files found.
src/components/pythonShare/index.js
View file @
b7d7d99b
import
React
,
{
Component
}
from
'react'
;
import
{
Link
}
from
'react-router-dom'
;
import
{
CopyToClipboard
}
from
'react-copy-to-clipboard'
;
import
AceEditor
from
'react-ace'
;
import
{
Toast
}
from
"antd-mobile"
...
...
@@ -19,7 +20,7 @@ class PythonClass extends Component {
entryMode
:
1
,
// 0:扫码页,1:落地页,2:直接进入
isExecute
:
false
,
isCopy
:
false
,
command
:
'
http://m.julyedu.com/python?from=python
'
,
command
:
''
,
data
:
{}
}
}
...
...
@@ -27,6 +28,13 @@ class PythonClass extends Component {
componentDidMount
()
{
this
.
handleFetchInfo
();
this
.
initPageStatus
();
this
.
initCommand
();
}
initCommand
=
()
=>
{
this
.
setState
({
command
:
`
${
API
.
m
}
/pythonShare?id=
${
getParam
(
'id'
)}
&type=
${
getParam
(
'type'
)}
&ques=
${
getParam
(
'ques'
)}
&from=python`
})
}
initPageStatus
=
()
=>
{
...
...
@@ -58,7 +66,6 @@ class PythonClass extends Component {
handleFetchInfo
=
()
=>
{
const
id
=
getParam
(
'id'
)
||
10
;
http
.
get
(
`
${
API
.
home
}
/web/python/share/help/
${
id
}
`
).
then
(
res
=>
{
console
.
log
(
res
);
const
{
code
,
data
}
=
res
.
data
;
if
(
code
===
200
)
{
this
.
setState
({
...
...
@@ -74,7 +81,7 @@ class PythonClass extends Component {
this
.
setState
({
entryMode
:
1
});
history
.
push
(
`/python?id=
${
getParam
(
'id'
)}
&type=
${
getParam
(
'type'
)}
&ques=
${
getParam
(
'ques'
)}
&from=python`
);
history
.
push
(
`/python
Share
?id=
${
getParam
(
'id'
)}
&type=
${
getParam
(
'type'
)}
&ques=
${
getParam
(
'ques'
)}
&from=python`
);
}
}
...
...
@@ -143,7 +150,7 @@ function PythonContent(props) {
entryMode
,
isCopy
,
command
,
data
:
{
head_img
,
nickname
,
code_lines
,
code
,
result
,
ques_name
,
course_name
,
video_name
},
data
:
{
head_img
,
nickname
,
code_lines
,
code
,
result
,
ques_name
,
course_name
,
course_id
,
video_name
},
handleToSend
,
copyToSuccess
,
handleToExecute
...
...
@@ -230,23 +237,20 @@ function PythonContent(props) {
}
<
/div
>
<
h4
className
=
"python-code__title"
>
{
entryMode
!==
0
&&
isShare
?
`这是Ta的第
${
code_lines
}
行代码`
:
'运行结果'
}
{
entryMode
!==
0
&&
isShare
&&
!
isWechat
?
`这是Ta的第
${
code_lines
}
行代码`
:
'运行结果'
}
<
/h4
>
<
div
className
=
"python-code__content"
>
<
SelfAceEditor
code
=
{
entryMode
!==
0
&&
isShare
?
code
:
result
}
/
>
<
SelfAceEditor
code
=
{
entryMode
!==
0
&&
isShare
&&
!
isWechat
?
code
:
result
}
/
>
<
/div
>
<
h4
className
=
"python-code__title"
>
{
entryMode
===
0
?
'代码'
:
'运行结果
'
}
<
/h4
>
<
h4
className
=
"python-code__title"
>
{
entryMode
!==
0
&&
isShare
&&
!
isWechat
?
'运行结果'
:
'代码
'
}
<
/h4
>
<
div
className
=
"python-code__content"
>
{
entryMode
===
0
&&
<
SelfAceEditor
code
=
{
code
}
/
>
}
{
entryMode
!==
0
&&
<
SelfAceEditor
code
=
{
isExecute
?
result
:
''
}
/
>
entryMode
!==
0
&&
isShare
&&
!
isWechat
?
<
SelfAceEditor
code
=
{
isExecute
?
result
:
''
}
/
>
:
<
SelfAceEditor
code
=
{
code
}
/
>
}
{
(
entryMode
!==
0
&&
isShare
&&
!
isExecute
)
&&
(
entryMode
!==
0
&&
isShare
&&
!
is
Wechat
&&
!
is
Execute
)
&&
<
button
className
=
"python-button python-button__execute"
onClick
=
{
handleToExecute
}
>
运行看看
<
/button
>
}
<
/div
>
...
...
@@ -254,7 +258,9 @@ function PythonContent(props) {
{
(
entryMode
===
0
&&
isWechat
)
&&
<
button
className
=
"python-button python-button__study"
onClick
=
{
handleToSend
}
>
发给好友
<
/button
>
<
button
className
=
"python-button python-button__study"
onClick
=
{
handleToSend
}
>
{
isShare
?
'分享给好友'
:
'发给好友求助'
}
<
/button
>
}
{
...
...
@@ -263,18 +269,20 @@ function PythonContent(props) {
text
=
{
command
}
onCopy
=
{
copyToSuccess
}
>
<
button
className
=
"python-button python-button__study"
>
发给好友
<
/button
>
<
button
className
=
"python-button python-button__study"
>
{
isShare
?
'分享给好友'
:
'发给好友求助'
}
<
/button
>
<
/CopyToClipboard
>
}
{
(
entryMode
===
0
&&
!
isWechat
&&
isCopy
)
&&
<
button
className
=
"python-button python-button__study"
>
已复制链接,快去粘贴发给好友吧~
<
/button
>
<
p
className
=
"python-button__tip"
>
已复制链接,快去粘贴发给好友吧~
<
/p
>
}
{
entryMode
!==
0
&&
<
button
className
=
"python-button python-button__study"
>
我也要学
Python
<
/button
>
<
Link
className
=
"python-button python-button__study"
to
=
{
`/python?id=
${
course_id
}
`
}
>
我也要学
Python
<
/Link
>
}
<
/div
>
);
...
...
src/components/pythonShare/index.scss
View file @
b7d7d99b
...
...
@@ -135,10 +135,20 @@
font-weight
:
500
;
color
:
#2D56F0
;
line-height
:
44px
;
text-align
:
center
;
background-color
:
#FFF95B
;
box-shadow
:
0px
5px
0px
rgba
(
255
,
210
,
0
,
1
);
}
.python-button__tip
{
margin
:
35px
0
0
;
font-size
:
15px
;
font-weight
:
500
;
color
:
#fff
;
line-height
:
44px
;
text-align
:
center
;
}
.python-button__execute
{
position
:
absolute
;
top
:
0
;
...
...
yarn.lock
View file @
b7d7d99b
...
...
@@ -1237,16 +1237,16 @@
"@types/unist" "*"
"@types/vfile-message" "*"
"@videojs/http-streaming@1.10.
3
":
version "1.10.
3
"
resolved "https://registry.
yarnpkg.com/@videojs/http-streaming/-/http-streaming-1.10.3.tgz#0c028443b9a3c96da85e5995748ed94280884584
"
integrity sha
512-fxXtwVrQBdhOFh6GymPAPCb4utCI01Zs5fdyZgtR6FSsaz/zGmnzfNS5GvNjBi/hZviMsbNPFaOTTFMMNLNA3A=
=
"@videojs/http-streaming@1.10.
6
":
version "1.10.
6
"
resolved "https://registry.
npm.taobao.org/@videojs/http-streaming/download/@videojs/http-streaming-1.10.6.tgz#a9119b1828b354c5cc17b42ea051cc7bcce2dca0
"
integrity sha
1-qRGbGCizVMXMF7QuoFHMe8zi3KA
=
dependencies:
aes-decrypter "3.0.0"
global "^4.3.0"
m3u8-parser "4.
3
.0"
m3u8-parser "4.
4
.0"
mpd-parser "0.8.1"
mux.js "5.
1.3
"
mux.js "5.
2.1
"
url-toolkit "^2.1.3"
video.js "^6.8.0 || ^7.0.0"
...
...
@@ -6953,6 +6953,13 @@ m3u8-parser@4.3.0:
dependencies:
global "^4.3.2"
m3u8-parser@4.4.0:
version "4.4.0"
resolved "https://registry.npm.taobao.org/m3u8-parser/download/m3u8-parser-4.4.0.tgz#adf606c0af6d97f6750095a42006c2ae03dde177"
integrity sha1-rfYGwK9tl/Z1AJWkIAbCrgPd4Xc=
dependencies:
global "^4.3.2"
make-dir@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5"
...
...
@@ -7354,10 +7361,10 @@ mux.js@5.1.1:
resolved "https://registry.yarnpkg.com/mux.js/-/mux.js-5.1.1.tgz#0e95f048b4ac51d413c9ddc2d78e4cefad8d06de"
integrity sha512-Mf/UYmh5b8jvUP+jmrTbETnyFZprMdbT0RxKm/lJ/4d2Q3xdc5GaHaRPI1zVV5D3+6uxArVPm78QEb1RsrmaQw==
mux.js@5.
1.3
:
version "5.
1.3
"
resolved "https://registry.
yarnpkg.com/mux.js/-/mux.js-5.1.3.tgz#1a59b8979a6780be5bcb63983c7e883c90cd615b
"
integrity sha
512-FhDcysLvAkO9H8ftBJ2sK1O4Rmz0AWnMS+2uqP7WjrnaAyE/ox11GEiZkRzrWIdp8at9R9qBHDqdURY3/h/xTg=
=
mux.js@5.
2.1
:
version "5.
2.1
"
resolved "https://registry.
npm.taobao.org/mux.js/download/mux.js-5.2.1.tgz#6698761fc88da5acecea0758ac25f11d3a08bee8
"
integrity sha
1-Zph2H8iNpazs6gdYrCXxHToIvug
=
nan@^2.12.1:
version "2.13.2"
...
...
@@ -11528,17 +11535,16 @@ vfile@^4.0.0:
videojs-vtt.js "0.14.1"
xhr "2.4.0"
video.js@^7.6.
0
:
version "7.6.
0
"
resolved "https://registry.
yarnpkg.com/video.js/-/video.js-7.6.0.tgz#556c151004e27d340be3a732a14bf7c1aaf7e8b4
"
integrity sha
512-A0HSKzAmcYkd1xyExqUlM6n8bkghcX54iCvW08bPvvl3UHt8d8zijuylfIWu8vo1Z8fYyk9HPOFs1i3Cldr/cw=
=
video.js@^7.6.
5
:
version "7.6.
6
"
resolved "https://registry.
npm.taobao.org/video.js/download/video.js-7.6.6.tgz#e7c9163d53f9b0e05ccb5ac0f79d02fa49b4d3ac
"
integrity sha
1-58kWPVP5sOBcy1rA950C+km006w
=
dependencies:
"@babel/runtime" "^7.4.5"
"@videojs/http-streaming" "1.10.
3
"
"@videojs/http-streaming" "1.10.
6
"
global "4.3.2"
keycode "^2.2.0"
safe-json-parse "4.0.0"
tsml "1.0.1"
videojs-font "3.2.0"
videojs-vtt.js "^0.14.1"
xhr "2.4.0"
...
...
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