wangfumin 2 miesięcy temu
rodzic
commit
cc9acf9ed2
40 zmienionych plików z 413 dodań i 81 usunięć
  1. 1 1
      .env
  2. 8 5
      .env.development
  3. 1 1
      .env.eur
  4. 1 1
      .env.eur.prod
  5. 1 1
      .env.fr
  6. 1 1
      .env.home.prod
  7. 1 1
      .env.home.test
  8. 34 0
      .env.jm.prod
  9. 1 1
      .env.production
  10. 1 0
      package.json
  11. BIN
      public/viewer/static/sdk/4.10.7/images/floorlogos/0.png
  12. BIN
      public/viewer/static/sdk/4.10.7/images/floorlogos/1.png
  13. BIN
      public/viewer/static/sdk/4.10.7/images/floorlogos/2.png
  14. BIN
      public/viewer/static/sdk/4.10.7/images/floorlogos/compass_arrow.png
  15. BIN
      public/viewer/static/sdk/4.10.7/images/floorlogos/compass_floor.png
  16. BIN
      public/viewer/static/sdk/4.10.7/images/floorlogos/en/0.png
  17. BIN
      public/viewer/static/sdk/4.10.7/images/floorlogos/en/1.png
  18. 19 19
      public/viewer/static/sdk/4.10.7/kankan-sdk-deps.js
  19. 5 5
      public/viewer/static/sdk/4.10.7/kankan-sdk.js
  20. 43 3
      src/App.vue
  21. BIN
      src/assets/images/avatar_default.png
  22. BIN
      src/assets/images/avatar_default1.png
  23. 1 0
      src/components/chatRoom/chatroom.scss
  24. 15 11
      src/components/chatRoom/controls/actions.ts
  25. 24 6
      src/components/chatRoom/dialog/login.vue
  26. 59 8
      src/components/chatRoom/index.vue
  27. 2 1
      src/components/chatRoom/memberList.vue
  28. 13 1
      src/components/chatRoom/roomControl.ts
  29. 1 0
      src/components/custom/panel.vue
  30. 40 6
      src/hooks/useRoom.ts
  31. 3 2
      src/hooks/userApp.ts
  32. 12 3
      src/hooks/userSocket.ts
  33. 1 1
      src/main.ts
  34. 1 1
      src/store/modules/app.ts
  35. 8 0
      src/utils/base64.js
  36. 99 0
      src/utils/encodeUtil.ts
  37. 7 1
      src/utils/request.ts
  38. 1 1
      tsconfig.json
  39. 5 0
      types/global.d.ts
  40. 4 0
      vite.config.ts

+ 1 - 1
.env

@@ -12,7 +12,7 @@ VITE_APP_STATIC_DIR=viewer
 
 # 云存储环境
 VITE_APP_REGION_URL=
-# 接口请求地址
+# 接口请求地址 国内测试
 VITE_APP_APIS_URL=https://v4-test.4dkankan.com/
 # VITE_APP_APIS_URL=https://v4-uat.4dkankan.com/
 # VITE_TAKE_LOOK_API=https://testeur.4dkankan.com/

+ 8 - 5
.env.development

@@ -1,12 +1,15 @@
 # 场景资源地址
-VITE_APP_RESOURCE_URL=http://192.168.0.25/oss/
+# VITE_APP_RESOURCE_URL=https://survey.4dkankan.com/oss/
+VITE_APP_RESOURCE_URL=http://192.168.0.125:1804/oss/
 # 静态资源地址
-VITE_APP_CDN_URL=http://192.168.0.25/v4/www/
+VITE_APP_CDN_URL=https://survey.4dkankan.com/v4/www/
+# VITE_APP_CDN_URL=http://192.168.0.125:1804/v4/www/
 # sdk文件地址
-# VITE_APP_SDK_DIR=https://192.168.0.25/v4/www/sdk
+VITE_APP_SDK_DIR=https://192.168.0.25/v4/www/sdk
 # VITE_APP_SDK_DIR=https://192.168.0.25/v4/sdk/4.10.7
 # VITE_APP_SOCKET_URL=wss://ws.gemer.xyz
-VITE_APP_SOCKET_URL=ws://192.168.0.25
+# 线上要切换,125是江门本地
+VITE_APP_SOCKET_URL=ws://192.168.0.125:1804/
 # VITE_APP_SOCKET_URL=wss://221.4.210.172:16666
 # 静态资源目录
 VITE_APP_STATIC_DIR=viewer
