Ver código fonte

feat(goods cate): udpate

gemercheung 3 anos atrás
pai
commit
9f0d0e613a

+ 2 - 2
src/api/scene/list.ts

@@ -4,7 +4,7 @@ import {
   RentListGetResultModel,
   SceneEditParam,
   SceneDownloadParam,
-  getDownloadProcessModel,
+  GetDownloadProcessModel,
 } from './model';
 import { Result } from '/#/axios';
 
@@ -39,7 +39,7 @@ export const downloadSceneDataAPi = (params: SceneDownloadParam) =>
     },
   });
 export const getDownloadProcessApi = (params: SceneDownloadParam) =>
-  defHttp.get<getDownloadProcessModel>({
+  defHttp.get<GetDownloadProcessModel>({
     url: Api.getDownloadProcess,
     params,
     headers: {

+ 34 - 2
src/api/scene/live.ts

@@ -1,6 +1,12 @@
 import { defHttp } from '/@/utils/http/axios';
-import { PageParams, RentListGetResultModel, SceneLiveItem, bindAnchorListParam } from './model';
-
+import {
+  PageParams,
+  RentListGetResultModel,
+  SceneLiveItem,
+  bindAnchorListParam,
+  GetAllSceneModel,
+} from './model';
+import { Result, UploadFileParams } from '/#/axios';
 enum Api {
   pageList = '/basic-api/brand/brandBindList',
   bindAnchorList = '/zfb-api/zfb/shop/sys/user/bindList',
@@ -10,6 +16,8 @@ enum Api {
   // bindUser = '/zfb-api/zfb/shop/sys/brand/bindUser',
   bindUser = '/basic-api/brand/bindUser',
   brandUpdate = '/basic-api/brand/update',
+  upload = '/basic-api/sys/oss/upload',
+  getAllScene = 'scene/getAllScene',
 }
 export type SceneLiveItemResult = SceneLiveItem;
 /**
@@ -65,3 +73,27 @@ export const brandTypeListApi = (params: PageParams) =>
       ignoreCancelToken: true,
     },
   });
+
+export function uploadLiveApi(
+  params: UploadFileParams,
+  onUploadProgress: (progressEvent: ProgressEvent) => void,
+) {
+  return defHttp.uploadFile<Result>(
+    {
+      url: Api.upload,
+      onUploadProgress,
+    },
+    params,
+  );
+}
+
+export const getAllSceneApi = (params: PageParams) => {
+  defHttp.get<GetAllSceneModel>({
+    url: Api.brandTypeList,
+    params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });
+};

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

@@ -57,9 +57,24 @@ export interface SceneProccessItem {
   url?: string;
 }
 
+export interface sceneItem {
+  appListPicUrl: string;
+  createTime: number;
+  createUserId: number;
+  deleted: number;
+  id: number;
+  isShow: number;
+  name: string;
+  sceneNum: string;
+  sceneUrl: string;
+  token: string;
+  updateTime: number;
+  updateUserId: number;
+}
 /**
  * @description: Request list return value
  */
 export type RentListGetResultModel = BasicFetchResult<SceneLiveItem>;
 export type LiveListGetResultModel = BasicFetchResult<SceneLiveItem>;
 export type GetDownloadProcessModel = BasicFetchResult<SceneProccessItem>;
+export type GetAllSceneModel = BasicFetchResult<sceneItem>;

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

@@ -26,6 +26,7 @@ export default {
   addLive: '新增场景',
   liveType: '直播间类型',
   liveName: '直播间名称',
+  makeLiveCover: '生成直播间封面',
   roleType: {
     0: '公司管理员',
     1: '公司员工',

+ 15 - 6
src/views/scenes/list.vue

@@ -3,8 +3,8 @@
     <BasicTable @register="registerTable" :rowSelection="{ type: 'checkbox' }">
       <template #toolbar>
         <a-button type="primary" @click="() => {}"> 新增</a-button>
-        <a-button type="primary" color="warning" @click="() => {}"> 编辑</a-button>
-        <a-button type="primary" color="error" @click="() => {}"> 删除</a-button>
+        <!-- <a-button type="primary" color="warning" @click="() => {}"> 编辑</a-button>
+        <a-button type="primary" color="error" @click="() => {}"> 删除</a-button> -->
       </template>
 
       <template #cover="{ record }">
@@ -23,9 +23,6 @@
               popConfirm: {
                 title: t('routes.scenes.downloadSceneConfirm'),
                 confirm: handleDownloadScene.bind(null, record),
-                // confirm: () => {
-                //   createMessage.info(t('common.notConnect'));
-                // },
               },
             },
             {
@@ -34,6 +31,18 @@
               label: t('routes.scenes.editor'),
               onClick: openSceneEditor.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.editor'),
+              onClick: openSceneEditor.bind(null, record),
+            },
           ]"
         />
       </template>
@@ -140,7 +149,7 @@
           title: t('common.operation'),
           dataIndex: '',
           slots: { customRender: 'action' },
-          width: 180,
+          width: 240,
           fixed: 'right',
         },
       ];

+ 3 - 3
src/views/scenes/live.vue

@@ -34,8 +34,8 @@ updateUserId: 427 -->
     <BasicTable @register="registerTable" :rowSelection="{ type: 'checkbox' }">
       <template #toolbar>
         <a-button type="primary" @click="handleLiveOpen"> 新增</a-button>
-        <a-button type="primary" color="warning" @click="() => {}"> 编辑</a-button>
-        <a-button type="primary" color="error" @click="() => {}"> 删除</a-button>
+        <!-- <a-button type="primary" color="warning" @click="() => {}"> 编辑</a-button>
+        <a-button type="primary" color="error" @click="() => {}"> 删除</a-button> -->
       </template>
       <template #cover="{ record }">
         <TableImg
@@ -174,7 +174,7 @@ updateUserId: 427 -->
           title: t('common.operation'),
           dataIndex: '',
           slots: { customRender: 'action' },
-          width: 230,
+          width: 250,
           fixed: 'right',
         },
       ];

+ 29 - 3
src/views/scenes/liveDrawer.vue

@@ -20,7 +20,8 @@
 
   // import { useMessage } from '/@/hooks/web/useMessage';
   import { useI18n } from '/@/hooks/web/useI18n';
-  import { brandTypeListApi } from '/@/api/scene/live';
+  // getAllSceneApi
+  import { brandTypeListApi, uploadLiveApi } from '/@/api/scene/live';
 
   export default defineComponent({
     name: 'MenuDrawer',
@@ -59,10 +60,35 @@
         },
         {
           field: 'appListPicUrl',
-          component: 'Input',
           label: t('routes.scenes.appListPicUrl'),
+          component: 'Upload',
+          helpMessage: '推荐大小:400 * 400 像素',
           required: true,
+          colProps: {
+            span: 10,
+          },
+          componentProps: {
+            api: uploadLiveApi,
+            maxgoodsNumber: 1,
+            afterFetch: function (data) {
+              Reflect.set(data, 'url', data.message.url);
+              return data;
+            },
+          },
         },
+        // {
+        //   field: 'sceneUrl',
+        //   label: t('routes.scenes.appListPicUrl'),
+        //   component: 'ApiSelect',
+        //   required: true,
+        //   colProps: {
+        //     span: 10,
+        //   },
+        //   componentProps: {
+        //     api: uploadLiveApi,
+        //     maxgoodsNumber: 1,
+        //   },
+        // },
       ];
       // updateSchema, validate
       const [registerForm, { resetFields, setFieldsValue }] = useForm({
@@ -93,7 +119,7 @@
         // });
       });
 
-      const getTitle = computed(() => (!unref(isUpdate) ? '新增菜单' : '编辑菜单'));
+      const getTitle = computed(() => (!unref(isUpdate) ? '新增直播间' : '编辑直播间'));
 
       async function handleSubmit() {}