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
c84d6adf
Commit
c84d6adf
authored
Apr 03, 2020
by
程智春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
直播
parent
11ac6472
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
30 deletions
+70
-30
src/pages/live/index.vue
+39
-14
src/pages/liveList/index.vue
+5
-9
src/pages/liveList/main.json
+1
-0
src/pages/liveOver/index.vue
+1
-1
src/pages/lived/index.vue
+20
-5
src/utils/request.js
+4
-1
No files found.
src/pages/live/index.vue
View file @
c84d6adf
...
...
@@ -209,9 +209,13 @@ export default {
isTimeFirstReq
:
true
,
//第一次数据请求
isDetailLock
:
true
,
//查看详情锁
updateVal
:
0
,
overOrStop
:
1
,
//是暂停还是结束
isDetailControlLock
:
true
,
}
},
watch
:{
...
...
@@ -268,6 +272,7 @@ export default {
this
.
isTimeLock
=
true
;
this
.
isTimeFirstReq
=
true
;
this
.
overOrStop
=
1
;
this
.
isDetailLock
=
true
;
this
.
online
=
0
//在线
this
.
look
=
0
//观看
...
...
@@ -277,7 +282,10 @@ export default {
this
.
liveTime
=
''
;
this
.
liveId
=
options
.
id
;
this
.
getLiveDetail
(
options
.
id
);
this
.
openLiveTimer
=
setInterval
(()
=>
{
this
.
getLiveDetail
(
options
.
id
);
//传入直播间id
},
5000
)
this
.
getServerTimeNow
();
//获取服务器时间戳
...
...
@@ -322,11 +330,6 @@ export default {
}
}
// this.isSetBeauty = false;
},
onUnload
(){
this
.
commentsList
=
[]
...
...
@@ -396,6 +399,7 @@ export default {
this
.
recoverLive
=
false
this
.
isBgImg
=
false
;
this
.
isSetBeauty
=
true
;
this
.
isDetailControlLock
=
false
;
this
.
pusher
.
startPreview
()
},
showPopup
(){
...
...
@@ -427,8 +431,16 @@ export default {
},
//获取直播间详情
getLiveDetail
(
id
){
console
.
log
(
'获取'
,
this
.
recoverLive
)
if
(
this
.
isDetailLock
&&
this
.
isDetailControlLock
){
this
.
isDetailLock
=
false
;
liveApi
.
queryLiveDetail
({
id
}).
then
(
res
=>
{
this
.
isDetailLock
=
true
;
if
(
res
.
data
.
code
==
'200'
){
let
result
=
res
.
data
.
data
result
.
coverUrl
=
DFSImg
(
result
.
coverUrl
)
result
.
logoUrl
=
DFSImg
(
result
.
logoUrl
)
...
...
@@ -443,6 +455,7 @@ export default {
this
.
isLive
=
true
this
.
isBgImg
=
false
;
}
else
if
(
result
.
liveBroadcastState
==
3
){
console
.
log
(
'llll'
)
this
.
recoverLive
=
true
;
this
.
isUsual
=
true
;
this
.
isBgImg
=
true
;
...
...
@@ -457,20 +470,21 @@ export default {
this
.
getLiveTimeHandler
(
result
.
startTime
)
//
this.getLiveTimeHandler(result.startTime)
// clearInterval(this.openLiveTimer)
this
.
openLiveTimer
=
setInterval
(()
=>
{
//
this.openLiveTimer = setInterval(() => {
this
.
getLiveTimeHandler
(
result
.
startTime
)
},
5000
)
// },5000)
// this.getProductList(); //获取商品列表
// this.getProductTimer = setInterval(() => {
this
.
getProductList
();
//获取商品列表
this
.
getProductTimer
=
setInterval
(()
=>
{
this
.
getProductList
();
//获取商品列表
},
30000
)
// },30000)
}
})
}
},
//获取开播时间
getLiveTimeHandler
(
time
){
...
...
@@ -561,6 +575,7 @@ export default {
},
//开始直播
startLive
(
type
){
this
.
isDetailControlLock
=
false
;
if
(
type
==
'recover'
){
this
.
recoverLive
=
false
;
this
.
isUsual
=
false
;
...
...
@@ -577,6 +592,7 @@ export default {
console
.
log
(
'开始直播'
)
this
.
pusher
.
start
();
//开始推流
this
.
isCountDown
=
false
;
this
.
isDetailControlLock
=
true
;
this
.
isSetBeauty
=
false
;
clearInterval
(
timer
)
this
.
changeLiveStatus
(
1
);
...
...
@@ -597,6 +613,7 @@ export default {
this
.
pusher
.
resume
();
}
else
if
(
val
==
3
){
this
.
isLive
=
false
;
console
.
log
(
'222222'
)
this
.
recoverLive
=
true
;
this
.
isBgImg
=
true
;
this
.
enableCamera
=
false
;
...
...
@@ -613,6 +630,7 @@ export default {
this
.
isSetBeauty
=
val
;
this
.
isBgImg
=
true
;
this
.
enableCamera
=
false
;
this
.
isDetailControlLock
=
true
;
if
(
this
.
liveInfo
.
liveBroadcastState
==
0
){
this
.
noStartLive
=
true
;
}
else
if
(
this
.
liveInfo
.
liveBroadcastState
==
1
){
...
...
@@ -627,6 +645,7 @@ export default {
//定时查询数据
timeGetInfo
(
serverTime
){
let
newCommentsTime
=
serverTime
let
userActivebeginTime
=
serverTime
clearInterval
(
this
.
liveDetailTimer
)
this
.
liveDetailTimer
=
setInterval
(()
=>
{
...
...
@@ -635,9 +654,11 @@ export default {
//第一次请求用服务器的时间减去2秒
this
.
isTimeLock
=
false
;
let
dataTime
=
this
.
isTimeFirstReq
?
serverTime
-
2000
:
newCommentsTime
let
userTime
=
this
.
isTimeFirstReq
?
serverTime
-
2000
:
userActivebeginTime
liveApi
.
queryLiveComments
({
id
:
Number
(
this
.
liveId
),
beginTime
:
dataTime
beginTime
:
dataTime
,
//评论时间
userActivebeginTime
:
userTime
,
//用户进入时间
}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
'200'
){
this
.
isTimeFirstReq
=
false
;
...
...
@@ -655,9 +676,9 @@ export default {
}
等
${
result
.
entryNoticeList
.
length
}
人`
;
//用户进入
}
}
//在线
this
.
look
=
result
.
historyWatchNum
;
//观看
this
.
look
=
result
.
historyWatchNum
;
//在线
this
.
online
=
result
.
watchNum
//点赞
this
.
praise
=
result
.
likeInfo
.
likeNum
...
...
@@ -669,6 +690,10 @@ export default {
newCommentsTime
=
result
.
guestBookList
[
result
.
guestBookList
.
length
-
1
].
createTimeStamp
}
if
(
result
.
entryNoticeList
&&
result
.
entryNoticeList
.
length
){
userActivebeginTime
=
result
.
entryNoticeList
[
result
.
entryNoticeList
.
length
-
1
].
createTimeStamp
}
this
.
updateVal
=
new
Date
().
getTime
();
//监听使用数据
}
}
...
...
src/pages/liveList/index.vue
View file @
c84d6adf
<
template
>
<!--
<div
class=
"container1"
:style=
"
{'padding-top':navHeight +'px'}"> -->
<div
class=
"container1"
>
<!--
<div
class=
"navbar"
:style=
"
{'height' : navHeight + 'px','padding-top':navTop+'px'}"> -->
<!--
<div
@
click=
"toHistory"
class=
"history-btn"
v-show=
"isLogin"
>
<img
class=
"btn-img"
src=
"../../../static/images/history.png"
alt=
""
>
</div>
-->
<!--
<div
@
click=
"toHistory"
class=
"history-btn"
>
<img
class=
"btn-img"
src=
"../../../static/images/history.png"
alt=
""
>
<div
class=
"container1"
:style=
"
{'padding-top':navHeight +'px'}">
<div
class=
"navbar"
:style=
"
{'height' : navHeight + 'px','padding-top':navTop+'px'}">
<div
@
click=
"toIndex"
class=
"history-btn"
>
<span
class=
"iconfont iconzuo"
></span>
</div>
<div
class=
"navbar-title"
>
直播计划
</div>
</div>
-->
</div>
<div
class=
"history-wrap"
>
<div
class=
"history-box"
@
click=
"toHistory"
>
...
...
src/pages/liveList/main.json
View file @
c84d6adf
{
"enablePullDownRefresh"
:
true
,
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"直播计划"
,
"usingComponents"
:
{
"van-divider"
:
"/static/vant/divider/index"
...
...
src/pages/liveOver/index.vue
View file @
c84d6adf
...
...
@@ -69,7 +69,7 @@ export default {
},
onShow
(){
this
.
overInfo
=
{}
//
this.overInfo = {}
},
onLoad
(
options
){
...
...
src/pages/lived/index.vue
View file @
c84d6adf
...
...
@@ -22,8 +22,8 @@
</div>
<div
class=
"info"
>
<p
class=
"name line-clamp1"
v-if=
"shopName"
>
{{
shopName
}}
</p>
<p
class=
"num"
v-if=
"liveNoticeInfo.
w
atchNum>0"
>
<span>
{{
liveNoticeInfo
.
w
atchNum
}}
</span>
<p
class=
"num"
v-if=
"liveNoticeInfo.
historyW
atchNum>0"
>
<span>
{{
liveNoticeInfo
.
historyW
atchNum
}}
</span>
<span
style=
"margin-left:6px;"
>
观看
</span>
</p>
</div>
...
...
@@ -126,6 +126,7 @@ export default {
isTimeFirstReq
:
true
,
//第一次数据请求
newCommentsTime
:
0
,
userActivebeginTime
:
0
,
};
},
components
:
{
...
...
@@ -136,6 +137,7 @@ export default {
},
computed
:
{},
onLoad
(
options
)
{
console
.
log
(
'onLoad'
)
this
.
isTimeLock
=
true
;
this
.
isTimeFirstReq
=
true
;
this
.
newCommentsTime
=
0
;
...
...
@@ -179,7 +181,7 @@ export default {
}
this
.
init
();
this
.
userEntry
(
"IN"
);
//
this.userEntry("IN");
// 通过分享进入直播间重新查询订阅消息配置
this
.
getMsgConfig
();
...
...
@@ -223,6 +225,13 @@ export default {
console
.
log
(
shareObj
,
"----------------168"
);
return
shareObj
;
},
onHide
(){
this
.
userEntry
(
"OUT"
);
},
onShow
(){
console
.
log
(
'onShow'
)
this
.
userEntry
(
"IN"
);
},
onUnload
()
{
this
.
liveNoticeInfo
.
liveBroadcastState
=
-
1
;
this
.
liveNoticeInfo
=
{};
...
...
@@ -341,10 +350,12 @@ export default {
if
(
this
.
isTimeLock
){
this
.
isTimeLock
=
false
;
let
dataTime
=
this
.
isTimeFirstReq
?
serverTime
-
2000
:
this
.
newCommentsTime
let
userTime
=
this
.
isTimeFirstReq
?
serverTime
-
2000
:
this
.
userActivebeginTime
// 前五秒
let
query
=
{
id
:
Number
(
this
.
liveId
),
beginTime
:
dataTime
beginTime
:
dataTime
,
userActivebeginTime
:
userTime
,
//用户进入时间
};
live
.
getLiveStateById
(
query
).
then
(
res
=>
{
this
.
isTimeFirstReq
=
false
;
...
...
@@ -404,11 +415,14 @@ export default {
if
(
resData
.
guestBookList
&&
resData
.
guestBookList
.
length
){
this
.
newCommentsTime
=
resData
.
guestBookList
[
resData
.
guestBookList
.
length
-
1
].
createTimeStamp
}
if
(
result
.
entryNoticeList
&&
result
.
entryNoticeList
.
length
){
this
.
userActivebeginTime
=
result
.
entryNoticeList
[
result
.
entryNoticeList
.
length
-
1
].
createTimeStamp
}
this
.
likeInfo
=
resData
.
likeInfo
;
//点赞信息
// 直播中且接口直播中---主要操作
// 数据初始化
this
.
entryNoticeText
=
""
;
this
.
liveNoticeInfo
.
watchNum
=
resData
.
w
atchNum
;
//观看人数
this
.
liveNoticeInfo
.
historyWatchNum
=
resData
.
historyW
atchNum
;
//观看人数
if
(
resData
.
entryNoticeList
.
length
>
0
)
{
if
(
resData
.
entryNoticeList
.
length
==
1
)
{
this
.
entryNoticeText
=
`
${
resData
.
entryNoticeList
[
0
].
userName
}
`
;
//用户进入
...
...
@@ -487,6 +501,7 @@ export default {
// this.timingGetInfo(res.data.data);
this
.
newCommentsTime
=
res
.
data
.
data
this
.
userActivebeginTime
=
res
.
data
.
data
console
.
log
(
'newCommentsTime'
,
this
.
newCommentsTime
)
// setTimeout(() => {
this
.
infoTiming
=
setInterval
(()
=>
{
...
...
src/utils/request.js
View file @
c84d6adf
...
...
@@ -11,7 +11,8 @@ export async function requestGET(url, options) {
header
:
{
"Shop-Mixid"
:
shopMixid
,
"Offline-Shop-Code"
:
store
.
state
.
offlineShopCode
,
"Authorization"
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
"Authorization"
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
,
"dubbo-tag"
:
"ljx"
},
success
:
function
(
res
)
{
resolve
(
res
)
...
...
@@ -33,6 +34,7 @@ export async function requestPOST(url, options) {
"Shop-Mixid"
:
shopMixid
,
"Authorization"
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
,
"Offline-Shop-Code"
:
store
.
state
.
offlineShopCode
,
"dubbo-tag"
:
"ljx"
},
success
:
function
(
res
)
{
resolve
(
res
)
...
...
@@ -55,6 +57,7 @@ export function requestPOST1(url, options) {
"Shop-Mixid"
:
shopMixid
,
Authorization
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
,
"Offline-Shop-Code"
:
store
.
state
.
offlineShopCode
,
"dubbo-tag"
:
"ljx"
},
success
:
function
(
res
)
{
resolve
(
res
)
...
...
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