|
@@ -8,21 +8,24 @@ Page({
|
|
*/
|
|
*/
|
|
data: {
|
|
data: {
|
|
dataTypes: 0, //0-全部数据 1-单独数据
|
|
dataTypes: 0, //0-全部数据 1-单独数据
|
|
- tabsList: ["私域直播", "展会直播"], //tabs列表
|
|
|
|
|
|
+ tabsList: ["私域直播", "展会直播", "合作商直播"], //tabs列表
|
|
|
|
+ buttonTabs: ["当前直播", "历史直播"], //按钮tabs
|
|
tabsIndex: 0, //tabs下标
|
|
tabsIndex: 0, //tabs下标
|
|
accountStatus: -1, //直播账号状态 1-账号正常 2-账号审核中 3-没有账号
|
|
accountStatus: -1, //直播账号状态 1-账号正常 2-账号审核中 3-没有账号
|
|
//liveDataCount: {}, 实时数据统计
|
|
//liveDataCount: {}, 实时数据统计
|
|
liveDataCountForSession: {}, //单场次数据统计
|
|
liveDataCountForSession: {}, //单场次数据统计
|
|
liveSessionList: [], //直播场次列表
|
|
liveSessionList: [], //直播场次列表
|
|
liveUserList: [], //直播用户观看记录
|
|
liveUserList: [], //直播用户观看记录
|
|
|
|
+ crLiveUserList: [], //当前直播用户观看记录
|
|
pageNumber: 1, //当前页码
|
|
pageNumber: 1, //当前页码
|
|
pageTotal: 1, //列表总页数
|
|
pageTotal: 1, //列表总页数
|
|
userPageNumber: 1, //用户当前页码
|
|
userPageNumber: 1, //用户当前页码
|
|
userPageTotal: 1, //用户总列表
|
|
userPageTotal: 1, //用户总列表
|
|
- optionRow: -1, //列表选中项
|
|
|
|
isSy: true, //是否为私域直播
|
|
isSy: true, //是否为私域直播
|
|
myShowModel: false, //自定义model
|
|
myShowModel: false, //自定义model
|
|
myShowModel2: false, // 真正申请中提示
|
|
myShowModel2: false, // 真正申请中提示
|
|
|
|
+ listRowIndex: -1, //列表选中项
|
|
|
|
+ CheckTheType: '当前直播', //查看类型
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -32,20 +35,70 @@ Page({
|
|
//获取直播账号
|
|
//获取直播账号
|
|
this.getLiveInfo()
|
|
this.getLiveInfo()
|
|
},
|
|
},
|
|
|
|
+ /* 按钮tab回调 */
|
|
|
|
+ tabsSelectedIitem({
|
|
|
|
+ detail
|
|
|
|
+ }) {
|
|
|
|
+ if (detail == this.data.CheckTheType) return;
|
|
|
|
+ this.setData({
|
|
|
|
+ CheckTheType: detail
|
|
|
|
+ })
|
|
|
|
+ },
|
|
/* 实时 */
|
|
/* 实时 */
|
|
realTime() {
|
|
realTime() {
|
|
- const that = this;
|
|
|
|
|
|
+ const that = this,
|
|
|
|
+ token = wx.getStorageSync('userData').token,
|
|
|
|
+ channelid = this.data.accountMsg.channelid;
|
|
|
|
+ /* 获取当前用户列表 */
|
|
|
|
+ this.getRealTimeViewerList();
|
|
|
|
+ //获取聊天
|
|
|
|
+ /* setInterval(() => {
|
|
|
|
+ _Http.basic({
|
|
|
|
+ "accesstoken": token,
|
|
|
|
+ "classname": "customer.live.live",
|
|
|
|
+ "method": "getRealTimeMessageList",
|
|
|
|
+ "content": {
|
|
|
|
+ "channelid": channelid
|
|
|
|
+ }
|
|
|
|
+ }, false).then(res => {
|
|
|
|
+ console.log("聊天", res)
|
|
|
|
+ })
|
|
|
|
+ }, 2000); */
|
|
|
|
+ _Http.basic({
|
|
|
|
+ "accesstoken": token,
|
|
|
|
+ "classname": "customer.live.live",
|
|
|
|
+ "method": "getRealTimeViewers",
|
|
|
|
+ "content": {
|
|
|
|
+ "channelid": channelid
|
|
|
|
+ }
|
|
|
|
+ }).then(res => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /* 获取当前用户列表 */
|
|
|
|
+ getRealTimeViewerList() {
|
|
_Http.basic({
|
|
_Http.basic({
|
|
"accesstoken": wx.getStorageSync('userData').token,
|
|
"accesstoken": wx.getStorageSync('userData').token,
|
|
"classname": "customer.live.live",
|
|
"classname": "customer.live.live",
|
|
"method": "getRealTimeViewerList",
|
|
"method": "getRealTimeViewerList",
|
|
"content": {
|
|
"content": {
|
|
- "pageNumber": 1,
|
|
|
|
|
|
+ "pageNumber": this.data.pageNumber,
|
|
"pageSize": 20,
|
|
"pageSize": 20,
|
|
- "channelid": that.data.accountMsg.channelid
|
|
|
|
|
|
+ "channelid": this.data.accountMsg.channelid
|
|
}
|
|
}
|
|
}, false).then(res => {
|
|
}, false).then(res => {
|
|
console.log(res)
|
|
console.log(res)
|
|
|
|
+ if (res.msg != '成功') {
|
|
|
|
+ if (res.data.liveUserList.length <= 0) return wx.showToast({
|
|
|
|
+ title: res.data,
|
|
|
|
+ icon: "none"
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.setData({
|
|
|
|
+ crLiveUserList: res.data,
|
|
|
|
+ pageTotal: res.pageTotal
|
|
|
|
+ })
|
|
})
|
|
})
|
|
},
|
|
},
|
|
/* 自定义model回调 */
|
|
/* 自定义model回调 */
|
|
@@ -106,7 +159,6 @@ Page({
|
|
"method": method,
|
|
"method": method,
|
|
"content": {}
|
|
"content": {}
|
|
}).then(res => {
|
|
}).then(res => {
|
|
- console.log("不显示")
|
|
|
|
const isSy = (method == "getSYLiveInfo") ? true : false;
|
|
const isSy = (method == "getSYLiveInfo") ? true : false;
|
|
this.setData({
|
|
this.setData({
|
|
accountStatus: res.code,
|
|
accountStatus: res.code,
|
|
@@ -115,7 +167,7 @@ Page({
|
|
})
|
|
})
|
|
//获取实时数据
|
|
//获取实时数据
|
|
this.realTime()
|
|
this.realTime()
|
|
- /* 直播场次列表查询 */
|
|
|
|
|
|
+ //直播场次列表查询
|
|
this.getLiveSessionList()
|
|
this.getLiveSessionList()
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -137,21 +189,27 @@ Page({
|
|
title: res.data,
|
|
title: res.data,
|
|
icon: "none"
|
|
icon: "none"
|
|
});
|
|
});
|
|
|
|
+ let sessionList = [];
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
for (let i = 0; i < res.data.length; i++) {
|
|
- let checkdate = res.data[i].starttime;
|
|
|
|
- res.data[i].starttime = checkdate.slice(0, checkdate.lastIndexOf('.'));
|
|
|
|
- }
|
|
|
|
|
|
+ let checkdate = res.data[i].starttime,
|
|
|
|
+ time = checkdate.slice(0, checkdate.lastIndexOf('.')),
|
|
|
|
+ t = time.split(' ');
|
|
|
|
+ res.data[i].starttime = t[0];
|
|
|
|
+ sessionList.push(t[0])
|
|
|
|
+ };
|
|
this.setData({
|
|
this.setData({
|
|
liveSessionList: res.data,
|
|
liveSessionList: res.data,
|
|
- pageTotal: res.pageTotal
|
|
|
|
- })
|
|
|
|
|
|
+ pageTotal: res.pageTotal,
|
|
|
|
+ sessionList
|
|
|
|
+ });
|
|
|
|
+ this.viewDetails(0)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
/* 查看场次详情 */
|
|
/* 查看场次详情 */
|
|
- viewDetails(e) {
|
|
|
|
- const {
|
|
|
|
- index
|
|
|
|
- } = e.currentTarget.dataset;
|
|
|
|
|
|
+ selectorChange(e) {
|
|
|
|
+ this.viewDetails(e.detail.value);
|
|
|
|
+ },
|
|
|
|
+ viewDetails(index) {
|
|
const sessionid = this.data.liveSessionList[index].sessionid;
|
|
const sessionid = this.data.liveSessionList[index].sessionid;
|
|
this.setData({
|
|
this.setData({
|
|
showStartTime: this.data.liveSessionList[index].starttime,
|
|
showStartTime: this.data.liveSessionList[index].starttime,
|
|
@@ -209,18 +267,9 @@ Page({
|
|
})
|
|
})
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- /* 场次列表选中 */
|
|
|
|
- optionItemIndex(e) {
|
|
|
|
- const {
|
|
|
|
- index
|
|
|
|
- } = e.currentTarget.dataset;
|
|
|
|
- this.setData({
|
|
|
|
- optionRow: index
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
/* 下一页 */
|
|
/* 下一页 */
|
|
buttonRightClick() {
|
|
buttonRightClick() {
|
|
- if (this.data.dataTypes == 0) {
|
|
|
|
|
|
+ if (this.data.CheckTheType == '当前直播') {
|
|
if (this.data.pageNumber == this.data.pageTotal) return wx.showToast({
|
|
if (this.data.pageNumber == this.data.pageTotal) return wx.showToast({
|
|
title: '已经到达最后一页',
|
|
title: '已经到达最后一页',
|
|
icon: "none"
|
|
icon: "none"
|
|
@@ -228,7 +277,7 @@ Page({
|
|
this.setData({
|
|
this.setData({
|
|
pageNumber: this.data.pageNumber + 1
|
|
pageNumber: this.data.pageNumber + 1
|
|
})
|
|
})
|
|
- this.getSYLiveSessionList()
|
|
|
|
|
|
+ this.getRealTimeViewerList()
|
|
} else {
|
|
} else {
|
|
if (this.data.userPageNumber == this.data.userPageTotal) return wx.showToast({
|
|
if (this.data.userPageNumber == this.data.userPageTotal) return wx.showToast({
|
|
title: '已经到达最后一页',
|
|
title: '已经到达最后一页',
|
|
@@ -242,18 +291,18 @@ Page({
|
|
},
|
|
},
|
|
/* 上一页 */
|
|
/* 上一页 */
|
|
buttonLifeClick() {
|
|
buttonLifeClick() {
|
|
- if (this.data.dataTypes == 0) {
|
|
|
|
|
|
+ if (this.data.CheckTheType == '当前直播') {
|
|
if (this.data.pageNumber == 1) return wx.showToast({
|
|
if (this.data.pageNumber == 1) return wx.showToast({
|
|
- title: '已经在第一页了哦',
|
|
|
|
|
|
+ title: '已经在第一页了',
|
|
icon: "none"
|
|
icon: "none"
|
|
});
|
|
});
|
|
this.setData({
|
|
this.setData({
|
|
pageNumber: this.data.pageNumber - 1
|
|
pageNumber: this.data.pageNumber - 1
|
|
})
|
|
})
|
|
- this.getSYLiveSessionList()
|
|
|
|
|
|
+ this.getRealTimeViewerList()
|
|
} else {
|
|
} else {
|
|
if (this.data.userPageNumber == 1) return wx.showToast({
|
|
if (this.data.userPageNumber == 1) return wx.showToast({
|
|
- title: '已经在第一页了哦',
|
|
|
|
|
|
+ title: '已经在第一页了',
|
|
icon: "none"
|
|
icon: "none"
|
|
});
|
|
});
|
|
this.setData({
|
|
this.setData({
|
|
@@ -262,6 +311,12 @@ Page({
|
|
this.LiveUserList()
|
|
this.LiveUserList()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ /* 选中行 */
|
|
|
|
+ listRowAvtion(e) {
|
|
|
|
+ this.setData({
|
|
|
|
+ listRowIndex: e.currentTarget.dataset.index
|
|
|
|
+ })
|
|
|
|
+ },
|
|
/* tabs回调 */
|
|
/* tabs回调 */
|
|
setIndex({
|
|
setIndex({
|
|
detail
|
|
detail
|
|
@@ -272,50 +327,62 @@ Page({
|
|
pageTotal: 1,
|
|
pageTotal: 1,
|
|
userPageNumber: 1,
|
|
userPageNumber: 1,
|
|
userPageTotal: 1
|
|
userPageTotal: 1
|
|
- })
|
|
|
|
|
|
+ });
|
|
|
|
+ if (detail == undefined) return;
|
|
this.getLiveInfo();
|
|
this.getLiveInfo();
|
|
|
|
+ if (detail == 2) this.getCooperationAgentsLiveList();
|
|
|
|
+ },
|
|
|
|
+ /* 获取合作商直播列表 */
|
|
|
|
+ getCooperationAgentsLiveList() {
|
|
|
|
+ _Http.basic({
|
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
|
+ "classname": "customer.live.live",
|
|
|
|
+ "method": "getCooperationAgentsLiveList",
|
|
|
|
+ "content": {}
|
|
|
|
+ }).then(res => {
|
|
|
|
+ this.setData({
|
|
|
|
+ partnerLiveList: res.data
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /* 查看合作商直播 */
|
|
|
|
+ toLive(e) {
|
|
|
|
+ const {
|
|
|
|
+ fliveshowurl
|
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: '/pages/webView/index?url=' + fliveshowurl,
|
|
|
|
+ })
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
*/
|
|
- onReady: function () {
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
|
|
+ onReady: function () {},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
*/
|
|
- onShow: function () {
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
|
|
+ onShow: function () {},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
*/
|
|
- onHide: function () {
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
|
|
+ onHide: function () {},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
*/
|
|
- onUnload: function () {
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
|
|
+ onUnload: function () {},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
*/
|
|
- onPullDownRefresh: function () {
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
|
|
+ onPullDownRefresh: function () {},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
*/
|
|
- onReachBottom: function () {
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
|
|
+ onReachBottom: function () {},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 用户点击右上角分享
|
|
* 用户点击右上角分享
|