@@ -15,7 +18,7 @@ VITE_APP_STATIC_DIR=viewer
 VITE_APP_REGION_URL=
 
 # 接口请求地址
-VITE_APP_APIS_URL=http://192.168.0.25
+VITE_APP_APIS_URL=http://192.168.0.125:1804
 # VITE_APP_APIS_URL=https://v4-uat.4dkankan.com/
 # VITE_TAKE_LOOK_API=https://testeur.4dkankan.com/
 VITE_USE_HTTPS=0

+ 1 - 1
.env.eur

@@ -15,7 +15,7 @@ VITE_APP_STATIC_DIR=viewer
 # 云存储环境
 VITE_APP_REGION_URL=aws
 
-# 接口请求地址
+# 接口请求地址 国际测试
 VITE_APP_APIS_URL=https://testeur.4dkankan.com/
 # VITE_APP_APIS_URL=https://v4-uat.4dkankan.com/
 # VITE_TAKE_LOOK_API=https://testeur.4dkankan.com/

+ 1 - 1
.env.eur.prod

@@ -15,7 +15,7 @@ VITE_APP_STATIC_DIR=viewer
 # 云存储环境
 VITE_APP_REGION_URL=aws
 
-# 接口请求地址
+# 接口请求地址 国际正式
 VITE_APP_APIS_URL=https://eur.4dkankan.com/
 # VITE_APP_APIS_URL=https://v4-uat.4dkankan.com/
 # VITE_TAKE_LOOK_API=https://testeur.4dkankan.com/

+ 1 - 1
.env.fr

@@ -14,7 +14,7 @@ VITE_APP_STATIC_DIR=viewer
 # 云存储环境
 VITE_APP_REGION_URL=aws
 
-# 接口请求地址
+# 接口请求地址 法国正式
 VITE_APP_APIS_URL=https://360.vizite.fr/
 # VITE_APP_APIS_URL=https://v4-uat.4dkankan.com/
 # VITE_TAKE_LOOK_API=https://testeur.4dkankan.com/

+ 1 - 1
.env.home.prod

@@ -1,4 +1,4 @@
-# 场景资源地址
+# 场景资源地址 江门正式
 VITE_APP_RESOURCE_URL=http://sanwei.jms.gd/oss/
 # 静态资源地址
 VITE_APP_CDN_URL=http://sanwei.jms.gd/v4/www/

+ 1 - 1
.env.home.test

@@ -14,7 +14,7 @@ VITE_APP_STATIC_DIR=viewer
 # 云存储环境
 VITE_APP_REGION_URL=
 
-# 接口请求地址
+# 接口请求地址 国内官网测试
 VITE_APP_APIS_URL=https://v4-test.4dkankan.com/
 # VITE_APP_APIS_URL=https://v4-uat.4dkankan.com/
 # VITE_TAKE_LOOK_API=https://testeur.4dkankan.com/

+ 34 - 0
.env.jm.prod

@@ -0,0 +1,34 @@
+# 场景资源地址
+# VITE_APP_RESOURCE_URL=https://survey.4dkankan.com/oss/
+VITE_APP_RESOURCE_URL=/oss/
+# 静态资源地址
+VITE_APP_CDN_URL=https://survey.4dkankan.com/v4/www/
+# VITE_APP_CDN_URL=http://192.168.0.125:1804/v4/www/
+# sdk文件地址
+VITE_APP_SDK_DIR=/v4/www/sdk
+# VITE_APP_SDK_DIR=https://192.168.0.25/v4/sdk/4.10.7
+# VITE_APP_SOCKET_URL=wss://ws.gemer.xyz
+# 线上要切换,125是江门本地
+# VITE_APP_SOCKET_URL=ws://192.168.0.125:1804/
+VITE_APP_SOCKET_URL=wss://survey.4dkankan.com
+# 静态资源目录
+VITE_APP_STATIC_DIR=viewer
+
+# 云存储环境
+VITE_APP_REGION_URL=
+
+# 接口请求地址
+VITE_APP_APIS_URL=
+# VITE_APP_APIS_URL=https://v4-uat.4dkankan.com/
+# VITE_TAKE_LOOK_API=https://testeur.4dkankan.com/
+VITE_USE_HTTPS=0
+VITE_PUBLIC_DIR='/livestream/'
+VITE_ROOM_MEMBER_DEBUG=0
+VITE_ROOM_MEMBER=10
+VITE_SHOW_CONSOLE=0
+VITE_SHOW_DEBUGPANEL=1
+VITE_TEST_VERSION =20231031
+VITE_ENABLE_VIDEO=1
+VITE_ENABLE_RTC=0
+VITE_IS_INTERNATIONAL=0
+VITE_H5_SHAREPATH="livestream/fd/criminal.html"

