|
@@ -11,7 +11,10 @@
|
|
|
></Slider>
|
|
></Slider>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="container">
|
|
<div class="container">
|
|
|
- <div class="left">
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ class="left"
|
|
|
|
|
+ @click="showJoinBtn = !showJoinBtn"
|
|
|
|
|
+ >
|
|
|
<div
|
|
<div
|
|
|
v-if="currentLiveRoom?.live_room?.cdn === 1"
|
|
v-if="currentLiveRoom?.live_room?.cdn === 1"
|
|
|
class="cdn-ico"
|
|
class="cdn-ico"
|
|
@@ -37,12 +40,12 @@
|
|
|
<VideoControls></VideoControls>
|
|
<VideoControls></VideoControls>
|
|
|
<div
|
|
<div
|
|
|
class="join-btn"
|
|
class="join-btn"
|
|
|
- :style="{
|
|
|
|
|
- display: !isMobile() ? 'none' : showControls ? 'block' : 'none',
|
|
|
|
|
|
|
+ :class="{
|
|
|
|
|
+ show: showJoinBtn,
|
|
|
}"
|
|
}"
|
|
|
>
|
|
>
|
|
|
<div
|
|
<div
|
|
|
- class="btn webrtc"
|
|
|
|
|
|
|
+ class="btn"
|
|
|
@click="joinRoom({ roomId: currentLiveRoom.live_room?.id! })"
|
|
@click="joinRoom({ roomId: currentLiveRoom.live_room?.id! })"
|
|
|
>
|
|
>
|
|
|
进入直播
|
|
进入直播
|
|
@@ -147,7 +150,6 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
-import { isMobile } from 'billd-utils';
|
|
|
|
|
import { onMounted, ref, watch } from 'vue';
|
|
import { onMounted, ref, watch } from 'vue';
|
|
|
import { useRouter } from 'vue-router';
|
|
import { useRouter } from 'vue-router';
|
|
|
|
|
|
|
@@ -156,10 +158,12 @@ import { sliderList } from '@/constant';
|
|
|
import { usePull } from '@/hooks/use-pull';
|
|
import { usePull } from '@/hooks/use-pull';
|
|
|
import { ILive } from '@/interface';
|
|
import { ILive } from '@/interface';
|
|
|
import { routerName } from '@/router';
|
|
import { routerName } from '@/router';
|
|
|
|
|
+import { useAppStore } from '@/store/app';
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
|
|
+const appStore = useAppStore();
|
|
|
const canvasRef = ref<Element>();
|
|
const canvasRef = ref<Element>();
|
|
|
-const showControls = ref(false);
|
|
|
|
|
|
|
+const showJoinBtn = ref(false);
|
|
|
const topNums = ref(6);
|
|
const topNums = ref(6);
|
|
|
const topLiveRoomList = ref<ILive[]>([]);
|
|
const topLiveRoomList = ref<ILive[]>([]);
|
|
|
const otherLiveRoomList = ref<ILive[]>([]);
|
|
const otherLiveRoomList = ref<ILive[]>([]);
|
|
@@ -167,7 +171,7 @@ const currentLiveRoom = ref<ILive>();
|
|
|
const interactionList = ref(sliderList);
|
|
const interactionList = ref(sliderList);
|
|
|
const remoteVideoRef = ref<HTMLDivElement>();
|
|
const remoteVideoRef = ref<HTMLDivElement>();
|
|
|
|
|
|
|
|
-const { handlePlay, videoLoading, remoteVideo, handleStopDrawing } = usePull();
|
|
|
|
|
|
|
+const { videoLoading, remoteVideo, handleStopDrawing, roomLiving } = usePull();
|
|
|
|
|
|
|
|
watch(
|
|
watch(
|
|
|
() => remoteVideo.value,
|
|
() => remoteVideo.value,
|
|
@@ -178,7 +182,6 @@ watch(
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
deep: true,
|
|
deep: true,
|
|
|
- immediate: true,
|
|
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
|
|
|
|
@@ -189,7 +192,8 @@ function changeLiveRoom(item: ILive) {
|
|
|
canvasRef.value?.childNodes?.forEach((item) => {
|
|
canvasRef.value?.childNodes?.forEach((item) => {
|
|
|
item.remove();
|
|
item.remove();
|
|
|
});
|
|
});
|
|
|
- handlePlay(item.live_room!);
|
|
|
|
|
|
|
+ appStore.setLiveRoomInfo(item.live_room!);
|
|
|
|
|
+ roomLiving.value = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function getLiveRoomList() {
|
|
async function getLiveRoomList() {
|
|
@@ -203,7 +207,8 @@ async function getLiveRoomList() {
|
|
|
otherLiveRoomList.value = res.data.rows.slice(topNums.value);
|
|
otherLiveRoomList.value = res.data.rows.slice(topNums.value);
|
|
|
if (res.data.total) {
|
|
if (res.data.total) {
|
|
|
currentLiveRoom.value = topLiveRoomList.value[0];
|
|
currentLiveRoom.value = topLiveRoomList.value[0];
|
|
|
- handlePlay(currentLiveRoom.value.live_room!);
|
|
|
|
|
|
|
+ appStore.setLiveRoomInfo(currentLiveRoom.value.live_room!);
|
|
|
|
|
+ roomLiving.value = true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -312,9 +317,6 @@ function joinRoom(data: { roomId: number }) {
|
|
|
|
|
|
|
|
user-select: none;
|
|
user-select: none;
|
|
|
}
|
|
}
|
|
|
- .controls {
|
|
|
|
|
- display: none;
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
&:hover {
|
|
|
.join-btn {
|
|
.join-btn {
|
|
@@ -333,6 +335,9 @@ function joinRoom(data: { roomId: number }) {
|
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
|
width: 80%;
|
|
width: 80%;
|
|
|
transform: translate(-50%, -50%);
|
|
transform: translate(-50%, -50%);
|
|
|
|
|
+ &.show {
|
|
|
|
|
+ display: inline-flex !important;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
.btn {
|
|
.btn {
|
|
|
padding: 14px 26px;
|
|
padding: 14px 26px;
|
|
@@ -346,12 +351,6 @@ function joinRoom(data: { roomId: number }) {
|
|
|
background-color: $theme-color-gold;
|
|
background-color: $theme-color-gold;
|
|
|
color: white;
|
|
color: white;
|
|
|
}
|
|
}
|
|
|
- &.webrtc {
|
|
|
|
|
- margin-right: 10px;
|
|
|
|
|
- }
|
|
|
|
|
- &.flv {
|
|
|
|
|
- margin-right: 10px;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|