123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <template>
- <view class="container" :style="'height: '+windowHeight+'px;'">
- <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" />
- <jhimlive
- ref="jhimlive"
- class="jhimlive"
- :sdkAppID="sdkAppID"
- :secretKey="secretKey"
- :userId="userId"
- :roomId="roomId"
- :isAuthor="isAuthor"
- :avatar="avatar"
- :name="name"
- @onMemberCount="num=$event"/>
- </view>
- </template>
- <script>
- import jhlive from "@/jhlive/jhlive";
- import jhimlive from "@/jhim/jhimlive";
- const NET = require('@/utils/request')
- const API = require('@/config/api')
-
- export default {
- components: { jhlive, jhimlive },
- data() {
- return {
- isAuthor: false,
- 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",
- userData: {},
- enabledIM: false,
- imReady: false,
- imMsgs: [],
- }
- },
- onLoad(options) {
- this.roomId = options.roomId;
- this.liveId = options.liveId
- this.userData = uni.getStorageSync("userData");
- this.userId = this.userData.userId;
- let info = uni.getSystemInfoSync();
- this.windowWidth = info.windowWidth;
- this.windowHeight = info.windowHeight;
- },
- onReady() {
- this.isAuthor = false;
- // this.linkMic = true;
- // this.userId = "123";
- // this.name = 'test';
- // this.roomId = '1';
- this.$nextTick(() => this.enterRoom());
- return;
- this.init();
- },
- onUnload() {
- this.exitRoom();
- },
- methods: {
- init() {
- this.avatar = uni.getStorageSync("liveImgUrl");
- this.name = uni.getStorageSync("liveName");
- this.$nextTick(() => this.enterRoom());
- },
- enterRoom() {
- this.$refs.jhimlive&&this.$refs.jhimlive.enterRoom();
- this.$refs.jhlive&&this.$refs.jhlive.enterRoom();
- },
- exitRoom() {
- this.$refs.jhimlive&&this.$refs.jhimlive.exitRoom();
- this.$refs.jhlive&&this.$refs.jhlive.exitRoom();
- },
- handleShop(msg) {
- }
- },
- }
- </script>
- <style lang="less" scoped>
-
- .container {
- position: relative;
- display: flex;
- flex-direction: column;
- align-items: stretch;
- width: 750rpx;
- }
- .jhlive {
- width: 750rpx;
- flex: 1;
- }
- .jhimlive {
- width: 400rpx;
- position: absolute;
- bottom: 10px;
- left: 10px;
- }
- </style>
|