pickVideo.nvue 2.0 KB

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