|
@@ -184,7 +184,7 @@
|
|
|
{ deep: true, immediate: true },
|
|
|
);
|
|
|
//设置socket 参数
|
|
|
- const startJoin = () => {
|
|
|
+ const startJoin = (callback?: () => void) => {
|
|
|
consola.info({
|
|
|
message: initParams,
|
|
|
tag: 'socket参数',
|
|
@@ -198,9 +198,14 @@
|
|
|
await createRTCSocket();
|
|
|
})();
|
|
|
initialRoom();
|
|
|
+ callback && callback();
|
|
|
};
|
|
|
+ console.log('initParams', rtcStore.userId);
|
|
|
const initParams: SocketParams = {
|
|
|
- userId: browser.getURLParam('vruserId') || `user_${Math.floor(Math.random() * 100000000)}`,
|
|
|
+ userId:
|
|
|
+ browser.getURLParam('vruserId') ||
|
|
|
+ rtcStore.userId ||
|
|
|
+ `user_${Math.floor(Math.random() * 100000000)}`,
|
|
|
roomId: browser.getURLParam('roomId') || `room_${Math.floor(Math.random() * 100000000)}`,
|
|
|
role: (browser.getURLParam('role') as RoleType) || 'leader',
|
|
|
avatar: browser.getURLParam('avatar'),
|
|
@@ -214,11 +219,21 @@
|
|
|
startJoin();
|
|
|
}
|
|
|
|
|
|
- const handleNameConfirm = () => {
|
|
|
+ const handleNameConfirm = (userName: string) => {
|
|
|
const rtcStore = useRtcStore();
|
|
|
+ console.log('userName', unref(userName));
|
|
|
+ rtcStore.setNickName(unref(userName));
|
|
|
+ const search = new URLSearchParams(location.search);
|
|
|
+ search.set('name', decodeURIComponent(unref(userName)));
|
|
|
+ // search.set('vruserId', rtcStore.userId);
|
|
|
initParams.nickname = rtcStore.nickname;
|
|
|
console.log('输入后', initParams);
|
|
|
- startJoin();
|
|
|
+ startJoin(() => {
|
|
|
+ search.set('vruserId', rtcStore.userId);
|
|
|
+ const replaceUrl = location.origin + location.pathname + '?' + search.toString();
|
|
|
+ console.log('replaceUrl', replaceUrl);
|
|
|
+ history.replaceState(null, '', replaceUrl);
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
onMounted(async () => {
|
|
@@ -361,7 +376,7 @@
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- const handleCloseRoom = () => {
|
|
|
+ const handleCloseRoom = async () => {
|
|
|
showCloseDialog.value = false;
|
|
|
const { closeSocket } = useSocket();
|
|
|
closeSocket();
|
|
@@ -370,7 +385,7 @@
|
|
|
const handleCreateShare = () => {
|
|
|
const search = new URLSearchParams();
|
|
|
search.set('isTour', '0');
|
|
|
- search.set('vruserId', `user_${Math.floor(Math.random() * 100000000)}`);
|
|
|
+ // search.set('vruserId', `user_${Math.floor(Math.random() * 100000000)}`);
|
|
|
search.set('role', 'customer');
|
|
|
search.set('name', '');
|
|
|
search.set('roomId', `${rtcStore.roomId}`);
|