Procházet zdrojové kódy

fix(Live): 增加删除

gemercheung před 4 roky
rodič
revize
33b2fb1b6c

+ 23 - 0
src/api/scene/live.ts

@@ -16,6 +16,7 @@ enum Api {
   // bindUser = '/zfb-api/zfb/shop/sys/brand/bindUser',
   bindUser = '/basic-api/brand/bindUser',
   brandUpdate = '/basic-api/brand/update',
+  brandDelete = '/basic-api/brand/delete',
   upload = '/basic-api/sys/oss/upload',
   getAllScene = '/zfb-api/zfb/scene/list',
 }
@@ -97,3 +98,25 @@ export const getAllSceneApi = (params: PageParams) => {
     },
   });
 };
+
+export const brandUpdateApi = (params: SceneLiveItem) => {
+  defHttp.post<GetAllSceneModel>({
+    url: Api.brandUpdate,
+    params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
+};
+
+export const LiveSceneDeleteApi = (params: string[]) => {
+  defHttp.post<GetAllSceneModel>({
+    url: Api.brandDelete,
+    params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
+};

+ 1 - 0
src/api/scene/model.ts

@@ -71,6 +71,7 @@ export interface sceneItem {
   updateTime: number;
   updateUserId: number;
 }
+
 /**
  * @description: Request list return value
  */

+ 12 - 35
src/views/scenes/live.vue

@@ -1,34 +1,3 @@
-<!-- address: "浙江省,杭州市,萧山区 山阴路688号恒隆广场B座1217"
-adminId: null
-appListPicUrl: "https://4dkk.4dage.com/shop/huafa/20211206/150212290bc34b.jpg?x-oss-process=image/resize,m_fixed,w_400,h_400"
-bindShowerId: null
-bindShowerName: null
-bindShowerNameList: null
-city: null
-contractPhone: "15975119071"
-createTime: null
-createUserDeptId: 178
-createUserId: 266
-deleted: 0
-id: 1046768
-introduceVideo: null
-introduceVideoCover: null
-latitude: 30.178317
-liveRoomUrl: "https://zfb.4dkankan.com/shop.html?m=zfb-Vs6EY33Ql"
-livestreamStatus: 0
-longitude: 120.262421
-name: "eliaukd"
-picList: ""
-sceneNum: "zfb-Vs6EY33Ql"
-sceneUrl: "https://zfb.4dkankan.com/smobile.html?m=zfb-Vs6EY33Ql"
-shareWxQrCode: "https://houseoss.4dkankan.com/domain/shop/image/zfb-Vs6EY33Ql1638771871311_QRCode.png"
-simpleDesc: "eliauk"
-sortOrder: 101
-token: null
-type: 0
-updateTime: null
-updateUserDeptId: 178
-updateUserId: 427 -->
 <template>
   <div class="p-4">
     <BasicTable @register="registerTable" :rowSelection="{ type: 'checkbox' }">
@@ -69,9 +38,7 @@ updateUserId: 427 -->
               label: '删除',
               popConfirm: {
                 title: '是否确认删除',
-                confirm: () => {
-                  createMessage.info(`暂未接入`);
-                },
+                confirm: handleDeleteLiveScene.bind(null, record),
               },
             },
           ]"
@@ -98,8 +65,9 @@ updateUserId: 427 -->
   // import { uploadApi } from '/@/api/sys/upload';
   import { Tag } from 'ant-design-vue';
   import { h } from 'vue';
-  import { ListApi, brandTypeListApi } from '/@/api/scene/live';
+  import { ListApi, brandTypeListApi, LiveSceneDeleteApi } from '/@/api/scene/live';
   import { useI18n } from '/@/hooks/web/useI18n';
+
   import { useModal } from '/@/components/Modal';
   import { useDrawer } from '/@/components/Drawer';
   import bindModal from './bindModal.vue';
@@ -288,6 +256,14 @@ updateUserId: 427 -->
         // console.log('record', record);
         openLiveDrawer(true, record);
       }
+      async function handleDeleteLiveScene(record: Recordable) {
+        try {
+          const id = [record.id];
+          await LiveSceneDeleteApi(id);
+          createMessage.success(t('common.optSuccess'));
+          reload();
+        } catch (error) {}
+      }
       return {
         registerTable,
         createMessage,
@@ -299,6 +275,7 @@ updateUserId: 427 -->
         reload,
         registerLiveDrawer,
         handleLiveOpen,
+        handleDeleteLiveScene,
       };
     },
   });

+ 11 - 1
src/views/scenes/liveDrawer.vue

@@ -45,7 +45,12 @@
   // import { useMessage } from '/@/hooks/web/useMessage';
   import { useI18n } from '/@/hooks/web/useI18n';
 
-  import { brandTypeListApi, uploadLiveApi, getAllSceneApi } from '/@/api/scene/live';
+  import {
+    brandTypeListApi,
+    uploadLiveApi,
+    getAllSceneApi,
+    LiveSceneDeleteApi,
+  } from '/@/api/scene/live';
   import { data as CascaderData } from '/@/utils/cascaderData';
 
   import { useScript } from '/@/hooks/web/useScript';
@@ -360,6 +365,10 @@
         handleMapSearch();
       }
 
+      async function handleDeleteLiveScene() {
+        await LiveSceneDeleteApi();
+      }
+
       return {
         detailAddr,
         registerDrawer,
@@ -371,6 +380,7 @@
         handleMapReset,
         handleClose,
         t,
+        handleDeleteLiveScene,
       };
     },
   });