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
445dec72
Commit
445dec72
authored
Nov 04, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'live' into 11-11
parents
f3e1141d
f5187301
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
30 deletions
+83
-30
src/common/closable-popup/index.scss
+1
-1
src/components/blessingPreheat/live/index.js
+63
-27
src/components/blessingPreheat/live/index.scss
+16
-1
src/utils/index.js
+3
-1
No files found.
src/common/closable-popup/index.scss
View file @
445dec72
...
...
@@ -25,7 +25,7 @@
.close
{
position
:
absolute
;
bottom
:
-
88
px
;
bottom
:
-
74
px
;
left
:
50%
;
transform
:
translateX
(
-50%
);
font-size
:
36px
;
...
...
src/components/blessingPreheat/live/index.js
View file @
445dec72
import
React
,
{
Component
}
from
'react'
import
'./index.scss'
import
{
Tabs
,
Toast
}
from
"antd-mobile"
import
{
getParam
,
http
,
SendMessageToApp
}
from
"@/utils"
import
{
getParam
,
http
,
SendMessageToApp
,
browser
}
from
"@/utils"
import
{
Popup
}
from
"@common/index"
import
QRCode
from
'qrcode'
import
{
uniqBy
}
from
'lodash'
...
...
@@ -12,12 +12,15 @@ import { withRouter } from 'react-router-dom'
@
connect
(
state
=>
({
user
:
state
.
user
}))
class
Live
extends
Component
{
popupInstance
=
null
state
=
{
tabs
:
[],
lives
:
{},
preheatLives
:
[],
today
:
''
,
isApp
:
getParam
(
'version'
)
isApp
:
getParam
(
'version'
),
QRCodeUrl
:
''
,
}
...
...
@@ -69,22 +72,33 @@ class Live extends Component {
}
toLiveRoom
=
id
=>
{
const
{
history
,
isLogin
}
=
this
.
props
;
const
{
history
,
isLogin
}
=
this
.
props
if
(
this
.
state
.
isApp
)
{
if
(
isLogin
)
{
if
(
isLogin
)
{
SendMessageToApp
(
'toLiveRoom'
,
id
)
}
else
{
}
else
{
SendMessageToApp
(
"toLogin"
)
}
}
else
{
if
(
isLogin
)
{
if
(
isLogin
)
{
window
.
location
.
href
=
`
${
window
.
location
.
protocol
}
//www.julyedu.com/live/m_room/
${
id
}
`
}
else
{
}
else
{
history
.
push
(
'/passport'
)
}
}
}
saveImage
=
()
=>
{
let
version
=
getParam
(
'version'
)
version
=
typeof
version
===
'string'
?
version
.
replace
(
'.'
,
''
).
replace
(
'.'
,
''
).
slice
(
0
,
3
)
:
''
const
{
QRCodeUrl
}
=
this
.
state
if
(
version
&&
parseInt
(
version
)
<
451
)
{
Toast
.
info
(
'当前不支持此功能,升级到最新版本app可以点击保存二维码!'
,
2
,
null
,
false
)
}
else
{
SendMessageToApp
(
'generateQRCode'
,
QRCodeUrl
)
}
}
makeSubscribe
=
id
=>
{
const
{
user
,
history
}
=
this
.
props
if
(
user
.
hasError
)
{
...
...
@@ -94,11 +108,29 @@ class Live extends Component {
.
then
(
res
=>
{
const
{
data
}
=
res
if
(
data
.
errno
==
200
)
{
this
.
setState
(()
=>
({
QRCodeUrl
:
data
.
data
.
url
,
}))
QRCode
.
toDataURL
(
data
.
data
.
url
,
(
err
,
url
)
=>
{
Popup
({
title
:
'扫码关注“七月在线”服务号即可预约'
,
content
:
<
img
id
=
{
'live-qr-code'
}
src
=
{
url
}
alt
=
""
/>
})
if
(
!
this
.
popupInstance
)
{
this
.
popupInstance
=
Popup
({
title
:
'扫码关注“七月在线”服务号即可预约'
,
content
:
(
<>
<
img
id
=
{
'live-qr-code'
}
src
=
{
url
}
alt
=
""
/>
{
browser
.
isAndroidApp
?
(
<
button
className
=
{
'save-image'
}
onClick
=
{
this
.
saveImage
}
>
保存二维码
<
/button
>
)
:
null
}
<
/
>
),
close
:
()
=>
new
Promise
(
resolve
=>
{
this
.
popupInstance
=
null
resolve
()
})
})
}
})
}
else
{
Toast
.
info
(
data
.
msg
,
2
,
null
,
false
)
...
...
@@ -136,27 +168,29 @@ class Live extends Component {
{
todayLives
.
map
((
item
,
index
)
=>
{
return
(
<
LiveContent
item
=
{
item
}
key
=
{
index
}
makeSubscribe
=
{
this
.
makeSubscribe
}
toLiveRoom
=
{
this
.
toLiveRoom
}
/
>
<
LiveContent
item
=
{
item
}
key
=
{
index
}
makeSubscribe
=
{
this
.
makeSubscribe
}
toLiveRoom
=
{
this
.
toLiveRoom
}
/
>
)
})
}
<
/div
>
)
})
:
tabs
.
map
((
item
,
index
)
=>
{
const
todayLives
=
preheatLives
[
item
.
title
]
return
(
<
div
key
=
{
index
}
>
{
todayLives
.
map
((
item
,
index
)
=>
{
return
(
<
LiveContent
item
=
{
item
}
key
=
{
index
}
makeSubscribe
=
{
this
.
makeSubscribe
}
toLiveRoom
=
{
this
.
toLiveRoom
}
/
>
)
})
}
<
/div
>
)
})
:
tabs
.
map
((
item
,
index
)
=>
{
const
todayLives
=
preheatLives
[
item
.
title
]
return
(
<
div
key
=
{
index
}
>
{
todayLives
.
map
((
item
,
index
)
=>
{
return
(
<
LiveContent
item
=
{
item
}
key
=
{
index
}
makeSubscribe
=
{
this
.
makeSubscribe
}
toLiveRoom
=
{
this
.
toLiveRoom
}
/
>
)
})
}
<
/div
>
)
})
}
<
/Tabs
>
...
...
@@ -201,7 +235,9 @@ function LiveContent({item, makeSubscribe, toLiveRoom}) {
<
/div
>
{
item
[
'on_live'
]
?
<
button
className
=
{
'on-living'
}
onClick
=
{()
=>
{
toLiveRoom
(
item
[
'room_url'
])}}
>
正在直播
<
/button
>
?
<
button
className
=
{
'on-living'
}
onClick
=
{()
=>
{
toLiveRoom
(
item
[
'room_url'
])
}}
>
正在直播
<
/button
>
:
item
[
'is_end'
]
?
<
button
className
=
{
'subscribed'
}
>
已结束
<
/button
>
...
...
src/components/blessingPreheat/live/index.scss
View file @
445dec72
...
...
@@ -227,12 +227,27 @@
.content
{
display
:
flex
;
justify-content
:
center
;
flex-direction
:
column
;
align-items
:
center
;
img
{
width
:
120px
;
height
:
120px
;
margin-top
:
10px
;
}
}
.save-image
{
width
:
133px
;
height
:
30px
;
margin-top
:
16px
;
background
:
rgba
(
83
,
39
,
250
,
1
);
border-radius
:
15px
;
font-size
:
14px
;
color
:
#fff
;
-webkit-appearance
:
none
;
outline
:
0
;
border
:
none
;
}
}
src/utils/index.js
View file @
445dec72
...
...
@@ -83,7 +83,9 @@ const browser = (function () {
isWeixin
:
/MicroMessenger/i
.
test
(
ua
),
isAndroid
:
/Android/i
.
test
(
ua
),
isIOS
:
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/i
.
test
(
ua
),
isIPad
:
/iPad/i
.
test
(
ua
)
isIPad
:
/iPad/i
.
test
(
ua
),
isAndroidApp
:
/Android/i
.
test
(
ua
)
&&
getParam
(
'version'
),
isIOSApp
:
/iPhone/i
.
test
(
ua
)
&&
getParam
(
'version'
)
}
})()
...
...
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