Skip to content

Commit 6563ea4

Browse files
committed
feat: video chat init
1 parent 4033175 commit 6563ea4

File tree

24 files changed

+447
-57
lines changed

24 files changed

+447
-57
lines changed
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

client/packages/rtc-web/src/components/lib.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { SetupContext } from 'vue';
22
import { SvgIcon, NavIcons } from './base';
33
import { MenuSide } from './menu';
4+
import { resetUrl } from '@/utils';
45

56
export const NavHeader = () => {
67
return (
@@ -18,11 +19,15 @@ export const NavHeader = () => {
1819
/>
1920
</label>
2021
</div>
21-
<div class="mx-2 flex-1 px-2">Web-Rtc</div>
22+
<div class="mx-2 flex-1 px-2">
23+
<span class="cursor-pointer" onClick={resetUrl}>
24+
Web-Rtc
25+
</span>
26+
</div>
2227
<NavIcons class="flex-none pr-3" />
2328
</div>
2429
</div>
25-
<div class="drawer-side">
30+
<div class="drawer-side z-50">
2631
<label for="my-drawer-3" class="drawer-overlay"></label>
2732
<MenuSide class="bg-base-200"></MenuSide>
2833
</div>

client/packages/rtc-web/src/components/menu-action.vue

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,19 @@ defineOptions({
66
});
77
88
type PropTypes = {
9-
menuAction: { name: string; tip: string; color?: string }[];
9+
menuAction: {
10+
name: string;
11+
tip: string;
12+
color?: string;
13+
tipDir?: string;
14+
btn?: boolean;
15+
}[];
16+
gap?: number;
1017
};
1118
1219
const props = withDefaults(defineProps<PropTypes>(), {
1320
menuAction: () => [] as PropTypes['menuAction'],
21+
gap: 0,
1422
});
1523
1624
const emits = defineEmits(['clickIcon']);
@@ -21,10 +29,18 @@ const handleClick = (name: string) => emits('clickIcon', name);
2129
<template>
2230
<div class="flex">
2331
<div
24-
v-for="item in props.menuAction"
32+
v-for="(item, index) in props.menuAction"
2533
:key="item.name"
2634
:data-tip="item.tip"
27-
class="tooltip tooltip-bottom"
35+
class="tooltip"
36+
:class="[item.tipDir ?? 'tooltip-bottom', props.gap ? 'first:ml-0' : '']"
37+
:style="
38+
props.gap && index === 0
39+
? `margin-left: 0`
40+
: props.gap
41+
? `margin-left: ${props.gap}px`
42+
: ''
43+
"
2844
>
2945
<emoji-picker v-if="item.name === 'emoji'" v-bind="$attrs">
3046
<svg-icon
@@ -34,6 +50,14 @@ const handleClick = (name: string) => emits('clickIcon', name);
3450
@click="handleClick(item.name)"
3551
/>
3652
</emoji-picker>
53+
<button v-else-if="item.btn" class="btn-circle btn">
54+
<svg-icon
55+
:color="item.color"
56+
:name="item.name"
57+
class="h-6 w-6 cursor-pointer"
58+
@click="handleClick(item.name)"
59+
/>
60+
</button>
3761
<svg-icon
3862
v-else
3963
:color="item.color"

client/packages/rtc-web/src/components/menu/menu-list.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ const menuListData = ref([
2020
icon: 'add-icon',
2121
label: '聊天',
2222
},
23+
{
24+
key: 'video',
25+
icon: 'add-icon',
26+
label: '视频聊天',
27+
},
2328
]);
2429
2530
const currentCreateRoomByKey = ref('');

client/packages/rtc-web/src/components/menu/menu-side.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
<script lang="ts" setup>
22
import MenuList from './menu-list.vue';
3+
import { useSwitchSiderbar } from '@/hooks';
34
45
defineOptions({
56
name: 'MenuSide',
67
});
8+
9+
const { open } = useSwitchSiderbar();
710
</script>
811

912
<template>
10-
<div class="menu h-full w-80 min-w-[320px] p-4">
13+
<div v-show="open" class="menu h-full w-80 min-w-[320px] p-4">
1114
<MenuList />
1215
</div>
1316
</template>
Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
type MenuActionType = { name: string; tip: string; color?: string };
1+
export type MenuActionType = {
2+
name: string;
3+
tip: string;
4+
color?: string;
5+
tipDir?: string;
6+
btn?: boolean;
7+
};
28

39
export const ChatAction: MenuActionType[] = [
410
{ name: 'member', tip: '显示成员', color: undefined },
@@ -7,3 +13,37 @@ export const ChatAction: MenuActionType[] = [
713
export const ChatInputAction: MenuActionType[] = [
814
{ name: 'emoji', tip: '表情' },
915
];
16+
17+
export const VideoMenuAction: MenuActionType[] = [
18+
{
19+
name: 'member',
20+
tip: '显示成员',
21+
color: undefined,
22+
tipDir: 'tooltip-top',
23+
btn: true,
24+
},
25+
];
26+
27+
export const VideoControlMenuAction: MenuActionType[] = [
28+
{
29+
name: 'camera',
30+
tip: '开启/关闭摄像头',
31+
color: '#707070',
32+
tipDir: 'tooltip-top',
33+
btn: true,
34+
},
35+
{
36+
name: 'mirror-image',
37+
tip: '开启镜像',
38+
color: '#707070',
39+
tipDir: 'tooltip-top',
40+
btn: true,
41+
},
42+
{
43+
name: 'hang-up',
44+
tip: '结束通话',
45+
color: undefined,
46+
tipDir: 'tooltip-top',
47+
btn: true,
48+
},
49+
];

0 commit comments

Comments
 (0)