|
|
@@ -16,6 +16,7 @@
|
|
|
:class="{ empty: currentProfileAvatar.length === 0 }"
|
|
|
class="avatar"
|
|
|
:style="{
|
|
|
+ // 公安用,其他要切换回avatar_default1.png,将图片名字互换后打包
|
|
|
backgroundImage: `url(${decodeURIComponent(decodeURIComponent(currentProfileAvatar))})`,
|
|
|
// backgroundImage: `url(/@/assets/images/avatar_default.jpg)`,
|
|
|
}"
|
|
|
@@ -193,6 +194,7 @@
|
|
|
} from 'vue';
|
|
|
import { getApp, useApp } from '/@/hooks/userApp';
|
|
|
import { initSocketEvent } from './roomControl';
|
|
|
+ import { handleTimeOutError } from './controls/actions';
|
|
|
import { createSocket, useSocket } from '/@/hooks/userSocket';
|
|
|
import { useRtcSdk } from '/@/hooks/useTRTC';
|
|
|
import { useDraw } from '/@/hooks/useDraw';
|
|
|
@@ -204,7 +206,7 @@
|
|
|
import memberList from './memberList.vue';
|
|
|
import SceneList from './sceneList.vue';
|
|
|
import Camera from './camera.vue';
|
|
|
- import { useRoom, SceneItemType, webLogin } from '/@/hooks/useRoom';
|
|
|
+ import { useRoom, SceneItemType, webLogin, checkNumAuth } from '/@/hooks/useRoom';
|
|
|
import consola from 'consola';
|
|
|
import CloseDialog from './dialog/close.vue';
|
|
|
import PasswordDialog from './dialog/password.vue';
|
|
|
@@ -219,7 +221,6 @@
|
|
|
import { useMiniApp } from '/@/hooks/useMiniApp';
|
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
import { useMagicKeys } from '@vueuse/core';
|
|
|
-
|
|
|
const { closeSocket } = useSocket();
|
|
|
dayjs.extend(duration);
|
|
|
// hook
|
|
|
@@ -257,6 +258,7 @@
|
|
|
|
|
|
const remoteStreams = computed(() => rtcStore.remoteStreams);
|
|
|
const currentSession = computed(() => rtcStore.currentSession);
|
|
|
+ console.log('appStore:', appStore);
|
|
|
const isPanoramaMode = computed(() => appStore.mode === 'panorama');
|
|
|
|
|
|
const shareLink = ref<string>('');
|
|
|
@@ -291,6 +293,7 @@
|
|
|
|
|
|
let roomCounter = ref(-1);
|
|
|
let roomCount: NodeJS.Timeout;
|
|
|
+ let authCheckInterval: NodeJS.Timeout | null = null;
|
|
|
const { t } = useI18n();
|
|
|
const { sceneList } = useRoom();
|
|
|
|
|
|
@@ -312,10 +315,11 @@
|
|
|
console.log('ttl', unref(val));
|
|
|
if (!roomCount && unref(val) > 0) {
|
|
|
roomCounter.value = unref(val);
|
|
|
- roomCount = setInterval(() => {
|
|
|
+ roomCount = setInterval(async () => {
|
|
|
roomCounter.value = roomCounter.value - 1;
|
|
|
- if (unref(roomCounter) < 0) {
|
|
|
+ if (unref(roomCounter) <= 0) {
|
|
|
clearInterval(roomCount);
|
|
|
+ handleTimeOutError();
|
|
|
}
|
|
|
}, 1000);
|
|
|
}
|
|
|
@@ -357,7 +361,6 @@
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
const socket = createSocket();
|
|
|
initSocketEvent(socket);
|
|
|
const { initRtcSDK } = useRtcSdk();
|
|
|
@@ -410,8 +413,7 @@
|
|
|
console.log('replaceUrl', replaceUrl);
|
|
|
history.replaceState(null, '', replaceUrl);
|
|
|
startJoin();
|
|
|
- window.parent &&
|
|
|
- window.parent.postMessage(
|
|
|
+ window.parent && window.parent.postMessage(
|
|
|
{
|
|
|
type: 'fillName',
|
|
|
data: {
|
|
|
@@ -421,6 +423,7 @@
|
|
|
},
|
|
|
'*',
|
|
|
);
|
|
|
+ location.reload();
|
|
|
};
|
|
|
|
|
|
const sceneInit = (app, val) => {
|
|
|
@@ -440,6 +443,51 @@
|
|
|
|
|
|
const { enter } = useMagicKeys();
|
|
|
onMounted(async () => {
|
|
|
+ if (browser.getURLParam('name')) {
|
|
|
+ const num = browser.getURLParam('m');
|
|
|
+ authCheckInterval = setInterval(async () => {
|
|
|
+ try {
|
|
|
+ let { viewAuth } = await checkNumAuth(num);
|
|
|
+ if (!viewAuth) {
|
|
|
+ // 没有权限关闭房间
|
|
|
+ const { socket, closeSocket, closeRoomForWechat } = useSocket();
|
|
|
+ socket.emit('exit', {
|
|
|
+ roomId: rtcStore.roomId,
|
|
|
+ userId: rtcStore.userId,
|
|
|
+ });
|
|
|
+ if (isUsingMiniApp.value) {
|
|
|
+ //@ts-ignore
|
|
|
+ closeRoomForWechat();
|
|
|
+ } else {
|
|
|
+ closeSocket();
|
|
|
+ }
|
|
|
+ if (authCheckInterval) clearInterval(authCheckInterval);
|
|
|
+ rtcStore.showBaseDialog(
|
|
|
+ {
|
|
|
+ title: t('base.tips'),
|
|
|
+ desc: '您没有访问权限',
|
|
|
+ okTxt: t('base.confirm'),
|
|
|
+ closeTxt: t('base.cancel'),
|
|
|
+ isSingle: true,
|
|
|
+ },
|
|
|
+ () => {
|
|
|
+ const redirect = decodeURIComponent(
|
|
|
+ decodeURIComponent(browser.getURLParam('redirect')),
|
|
|
+ );
|
|
|
+ const redirectUrl = new URL(redirect || location.href);
|
|
|
+ location.replace(redirectUrl.toString());
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error(e);
|
|
|
+ }
|
|
|
+ }, 1000);
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ if (authCheckInterval) clearInterval(authCheckInterval);
|
|
|
+ }, 60 * 60 * 1000);
|
|
|
+ }
|
|
|
watch(
|
|
|
() => isLoaded,
|
|
|
(val) => {
|
|
|
@@ -481,6 +529,7 @@
|
|
|
// });
|
|
|
});
|
|
|
onUnmounted(async () => {
|
|
|
+ if (authCheckInterval) clearInterval(authCheckInterval);
|
|
|
const { handleLeave } = useRtcSdk();
|
|
|
const app = await useApp();
|
|
|
app.Connect.follow.off('data', leaderSync);
|
|
|
@@ -636,6 +685,7 @@
|
|
|
search.set('name', '');
|
|
|
search.set('roomId', `${rtcStore.roomId}`);
|
|
|
search.set('m', browser.getURLParam('m'));
|
|
|
+ // search.set('token', browser.getURLParam('token'));
|
|
|
const isFd = browser.getURLParam('platform') === 'fd';
|
|
|
if (browser.getURLParam('platform') && browser.getURLParam('platform').length > 0) {
|
|
|
search.set('platform', browser.getURLParam('platform'));
|
|
|
@@ -651,12 +701,13 @@
|
|
|
'redirect',
|
|
|
decodeURIComponent(decodeURIComponent(browser.getURLParam('redirect'))),
|
|
|
);
|
|
|
+ search.delete('token');
|
|
|
}
|
|
|
url.search = `?` + search.toString();
|
|
|
if (isFd) {
|
|
|
// debugger
|
|
|
const redirect = decodeURIComponent(decodeURIComponent(browser.getURLParam('redirect')));
|
|
|
- const redirectUrl = new URL(redirect);
|
|
|
+ const redirectUrl = new URL(redirect || location.href);
|
|
|
// const fullPath =redirectUrl.host + '/swkk/'+ search.toString();
|
|
|
url.hostname = redirectUrl.hostname;
|
|
|
url.port = Number(location.port) > 443 ? location.port : '80';
|