index.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. import {
  2. ApiModel
  3. } from "../../utils/api";
  4. const _Http = new ApiModel;
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. tabsList: ["私域直播", "展会直播"], //tabs列表
  11. tabsIndex: 0, //tabs下标
  12. accountStatus: null, //直播账号状态 1-账号正常 2-账号审核中 3-没有账号
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad: function (options) {
  18. //获取直播详情
  19. _Http.basic({
  20. "accesstoken": wx.getStorageSync('userData').token,
  21. "classname": "customer.live.live",
  22. "method": "getSYLiveInfo",
  23. "content": {}
  24. }).then(res => {
  25. console.log(res)
  26. this.setData({
  27. accountStatus: res.code
  28. })
  29. switch (res.code) {
  30. case 1:
  31. this.setData({
  32. accountMsg: res.data[0]
  33. })
  34. break;
  35. case 2:
  36. console.log(2)
  37. break;
  38. case 3:
  39. console.log(2)
  40. break;
  41. default:
  42. wx.showToast({
  43. title: res.data,
  44. icon: "none"
  45. })
  46. }
  47. })
  48. },
  49. /* 申请直播账号 */
  50. applyForLive() {
  51. _Http.basic({
  52. "accesstoken": wx.getStorageSync('userData').token,
  53. "classname": "customer.live.live",
  54. "method": "applySYLive",
  55. "content": {}
  56. }).then(res => {
  57. if (res.code == 1) {
  58. wx.showToast({
  59. title: res.msg,
  60. icon: "none"
  61. })
  62. this.setData({
  63. accountStatus: 2
  64. })
  65. } else {
  66. if (res.data == '私域直播已申请') return wx.showModal({
  67. title: "提示",
  68. content: "您的私域直播账号正在申请中"
  69. })
  70. }
  71. })
  72. },
  73. /* tabs回调 */
  74. setIndex({
  75. detail
  76. }) {
  77. this.setData({
  78. tabsIndex: detail
  79. })
  80. },
  81. /* 复制地址 */
  82. copyTheAddress(e) {
  83. console.log(e)
  84. const {
  85. url
  86. } = e.target.dataset
  87. wx.setClipboardData({
  88. data: url,
  89. success(res) {
  90. wx.getClipboardData({
  91. success(res) {
  92. console.log('内容已复制') // data
  93. }
  94. })
  95. }
  96. })
  97. },
  98. /**
  99. * 生命周期函数--监听页面初次渲染完成
  100. */
  101. onReady: function () {
  102. },
  103. /**
  104. * 生命周期函数--监听页面显示
  105. */
  106. onShow: function () {
  107. },
  108. /**
  109. * 生命周期函数--监听页面隐藏
  110. */
  111. onHide: function () {
  112. },
  113. /**
  114. * 生命周期函数--监听页面卸载
  115. */
  116. onUnload: function () {
  117. },
  118. /**
  119. * 页面相关事件处理函数--监听用户下拉动作
  120. */
  121. onPullDownRefresh: function () {
  122. },
  123. /**
  124. * 页面上拉触底事件的处理函数
  125. */
  126. onReachBottom: function () {
  127. },
  128. /**
  129. * 用户点击右上角分享
  130. */
  131. onShareAppMessage: function () {
  132. }
  133. })