gemercheung il y a 2 ans
Parent
commit
eadf9bf478

+ 1 - 1
.env.eur

@@ -7,7 +7,7 @@ VITE_APP_SDK_DIR=https://testeurs3.4dkankan.com/v4/www/sdk
 # socket地址
 VITE_APP_SOCKET_URL=wss://ws.4dkankan.com
 # VITE_APP_SOCKET_URL=wss://testeurws.4dkankan.com
-# VITE_APP_SOCKET_URL=ws://127.0.01:6666
+# VITE_APP_SOCKET_URL=wss://221.4.210.172:16666
 # 静态资源目录
 VITE_APP_STATIC_DIR=viewer
 

+ 5 - 0
src/components/chatRoom/dialog/createdName.vue

@@ -50,6 +50,7 @@
   // Cropper
   const emit = defineEmits(['closeDialog', 'confirmDialog']);
   const { t } = useI18n();
+  const regex = new RegExp('^([\u4E00-\uFA29]|[\uE7C7-\uE7F3]|[a-zA-Z0-9_]){1,15}$');
 
   const userName = ref('');
   // const rtcStore = useRtcStore();
@@ -76,6 +77,10 @@
     if (unref(userName).length === 0) {
       Dialog.toast({ content: t('base.nickNameRequired'), type: 'error' });
     } else {
+      if (unref(userName)?.length && !regex.test(unref(userName))) {
+        Dialog.toast({ content: t('base.nickNameRegrexError'), type: 'error' });
+        return;
+      }
       Dialog.toast({ content: t('base.saveSuccess'), type: 'success' });
       ifShow.value = false;
       emit('confirmDialog', unref(userName));

+ 27 - 14
src/hooks/useTRTC.ts

@@ -116,19 +116,32 @@ async function handleJoin() {
     if (error.getCode() === 0x4043) {
       // 自动播放受限导致播放失败,此时引导用户点击页面。
       // 在点击事件的回调函数中,执行 stream.resume();
-      Dialog.confirm({
-        showCloseIcon: false,
-        okText: '确定',
-        content:
-          "<span style='font-size: 16px; line-height: 1.5;'>在用户与网页产生交互(例如点击、触摸页面等)之前,网页将被禁止播放带有声音的媒体。点击恢复播放<span/>",
-        title: '隐私条款:',
-        single: true,
-        func: (state) => {
-          if (state == 'ok') {
-            localStream.resume();
-          }
+      const rtcStore = useRtcStore();
+      const { t } = useI18n();
+      rtcStore.showBaseDialog(
+        {
+          title: t('base.tips'),
+          desc: t('base.audioPermission'),
+          okTxt: t('base.confirm'),
+          closeTxt: t('base.cancel'),
         },
-      });
+        () => {
+          localStream.resume();
+        },
+      );
+      // Dialog.confirm({
+      //   showCloseIcon: false,
+      //   okText: '确定',
+      //   content:
+      //     "<span style='font-size: 16px; line-height: 1.5;'>在用户与网页产生交互(例如点击、触摸页面等)之前,网页将被禁止播放带有声音的媒体。点击恢复播放<span/>",
+      //   title: '隐私条款:',
+      //   single: true,
+      //   func: (state) => {
+      //     if (state == 'ok') {
+      //       localStream.resume();
+      //     }
+      //   },
+      // });
     }
   });
 }
@@ -350,11 +363,11 @@ async function handleStreamSubscribed(event) {
         tag: 'rtc:audio',
       });
     } catch (error) {
-      remoteStream.resume();
+      // remoteStream.resume();
       rtcStore.showBaseDialog(
         {
           title: t('base.tips'),
-          desc: '继续访问该页面需要获取您摄像头及麦克风的权限。',
+          desc: t('base.audioPermission'),
           okTxt: t('base.confirm'),
           closeTxt: t('base.cancel'),
         },

+ 2 - 0
src/locales/lang/en/base.ts

@@ -29,4 +29,6 @@ export default {
   nickNameRequired: 'Please input your’s nickname!',
   joinRoom: '加入带看房间',
   hoster: 'hoster',
+  audioPermission: '继续访问该页面需要获取您摄像头及麦克风的权限。',
+  nickNameRegrexError: '昵称应是为中文、英文、数字或者下划线,且长度为1到15',
 };

+ 2 - 0
src/locales/lang/zh/base.ts

@@ -29,4 +29,6 @@ export default {
   nickNameRequired: '请输入入您的昵称',
   joinRoom: '加入带看房间',
   hoster: '主持人',
+  audioPermission: '继续访问该页面需要获取您摄像头及麦克风的权限。',
+  nickNameRegrexError: '昵称应是为中文、英文、数字或者下划线,且长度为1到15',
 };