123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- import {
- ApiModel
- } from "../../utils/api";
- const _Http = new ApiModel;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- tabsList: ["私域直播", "展会直播"], //tabs列表
- tabsIndex: 0, //tabs下标
- accountStatus: null, //直播账号状态 1-账号正常 2-账号审核中 3-没有账号
- liveDataCount: {}, //实时数据统计
- liveSessionList: {}, //直播场次列表
- pageNumber: 1, //当前页码
- pageTotal: 1, //列表总页数
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- //获取直播详情
- _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "customer.live.live",
- "method": "getSYLiveInfo",
- "content": {}
- }).then(res => {
- console.log(res)
- this.setData({
- accountStatus: res.code
- })
- switch (res.code) {
- case 1:
- this.setData({
- accountMsg: res.data[0]
- })
- /* 直播数据统计 */
- _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "customer.live.live",
- "method": "getSYLiveDataCount",
- "content": {
- "channelid": res.data[0].channelid
- }
- }).then(res => {
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- this.setData({
- liveDataCount: res.data
- })
- })
- /* 私域直播场次列表查询 */
- this.getSYLiveSessionList()
- break;
- case 2:
- console.log(2)
- break;
- case 3:
- console.log(3)
- break;
- default:
- wx.showToast({
- title: res.data,
- icon: "none"
- })
- }
- })
- },
- /* 私域直播场次列表查询 */
- getSYLiveSessionList() {
- _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "customer.live.live",
- "method": "getSYLiveSessionList",
- "content": {
- "getdatafromdbanyway": true,
- "pageNumber": this.data.pageNumber,
- "pageSize": 10,
- "channelid": this.data.accountMsg.channelid
- }
- }).then(res => {
- console.log(res)
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- });
- for (let i = 0; i < res.data.length; i++) {
- let checkdate = res.data[i].starttime;
- res.data[i].starttime = checkdate.slice(0, checkdate.lastIndexOf('.'));
- }
- this.setData({
- liveSessionList: res.data,
- pageTotal: res.pageTotal
- })
- })
- },
- /* 下一页 */
- buttonRightClick() {
- if (this.data.pageNumber == this.data.pageTotal) return wx.showToast({
- title: '已经到达最后一页',
- icon: "none"
- });
- this.setData({
- pageNumber: this.data.pageNumber + 1
- })
- this.getSYLiveSessionList()
- },
- /* 上一页 */
- buttonLifeClick() {
- if (this.data.pageNumber == 1) return wx.showToast({
- title: '已经在第一页了哦',
- icon: "none"
- });
- this.setData({
- pageNumber: this.data.pageNumber - 1
- })
- this.getSYLiveSessionList()
- },
- /* 申请直播账号 */
- applyForLive() {
- _Http.basic({
- "accesstoken": wx.getStorageSync('userData').token,
- "classname": "customer.live.live",
- "method": "applySYLive",
- "content": {}
- }).then(res => {
- console.log(res)
- if (res.code == 1) {
- wx.showToast({
- title: res.msg,
- icon: "none"
- })
- this.setData({
- accountStatus: 2
- })
- } else {
- if (res.data == '私域直播已申请') return wx.showModal({
- title: "提示",
- content: "您的私域直播账号正在申请中"
- })
- }
- })
- },
- /* tabs回调 */
- setIndex({
- detail
- }) {
- this.setData({
- tabsIndex: detail
- })
- },
- /* 复制地址 */
- copyTheAddress(e) {
- console.log(e)
- const {
- url
- } = e.target.dataset
- wx.setClipboardData({
- data: url,
- success(res) {
- wx.getClipboardData({
- success(res) {
- console.log('内容已复制') // data
- }
- })
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|