浏览代码

fix(bugs): 房间管理

tangning 3 年之前
父节点
当前提交
4f4c5de46c
共有 3 个文件被更改,包括 30 次插入7 次删除
  1. 2 2
      src/locales/lang/zh-CN/routes/room.ts
  2. 12 3
      src/views/scenes/room.vue
  3. 16 2
      src/views/scenes/roomDeital.vue

+ 2 - 2
src/locales/lang/zh-CN/routes/room.ts

@@ -53,8 +53,8 @@ export default {
   statusText: {
     1: '正常',
     0: '封存',
-    101: '直播中',
-    102: '开始',
+    101: '已开始',
+    102: '开始',
     103: '已结束',
   },
 };

+ 12 - 3
src/views/scenes/room.vue

@@ -23,6 +23,9 @@
       <template #Time="{ record }">
         <Time :value="record.createTime" mode="datetime" />
       </template>
+      <template #liveEndTime="{ record }">
+        <Time :value="record.liveEndTime" mode="datetime" />
+      </template>
 
       <template #liveTime="{ record }">
         <Time :value="record.effectiveStartTime" mode="datetime" />
@@ -132,9 +135,15 @@
           width: 180,
         },
         {
+          title: '房间结束时间',
+          dataIndex: 'liveEndTime',
+          slots: { customRender: 'liveEndTime' },
+          width: 140,
+        },
+        {
           title: '创建人',
           dataIndex: 'createUserName',
-          width: 140,
+          width: 180,
         },
         {
           title: t('routes.room.roomStatus'),
@@ -294,7 +303,7 @@
           title: '温馨提示',
           content: `关闭房间后,房间内的所有人都会退出房间,是否继续关闭?<br>(关闭后,房间状态将改为已结束)`,
           onOk: async () => {
-            console.log('record', record);
+            handleDismissRoom(record);
           },
         });
       }
@@ -352,7 +361,7 @@
             {
               label: '结束房间',
               color: 'error',
-              onClick: handleDismissRoom.bind(null, record),
+              onClick: handleBindAnchor.bind(null, record),
             },
           ];
         } else if (record.state == '102') {

+ 16 - 2
src/views/scenes/roomDeital.vue

@@ -18,12 +18,13 @@
   </BasicModal>
 </template>
 <script lang="ts">
-  import { defineComponent, nextTick, ref, reactive } from 'vue';
+  import { defineComponent, nextTick, ref, computed, reactive } from 'vue';
   import { BasicModal, useModalInner } from '/@/components/Modal';
   import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
   import { useMessage } from '/@/hooks/web/useMessage';
   // import { checkUserAddAble } from '/@/api/corporation/modal';
   import { useI18n } from '/@/hooks/web/useI18n';
+  import { useUserStore } from '/@/store/modules/user';
   import { staffListApi } from '/@/api/staff/list';
   import { ListApi } from '/@/api/scene/live';
   import { bindUserList, createOrUpdate } from '/@/api/scene/list';
@@ -40,6 +41,10 @@
     setup(props, { emit }) {
       const { createMessage } = useMessage();
       const modalTitle = ref('编辑');
+      const userStore = useUserStore();
+      const userinfo = computed(() => userStore.getUserInfo);
+      console.log('userinfovalue', userinfo.value);
+      const { getCheckRole } = userStore;
       const isPropsData = reactive({
         isUpdate: true,
         isSetData: true,
@@ -209,6 +214,9 @@
       function onDataReceive(data) {
         isPropsData.isUpdate = data.isUpdate || false;
         isPropsData.isSetData = data.isSetData || false;
+        modalTitle.value = data.isSetData ? '查看' : data.isUpdate ? '编辑' : '新增';
+        // const  = ref('编辑');
+
         isPropsData.record = data.record || {};
         if (data.isUpdate) {
           //编辑
@@ -273,7 +281,7 @@
           effectiveEndTime: new Date(launchPeriod[0]).getTime(),
           effectiveStartTime: new Date(launchPeriod[1]).getTime(),
         };
-        if (isPropsData.isUpdate) {
+        if (!isPropsData.isSetData) {
           apiData.id = isPropsData.record.id;
           await createOrUpdate(apiData);
           createMessage.success(t('common.optSuccess'));
@@ -298,6 +306,12 @@
             anchorUserId: '',
           });
         }
+        if (getCheckRole(['staff'])) {
+          disabled = true;
+          setFieldsValue({
+            anchorUserId: userinfo.value.id,
+          });
+        }
         updateSchema({
           field: 'anchorUserId',
           componentProps: {