Commit 1f5770ae by 程智春

直播优化

parent c3309530
......@@ -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;
......
......@@ -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: 60vw;
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;
......
......@@ -75,6 +75,8 @@ export default {
}
});
}
}else{
console.log('开播失败')
}
} catch (err) {
console.error("subscribeMessage-err", err);
......
......@@ -442,6 +442,10 @@ export default {
if(res.data.code == '200'){
let result = res.data.data
if(result){
result.coverUrl = DFSImg(result.coverUrl)
result.logoUrl = DFSImg(result.logoUrl)
this.liveInfo = result;
......@@ -470,18 +474,38 @@ export default {
// 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`})
......
......@@ -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,6 +172,11 @@ export default {
},
//去直播间
toLive(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){
......@@ -187,6 +193,35 @@ export default {
}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.showModal({
title: '提示',
content: '直播已关闭',
success : (res3) => {
if (res3.confirm) {
this.getLiveList()
} else if (res3.cancel) {
console.log('用户点击取消')
}
}
})
}
})
},
getUserInfo(e){
......
......@@ -415,8 +415,8 @@ 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
if(resData.entryNoticeList && resData.entryNoticeList.length){
this.userActivebeginTime = resData.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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment