Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
1f5770ae
Commit
1f5770ae
authored
Apr 03, 2020
by
程智春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
直播优化
parent
c3309530
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
128 additions
and
55 deletions
+128
-55
src/components/comments/index.vue
+6
-1
src/components/livedModel/livedIsMsg.vue
+9
-3
src/components/livedModel/notStarted.vue
+2
-0
src/pages/live/index.vue
+58
-34
src/pages/liveList/index.vue
+49
-14
src/pages/lived/index.vue
+4
-3
No files found.
src/components/comments/index.vue
View file @
1f5770ae
...
...
@@ -78,12 +78,17 @@ export default {
overflow
:
hidden
;
bottom
:
0
;
padding-left
:
10px
;
background-color
:
rgba
(
0
,
0
,
0
,
0.3
);
.item
{
width
:
50vw
;
padding
:
4px
0
;
display
:
flex
;
align-items
:
flex-start
;
line-height
:
18px
;
border-radius
:
9px
;
background-color
:
rgba
(
0
,
0
,
0
,
0.3
);
margin-bottom
:
4px
;
padding-left
:
8px
;
box-sizing
:
border-box
;
.user
{
.name
{
color
:
#f9a93c
;
...
...
src/components/livedModel/livedIsMsg.vue
View file @
1f5770ae
...
...
@@ -63,15 +63,21 @@ export default {
position
:
relative
;
width
:
60vw
;
.list
{
width
:
60vw
;
max-height
:
24vh
;
width
:
50vw
;
overflow
:
hidden
;
bottom
:
0
;
padding-left
:
10px
;
.item
{
width
:
6
0vw
;
width
:
5
0vw
;
padding
:
4px
0
;
display
:
flex
;
align-items
:
flex-start
;
line-height
:
18px
;
border-radius
:
9px
;
background-color
:
rgba
(
0
,
0
,
0
,
0.3
);
margin-bottom
:
4px
;
padding-left
:
8px
;
box-sizing
:
border-box
;
.user
{
.name
{
color
:
#f9a93c
;
...
...
src/components/livedModel/notStarted.vue
View file @
1f5770ae
...
...
@@ -75,6 +75,8 @@ export default {
}
});
}
}
else
{
console
.
log
(
'开播失败'
)
}
}
catch
(
err
)
{
console
.
error
(
"subscribeMessage-err"
,
err
);
...
...
src/pages/live/index.vue
View file @
1f5770ae
...
...
@@ -442,46 +442,70 @@ export default {
if
(
res
.
data
.
code
==
'200'
){
let
result
=
res
.
data
.
data
result
.
coverUrl
=
DFSImg
(
result
.
coverUrl
)
result
.
logoUrl
=
DFSImg
(
result
.
logoUrl
)
this
.
liveInfo
=
result
;
this
.
tuiStream
=
result
.
tuiStream
if
(
result
.
liveBroadcastState
==
0
){
this
.
isLive
=
false
this
.
isBgImg
=
true
;
this
.
noStartLive
=
true
;
}
else
if
(
result
.
liveBroadcastState
==
1
){
this
.
enableCamera
=
true
this
.
isLive
=
true
this
.
isBgImg
=
false
;
}
else
if
(
result
.
liveBroadcastState
==
3
){
console
.
log
(
'llll'
)
this
.
recoverLive
=
true
;
this
.
isUsual
=
true
;
this
.
isBgImg
=
true
;
}
if
(
result
.
realStartTime
){
this
.
realStartTime
=
Math
.
floor
((
new
Date
().
getTime
()
-
new
Date
(
result
.
realStartTime
.
replace
(
/-/g
,
'/'
).
replace
(
/-/g
,
'/'
)).
getTime
())
/
1000
)
if
(
result
){
result
.
coverUrl
=
DFSImg
(
result
.
coverUrl
)
result
.
logoUrl
=
DFSImg
(
result
.
logoUrl
)
this
.
liveInfo
=
result
;
this
.
tuiStream
=
result
.
tuiStream
if
(
result
.
liveBroadcastState
==
0
){
this
.
isLive
=
false
this
.
isBgImg
=
true
;
this
.
noStartLive
=
true
;
}
else
if
(
result
.
liveBroadcastState
==
1
){
this
.
enableCamera
=
true
this
.
isLive
=
true
this
.
isBgImg
=
false
;
}
else
if
(
result
.
liveBroadcastState
==
3
){
console
.
log
(
'llll'
)
this
.
recoverLive
=
true
;
this
.
isUsual
=
true
;
this
.
isBgImg
=
true
;
}
}
else
{
this
.
realStartTime
=
0
}
if
(
result
.
realStartTime
){
this
.
realStartTime
=
Math
.
floor
((
new
Date
().
getTime
()
-
new
Date
(
result
.
realStartTime
.
replace
(
/-/g
,
'/'
).
replace
(
/-/g
,
'/'
)).
getTime
())
/
1000
)
}
else
{
this
.
realStartTime
=
0
}
// this.getLiveTimeHandler(result.startTime)
// clearInterval(this.openLiveTimer)
// this.openLiveTimer = setInterval(() => {
this
.
getLiveTimeHandler
(
result
.
startTime
)
// },5000)
// this.getProductList(); //获取商品列表
// this.getProductTimer = setInterval(() => {
this
.
getProductList
();
//获取商品列表
// },30000)
}
else
{
wx
.
showModal
({
title
:
'提示'
,
content
:
'直播已关闭'
,
success
(
res3
)
{
if
(
res3
.
confirm
)
{
wx
.
reLaunch
({
url
:
`../liveList/main`
})
}
else
if
(
res3
.
cancel
)
{
console
.
log
(
'用户点击取消'
)
}
}
})
}
}
else
if
(
res
.
data
.
code
==
'-1'
){
wx
.
showModal
({
title
:
'提示'
,
content
:
'直播已关闭'
,
success
(
res3
)
{
if
(
res3
.
confirm
)
{
wx
.
reLaunch
({
url
:
`../liveList/main`
})
}
else
if
(
res3
.
cancel
)
{
console
.
log
(
'用户点击取消'
)
}
}
})
}
})
}
...
...
@@ -504,13 +528,13 @@ export default {
day
=
Math
.
floor
(
getTimeAbs
/
(
3600
*
1000
*
24
))
hours
=
Math
.
floor
((
getTimeAbs
%
(
24
*
3600
*
1000
))
/
(
3600
*
1000
));
minute
=
Math
.
ceil
((
getTimeAbs
%
(
24
*
3600
*
1000
)
%
(
3600
*
1000
)
)
/
(
60
*
1000
))
minute
=
Math
.
floor
((
getTimeAbs
%
(
24
*
3600
*
1000
)
%
(
3600
*
1000
)
)
/
(
60
*
1000
))
if
(
getTime
>
0
){
if
(
day
>
0
){
this
.
liveTime
=
`
${
day
>=
10
?
day
:
'0'
+
day
}
天
${
hours
>=
10
?
hours
:
'0'
+
hours
}
小时
${
minute
>=
10
?
minute
:
'0'
+
minute
}
分`
}
else
if
(
day
<=
0
&&
hours
>
0
){
this
.
liveTime
=
`
${
hours
>=
10
?
hours
:
'0'
+
hours
}
小时
${
minute
>=
10
?
minute
:
'0'
+
minute
}
分`
}
else
if
(
day
<=
0
&&
hours
<=
0
&&
minute
>
0
){
}
else
if
(
day
<=
0
&&
hours
<=
0
&&
minute
>
=
0
){
this
.
liveTime
=
`
${
minute
>=
10
?
minute
:
'0'
+
minute
}
分`
}
...
...
@@ -547,7 +571,7 @@ export default {
if
(
res2
.
data
.
data
.
liveBroadcastState
==
4
||
res2
.
data
.
data
.
liveBroadcastState
==
2
){
wx
.
showModal
({
title
:
'提示'
,
content
:
'直播
超时
已关闭'
,
content
:
'直播已关闭'
,
success
(
res3
)
{
if
(
res3
.
confirm
)
{
wx
.
reLaunch
({
url
:
`../liveList/main`
})
...
...
src/pages/liveList/index.vue
View file @
1f5770ae
...
...
@@ -81,6 +81,7 @@ import { getNavbarInfo,DFSImg } from '../../utils/common.js'
import
{
wx_decode
}
from
"@/utils/wxIndex.js"
;
import
login
from
"@/api/login"
;
import
indexApi
from
'@/api/liveing'
import
liveApi
from
'@/api/liveing'
export
default
{
data
(){
return
{
...
...
@@ -171,22 +172,56 @@ export default {
},
//去直播间
toLive
(
id
){
let
openId
=
''
;
this
.
liveList
.
forEach
(
item
=>
{
if
(
item
.
liveBroadcastState
==
3
||
item
.
liveBroadcastState
==
1
){
openId
=
item
.
id
}
})
if
(
openId
){
if
(
openId
==
id
){
wx
.
navigateTo
({
url
:
'../live/main?id='
+
id
})
liveApi
.
queryLiveDetail
({
id
}).
then
(
res
=>
{
console
.
log
(
res
.
data
)
if
(
res
.
data
.
code
==
'200'
){
if
(
res
.
data
.
data
){
let
openId
=
''
;
this
.
liveList
.
forEach
(
item
=>
{
if
(
item
.
liveBroadcastState
==
3
||
item
.
liveBroadcastState
==
1
){
openId
=
item
.
id
}
})
if
(
openId
){
if
(
openId
==
id
){
wx
.
navigateTo
({
url
:
'../live/main?id='
+
id
})
}
else
{
wx
.
showToast
({
title
:
'同时只能开播一个直播间'
,
icon
:
"none"
});
}
}
else
{
wx
.
navigateTo
({
url
:
'../live/main?id='
+
id
})
}
}
else
{
wx
.
showModal
({
title
:
'提示'
,
content
:
'直播已关闭'
,
success
:
(
res3
)
=>
{
if
(
res3
.
confirm
)
{
this
.
getLiveList
()
}
else
if
(
res3
.
cancel
)
{
console
.
log
(
'用户点击取消'
)
}
}
})
}
}
else
{
wx
.
showToast
({
title
:
'同时只能开播一个直播间'
,
icon
:
"none"
});
wx
.
showModal
({
title
:
'提示'
,
content
:
'直播已关闭'
,
success
:
(
res3
)
=>
{
if
(
res3
.
confirm
)
{
this
.
getLiveList
()
}
else
if
(
res3
.
cancel
)
{
console
.
log
(
'用户点击取消'
)
}
}
})
}
}
else
{
wx
.
navigateTo
({
url
:
'../live/main?id='
+
id
})
}
})
},
getUserInfo
(
e
){
...
...
src/pages/lived/index.vue
View file @
1f5770ae
...
...
@@ -415,8 +415,8 @@ export default {
if
(
resData
.
guestBookList
&&
resData
.
guestBookList
.
length
){
this
.
newCommentsTime
=
resData
.
guestBookList
[
resData
.
guestBookList
.
length
-
1
].
createTimeStamp
}
if
(
res
ult
.
entryNoticeList
&&
result
.
entryNoticeList
.
length
){
this
.
userActivebeginTime
=
res
ult
.
entryNoticeList
[
result
.
entryNoticeList
.
length
-
1
].
createTimeStamp
if
(
res
Data
.
entryNoticeList
&&
resData
.
entryNoticeList
.
length
){
this
.
userActivebeginTime
=
res
Data
.
entryNoticeList
[
resData
.
entryNoticeList
.
length
-
1
].
createTimeStamp
}
this
.
likeInfo
=
resData
.
likeInfo
;
//点赞信息
// 直播中且接口直播中---主要操作
...
...
@@ -432,7 +432,8 @@ export default {
}
人`
;
//用户进入
}
}
this
.
updateVal
=
Math
.
random
();
//监听使用数据
this
.
updateVal
=
new
Date
().
getTime
();
//监听使用数据
}
else
{
// if (this.infoTiming) {
// clearInterval(this.infoTiming);
...
...
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