Просмотр исходного кода

Merge branch 'dev' of http://face3d.4dage.com:7005/zhangyupeng/zfb_mp into dev

tangning 3 лет назад
Родитель
Сommit
409d8e9446

+ 3 - 3
src/api/device/list.ts

@@ -1,5 +1,5 @@
 import { defHttp } from '/@/utils/http/axios';
 import { defHttp } from '/@/utils/http/axios';
-import { PageParams, RentListGetResultModel, addCamerParams } from './model';
+import { PageParams, RentListGetResultModel, addCameraParams } from './model';
 
 
 enum Api {
 enum Api {
   pageList = '/zfb-api/zfb/camera/pageList',
   pageList = '/zfb-api/zfb/camera/pageList',
@@ -43,7 +43,7 @@ export const allCompanyApi = (params: PageParams) =>
     },
     },
   });
   });
 
 
-export const addCameraApi = (params: addCamerParams) =>
+export const addCameraApi = (params: addCameraParams) =>
   defHttp.post<RentListGetResultModel>({
   defHttp.post<RentListGetResultModel>({
     url: Api.addCamera,
     url: Api.addCamera,
     params,
     params,
@@ -53,7 +53,7 @@ export const addCameraApi = (params: addCamerParams) =>
     },
     },
   });
   });
 
 
-export const editCameraApi = (params: addCamerParams) =>
+export const editCameraApi = (params: addCameraParams) =>
   defHttp.post<RentListGetResultModel>({
   defHttp.post<RentListGetResultModel>({
     url: Api.editCamera,
     url: Api.editCamera,
     params,
     params,

+ 1 - 1
src/api/device/model.ts

@@ -4,7 +4,7 @@ import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
  */
  */
 export type PageParams = BasicPageParams;
 export type PageParams = BasicPageParams;
 
 
-export interface addCamerParams {
+export interface addCameraParams {
   address: string;
   address: string;
   balance: string;
   balance: string;
   cameraType: string;
   cameraType: string;

+ 4 - 4
src/api/scene/live.ts

@@ -82,24 +82,24 @@ export const brandTypeListApi = (params: PageParams) =>
 
 
 export function uploadLiveApi(
 export function uploadLiveApi(
   params: UploadFileParams,
   params: UploadFileParams,
-  onUploadProgress: (progressEvent: ProgressEvent) => void,
+  // onUploadProgress: (progressEvent: ProgressEvent) => void,
 ) {
 ) {
   return defHttp.uploadFile<Result>(
   return defHttp.uploadFile<Result>(
     {
     {
       url: Api.upload,
       url: Api.upload,
-      onUploadProgress,
+      // onUploadProgress,
     },
     },
     params,
     params,
   );
   );
 }
 }
 export function uploadLiveVideoApi(
 export function uploadLiveVideoApi(
   params: UploadFileParams,
   params: UploadFileParams,
-  onUploadProgress: (progressEvent: ProgressEvent) => void,
+  // onUploadProgress: (progressEvent: ProgressEvent) => void,
 ) {
 ) {
   return defHttp.uploadFile<Result>(
   return defHttp.uploadFile<Result>(
     {
     {
       url: Api.uploadVideo,
       url: Api.uploadVideo,
-      onUploadProgress,
+      // onUploadProgress,
     },
     },
     params,
     params,
   );
   );

+ 8 - 0
src/components/Cropper/src/CopperModal.vue

@@ -167,6 +167,14 @@
           createMessage.error(t('component.upload.maxSizeMultiple', [maxSize]));
           createMessage.error(t('component.upload.maxSizeMultiple', [maxSize]));
           return false;
           return false;
         }
         }
+        const accept = ['image/jpg', 'image/jpeg', 'image/gif', 'image/png'];
+        const isAccept = accept.find((i) => String(file.type) === i);
+        if (!isAccept) {
+          createMessage.error(t('component.upload.illegalFile'));
+          return false;
+        }
+        console.log('file.type', isAccept, file.type);
+
         const reader = new FileReader();
         const reader = new FileReader();
         reader.readAsDataURL(file);
         reader.readAsDataURL(file);
         src.value = '';
         src.value = '';

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

@@ -122,6 +122,7 @@ export default {
     uploadWait: '请等待文件上传结束后操作',
     uploadWait: '请等待文件上传结束后操作',
     reUploadFailed: '重新上传失败文件',
     reUploadFailed: '重新上传失败文件',
     empty: '上传文件为空,请重新上传',
     empty: '上传文件为空,请重新上传',
+    illegalFile: '非法类型文件',
   },
   },
   verify: {
   verify: {
     error: '验证失败!',
     error: '验证失败!',

+ 10 - 23
src/views/devices/AddModal.vue

@@ -19,22 +19,14 @@
   import { useMessage } from '/@/hooks/web/useMessage';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { allCompanyApi, addCameraApi } from '/@/api/device/list';
   import { allCompanyApi, addCameraApi } from '/@/api/device/list';
   import { useI18n } from '/@/hooks/web/useI18n';
   import { useI18n } from '/@/hooks/web/useI18n';
-  //   address: "11111"
-  // balance: "111"
-  // cameraType: "4"
-  // childName: "11111"
-  // companyId: 1146
-  // orderSn: "1111"
-  // own: "0"
-  // rnd: 0.9923218970879999
-  // snCode: "1111"
-  // wifiName: "1111"
+
   const { t } = useI18n();
   const { t } = useI18n();
   export default defineComponent({
   export default defineComponent({
     components: { BasicModal, BasicForm },
     components: { BasicModal, BasicForm },
     props: {
     props: {
       userData: { type: Object },
       userData: { type: Object },
     },
     },
+    emits: ['update', 'register'],
     setup(props, { emit }) {
     setup(props, { emit }) {
       const modelRef = ref({});
       const modelRef = ref({});
       const { createMessage } = useMessage();
       const { createMessage } = useMessage();
@@ -150,7 +142,7 @@
           },
           },
         },
         },
       ];
       ];
-      const [registerForm, { getFieldsValue, validateFields, resetFields }] = useForm({
+      const [registerForm, { validate, resetFields }] = useForm({
         labelWidth: 120,
         labelWidth: 120,
         schemas,
         schemas,
         showActionButtonGroup: false,
         showActionButtonGroup: false,
@@ -202,19 +194,14 @@
         }
         }
       }
       }
       const handleSubmit = async () => {
       const handleSubmit = async () => {
-        console.log('getFieldsValue()', getFieldsValue());
         try {
         try {
-          const data = await validateFields();
-          const param = await getFieldsValue();
-          let res = await addCameraApi(param);
-          console.log('getFieldsValue()', res, data, param);
-          if (res.code) {
-            createMessage.error(res.error || t('common.optFail'));
-          } else {
-            emit('getList');
-            closeModal();
-            resetFields();
-          }
+          const params = await validate();
+          const res = await addCameraApi(params as any);
+          console.log('res', res);
+          closeModal();
+          resetFields();
+          createMessage.success(res);
+          emit('update');
         } catch (error) {
         } catch (error) {
           console.log('not passing', error);
           console.log('not passing', error);
         }
         }

+ 1 - 1
src/views/devices/list.vue

@@ -48,7 +48,7 @@
         />
         />
       </template>
       </template>
     </BasicTable>
     </BasicTable>
-    <AddModal @get-list="reload" @register="registerAddModal" />
+    <AddModal @submit="reload" @register="registerAddModal" />
     <EditModal @register="registerEditModal" @update="reload" />
     <EditModal @register="registerEditModal" @update="reload" />
   </div>
   </div>
 </template>
 </template>

+ 10 - 7
src/views/scenes/live.vue

@@ -15,7 +15,7 @@
         />
         />
       </template>
       </template>
       <template #houseType="{ record }">
       <template #houseType="{ record }">
-        {{ renderHouseType(record.houseType) }}
+        {{ renderHouseType(Number(record.type)) }}
       </template>
       </template>
 
 
       <template #action="{ record }">
       <template #action="{ record }">
@@ -98,7 +98,7 @@
         },
         },
         {
         {
           title: t('common.type'),
           title: t('common.type'),
-          dataIndex: 'houseType',
+          dataIndex: 'type',
           slots: { customRender: 'houseType' },
           slots: { customRender: 'houseType' },
           width: 100,
           width: 100,
         },
         },
@@ -178,7 +178,7 @@
               api: brandTypeListApi,
               api: brandTypeListApi,
               resultField: 'list',
               resultField: 'list',
               labelField: 'name',
               labelField: 'name',
-              valueField: 'id',
+              valueField: 'brandType',
               params: {
               params: {
                 page: 1,
                 page: 1,
                 limit: 1000,
                 limit: 1000,
@@ -215,16 +215,19 @@
           },
           },
         ],
         ],
       };
       };
+
       function renderHouseType(type: number): string {
       function renderHouseType(type: number): string {
         switch (type) {
         switch (type) {
           case 0:
           case 0:
-            return t(`routes.scenes.houseType.0`);
+            return '新房';
           case 1:
           case 1:
-            return t(`routes.scenes.houseType.1`);
+            return '二手房';
           case 2:
           case 2:
-            return t(`routes.scenes.houseType.2`);
+            return '公寓';
           case 3:
           case 3:
-            return t(`routes.scenes.houseType.3`);
+            return '民宿';
+          case 4:
+            return '装修';
           default:
           default:
             return t(`routes.scenes.houseType.9`);
             return t(`routes.scenes.houseType.9`);
         }
         }

+ 21 - 21
src/views/scenes/liveDrawer.vue

@@ -49,7 +49,7 @@
     brandTypeListApi,
     brandTypeListApi,
     uploadLiveApi,
     uploadLiveApi,
     getAllSceneApi,
     getAllSceneApi,
-    uploadLiveVideoApi,
+    // uploadLiveVideoApi,
     addSave,
     addSave,
     getLiveInfoApi,
     getLiveInfoApi,
     brandUpdateApi,
     brandUpdateApi,
@@ -282,27 +282,27 @@
             span: 20,
             span: 20,
           },
           },
         },
         },
-        {
-          field: 'introduceVideo',
-          label: '视频',
-          component: 'Upload',
-          componentProps: {
-            api: uploadLiveVideoApi,
-            maxSize: 100,
-            emptyHidePreview: true,
-            maxNumber: 1,
-            accept: ['video/*'],
-            afterFetch: function (data) {
-              Reflect.set(data, 'url', data.message.video);
-              myData.introduceVideoCover = data.message.image;
-              return data;
-            },
-          },
+        // {
+        //   field: 'introduceVideo',
+        //   label: '视频',
+        //   component: 'Upload',
+        //   componentProps: {
+        //     api: uploadLiveVideoApi,
+        //     maxSize: 100,
+        //     emptyHidePreview: true,
+        //     maxNumber: 1,
+        //     accept: ['video/*'],
+        //     afterFetch: function (data) {
+        //       Reflect.set(data, 'url', data.message.video);
+        //       myData.introduceVideoCover = data.message.image;
+        //       return data;
+        //     },
+        //   },
 
 
-          colProps: {
-            span: 20,
-          },
-        },
+        //   colProps: {
+        //     span: 20,
+        //   },
+        // },
         {
         {
           field: 'sortOrder',
           field: 'sortOrder',
           component: 'InputNumber',
           component: 'InputNumber',