index.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import {
  2. ApiModel
  3. } from "../../utils/api";
  4. const _Http = new ApiModel;
  5. Component({
  6. options: {
  7. addGlobalClass: true
  8. },
  9. /**
  10. * 组件的属性列表
  11. */
  12. properties: {
  13. /* 直播账号状态 */
  14. accountStatus: {
  15. type: Number
  16. },
  17. /* 直播账号信息 */
  18. accountMsg: {
  19. type: Object
  20. },
  21. /* 是否私域 */
  22. isSY: {
  23. type: Boolean,
  24. value: true
  25. }
  26. },
  27. /**
  28. * 组件的初始数据
  29. */
  30. data: {},
  31. /**
  32. * 组件的方法列表
  33. */
  34. methods: {
  35. /* 申请直播账号 */
  36. applyForLive() {
  37. _Http.basic({
  38. "accesstoken": wx.getStorageSync('userData').token,
  39. "classname": "customer.live.live",
  40. "method": "applySYLive",
  41. "content": {}
  42. }).then(res => {
  43. console.log(res)
  44. if (res.code == 1) {
  45. wx.showToast({
  46. title: res.msg,
  47. icon: "none"
  48. })
  49. this.setData({
  50. accountStatus: 2
  51. })
  52. } else {
  53. if (res.data == '私域直播已申请') return wx.showModal({
  54. title: "提示",
  55. content: "您的私域直播账号正在申请中"
  56. })
  57. }
  58. })
  59. },
  60. /* 复制地址 */
  61. copyTheAddress(e) {
  62. console.log(e)
  63. const {
  64. url
  65. } = e.target.dataset
  66. wx.setClipboardData({
  67. data: url,
  68. success(res) {
  69. wx.getClipboardData({
  70. success(res) {
  71. console.log('内容已复制') // data
  72. }
  73. })
  74. }
  75. })
  76. },
  77. }
  78. })