浏览代码

feat(api): 临时hack 套入数据

gemercheung 3 年之前
父节点
当前提交
87283331ec

+ 1 - 1
.env.development

@@ -6,7 +6,7 @@ VITE_PUBLIC_PATH = /
 
 # Cross-domain proxy, you can configure multiple
 # Please note that no line breaks
-VITE_PROXY = [["/basic-api","http://192.168.0.47:8190"],["/upload","http://localhost:3300/upload"],["/zfb-api","http://192.168.0.47:7081"]]
+VITE_PROXY = [["/basic-api","http://192.168.0.47:8190"],["/upload","http://localhost:3300/upload"],["/zfb-api","https://cszfb.4dkankan.com"]]
 # VITE_PROXY=[["/api","https://vvbin.cn/test"]]
 
 # Delete console

+ 2 - 2
src/api/bulletin/rent.ts

@@ -2,7 +2,7 @@ import { defHttp } from '/@/utils/http/axios';
 import { PageParams, RentListGetResultModel } from './model';
 
 enum Api {
-  selectHouseByType = '/zfb-api//zfb/house/selectHouseByType',
+  selectHouseByType = '/zfb-api/zfb/house/selectHouseByType',
 }
 
 /**
@@ -10,7 +10,7 @@ enum Api {
  */
 
 export const RentListApi = (params: PageParams) =>
-  defHttp.get<RentListGetResultModel>({
+  defHttp.post<RentListGetResultModel>({
     url: Api.selectHouseByType,
     params,
     headers: {

+ 15 - 3
src/api/scene/list.ts

@@ -1,8 +1,10 @@
 import { defHttp } from '/@/utils/http/axios';
-import { PageParams, RentListGetResultModel } from './model';
+import { PageParams, RentListGetResultModel, SceneEditParam } from './model';
+import { Result } from '/#/axios';
 
 enum Api {
-  pageList = '/zfb/scene/list',
+  pageList = '/zfb-api/zfb/scene/pageList',
+  generateSceneEditToken = '/zfb-api/zfb/api/platform/generateSceneEditToken',
 }
 
 /**
@@ -10,7 +12,7 @@ enum Api {
  */
 
 export const ListApi = (params: PageParams) =>
-  defHttp.get<RentListGetResultModel>({
+  defHttp.post<RentListGetResultModel>({
     url: Api.pageList,
     params,
     headers: {
@@ -18,3 +20,13 @@ export const ListApi = (params: PageParams) =>
       ignoreCancelToken: true,
     },
   });
+
+export const generateSceneEditTokenApi = (params: SceneEditParam) =>
+  defHttp.post<Result>({
+    url: Api.generateSceneEditToken,
+    params,
+    headers: {
+      // @ts-ignore
+      ignoreCancelToken: true,
+    },
+  });

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

@@ -4,6 +4,11 @@ import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
  */
 export type PageParams = BasicPageParams;
 
+export interface SceneEditParam {
+  sceneNum: string;
+  userName: string;
+}
+
 export interface DeviceListItem {
   id: number;
   name: string;

+ 7 - 7
src/api/system/system.ts

@@ -13,13 +13,13 @@ import {
 import { defHttp } from '/@/utils/http/axios';
 
 enum Api {
-  AccountList = '/system/getAccountList',
-  IsAccountExist = '/system/accountExist',
-  DeptList = '/system/getDeptList',
-  setRoleStatus = '/system/setRoleStatus',
-  MenuList = '/system/getMenuList',
-  RolePageList = '/system/getRoleListByPage',
-  GetAllRoleList = '/system/getAllRoleList',
+  AccountList = '/basic-api/system/getAccountList',
+  IsAccountExist = '/basic-api/system/accountExist',
+  DeptList = '/basic-api/system/getDeptList',
+  setRoleStatus = '/basic-api/system/setRoleStatus',
+  MenuList = '/basic-api/system/getMenuList',
+  RolePageList = '/basic-api/system/getRoleListByPage',
+  GetAllRoleList = '/basic-api/system/getAllRoleList',
 }
 
 export const getAccountList = (params: AccountParams) =>

+ 28 - 11
src/views/dashboard/corporation/index.vue

@@ -2,14 +2,32 @@
   <div class="p-4">
     <BasicTable @register="registerTable">
       <template #toolbar> </template>
-      <template #sceneLogo="{ sceneLogo }">
-        <CropperAvatar :showBtn="false" :width="80" :uploadApi="uploadApi" :value="sceneLogo" />
+      <template #sceneLogo="{ record }">
+        <CropperAvatar
+          :showBtn="false"
+          :width="80"
+          :uploadApi="uploadApi"
+          :value="record.sceneLogo"
+        />
       </template>
-      <template #floorLogo="{ floorLogo }">
-        <CropperAvatar :showBtn="false" :width="80" :uploadApi="uploadApi" :value="floorLogo" />
+      <template #floorLogo="{ record }">
+        <CropperAvatar
+          :showBtn="false"
+          :width="80"
+          :uploadApi="uploadApi"
+          :value="record.floorLogo"
+        />
       </template>
-      <template #bgMusic="{ bgMusic }">
-        <CropperAvatar :showBtn="false" :width="80" :uploadApi="uploadApi" :value="bgMusic" />
+      <template #bgMusic="{ record }">
+        <CropperAvatar
+          :showBtn="false"
+          :width="80"
+          :uploadApi="uploadApi"
+          :value="record.bgMusic"
+        />
+      </template>
+      <template #expirationTime="{ record }">
+        <Time :value="record.expirationTime" mode="datetime" />
       </template>
 
       <template #action="{ record }">
@@ -29,10 +47,7 @@
               // icon: 'mdi:account-group',
               color: 'error',
               label: '子账号',
-              popConfirm: {
-                title: '是否确认删除',
-                confirm: () => {},
-              },
+              onClick: handleOpenChargeModal.bind(null, record),
             },
           ]"
         />
@@ -52,9 +67,10 @@
   import { ListApi } from '/@/api/corporation/list';
   import { useModal } from '/@/components/Modal';
   import chargeModal from './chargeModal.vue';
+  import { Time } from '/@/components/Time';
 
   export default defineComponent({
-    components: { BasicTable, CropperAvatar, TableAction, chargeModal },
+    components: { BasicTable, CropperAvatar, TableAction, chargeModal, Time },
     setup() {
       const [registerChargeModal, { openModal: openChargeModal }] = useModal();
 
@@ -116,6 +132,7 @@
         {
           title: '到期时间',
           dataIndex: 'expirationTime',
+          slots: { customRender: 'expirationTime' },
           width: 180,
         },
       ];

+ 176 - 0
src/views/dashboard/scenes/list copy.vue

@@ -0,0 +1,176 @@
+<template>
+  <div class="p-4">
+    <BasicTable @register="registerTable">
+      <template #toolbar> </template>
+      <template #cover="{ record }">
+        <TableImg :size="150" :simpleShow="true" :imgList="[record.cover]" />
+      </template>
+      <template #action>
+        <TableAction
+          :actions="[
+            {
+              icon: 'clarity:note-edit-line',
+              label: '编辑',
+              onClick: () => {
+                createMessage.info(`暂未接入`);
+              },
+            },
+            {
+              icon: 'ant-design:delete-outlined',
+              color: 'error',
+              label: '删除',
+              popConfirm: {
+                title: '是否确认删除',
+                confirm: () => {
+                  createMessage.info(`暂未接入`);
+                },
+              },
+            },
+          ]"
+        />
+      </template>
+    </BasicTable>
+  </div>
+</template>
+<script lang="ts">
+  import { defineComponent } from 'vue';
+  import {
+    BasicTable,
+    useTable,
+    BasicColumn,
+    FormProps,
+    TableAction,
+    TableImg,
+  } from '/@/components/Table';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { uploadApi } from '/@/api/sys/upload';
+  import { Switch } from 'ant-design-vue';
+  import { h } from 'vue';
+  import { ListApi } from '/@/api/scene/list';
+  import { useI18n } from '/@/hooks/web/useI18n';
+
+  export default defineComponent({
+    components: { BasicTable, TableAction, TableImg },
+    setup() {
+      const { createMessage } = useMessage();
+      const { t } = useI18n();
+      const columns: BasicColumn[] = [
+        {
+          title: 'ID',
+          dataIndex: 'id',
+          fixed: 'left',
+          width: 100,
+        },
+        {
+          title: '场景名称',
+          dataIndex: 'name',
+          width: 230,
+        },
+        {
+          title: '封面',
+          dataIndex: 'cover',
+          slots: { customRender: 'cover' },
+          width: 120,
+        },
+        {
+          title: '场景链接',
+          dataIndex: 'link',
+          slots: { customRender: 'link' },
+          width: 180,
+        },
+        {
+          title: '是否显示',
+          dataIndex: 'isShow',
+          width: 180,
+          customRender: ({ record }) => {
+            if (!Reflect.has(record, 'pendingStatus')) {
+              record.pendingStatus = false;
+            }
+            return h(Switch, {
+              checked: record.isShow,
+              checkedChildren: t('common.yes'),
+              unCheckedChildren: t('common.no'),
+              loading: false,
+              onChange(checked: boolean) {
+                record.pendingStatus = true;
+                const newStatus = checked ? '1' : '0';
+                const { createMessage } = useMessage();
+                createMessage.info(`暂未接入` + newStatus);
+                // setRoleStatus(record.id, newStatus)
+                //   .then(() => {
+                //     record.status = newStatus;
+                //     createMessage.success(`已成功修改角色状态`);
+                //   })
+                //   .catch(() => {
+                //     createMessage.error('修改角色状态失败');
+                //   })
+                //   .finally(() => {
+                //     record.pendingStatus = false;
+                //   });
+              },
+            });
+          },
+        },
+
+        {
+          title: '操作',
+          dataIndex: '',
+          slots: { customRender: 'action' },
+          width: 120,
+        },
+      ];
+
+      const searchForm: Partial<FormProps> = {
+        labelWidth: 100,
+        schemas: [
+          {
+            field: 'id',
+            label: 'id',
+            component: 'Input',
+            colProps: {
+              xl: 3,
+              xxl: 3,
+            },
+          },
+          {
+            field: 'userName',
+            label: '企业账号',
+            component: 'Input',
+            colProps: {
+              xl: 12,
+              xxl: 8,
+            },
+          },
+        ],
+      };
+      // { getForm }
+      const [registerTable] = useTable({
+        title: '场景列表',
+        api: ListApi,
+        columns: columns,
+        useSearchForm: false,
+        formConfig: searchForm,
+        showTableSetting: true,
+        tableSetting: { fullScreen: true },
+        showIndexColumn: false,
+        rowKey: 'id',
+        //TODO
+        fetchSetting: {
+          pageField: 'pageNum',
+          sizeField: 'pageSize',
+          listField: 'list',
+          totalField: 'total',
+        },
+        pagination: { pageSize: 20 },
+      });
+
+      // pagination.value = { pageSize: 20 };
+      return {
+        registerTable,
+        createMessage,
+        t,
+        uploadApi: uploadApi as any,
+      };
+    },
+  });
+</script>

+ 96 - 69
src/views/dashboard/scenes/list.vue

@@ -5,27 +5,25 @@
       <template #cover="{ record }">
         <TableImg :size="150" :simpleShow="true" :imgList="[record.cover]" />
       </template>
-      <template #action>
+      <template #action="{ record }">
         <TableAction
           :actions="[
             {
-              icon: 'clarity:note-edit-line',
-              label: '编辑',
-              onClick: () => {
-                createMessage.info(`暂未接入`);
-              },
-            },
-            {
-              icon: 'ant-design:delete-outlined',
-              color: 'error',
-              label: '删除',
+              // icon: 'mdi:briefcase-download',
+              label: '下载场景',
               popConfirm: {
-                title: '是否确认删除',
+                title: '是否确认下载场景',
                 confirm: () => {
                   createMessage.info(`暂未接入`);
                 },
               },
             },
+            {
+              // icon: 'dashicons:editor-kitchensink',
+              color: 'error',
+              label: '打开编辑器',
+              onClick: openSceneEditor.bind(null, record),
+            },
           ]"
         />
       </template>
@@ -44,9 +42,9 @@
   } from '/@/components/Table';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { uploadApi } from '/@/api/sys/upload';
-  import { Switch } from 'ant-design-vue';
-  import { h } from 'vue';
-  import { ListApi } from '/@/api/scene/list';
+  // import { Switch } from 'ant-design-vue';
+  // import { h } from 'vue';
+  import { ListApi, generateSceneEditTokenApi } from '/@/api/scene/list';
   import { useI18n } from '/@/hooks/web/useI18n';
 
   export default defineComponent({
@@ -54,69 +52,66 @@
     setup() {
       const { createMessage } = useMessage();
       const { t } = useI18n();
+
       const columns: BasicColumn[] = [
-        {
-          title: 'ID',
-          dataIndex: 'id',
-          fixed: 'left',
-          width: 100,
-        },
+        // {
+        //   title: 'ID',
+        //   dataIndex: 'id',
+        //   fixed: 'left',
+        //   width: 80,
+        // },
         {
           title: '场景名称',
-          dataIndex: 'name',
-          width: 230,
+          dataIndex: 'sceneName',
+          width: 120,
         },
         {
-          title: '封面',
-          dataIndex: 'cover',
-          slots: { customRender: 'cover' },
+          title: '企业名称',
+          dataIndex: 'companyName',
           width: 120,
         },
         {
           title: '场景链接',
-          dataIndex: 'link',
+          dataIndex: 'webSite',
           slots: { customRender: 'link' },
           width: 180,
         },
         {
-          title: '是否显示',
-          dataIndex: 'isShow',
+          title: '拍摄设备ID',
+          dataIndex: 'childName',
+          width: 120,
+        },
+        {
+          title: '场景访问量',
+          dataIndex: 'viewCount',
+          width: 180,
+        },
+        {
+          title: '拍摄时间',
+          dataIndex: 'createTime',
+          width: 180,
+        },
+
+        {
+          title: '场景码',
+          dataIndex: 'num',
           width: 180,
-          customRender: ({ record }) => {
-            if (!Reflect.has(record, 'pendingStatus')) {
-              record.pendingStatus = false;
-            }
-            return h(Switch, {
-              checked: record.isShow,
-              checkedChildren: t('common.yes'),
-              unCheckedChildren: t('common.no'),
-              loading: false,
-              onChange(checked: boolean) {
-                record.pendingStatus = true;
-                const newStatus = checked ? '1' : '0';
-                const { createMessage } = useMessage();
-                createMessage.info(`暂未接入` + newStatus);
-                // setRoleStatus(record.id, newStatus)
-                //   .then(() => {
-                //     record.status = newStatus;
-                //     createMessage.success(`已成功修改角色状态`);
-                //   })
-                //   .catch(() => {
-                //     createMessage.error('修改角色状态失败');
-                //   })
-                //   .finally(() => {
-                //     record.pendingStatus = false;
-                //   });
-              },
-            });
-          },
+        },
+
+        {
+          title: '下载进度',
+          dataIndex: '',
+          width: 180,
+          slots: { customRender: 'process' },
+          ifShow: false,
         },
 
         {
           title: '操作',
           dataIndex: '',
           slots: { customRender: 'action' },
-          width: 120,
+          width: 140,
+          fixed: 'right',
         },
       ];
 
@@ -124,21 +119,39 @@
         labelWidth: 100,
         schemas: [
           {
-            field: 'id',
-            label: 'id',
+            field: 'companyName',
+            label: '企业名称',
+            component: 'Input',
+            colProps: {
+              lg: 6,
+              xl: 6,
+              xxl: 6,
+              sm: 12,
+              xs: 24,
+            },
+          },
+          {
+            field: 'sceneName',
+            label: '场景名称',
             component: 'Input',
             colProps: {
-              xl: 3,
-              xxl: 3,
+              lg: 6,
+              xl: 6,
+              xxl: 6,
+              sm: 12,
+              xs: 24,
             },
           },
           {
-            field: 'userName',
-            label: '企业账号',
+            field: 'childName',
+            label: '拍摄设备ID',
             component: 'Input',
             colProps: {
-              xl: 12,
-              xxl: 8,
+              lg: 6,
+              xl: 6,
+              xxl: 6,
+              sm: 12,
+              xs: 24,
             },
           },
         ],
@@ -148,20 +161,34 @@
         title: '场景列表',
         api: ListApi,
         columns: columns,
-        useSearchForm: false,
+        useSearchForm: true,
         formConfig: searchForm,
         showTableSetting: true,
         tableSetting: { fullScreen: true },
         showIndexColumn: false,
         rowKey: 'id',
-        pagination: { pageSize: 20 },
+        //TODO
+        fetchSetting: {
+          pageField: 'pageNum',
+          sizeField: 'pageSize',
+          listField: 'list',
+          totalField: 'total',
+        },
       });
+      async function openSceneEditor(record: Recordable) {
+        const url = record.webSite.replace('smobile', 'epc') + '&menu=business&token=';
+        const data = await generateSceneEditTokenApi({
+          sceneNum: record.num,
+          userName: '17324327132',
+        });
+        window.open(url + data.message);
+      }
 
-      // pagination.value = { pageSize: 20 };
       return {
         registerTable,
         createMessage,
         t,
+        openSceneEditor,
         uploadApi: uploadApi as any,
       };
     },