gemercheung 2 년 전
부모
커밋
52c5042338
1개의 변경된 파일22개의 추가작업 그리고 12개의 파일을 삭제
  1. 22 12
      src/views/room/edit-room/index.vue

+ 22 - 12
src/views/room/edit-room/index.vue

@@ -146,12 +146,12 @@
             name="scenes"
             style="margin-bottom: 2px"
           >
-          <template #slot="label">
-            {{ t('room.authorize') }}
-            <a-tooltip title="Tooltip with customize">
-             <InfoCircleOutlined />
-           </a-tooltip>
-          </template>
+            <template #slot="label">
+              {{ t('room.authorize') }}
+              <a-tooltip title="Tooltip with customize">
+                <InfoCircleOutlined />
+              </a-tooltip>
+            </template>
             <a-button
               type="primary"
               size="small"
@@ -199,6 +199,7 @@
       v-model:visible="authvisible"
       :title="t('room.addUser')"
       centered
+      @cancel="authformState.userName = ''"
       @ok="handleAuthConfirm"
     >
       <a-form layout="inline" :model="authformState">
@@ -232,7 +233,15 @@
 </template>
 
 <script lang="ts">
-import { ref, UnwrapRef, defineComponent, reactive, computed, unref } from 'vue'
+import {
+  ref,
+  UnwrapRef,
+  toRaw,
+  defineComponent,
+  reactive,
+  computed,
+  unref
+} from 'vue'
 import { createRoom, useRoomStore } from '@/store/modules/room'
 import { props } from './props'
 import { message } from 'ant-design-vue'
@@ -275,7 +284,7 @@ export default defineComponent({
     const roomStore = useRoomStore()
     const isRoomEnd = computed(() => roomStore.roomStatus === 2)
     const { getLocale } = useLocale()
-    const { t } = useI18n();
+    const { t } = useI18n()
     const returnLocale = computed(() => {
       if (unref(getLocale).includes('zh')) {
         return 'zh'
@@ -342,7 +351,7 @@ export default defineComponent({
     }
 
     const handleAuthConfirm = async () => {
-      const { t } = useI18n();
+      const { t } = useI18n()
       if (authformState.userName?.length) {
         const userName = authformState.userName
         const res = await addAuthUser(userName)
@@ -352,14 +361,15 @@ export default defineComponent({
           )
           console.log('isExist', isExist === -1)
           if (isExist === -1) {
-            current.userObjList?.push(authformState)
+            const dup = structuredClone(toRaw(authformState));
+            console.log('dup',dup);
+            current.userObjList?.push(dup)
           }
 
           authvisible.value = false
           console.log('current', current)
         } else {
-     
-          message.error(t('room.authUserError'));
+          message.error(t('room.authUserError'))
         }
       } else {
         message.error('用户账号不能为空!')