+ 1 - 1
.env.production

@@ -12,7 +12,7 @@ VITE_APP_STATIC_DIR=viewer
 # 云存储环境
 VITE_APP_REGION_URL=aws
 
-# 接口请求地址
+# 接口请求地址 国际测试
 VITE_APP_APIS_URL=https://testeur.4dkankan.com/
 # VITE_APP_APIS_URL=https://v4-uat.4dkankan.com/
 # VITE_TAKE_LOOK_API=https://testeur.4dkankan.com/

+ 1 - 0
package.json

@@ -11,6 +11,7 @@
     "build-home-test": "vue-tsc  --noEmit && vite build --mode home.test",
     "build-home-prod": "vue-tsc  --noEmit && vite build --mode home.prod",
     "build-eur-fr": "vue-tsc  --noEmit && vite build --mode fr",
+    "build-jm": "vue-tsc  --noEmit && vite build --mode jm.prod",
     "build": "vue-tsc  --noEmit && vite build --mode production",
     "commit": "git add . && git cz",
     "preview": "vite preview",

BIN
public/viewer/static/sdk/4.10.7/images/floorlogos/0.png


BIN
public/viewer/static/sdk/4.10.7/images/floorlogos/1.png


BIN
public/viewer/static/sdk/4.10.7/images/floorlogos/2.png


BIN
public/viewer/static/sdk/4.10.7/images/floorlogos/compass_arrow.png


BIN
public/viewer/static/sdk/4.10.7/images/floorlogos/compass_floor.png


BIN
public/viewer/static/sdk/4.10.7/images/floorlogos/en/0.png


BIN
public/viewer/static/sdk/4.10.7/images/floorlogos/en/1.png


Plik diff jest za duży
+ 19 - 19
public/viewer/static/sdk/4.10.7/kankan-sdk-deps.js


Plik diff jest za duży
+ 5 - 5
public/viewer/static/sdk/4.10.7/kankan-sdk.js


+ 43 - 3
src/App.vue

@@ -48,6 +48,7 @@
   } else {
     changeLocale('zh');
   }
+  const { authLogin } = useRoom();
   const showLogin = ref(false);
   const sceneStore = useSceneStore();
   const appStore = useAppStore();
@@ -78,7 +79,21 @@
   });
   const show = ref(false);
   const isTourMode = computed(() => appStore.isTourMode);
-
+  // 自当前页面获取url参数
+  const getUrlParams = () => {
+    let params = window.location.search.substring(1).split('&');
+    const paramsObj = {} as any;
+    params.forEach((item) => {
+      const key = item.split('=')[0];
+      const match = item.match(/=(.*)/);
+      if (match && match[1] !== undefined) {
+        paramsObj[key] = match[1];
+      }
+    });
+    return paramsObj;
+  };
+  let u = getUrlParams().u || '';
+  let p = getUrlParams().p || '';
   watchEffect(() => {
     console.warn('mode', mode);
   });
@@ -90,9 +105,19 @@
   //   console.log('强制开https');
   // }
   onMounted(async () => {
+    if (!sessionStorage.getItem('userName') && !sessionStorage.getItem('password')) {
+      const tokenName = `${browser.getURLParam('m')}token`;
+      console.log('没有登录信息');
+      localStorage.removeItem('userName');
+      localStorage.removeItem('password');
+      localStorage.removeItem(tokenName);
+      sessionStorage.removeItem(tokenName);
+    }
     const app = await createApp({
       dom: scene$.value as HTMLElement,
       num: browser.getURLParam('m'),
+      u: browser.getURLParam('u'),
+      p: browser.getURLParam('p'),
       mobile: true,
     });
     // SDK初始化
@@ -220,7 +245,7 @@
         appStore.setFloorId(targetPano.floorIndex);
       }
     });
