import { ApiModel } from "../../utils/api"; const _Http = new ApiModel; Page({ /** * 页面的初始数据 */ data: { tabsList: ["私域直播", "展会直播"], //tabs列表 tabsIndex: 0, //tabs下标 accountStatus: null, //直播账号状态 1-账号正常 2-账号审核中 3-没有账号 }, /** * 生命周期函数--监听页面加载 */ 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] }) break; case 2: console.log(2) break; case 3: console.log(2) break; default: wx.showToast({ title: res.data, icon: "none" }) } }) }, /* 申请直播账号 */ applyForLive() { _Http.basic({ "accesstoken": wx.getStorageSync('userData').token, "classname": "customer.live.live", "method": "applySYLive", "content": {} }).then(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 () { } })