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