浏览代码

fix(bugs): 添加场景删除

tangning 3 年之前
父节点
当前提交
069ec7c6cb
共有 4 个文件被更改,包括 30 次插入10 次删除
  1. 12 1
      src/api/scene/list.ts
  2. 1 0
      src/locales/lang/ja/routes/scenes.ts
  3. 1 0
      src/locales/lang/zh-CN/routes/scenes.ts
  4. 16 9
      src/views/scenes/list.vue

+ 12 - 1
src/api/scene/list.ts

@@ -21,6 +21,7 @@ enum Api {
   getDownloadProcess = '/kankan-api/api/user/scene/downloadProcess',
   addDownloadNum = '/kankan-api/api/scene/addDownloadNum',
   checkDownload = '/kankan-api/api/user/scene/checkDownload',
+  detele = '/kankan-api/api/user/scene/delete',
 }
 
 /**
@@ -36,7 +37,17 @@ export const ListApi = (params: PageParams) =>
       ignoreCancelToken: true,
     },
   });
-
+export const DeleteApi = (params: string) =>
+  defHttp.post<Result>({
+    url: Api.detele,
+    params: {
+      sceneNum: params,
+    },
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
 export const downloadSceneDataAPi = (params: SceneDownloadParam) =>
   defHttp.post<SceneDownloadModel>({
     url: Api.downloadSceneData,

+ 1 - 0
src/locales/lang/ja/routes/scenes.ts

@@ -28,6 +28,7 @@ export default {
   liveType: 'ライブルームタイプ',
   liveName: 'ライブルーム名',
   makeLiveCover: 'ライブルームカバーを生成する',
+  delete: '削除',
   sceneUrl: 'シーンリンク',
   roleType: {
     0: '会社の管理者',

+ 1 - 0
src/locales/lang/zh-CN/routes/scenes.ts

@@ -29,6 +29,7 @@ export default {
   liveName: '直播间名称',
   makeLiveCover: '生成直播间封面',
   sceneUrl: '场景链接',
+  delete: '删除',
   roleType: {
     0: '公司管理员',
     1: '公司员工',

+ 16 - 9
src/views/scenes/list.vue

@@ -38,12 +38,12 @@
               label: t('routes.scenes.jointVisit'),
               onClick: handleLivestream.bind(null, record),
             },
-            // {
-            //   // icon: 'dashicons:editor-kitchensink',
-            //   color: 'error',
-            //   label: t('routes.scenes.makeLiveCover'),
-            //   onClick: openSceneEditor.bind(null, record),
-            // },
+            {
+              // icon: 'dashicons:editor-kitchensink',
+              color: 'error',
+              label: t('routes.scenes.delete'),
+              onClick: handleDelete.bind(null, record),
+            },
             // {
             //   // icon: 'dashicons:editor-kitchensink',
             //   color: 'error',
@@ -80,6 +80,7 @@
     downloadSceneDataAPi,
     addDownloadNumApi,
     checkDownloadApi,
+    DeleteApi,
   } from '/@/api/scene/list';
   import { useI18n } from '/@/hooks/web/useI18n';
   import {
@@ -167,7 +168,7 @@
           title: t('common.operation'),
           dataIndex: '',
           slots: { customRender: 'action' },
-          width: isJA.value ? 350 : 220,
+          width: isJA.value ? 410 : 260,
           fixed: 'right',
         },
       ];
@@ -214,7 +215,7 @@
         ],
       };
       // { getForm }
-      const [registerTable] = useTable({
+      const [registerTable, { reload }] = useTable({
         title: t('routes.scenes.sceneList'),
         api: ListApi,
         columns: columns,
@@ -258,7 +259,12 @@
           console.log('error', error);
         }
       }
-
+      async function handleDelete(record: Recordable) {
+        console.log('DeleteApi', record);
+        await DeleteApi(record.num);
+        createMessage.success(t('common.optSuccess'));
+        reload();
+      }
       async function handleDownloadScene(record: Recordable) {
         await addDownloadNumApi({
           sceneNum: record.num,
@@ -287,6 +293,7 @@
         t,
         openSceneEditor,
         handleDownloadScene,
+        handleDelete,
         handleLivestream,
         registerDownloadModal,
       };