pickVideo.nvue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. @onRemoteUser="num=$event.length" />
  17. </view>
  18. </template>
  19. <script>
  20. import jhlive from "@/jhlive/jhlive";
  21. const NET = require('@/utils/request')
  22. const API = require('@/config/api')
  23. export default {
  24. components: { jhlive },
  25. data() {
  26. return {
  27. userData: {},
  28. orderId: '',
  29. tenantCode: '',
  30. goodsList: [],
  31. isAuthor: false,
  32. linkMic: true,
  33. sdkAppID:API.sdkAppID,
  34. secretKey:API.secretKey,
  35. windowWidth: 0,
  36. windowHeight: 0,
  37. userId: '',
  38. roomId: '',
  39. liveId: '',
  40. num: 0,
  41. likes: 0,
  42. name: "",
  43. avatar: "../static/images/loginLogo.png",
  44. }
  45. },
  46. onLoad(options) {
  47. this.tenantCode = options.tenantCode,
  48. this.orderId = options.orderId
  49. this.userData = uni.getStorageSync("userData");
  50. let info = uni.getSystemInfoSync();
  51. this.windowWidth = info.windowWidth;
  52. this.windowHeight = info.windowHeight;
  53. },
  54. onReady() {
  55. this.init();
  56. },
  57. methods: {
  58. init() {
  59. NET.request(API.linkPickVideo, {
  60. tenantCode : this.tenantCode,
  61. orderId: this.orderId
  62. }, 'GET').then(res => {
  63. this.name = res.data.tenantName;
  64. this.avatar = res.data.headImg;
  65. this.liveId = res.data.liveId;
  66. this.roomId = res.data.roomId;
  67. this.goodsList = res.data.liveProducResVO;
  68. this.$nextTick(() => this.enterRoom());
  69. }).catch(error => {
  70. uni.showToast({
  71. title: error.data.msg,
  72. duration: 2000
  73. });
  74. });
  75. },
  76. enterRoom() {
  77. this.$refs.jhlive&&this.$refs.jhlive.enterRoom();
  78. },
  79. exitRoom() {
  80. this.$refs.jhlive&&this.$refs.jhlive.exitRoom();
  81. },
  82. }
  83. }
  84. </script>
  85. <style lang="less" scoped>
  86. .container {
  87. position: relative;
  88. display: flex;
  89. flex-direction: column;
  90. align-items: stretch;
  91. width: 750rpx;
  92. }
  93. .jhlive {
  94. width: 750rpx;
  95. flex: 1;
  96. }
  97. </style>