12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <template>
- <view class="container">
- <jhlive
- ref="jhlive"
- class="jhlive"
- :sdkAppID="sdkAppID"
- :secretKey="secretKey"
- :userId="userId"
- :roomId="roomId"
- :isAuthor="isAuthor"
- :linkMic="linkMic"
- :avatar="avatar"
- :num="num"
- :likes="likes"
- :name="name" />
- </view>
- </template>
- <script>
- import jhlive from "@/jhlive/jhlive";
- const NET = require('@/utils/request')
- const API = require('@/config/api')
- export default {
- components: { jhlive },
- data() {
- return {
- userData: {},
- orderId: '',
- goodsList: [],
-
- isAuthor: true,
- linkMic: false,
- sdkAppID:API.sdkAppID,
- secretKey:API.secretKey,
- windowWidth: 0,
- windowHeight: 0,
- userId: '',
- roomId: '',
- liveId: '',
- num: 0,
- likes: 0,
- name:"等待用户连接",
- avatar:"../static/images/loginLogo.png",
- }
- },
- onLoad(options) {
- this.orderId = options.orderId
- this.userData = uni.getStorageSync("userData");
- let info = uni.getSystemInfoSync();
- this.windowWidth = info.windowWidth;
- this.windowHeight = info.windowHeight;
- },
- onReady() {
- this.init();
- },
- methods: {
- init() {
- NET.request(API.creatPickVideo, {orderId: this.orderId}, 'GET').then(res => {
- this.liveId = res.data.liveId
- this.roomId = res.data.roomId;
- this.goodsList = res.data.liveProducResVO
- this.$nextTick(() => this.enterRoom());
- }).catch(error => {
- uni.showToast({
- title: error.data.msg,
- duration: 2000
- });
- })
- },
- enterRoom() {
- this.$refs.jhlive&&this.$refs.jhlive.enterRoom();
- },
- exitRoom() {
- this.$refs.jhlive&&this.$refs.jhlive.exitRoom();
- },
- }
- }
- </script>
- <style lang="less" scoped>
- .container {
- position: relative;
- display: flex;
- flex-direction: column;
- align-items: stretch;
- width: 750rpx;
- }
- .jhlive {
- width: 750rpx;
- flex: 1;
- }
- </style>
|