liveDetail.nvue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="container" :style="'height: '+windowHeight+'px;'">
  3. <jhlive
  4. ref="jhlive"
  5. class="jhlive"
  6. :sdkAppID="sdkAppID"
  7. :secretKey="secretKey"
  8. :userId="userId"
  9. :roomId="roomId"
  10. :isAuthor="isAuthor"
  11. :linkMic="linkMic"
  12. :avatar="avatar"
  13. :num="num"
  14. :likes="likes"
  15. :name="name" />
  16. <jhimlive
  17. ref="jhimlive"
  18. class="jhimlive"
  19. :sdkAppID="sdkAppID"
  20. :secretKey="secretKey"
  21. :userId="userId"
  22. :roomId="roomId"
  23. :isAuthor="isAuthor"
  24. :avatar="avatar"
  25. :name="name"
  26. @onMemberCount="num=$event"/>
  27. </view>
  28. </template>
  29. <script>
  30. import jhlive from "@/jhlive/jhlive";
  31. import jhimlive from "@/jhim/jhimlive";
  32. const NET = require('@/utils/request')
  33. const API = require('@/config/api')
  34. export default {
  35. components: { jhlive, jhimlive },
  36. data() {
  37. return {
  38. isAuthor: false,
  39. linkMic: false,
  40. sdkAppID:API.sdkAppID,
  41. secretKey:API.secretKey,
  42. windowWidth: 0,
  43. windowHeight: 0,
  44. userId: '',
  45. roomId: '',
  46. liveId: '',
  47. num: 0,
  48. likes: 0,
  49. name:"",
  50. avatar:"../static/images/loginLogo.png",
  51. userData: {},
  52. enabledIM: false,
  53. imReady: false,
  54. imMsgs: [],
  55. }
  56. },
  57. onLoad(options) {
  58. this.roomId = options.roomId;
  59. this.liveId = options.liveId
  60. this.userData = uni.getStorageSync("userData");
  61. this.userId = this.userData.userId;
  62. let info = uni.getSystemInfoSync();
  63. this.windowWidth = info.windowWidth;
  64. this.windowHeight = info.windowHeight;
  65. },
  66. onReady() {
  67. this.isAuthor = false;
  68. // this.linkMic = true;
  69. // this.userId = "123";
  70. // this.name = 'test';
  71. // this.roomId = '1';
  72. this.$nextTick(() => this.enterRoom());
  73. return;
  74. this.init();
  75. },
  76. onUnload() {
  77. this.exitRoom();
  78. },
  79. methods: {
  80. init() {
  81. this.avatar = uni.getStorageSync("liveImgUrl");
  82. this.name = uni.getStorageSync("liveName");
  83. this.$nextTick(() => this.enterRoom());
  84. },
  85. enterRoom() {
  86. this.$refs.jhimlive&&this.$refs.jhimlive.enterRoom();
  87. this.$refs.jhlive&&this.$refs.jhlive.enterRoom();
  88. },
  89. exitRoom() {
  90. this.$refs.jhimlive&&this.$refs.jhimlive.exitRoom();
  91. this.$refs.jhlive&&this.$refs.jhlive.exitRoom();
  92. },
  93. handleShop(msg) {
  94. }
  95. },
  96. }
  97. </script>
  98. <style lang="less" scoped>
  99. .container {
  100. position: relative;
  101. display: flex;
  102. flex-direction: column;
  103. align-items: stretch;
  104. width: 750rpx;
  105. }
  106. .jhlive {
  107. width: 750rpx;
  108. flex: 1;
  109. }
  110. .jhimlive {
  111. width: 400rpx;
  112. position: absolute;
  113. bottom: 10px;
  114. left: 10px;
  115. }
  116. </style>