Showing
3 changed files
with
25 additions
and
7 deletions
| 1 | import { defHttp } from '@/utils/external/http/axios' | 1 | import { defHttp } from '@/utils/external/http/axios' |
| 2 | -import {CameraRecord, ConfigurationItemType, DictItem, OrganizationListItem, UploadResponse} from './model' | 2 | +import { CameraRecord, ConfigurationItemType, DictItem, OrganizationListItem, UploadResponse } from './model' |
| 3 | import { PaginationResult } from '/#/external/axios' | 3 | import { PaginationResult } from '/#/external/axios' |
| 4 | import { isShareMode } from '@/views/share/hook' | 4 | import { isShareMode } from '@/views/share/hook' |
| 5 | 5 | ||
| @@ -22,6 +22,7 @@ enum Api { | @@ -22,6 +22,7 @@ enum Api { | ||
| 22 | GET_DEVICE_LATEST = '/plugins/telemetry/DEVICE/', | 22 | GET_DEVICE_LATEST = '/plugins/telemetry/DEVICE/', |
| 23 | DEVICE_ATTR = '/device/attributes', | 23 | DEVICE_ATTR = '/device/attributes', |
| 24 | ALARM_LIST = '/alarm', | 24 | ALARM_LIST = '/alarm', |
| 25 | + BASE_DELETE_URL = '/oss', | ||
| 25 | } | 26 | } |
| 26 | 27 | ||
| 27 | export const getDictItemByCode = (value: string) => { | 28 | export const getDictItemByCode = (value: string) => { |
| @@ -89,7 +90,7 @@ export const getOrganizationList = (params?: OrganizationListItem) => | @@ -89,7 +90,7 @@ export const getOrganizationList = (params?: OrganizationListItem) => | ||
| 89 | 90 | ||
| 90 | //获取视频列表 | 91 | //获取视频列表 |
| 91 | export const getVideoList = (params?: object) => | 92 | export const getVideoList = (params?: object) => |
| 92 | - defHttp.get<{data: CameraRecord[]}>({ | 93 | + defHttp.get<{ data: CameraRecord[] }>({ |
| 93 | url: Api.VIDEO, | 94 | url: Api.VIDEO, |
| 94 | params | 95 | params |
| 95 | }) | 96 | }) |
| @@ -160,6 +161,17 @@ export const getAlarmList = (params?: object) => | @@ -160,6 +161,17 @@ export const getAlarmList = (params?: object) => | ||
| 160 | url: Api.ALARM_LIST, | 161 | url: Api.ALARM_LIST, |
| 161 | params | 162 | params |
| 162 | }, | 163 | }, |
| 163 | - { | ||
| 164 | - withShareToken: true | ||
| 165 | - }) | 164 | + { |
| 165 | + withShareToken: true | ||
| 166 | + }) | ||
| 167 | + | ||
| 168 | + | ||
| 169 | +/** | ||
| 170 | + * 删除上传的图片 | ||
| 171 | + * @description deleteFilePath图片url | ||
| 172 | + */ | ||
| 173 | +export const deleteFilePath = (deleteFilePath?: string) => { | ||
| 174 | + return defHttp.delete({ | ||
| 175 | + url: `${Api.BASE_DELETE_URL}?deleteFilePath=${deleteFilePath}`, | ||
| 176 | + }); | ||
| 177 | +}; |
| @@ -11,6 +11,7 @@ import { useSync } from '../useSync.hook' | @@ -11,6 +11,7 @@ import { useSync } from '../useSync.hook' | ||
| 11 | import { BaseUpdateContentParams, DateViewConfigurationInfoType } from '@/api/external/contentSave/model/contentModel' | 11 | import { BaseUpdateContentParams, DateViewConfigurationInfoType } from '@/api/external/contentSave/model/contentModel' |
| 12 | import { useRole } from './business/useRole' | 12 | import { useRole } from './business/useRole' |
| 13 | import { ChartEditStoreType, PageChartEditStoreType } from '@/store/modules/chartEditStore/chartEditStore.d' | 13 | import { ChartEditStoreType, PageChartEditStoreType } from '@/store/modules/chartEditStore/chartEditStore.d' |
| 14 | +import { deleteFilePath } from '@/api/external/common' | ||
| 14 | 15 | ||
| 15 | /** | 16 | /** |
| 16 | * * base64转file | 17 | * * base64转file |
| @@ -180,7 +181,8 @@ export const useSyncRemote = () => { | @@ -180,7 +181,8 @@ export const useSyncRemote = () => { | ||
| 180 | 181 | ||
| 181 | //thumbnailSyncUpdate 缩略图保存 | 182 | //thumbnailSyncUpdate 缩略图保存 |
| 182 | const thumbnailSyncUpdate = throttle(async (updateImg = true) => { | 183 | const thumbnailSyncUpdate = throttle(async (updateImg = true) => { |
| 183 | - const { state, organizationId, dataViewName } = projectInfoStore.getProjectInfo | 184 | + console.log(projectInfoStore.getProjectInfo, 'projectInfoStore.getProjectInfo') |
| 185 | + const { state, organizationId, dataViewName, thumbnail } = projectInfoStore.getProjectInfo | ||
| 184 | if (updateImg) { | 186 | if (updateImg) { |
| 185 | // 获取缩略图片 | 187 | // 获取缩略图片 |
| 186 | const range = document.querySelector('.go-edit-range') as HTMLElement | 188 | const range = document.querySelector('.go-edit-range') as HTMLElement |
| @@ -198,6 +200,9 @@ export const useSyncRemote = () => { | @@ -198,6 +200,9 @@ export const useSyncRemote = () => { | ||
| 198 | base64toFile(canvasImage.toDataURL(), `${fetchRouteParamsLocation()}_index_preview.png`) | 200 | base64toFile(canvasImage.toDataURL(), `${fetchRouteParamsLocation()}_index_preview.png`) |
| 199 | ) | 201 | ) |
| 200 | const uploadRes = await uploadFile(uploadParams) | 202 | const uploadRes = await uploadFile(uploadParams) |
| 203 | + if (thumbnail) { | ||
| 204 | + await deleteFilePath(thumbnail) | ||
| 205 | + } | ||
| 201 | // 保存预览图 | 206 | // 保存预览图 |
| 202 | if (uploadRes) { | 207 | if (uploadRes) { |
| 203 | await saveDataViewList({ | 208 | await saveDataViewList({ |