-    app.Scene.on('error', (data) => {
+    app.Scene.on('error', async (data) => {
       console.log('当前错误code', data.code);
       if (data.code) {
         switch (data.code) {
@@ -294,7 +319,22 @@
             break;
 
           case 4010:
-            showLogin.value = true;
+            if (u && p) {
+              // 自动登录
+              localStorage.setItem('userName', u);
+              localStorage.setItem('password', p);
+              const data = await authLogin(window.atob(u), window.atob(p));
+              if (data && Number(data.code) === 0) {
+                showLogin.value = false;
+                app.config.params = `userName=${u}&password=${p}`;
+                app.render()
+                location.reload();
+              } else {
+                showLogin.value = true;
+              }
+            } else {
+              showLogin.value = true;
+            }
             break;
 
           default:

BIN
src/assets/images/avatar_default.png


BIN
src/assets/images/avatar_default1.png


+ 1 - 0
src/components/chatRoom/chatroom.scss

@@ -73,6 +73,7 @@
       border-radius: 50%;
       margin-right: 0.07rem;
       &.empty {
+        // 公安用,其他要切换回avatar_default1.png,将图片名字互换后打包
         background-image: url(/@/assets/images/avatar_default.png) !important;
       }
     }

+ 15 - 11
src/components/chatRoom/controls/actions.ts

@@ -495,6 +495,19 @@ export const handleTimeOutError = () => {
   const rtcStore = useRtcStore();
 
   const { t } = useI18n();
+  let timer: NodeJS.Timeout;
+  const performExit = () => {
+    if (timer) clearTimeout(timer);
+    if (isUsingMiniApp.value) {
+      //@ts-ignore
+      wx.miniProgram.switchTab({
+        url: '/pages/index/index',
+      });
+    } else {
+      const { closeSocket } = useSocket();
+      closeSocket();
+    }
+  };
   rtcStore.showBaseDialog(
     {
       title: t('base.tips'),
@@ -503,18 +516,9 @@ export const handleTimeOutError = () => {
       closeTxt: t('base.cancel'),
       isSingle: true,
     },
-    () => {
-      if (isUsingMiniApp.value) {
-        //@ts-ignore
-        wx.miniProgram.switchTab({
-          url: '/pages/index/index',
-        });
-      } else {
-        const { closeSocket } = useSocket();
-        closeSocket();
-      }
-    },
+    performExit,
   );
+  timer = setTimeout(performExit, 3000);
 };
 export const handleEarlyError = () => {
   const rtcStore = useRtcStore();

+ 24 - 6
src/components/chatRoom/dialog/login.vue

@@ -4,7 +4,7 @@
       <div class="blurBox"></div>
 
       <div class="content">
-        <div class="dialog_title">用户登</div>
+        <div class="dialog_title">用户登</div>
         <div class="pass_container">
           <input v-model.trim="userName" class="pass-input" type="text" placeholder="请输入账号" />
         </div>
@@ -60,10 +60,13 @@
   import { ref, watchEffect } from 'vue';
   import { useI18n } from '/@/hooks/useI18n';
   import { useRoom } from '/@/hooks/useRoom';
+  import { useUrlSearchParams } from "@vueuse/core";
+  import { encodeStr } from '../../../utils/encodeUtil.js';
 
   // const emit = defineEmits(['closeDialog', 'confirmDialog']);
   const { t } = useI18n();
-
+  const params = useUrlSearchParams("history");
+  console.log('params', params);
   const userName = ref('');
   const password = ref('');
   const isShowPass = ref(false);
@@ -86,17 +89,32 @@
   });
 
   const createdConfirm = async () => {
-    const { authLogin } = useRoom();
+    const { authLogin, getJmToken } = useRoom();
     const useName = userName.value;
     const pw = password.value;
     const data = await authLogin(useName, pw);
-    console.log('code', data.code);
+    console.log(!params.token, params.token == 'undefined', 1111111111)
+    // if(!params.token || params.token == 'undefined') {
+      const res = await getJmToken({username: useName, userName: useName, password: encodeStr(Base64.encode(pw))});
+      if(res.code !== 0) {
+        ErrorText.value = res.message;
+        isShowError.value = true;
+        return;
+      }
+      console.log('res', res);
+      params.token = res.data.token;
+      const tokenName = `${params.m}token`;
+      localStorage.setItem(tokenName, res.data.token);
+      sessionStorage.setItem(tokenName, res.data.token);
+    // }
 
     if (data && Number(data.code) === 0) {
       ErrorText.value = '';
       isShowError.value = false;
-      localStorage.setItem('userName',btoa(useName))
-      localStorage.setItem('password',btoa(pw))
+      sessionStorage.setItem('userName',Base64.encode(useName));
+      sessionStorage.setItem('password',Base64.encode(pw));
+      localStorage.setItem('userName',Base64.encode(useName));
+      localStorage.setItem('password',Base64.encode(pw));
       location.reload();
     } else {
       if (Number(data.code) === 4000) {

+ 59 - 8
src/components/chatRoom/index.vue

@@ -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';

+ 2 - 1
src/components/chatRoom/memberList.vue

@@ -83,7 +83,8 @@
 <script lang="ts" setup>
   import { propTypes } from '/@/utils/propTypes';
   import { UserInfoType, useRtcStore } from '/@/store/modules/rtc';
-  import defaultAvatar from '/@/assets/images/rtcLive/avatar_small@2x.png';
+  // import defaultAvatar from '/@/assets/images/rtcLive/avatar_small@2x.png'; // 公安用,其他要切换回avatar_default.png,将图片名字互换后打包
+  import defaultAvatar from '/@/assets/images/avatar_default.png';
   import { computed, watchEffect } from 'vue';
   import { useSocket } from '/@/hooks/userSocket';
   import { useI18n } from '/@/hooks/useI18n';

+ 13 - 1
src/components/chatRoom/roomControl.ts

@@ -14,6 +14,7 @@ import {
   handleError,
   handleMaxRoomsError,
 } from '../chatRoom/controls/actions';
+import browser from '/@/utils/browser';
 // 所有socket业务事件集中点
 
 export function initSocketEvent(socket: SocketIOClient.Socket): void {
@@ -40,6 +41,7 @@ export function initSocketEvent(socket: SocketIOClient.Socket): void {
       const now = dayjs();
       const roomEnd = dayjs(useEndTime);
       const ttl = roomEnd.diff(now, 'second');
+      console.log('ttl', ttl, rtcStore);
 
       if (useStartTime) {
         const unstartTTl = dayjs(useStartTime).diff(now, 'second');
@@ -105,7 +107,7 @@ export function initSocketEvent(socket: SocketIOClient.Socket): void {
         tag: `action-${data.type || ''}`,
         level: 3,
       };
-      consola.info(actionLog);
+      console.log(actionLog);
       handleActions(data);
     });
     // 自已进入逻辑
@@ -124,6 +126,16 @@ export function initSocketEvent(socket: SocketIOClient.Socket): void {
         case 'repeat-login':
           Dialog.toast({ content: t('action.errorRepeatLogin') });
           handleMaxRoomsError();
+          setTimeout(() => {
+            const isFd = browser.getURLParam('platform') === 'fd';
+            if (isFd) {
+              const redirect = decodeURIComponent(
+                decodeURIComponent(browser.getURLParam('redirect')),
+              );
+              const redirectUrl = new URL(redirect || location.href);
+              location.replace(redirectUrl.toString());
+            }
+          }, 3000);
           break;
         case 'room-maxing':
           // Dialog.toast({ content: t('action.errorRoomMaxing') });

+ 1 - 0
src/components/custom/panel.vue

@@ -49,6 +49,7 @@
     console.log('hasMusic', hasMusic, musicURL);
   });
   onMounted(() => {
+    console.log(4444)
     initialRoom();
   });
 

+ 40 - 6
src/hooks/useRoom.ts

@@ -84,6 +84,7 @@ export function useRoom() {
     currentScene,
     changeScene,
     initialRoom,
+    getRoomId,
     enterRoom,
     leaveRoom,
     createNewURLEntry,
@@ -94,7 +95,8 @@ export function useRoom() {
     currentSceneIndex,
     currentNum,
     firstNum,
-    authLogin
+    authLogin,
+    getJmToken,
   };
 }
 
@@ -138,19 +140,34 @@ const wxToken = browser.getURLParam('wxToken') || '';
 if (wxToken) {
   shopAxios.defaults.headers['wxToken'] = wxToken;
 }
-
+const tokenName = `${browser.getURLParam('m')}token`;
 export const initialRoom = async () => {
   shopAxios.defaults.headers.platform = browser.getURLParam('platform') || '';
+  // 江门需要加上token验证,其他项目需要去掉
+  const token = localStorage.getItem(tokenName) || browser.getURLParam('token') || '';
+  shopAxios.defaults.headers.token = token;
   const res = await shopAxios.get('/takelook/roomInfo', { params: { roomId } });
   room.value = res.data.data;
 };
 
+export const getRoomId = async (m: any) => {
+  shopAxios.defaults.headers.platform = browser.getURLParam('platform') || '';
+  // 江门需要加上token验证,其他项目需要去掉
+  const token = localStorage.getItem(tokenName) || browser.getURLParam('token') || '';
+  shopAxios.defaults.headers.token = token;
+  const res = await shopAxios.post<AxiosResponse>('/fusion/caseLive/getTakeLookRoom', { m });
+  return res;
+};
+
 export const enterRoom = async () => {
   // if (!isLeader) return;
   const rtcStore = useRtcStore();
   const userID = rtcStore.userId || browser.getURLParam('vruserId');
   const role = rtcStore.role || browser.getURLParam('role');
   shopAxios.defaults.headers.platform = browser.getURLParam('platform') || '';
+  // 江门需要加上token验证,其他项目需要去掉
+  const token = localStorage.getItem(tokenName) || browser.getURLParam('token') || '';
+  shopAxios.defaults.headers.token = token;
 
   // overRide测试人数
 
@@ -251,10 +268,27 @@ export const authLogin = async (username: string, password: string) => {
   const res = await shopAxios.get('/service/scene/getInfo', {
     params: {
       num: currentNum,
-      userName: btoa(username),
-      password: btoa(password),
-    }
-  })
+      userName: Base64.encode(username),
+      password: Base64.encode(password),
+    },
+  });
 
   return res.data;
 };
+// Jm获取token
+export const getJmToken = async (data) => {
+  const res = await shopAxios.post('/service/manage/login', data);
+  return res.data;
+};
+
+export const checkNumAuth = async (num: string) => {
+  shopAxios.defaults.headers.platform = browser.getURLParam('platform') || '';
+  const token = localStorage.getItem(tokenName) || browser.getURLParam('token') || '';
+  shopAxios.defaults.headers.token = token;
+  try {
+    const res = await shopAxios.get(`/service/manage/inner/checkNumAuth/${num}`);
+    return res.data?.data;
+  } catch (error) {
+    return false;
+  }
+};

+ 3 - 2
src/hooks/userApp.ts

@@ -17,6 +17,8 @@ interface appOptions {
   num: string;
   lang?: string;
   langs?: any;
+  u?: string;
+  p?: string;
 }
 // onMounted(() => {
 
@@ -49,8 +51,7 @@ export function createApp(options: appOptions): Promise<KanKanInstance> {
   options.lang = lang;
 
   _num = options.num;
-
-  console.log('options', options);
+  console.log('options.num', options.num);
   if (!instance) {
     consola.error('kankan SDK 没有引入!');
   }

+ 12 - 3
src/hooks/userSocket.ts

@@ -15,10 +15,19 @@ interface ReturnUseSocketType {
 
 export function createSocket() {
   const rtcStore = useRtcStore();
-  // console.log('rtcStore', rtcStore)
+  console.log('rtcStore', rtcStore)
   const address = import.meta.env.VITE_APP_SOCKET_URL;
-  console.log('address', address);
-  socket = io(address, {
+  let server = address || location.host
+  if(!address) {
+     if(location.protocol == 'https:') {
+        server = 'wss://'+server
+      } else {
+        server = 'ws://'+server
+      }
+  }
+ 
+  console.log('address', server);
+  socket = io(server, {
     path: '/ws-sync',
     transports: ['websocket'],
   });

+ 1 - 1
src/main.ts

@@ -1,4 +1,5 @@
 import { createApp } from 'vue';
+import '/@/utils/base64.js';
 import 'virtual:windi-base.css';
 import 'virtual:windi-components.css';
 import './style.css';
@@ -21,5 +22,4 @@ async function bootstrap() {
   // app.directive('click-outside', ClickOutSide);
   app.mount('#app');
 }
-
 bootstrap();

+ 1 - 1
src/store/modules/app.ts

@@ -32,7 +32,7 @@ export const useAppStore = defineStore({
   state: (): AppState => ({
     isLoaded: false,
     panoId: null,
-    mode: 'panorama',
+    mode: '',
     flying: false,
     floorId: null,
     player: {

Plik diff jest za duży
+ 8 - 0
src/utils/base64.js


+ 99 - 0
src/utils/encodeUtil.ts

@@ -0,0 +1,99 @@
+/*
+ ** 登录密码加密
+  http://face3d.4dage.com:7005/4dzfb-2.0/shop/src/master/platform-admin/src/main/webapp/login.html
+ */
+function randomWord(randomFlag: any, min: any, max?: any) {
+  let str = '';
+  let range = min;
+  const arr = [
+    '0',
+    '1',
+    '2',
+    '3',
+    '4',
+    '5',
+    '6',
+    '7',
+    '8',
+    '9',
+    'a',
+    'b',
+    'c',
+    'd',
+    'e',
+    'f',
+    'g',
+    'h',
+    'i',
+    'j',
+    'k',
+    'l',
+    'm',
+    'n',
+    'o',
+    'p',
+    'q',
+    'r',
+    's',
+    't',
+    'u',
+    'v',
+    'w',
+    'x',
+    'y',
+    'z',
+    'A',
+    'B',
+    'C',
+    'D',
+    'E',
+    'F',
+    'G',
+    'H',
+    'I',
+    'J',
+    'K',
+    'L',
+    'M',
+    'N',
+    'O',
+    'P',
+    'Q',
+    'R',
+    'S',
+    'T',
+    'U',
+    'V',
+    'W',
+    'X',
+    'Y',
+    'Z',
+  ];
+  // 随机产生
+  if (randomFlag) {
+    range = Math.round(Math.random() * (max - min)) + min;
+  }
+  for (let i = 0; i < range; i++) {
+    const pos = Math.round(Math.random() * (arr.length - 1));
+    str += arr[pos];
+  }
+  return str;
+}
+
+export function encodeStr(str: any, strv = ''): any {
+  const NUM = 2;
+  const front = randomWord(false, 8);
+  const middle = randomWord(false, 8);
+  const end = randomWord(false, 8);
+
+  const str1 = str.substring(0, NUM);
+  const str2 = str.substring(NUM);
+
+  if (strv) {
+    const strv1 = strv.substring(0, NUM);
+    const strv2 = strv.substring(NUM);
+    return [front + str2 + middle + str1 + end, front + strv2 + middle + strv1 + end];
+  }
+
+  return front + str2 + middle + str1 + end;
+}

+ 7 - 1
src/utils/request.ts

@@ -7,6 +7,7 @@
  */
 // @ts-nocheck
 import axios from 'axios';
+import browser from './browser';
 
 // TextDecoder polyfills for lower browser
 if (undefined === window.TextEncoder) {
@@ -30,7 +31,12 @@ const fetch = axios.create();
 
 fetch.interceptors.request.use(
   (config) => {
-    config.headers['token'] = 123;
+    const token = browser.getURLParam('token');
+    if (token) {
+      config.headers['token'] = token;
+    } else {
+      config.headers['token'] = 123;
+    }
 
     return config;
   },

+ 1 - 1
tsconfig.json

@@ -32,6 +32,6 @@
     "src/**/*.tsx",
     "src/**/*.vue",
     "types/**/*.d.ts"
-  ],
+, "src/utils/base64.js"  ],
   "references": [{ "path": "./tsconfig.node.json" }]
 }

+ 5 - 0
types/global.d.ts

@@ -77,6 +77,11 @@ declare global {
 
   declare function parseFloat(string: string | number): number;
 
+  declare const Base64: {
+    encode: (str: string) => string;
+    decode: (str: string) => string;
+  };
+
   namespace JSX {
     // tslint:disable no-empty-interface
     type Element = VNode;

+ 4 - 0
vite.config.ts

@@ -66,6 +66,10 @@ export default ({ mode }) =>
           target: loadEnv(mode, process.cwd()).VITE_APP_APIS_URL,
           changeOrigin: true,
         },
+        '/fusion': {
+          target: loadEnv(mode, process.cwd()).VITE_APP_APIS_URL,
+          changeOrigin: true,
+        },
       },
     },
     build: {