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
6c7b4f9e
Commit
6c7b4f9e
authored
Nov 06, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大咖直播
parent
d3982e50
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
61 deletions
+24
-61
src/components/blessingPreheat/live/index.js
+18
-59
src/components/blessingPreheat/live/index.scss
+6
-2
No files found.
src/components/blessingPreheat/live/index.js
View file @
6c7b4f9e
...
...
@@ -16,9 +16,9 @@ class Live extends Component {
state
=
{
tabs
:
[],
lives
:
{}
,
lives
:
[]
,
preheatLives
:
[],
today
:
''
,
today
Index
:
''
,
isApp
:
getParam
(
'version'
),
QRCodeUrl
:
''
,
}
...
...
@@ -27,45 +27,20 @@ class Live extends Component {
componentDidMount
()
{
http
.
get
(
`
${
API
.
home
}
/sys/get_live_info`
)
.
then
(
res
=>
{
const
{
data
}
=
res
if
(
data
.
code
==
200
)
{
const
lives
=
data
.
data
[
'data_active'
].
reduce
((
accu
,
current
)
=>
{
if
(
!
(
current
.
date
in
accu
))
{
accu
[
current
.
date
]
=
[
current
]
}
else
{
accu
[
current
.
date
].
push
(
current
)
}
return
accu
},
{})
const
preheatLives
=
data
.
data
[
'data_hot'
].
reduce
((
accu
,
current
)
=>
{
if
(
!
(
current
.
date
in
accu
))
{
accu
[
current
.
date
]
=
[
current
]
}
else
{
accu
[
current
.
date
].
push
(
current
)
}
return
accu
},
{})
let
tabs
,
today
if
(
this
.
props
.
isFormal
)
{
tabs
=
Object
.
keys
(
lives
).
map
(
item
=>
({
title
:
item
}))
today
=
uniqBy
(
data
.
data
[
'data_active'
],
value
=>
value
.
date
).
findIndex
(
item
=>
item
[
'is_today'
])
}
else
{
tabs
=
Object
.
keys
(
preheatLives
).
map
(
item
=>
({
title
:
item
}))
today
=
uniqBy
(
data
.
data
[
'data_hot'
],
value
=>
value
.
date
).
findIndex
(
item
=>
item
[
'is_today'
])
}
const
{
data
,
code
,
msg
}
=
res
.
data
if
(
code
==
200
)
{
let
tabs
=
uniqBy
(
data
,
item
=>
item
.
date
)
tabs
=
tabs
.
map
(
item
=>
({
title
:
item
.
date
}))
let
todayIndex
=
data
.
findIndex
(
item
=>
item
[
'is_today'
])
this
.
setState
({
tabs
,
lives
,
today
,
preheatLives
lives
:
data
,
todayIndex
:
todayIndex
<
0
?
0
:
todayIndex
,
})
}
else
{
Toast
.
info
(
data
.
msg
,
2
,
null
,
false
)
Toast
.
info
(
msg
,
2
,
null
,
false
)
}
})
...
...
@@ -73,9 +48,9 @@ class Live extends Component {
toLiveRoom
=
id
=>
{
const
{
history
,
isLogin
}
=
this
.
props
var
_czc
=
_czc
||
[]
;
var
name
=
'直播间id='
+
id
;
_czc
.
push
([
"_trackEvent"
,
name
,
'm端双十一大咖直播-正在直播'
])
;
var
_czc
=
_czc
||
[]
var
name
=
'直播间id='
+
id
_czc
.
push
([
"_trackEvent"
,
name
,
'm端双十一大咖直播-正在直播'
])
if
(
this
.
state
.
isApp
)
{
if
(
isLogin
)
{
SendMessageToApp
(
'toLiveRoom'
,
id
)
...
...
@@ -108,8 +83,8 @@ class Live extends Component {
history
.
push
(
'/passport/login'
)
}
var
name
=
'直播间id='
+
id
;
_czc
.
push
([
"_trackEvent"
,
name
,
'm端双十一大咖直播-立即预约'
])
;
var
name
=
'直播间id='
+
id
_czc
.
push
([
"_trackEvent"
,
name
,
'm端双十一大咖直播-立即预约'
])
http
.
get
(
`
${
API
[
'base-api'
]}
/sys/createLiveQrcode/
${
id
}
`
)
.
then
(
res
=>
{
...
...
@@ -146,7 +121,7 @@ class Live extends Component {
}
render
()
{
const
{
tabs
,
lives
,
preheatLives
,
today
}
=
this
.
state
const
{
tabs
,
lives
,
today
}
=
this
.
state
return
(
<
div
id
=
{
'live'
}
>
<
div
className
=
"title"
>
...
...
@@ -167,24 +142,8 @@ class Live extends Component {
swipeable
=
{
false
}
>
{
this
.
props
.
isFormal
?
tabs
.
map
((
item
,
index
)
=>
{
const
todayLives
=
lives
[
item
.
title
]
return
(
<
div
key
=
{
index
}
>
{
todayLives
&&
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
]
tabs
.
map
((
item
,
index
)
=>
{
const
todayLives
=
lives
.
filter
(
liveItem
=>
liveItem
.
date
===
item
.
title
)
return
(
<
div
key
=
{
index
}
>
{
...
...
src/components/blessingPreheat/live/index.scss
View file @
6c7b4f9e
...
...
@@ -182,6 +182,7 @@
color
:
#fff
;
&
.am-tabs-default-bar-tab
:nth-last-of-type
(
2
)
{
width
:
21%
!
important
;
&
:
:
after
{
display
:
none
;
}
...
...
@@ -211,14 +212,17 @@
}
}
.am-tabs-default-bar-tab-active
{
background
:
#FFF604
;
border-radius
:
0
0
5px
5px
;
}
.am-tabs-default-bar-top
{
.am-tabs-default-bar-content
{
.am-tabs-default-bar-top
{
.am-tabs-default-bar-content
{
border
:
1px
solid
rgba
(
255
,
246
,
4
,
1
);
border-radius
:
0
0
6px
6px
;
overflow
:
hidden
;
}
}
...
...
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