feat: 初始化
This commit is contained in:
parent
c4390a34d7
commit
1d12b3f529
5
.dumi/loading.tsx
Normal file
5
.dumi/loading.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import React from 'react';
|
||||
|
||||
export default () => {
|
||||
return <div style={{ textAlign: 'center' }}>客官,您慢点儿...</div>;
|
||||
};
|
4
.dumi/tsconfig.json
Normal file
4
.dumi/tsconfig.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["**/*"]
|
||||
}
|
@ -6,7 +6,10 @@ export default defineConfig({
|
||||
favicons: ['/logo.jpg'],
|
||||
history: { type: 'hash' },
|
||||
themeConfig: {
|
||||
name: 'zhst前端库',
|
||||
name: 'lambo',
|
||||
socialLinks: {
|
||||
gitlab: 'http://10.0.0.88/web-project/zhst-component',
|
||||
},
|
||||
},
|
||||
alias: {
|
||||
'@zhst/hooks': path.join(__dirname, 'packages/hooks/src'),
|
||||
|
@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "@umijs/lint/dist/config/stylelint"
|
||||
"extends": "@umijs/lint/dist/config/stylelint",
|
||||
"rules": {
|
||||
"selector-class-pattern": null
|
||||
}
|
||||
}
|
||||
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -3,6 +3,9 @@
|
||||
"ahooks",
|
||||
"antd",
|
||||
"COMPATER",
|
||||
"flvjs",
|
||||
"remuxer",
|
||||
"transmuxer",
|
||||
"zhst"
|
||||
]
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
hero:
|
||||
title: zhst
|
||||
description: 前端工具库合集
|
||||
title: lambo
|
||||
description: 致力于提升前端开发效率与规范
|
||||
actions:
|
||||
- text: 快速上手
|
||||
link: /bizs
|
||||
@ -16,8 +16,23 @@ features:
|
||||
emoji: 🌈
|
||||
description: 常用函数库
|
||||
- title: meta
|
||||
emoji: 🧸
|
||||
emoji: ☀️
|
||||
description: 原子组件库
|
||||
- title: constants
|
||||
emoji: 🈶️
|
||||
description: 静态定义库
|
||||
- title: request
|
||||
emoji: 🥣
|
||||
description: 网络请求库
|
||||
- title: types
|
||||
emoji: 🈸
|
||||
description: typescript 声明库
|
||||
- title: material
|
||||
emoji: 🥱
|
||||
description: 物料库
|
||||
- title: cli
|
||||
emoji: 🐔
|
||||
description: 脚手架
|
||||
---
|
||||
|
||||
## 目录结构
|
||||
@ -70,6 +85,10 @@ features:
|
||||
material
|
||||
<small>物料库</small>
|
||||
</li>
|
||||
<li>
|
||||
cli
|
||||
<small>脚手架</small>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
@ -95,7 +114,7 @@ features:
|
||||
|
||||
## 本文档食用说明
|
||||
|
||||
目前在开发中的项目为:@zhst/bizs、@zhst/hooks、@zhst/meta、@zhst/func。
|
||||
目前在进行中的项目为:@zhst/bizs、@zhst/hooks、@zhst/meta、@zhst/func..
|
||||
|
||||
bizs: 基于@zhst/hooks、@zhst/meta、@zhst/func 开发,基本贴近于业务。<Badge>doing</Badge>
|
||||
|
||||
@ -103,20 +122,20 @@ meta:基于 antd 开发,作为公司的定制化原子组件。<Badge>doing<
|
||||
|
||||
hooks:基于 ahooks、@zhst/func 定制化二次开发。<Badge>doing</Badge>
|
||||
|
||||
func:基于 lodash-es 定制化二次开发 (由于utils包名被使用了)<Badge>doing</Badge>
|
||||
func:基于 lodash-es 定制化二次开发 (由于 utils 包名被使用了)<Badge>doing</Badge>
|
||||
|
||||
## 后续构思
|
||||
|
||||
想做一个,基于智慧视通开发场景和业务场景的前端技术流程化方案,希望它能渗透到整个研发的所有流程中。
|
||||
|
||||
比如:代码规范、git提交规范、物料库、基于electron的前端工具客户端(可集成物料库、图片上传小工具)、api自动生成...
|
||||
比如:代码规范、git 提交规范、物料库、基于 electron 的前端工具客户端(可集成物料库、图片上传小工具)、api 自动生成...
|
||||
|
||||
:::info{title=@zhst/lint}
|
||||
lint工具库,包含:eslint-config、eslint-plugin、commit-lint
|
||||
lint 工具库,包含:eslint-config、eslint-plugin、commit-lint
|
||||
:::
|
||||
|
||||
:::info{title=@zhst/metarial}
|
||||
物料库,可以直接通过 clone npm 仓库的形式生成模板页面
|
||||
物料库,可以直接通过 clone npm 仓库的形式生成模板页面,页面没有任何依赖,一个页面就是一个项目。
|
||||
:::
|
||||
|
||||
:::info{title=@zhst/app}
|
||||
@ -134,3 +153,7 @@ lint工具库,包含:eslint-config、eslint-plugin、commit-lint
|
||||
:::info{title=@zhst/constants}
|
||||
静态变量枚举库
|
||||
:::
|
||||
|
||||
:::info{title=@zhst/cli}
|
||||
基于物料库的脚手架,可以直接通过可视化界面搭建项目,偏向于 lowcode+ 思维
|
||||
:::
|
||||
|
@ -1,5 +1,18 @@
|
||||
# @zhst/biz
|
||||
|
||||
## 0.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 初始化项目包
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/hooks@0.3.0
|
||||
- @zhst/func@0.3.0
|
||||
- @zhst/meta@0.3.0
|
||||
|
||||
## 0.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
23
packages/biz/es/BigImageModal/BigImageModal.d.ts
vendored
Normal file
23
packages/biz/es/BigImageModal/BigImageModal.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import React from 'react';
|
||||
import type { ModalProps, DescriptionsProps, TabsProps } from 'antd';
|
||||
import './index.less';
|
||||
export declare const componentPrefix = "zhst-image";
|
||||
export interface BigImageModalProps extends ModalProps {
|
||||
visible: boolean;
|
||||
descriptionConfig: {
|
||||
data: {
|
||||
title: string;
|
||||
children: Pick<DescriptionsProps, 'items'>;
|
||||
}[];
|
||||
};
|
||||
tabsConfig: {
|
||||
data: Pick<TabsProps, 'items'> & {
|
||||
key: 'NORMAL' | 'COMPATER' | 'TRACK';
|
||||
};
|
||||
};
|
||||
dataSource: any;
|
||||
imageData: any;
|
||||
relatedData: any;
|
||||
}
|
||||
declare const BigImageModal: React.FC<BigImageModalProps>;
|
||||
export default BigImageModal;
|
File diff suppressed because one or more lines are too long
13
packages/biz/es/BigImageModal/components/navigation/index.d.ts
vendored
Normal file
13
packages/biz/es/BigImageModal/components/navigation/index.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import './index.less';
|
||||
declare const Navigation: React.FC<{
|
||||
show?: boolean;
|
||||
onClick?: React.MouseEventHandler<HTMLElement>;
|
||||
prev?: boolean;
|
||||
next?: boolean;
|
||||
disabled?: boolean;
|
||||
className?: string;
|
||||
color?: string;
|
||||
hoverColor?: string;
|
||||
}>;
|
||||
export default Navigation;
|
3
packages/biz/es/BigImageModal/index.d.ts
vendored
Normal file
3
packages/biz/es/BigImageModal/index.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import BigImageModal from "./BigImageModal";
|
||||
export type { BigImageModalProps } from './BigImageModal';
|
||||
export default BigImageModal;
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,4 @@
|
||||
.zhst-image {
|
||||
|
||||
.zhst-dialog-content {
|
||||
box-shadow: 0 4px 12px rgb(0 0 0 / 20%);
|
||||
}
|
||||
@ -67,256 +66,7 @@
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
}
|
||||
.zhst-image__img-view {
|
||||
position: relative;
|
||||
width: calc(100% - 46px - 46px - 20px - 20px);
|
||||
height: 100%;
|
||||
margin: 0 66px;
|
||||
|
||||
&-opt {
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
&-crop-opt {
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
&-align {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&-main {
|
||||
// height: 532px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
&--cursor {
|
||||
& canvas {
|
||||
cursor: pointer !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-screenshot {
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
&-attach {
|
||||
position: absolute;
|
||||
z-index: 11;
|
||||
bottom: 0;
|
||||
|
||||
// left: 78px;
|
||||
left: 0;
|
||||
min-width: 120px;
|
||||
height: 202px;
|
||||
transition: all 200ms;
|
||||
|
||||
&--fixed {
|
||||
width: 152px !important;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
&--zoomin {
|
||||
height: 532px;
|
||||
|
||||
&--fixed {
|
||||
width: 398px !important;
|
||||
}
|
||||
}
|
||||
|
||||
&__tab {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
|
||||
&-item {
|
||||
display: flex;
|
||||
width: 30px;
|
||||
height: 24px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #000;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
opacity: 0.5;
|
||||
transition: all 200ms;
|
||||
|
||||
&--select {
|
||||
width: 48px;
|
||||
height: 34px;
|
||||
background: #09f;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__scale {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 4px;
|
||||
display: flex;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgb(0 0 0 / 60%);
|
||||
border-radius: 100%;
|
||||
cursor: pointer;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&__img {
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
|
||||
&--fixed {
|
||||
width: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.zhst-image__video-view {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
height: 532px;
|
||||
background-color: #333;
|
||||
|
||||
// &-flv {
|
||||
// width: 85%;
|
||||
// }
|
||||
&-screenshot {
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
&-crop-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
&-align {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&-opt {
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
padding: 0 12px;
|
||||
background-color: rgb(0 0 0 / 80%);
|
||||
line-height: 32px;
|
||||
|
||||
&>div:first-child {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
&>div:last-child {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
&-range {
|
||||
display: flex;
|
||||
height: 32px;
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
line-height: 32px;
|
||||
text-align: center;
|
||||
|
||||
&>div:first-child {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&>div:last-child {
|
||||
width: 100px;
|
||||
margin-left: 8px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__player-mask {
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: rgb(4 4 4 / 70%);
|
||||
|
||||
&--bg {
|
||||
z-index: 999;
|
||||
background-color: rgb(4 4 4 / 100%);
|
||||
}
|
||||
|
||||
i {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&-title {
|
||||
margin-top: 12px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
|
||||
& a {
|
||||
color: #09f;
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__icon-wraper {
|
||||
display: flex;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: rgb(255 255 255 / 10%);
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
line-height: 80px;
|
||||
text-align: center;
|
||||
|
||||
// &:hover {
|
||||
// background: #0099ff;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
.zhst-image__tool {
|
||||
display: flex;
|
||||
@ -504,7 +254,6 @@
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
|
||||
border-color: #f0f0f0;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
@ -553,57 +302,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.zhst-image__btn-group {
|
||||
// display: flex;
|
||||
width: 30px;
|
||||
box-shadow: 0 2px 6px 0 rgb(0 0 0 / 40%);
|
||||
|
||||
&__item {
|
||||
display: flex;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #000;
|
||||
|
||||
&>button {
|
||||
padding: 0;
|
||||
color: #fff;
|
||||
|
||||
&:hover {
|
||||
color: #09f;
|
||||
}
|
||||
|
||||
&:active {
|
||||
color: #09f;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&>span {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
&--active {
|
||||
&>button {
|
||||
color: #09f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&--circle {
|
||||
background-color: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
&--circle &__item {
|
||||
margin-bottom: 4px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.zhst-image__compater-view {
|
||||
display: flex;
|
||||
@ -962,78 +660,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.zhst-image__score {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
&-box {
|
||||
position: relative;
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 12px;
|
||||
border-radius: 50%;
|
||||
|
||||
&-bg {
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
border: 2px solid #fff;
|
||||
background-color: #fff;
|
||||
border-radius: 50%;
|
||||
|
||||
&-inner {
|
||||
width: 100% !important;
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-score {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
color: rgb(0 0 0 / 88%);
|
||||
font-size: 28px;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
&-text {
|
||||
width: 54px;
|
||||
height: 24px;
|
||||
color: rgb(0 0 0 / 88%);
|
||||
font-size: 18px;
|
||||
line-height: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.zhst-image__CornerScore {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 56px;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
text-align: right;
|
||||
vertical-align: bottom;
|
||||
padding-right: 1px;
|
||||
background-size: 100%;
|
||||
background-image: url('./images/percent_background.png');
|
||||
z-index: 99;
|
||||
|
||||
&>span {
|
||||
padding-right: 6px;
|
||||
line-height: 22px;
|
||||
font-size: 12px;
|
||||
vertical-align: middle;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
}
|
||||
|
||||
.zhst-image__attributePanel {
|
||||
margin: 0 66px;
|
||||
background: #f6f6f6;
|
||||
@ -1082,7 +708,6 @@
|
||||
.relatedContent {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
|
||||
display: flex;
|
||||
|
||||
.relatedPics {
|
||||
@ -1108,19 +733,19 @@
|
||||
}
|
||||
|
||||
.disabled {
|
||||
color: rgba(0, 0, 0, 0.25);
|
||||
color: rgba(0, 0, 0, 25%);
|
||||
}
|
||||
|
||||
.relatedBtn {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
color: #333333;
|
||||
color: #333;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: #0099ff;
|
||||
color: #09f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
294
packages/biz/es/BigImageModal/mock.d.ts
vendored
Normal file
294
packages/biz/es/BigImageModal/mock.d.ts
vendored
Normal file
@ -0,0 +1,294 @@
|
||||
export declare const IMAGE_DATA: {
|
||||
enAbleDeleteFeature: boolean;
|
||||
tabsFilter: string[];
|
||||
dataSources: {
|
||||
objectId: string;
|
||||
condition: {
|
||||
featureInfo: null;
|
||||
featureData: string;
|
||||
imageData: string;
|
||||
alg: string;
|
||||
rect: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
objectImageUrl: string;
|
||||
srcImageUrl: string;
|
||||
};
|
||||
score: number;
|
||||
timestamp: number;
|
||||
deviceId: string;
|
||||
id: string;
|
||||
name: string;
|
||||
dirid: string;
|
||||
status: string;
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
caseId: string;
|
||||
caseGroup: string;
|
||||
isDeleted: string;
|
||||
extendInfo: {
|
||||
vmsPlatformId: string;
|
||||
vmsChannel: string;
|
||||
vmsCameraDecoderTag: string;
|
||||
platformPluginType: string;
|
||||
deviceVender: string;
|
||||
type: string;
|
||||
ip: string;
|
||||
port: string;
|
||||
username: string;
|
||||
passwd: string;
|
||||
rtspAddress: string;
|
||||
facesnapChannel: string;
|
||||
edgeDeviceSn: string;
|
||||
platform1400Id: number;
|
||||
useRtspAddress: boolean;
|
||||
frameCheck: boolean;
|
||||
frameRectX: number;
|
||||
frameRectY: number;
|
||||
frameRectW: number;
|
||||
frameRectH: number;
|
||||
edgeNodeId: string;
|
||||
processStatus: string;
|
||||
};
|
||||
objectIndex: {
|
||||
objectId: string;
|
||||
solutionId: string;
|
||||
deviceId: string;
|
||||
fragmentId: string;
|
||||
};
|
||||
objectType: string;
|
||||
isObjectTrack: boolean;
|
||||
pathId: string;
|
||||
frameInfo: {
|
||||
frameId: string;
|
||||
frameTimestamp: string;
|
||||
width: number;
|
||||
height: number;
|
||||
originWidth: number;
|
||||
originHeight: number;
|
||||
offsetTime: string;
|
||||
skipNumber: string;
|
||||
};
|
||||
level: number;
|
||||
bboxInFrame: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
bboxExtInFrame: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
objectImageKey: string;
|
||||
objectExtImageKey: string;
|
||||
frameImageKey: string;
|
||||
confidence: number;
|
||||
sourceObjectId: string;
|
||||
storeTimestamp: string;
|
||||
gbNumber: string;
|
||||
qualityScore: number;
|
||||
subObjectCount: number;
|
||||
subObjectType: string[];
|
||||
subObjectIds: string[];
|
||||
cameraInfo: {
|
||||
id: string;
|
||||
name: string;
|
||||
dirid: string;
|
||||
status: string;
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
caseId: string;
|
||||
caseGroup: string;
|
||||
isDeleted: string;
|
||||
extendInfo: {
|
||||
vmsPlatformId: string;
|
||||
vmsChannel: string;
|
||||
vmsCameraDecoderTag: string;
|
||||
platformPluginType: string;
|
||||
deviceVender: string;
|
||||
type: string;
|
||||
ip: string;
|
||||
port: string;
|
||||
username: string;
|
||||
passwd: string;
|
||||
rtspAddress: string;
|
||||
facesnapChannel: string;
|
||||
edgeDeviceSn: string;
|
||||
platform1400Id: number;
|
||||
useRtspAddress: boolean;
|
||||
frameCheck: boolean;
|
||||
frameRectX: number;
|
||||
frameRectY: number;
|
||||
frameRectW: number;
|
||||
frameRectH: number;
|
||||
edgeNodeId: string;
|
||||
processStatus: string;
|
||||
};
|
||||
};
|
||||
solutionId: string;
|
||||
fragmentId: string;
|
||||
contrastKey: string;
|
||||
compaterImages: string[];
|
||||
imgSummary: string;
|
||||
imageKey: string;
|
||||
srcImageUrl: string;
|
||||
algorithmVersion: string;
|
||||
cameraId: string;
|
||||
cameraName: string;
|
||||
}[];
|
||||
selectIndex: number;
|
||||
disableBtn: number[];
|
||||
dataSource: {
|
||||
objectId: string;
|
||||
condition: {
|
||||
featureInfo: null;
|
||||
featureData: string;
|
||||
imageData: string;
|
||||
alg: string;
|
||||
rect: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
objectImageUrl: string;
|
||||
srcImageUrl: string;
|
||||
};
|
||||
score: number;
|
||||
timestamp: number;
|
||||
deviceId: string;
|
||||
id: string;
|
||||
name: string;
|
||||
dirid: string;
|
||||
status: string;
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
caseId: string;
|
||||
caseGroup: string;
|
||||
isDeleted: string;
|
||||
extendInfo: {
|
||||
vmsPlatformId: string;
|
||||
vmsChannel: string;
|
||||
vmsCameraDecoderTag: string;
|
||||
platformPluginType: string;
|
||||
deviceVender: string;
|
||||
type: string;
|
||||
ip: string;
|
||||
port: string;
|
||||
username: string;
|
||||
passwd: string;
|
||||
rtspAddress: string;
|
||||
facesnapChannel: string;
|
||||
edgeDeviceSn: string;
|
||||
platform1400Id: number;
|
||||
useRtspAddress: boolean;
|
||||
frameCheck: boolean;
|
||||
frameRectX: number;
|
||||
frameRectY: number;
|
||||
frameRectW: number;
|
||||
frameRectH: number;
|
||||
edgeNodeId: string;
|
||||
processStatus: string;
|
||||
};
|
||||
objectIndex: {
|
||||
objectId: string;
|
||||
solutionId: string;
|
||||
deviceId: string;
|
||||
fragmentId: string;
|
||||
};
|
||||
objectType: string;
|
||||
isObjectTrack: boolean;
|
||||
pathId: string;
|
||||
frameInfo: {
|
||||
frameId: string;
|
||||
frameTimestamp: string;
|
||||
width: number;
|
||||
height: number;
|
||||
originWidth: number;
|
||||
originHeight: number;
|
||||
offsetTime: string;
|
||||
skipNumber: string;
|
||||
};
|
||||
level: number;
|
||||
bboxInFrame: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
bboxExtInFrame: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
objectImageKey: string;
|
||||
objectExtImageKey: string;
|
||||
frameImageKey: string;
|
||||
confidence: number;
|
||||
sourceObjectId: string;
|
||||
storeTimestamp: string;
|
||||
gbNumber: string;
|
||||
qualityScore: number;
|
||||
subObjectCount: number;
|
||||
subObjectType: string[];
|
||||
subObjectIds: string[];
|
||||
cameraInfo: {
|
||||
id: string;
|
||||
name: string;
|
||||
dirid: string;
|
||||
status: string;
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
caseId: string;
|
||||
caseGroup: string;
|
||||
isDeleted: string;
|
||||
extendInfo: {
|
||||
vmsPlatformId: string;
|
||||
vmsChannel: string;
|
||||
vmsCameraDecoderTag: string;
|
||||
platformPluginType: string;
|
||||
deviceVender: string;
|
||||
type: string;
|
||||
ip: string;
|
||||
port: string;
|
||||
username: string;
|
||||
passwd: string;
|
||||
rtspAddress: string;
|
||||
facesnapChannel: string;
|
||||
edgeDeviceSn: string;
|
||||
platform1400Id: number;
|
||||
useRtspAddress: boolean;
|
||||
frameCheck: boolean;
|
||||
frameRectX: number;
|
||||
frameRectY: number;
|
||||
frameRectW: number;
|
||||
frameRectH: number;
|
||||
edgeNodeId: string;
|
||||
processStatus: string;
|
||||
};
|
||||
};
|
||||
solutionId: string;
|
||||
fragmentId: string;
|
||||
contrastKey: string;
|
||||
compaterImages: string[];
|
||||
imgSummary: string;
|
||||
imageKey: string;
|
||||
srcImageUrl: string;
|
||||
algorithmVersion: string;
|
||||
cameraId: string;
|
||||
cameraName: string;
|
||||
}[];
|
||||
isArchiveDetail: boolean;
|
||||
ToolProps: {
|
||||
renderVideoBtn: boolean;
|
||||
disableVideo: boolean;
|
||||
};
|
||||
specialTitle: string;
|
||||
};
|
3
packages/biz/es/Demo/index.d.ts
vendored
Normal file
3
packages/biz/es/Demo/index.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
declare const _default: () => React.JSX.Element;
|
||||
export default _default;
|
153
packages/biz/es/adapter/BigImageModalAdapter/index.d.ts
vendored
Normal file
153
packages/biz/es/adapter/BigImageModalAdapter/index.d.ts
vendored
Normal file
@ -0,0 +1,153 @@
|
||||
/**
|
||||
* 适配老的大屏组件数据格式传入
|
||||
*/
|
||||
import React from 'react';
|
||||
import { AlgorithmVersionStr, HumanProperty, ObjectType, Rect, ViewOption, AlignType, IScreenshotButtonProp, ODRECT } from '@zhst/types';
|
||||
export type TAB_TYPE = 'COMPATER' | 'NORMAL' | 'TRACK';
|
||||
export type MODEL_TYPE = 'VIDEO' | 'IMAGE';
|
||||
export interface ImgViewProps extends React.HTMLAttributes<HTMLElement> {
|
||||
imageKey: string;
|
||||
odRect: ODRECT;
|
||||
attachImg?: Array<{
|
||||
label: string;
|
||||
url: string;
|
||||
}>;
|
||||
showAttachImgLabel: boolean;
|
||||
screenshotButtonAlign: AlignType;
|
||||
screenshotButtonRender: (screenshotButtonProp: IScreenshotButtonProp) => React.ReactElement;
|
||||
scale$?: number;
|
||||
showCrop$?: boolean;
|
||||
hideLeftTopBtn?: boolean;
|
||||
score?: number;
|
||||
viewOption?: ViewOption;
|
||||
}
|
||||
export interface VideoViewProps {
|
||||
flvUrl: string;
|
||||
maxDuration?: number;
|
||||
screenshotButtonAlign?: AlignType;
|
||||
screenshotButtonRender?: (screenshotButtonProp: IScreenshotButtonProp) => React.ReactElement;
|
||||
defautlNormalizationRect?: Rect;
|
||||
onCropChange?: (showCrop: boolean, normalizationRect: null | Rect) => void;
|
||||
showCrop$?: boolean;
|
||||
}
|
||||
export interface CarouselProps {
|
||||
hasPre?: boolean;
|
||||
hasNext?: boolean;
|
||||
selectIndex: number;
|
||||
setSelectIndex: React.Dispatch<React.SetStateAction<number>>;
|
||||
dataSource: Array<{
|
||||
key: string;
|
||||
url: string;
|
||||
}>;
|
||||
}
|
||||
export type ISelectItem = Partial<Omit<ImgViewProps, 'screenshotButtonRender'>> & Partial<Omit<VideoViewProps, 'screenshotButtonRender'>>;
|
||||
export interface HeaderProps {
|
||||
value: TAB_TYPE;
|
||||
onChange: (type: TAB_TYPE) => void;
|
||||
tabsFilter: TAB_TYPE[];
|
||||
}
|
||||
export interface ImgViewRef {
|
||||
imgInsRef: React.MutableRefObject<any>;
|
||||
setShowCrop: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
}
|
||||
export interface VideoViewRef {
|
||||
cropAble: boolean;
|
||||
setShowCrop: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
downloadVideoframe: () => void;
|
||||
}
|
||||
export interface ParamProps {
|
||||
tab: string;
|
||||
selectItem: ISelectItem;
|
||||
imgViewRef: React.MutableRefObject<ImgViewRef>;
|
||||
VideoViewRef: React.MutableRefObject<VideoViewRef>;
|
||||
model: MODEL_TYPE;
|
||||
setModel: React.Dispatch<React.SetStateAction<MODEL_TYPE>>;
|
||||
scale$: number;
|
||||
showCrop$: boolean;
|
||||
}
|
||||
export interface BigImageData {
|
||||
extendRectList: (Rect & {
|
||||
algorithmVersion: AlgorithmVersionStr;
|
||||
imageKey: string;
|
||||
})[];
|
||||
rectList: (Rect & {
|
||||
algorithmVersion: AlgorithmVersionStr;
|
||||
imageKey: string;
|
||||
})[];
|
||||
attachImg: {
|
||||
url: string;
|
||||
label: '形体' | '人脸';
|
||||
}[];
|
||||
odRect: Rect;
|
||||
imageKey: string;
|
||||
imgSummary: string;
|
||||
objectExtImageKey: string;
|
||||
attributeList: {
|
||||
label: string;
|
||||
list: any[];
|
||||
}[];
|
||||
archiveImages?: any;
|
||||
spaceName: string;
|
||||
objectType: ObjectType;
|
||||
objectId: string;
|
||||
bodyObjectId?: string;
|
||||
faceObjectId?: string;
|
||||
sourceObjectId?: string;
|
||||
cameraId: string;
|
||||
cameraName: string;
|
||||
selectIndex: number;
|
||||
humanProperty: HumanProperty;
|
||||
qualityScore?: number;
|
||||
score: number;
|
||||
timestamp: string;
|
||||
bodyImageUrl: string;
|
||||
faceImageUrl: string;
|
||||
algorithmVersion: AlgorithmVersionStr;
|
||||
bodySpaceName: string;
|
||||
faceSpaceName: string;
|
||||
solutionId?: string;
|
||||
[index: string]: any;
|
||||
}
|
||||
interface IOldImageData {
|
||||
visible?: boolean;
|
||||
defaultModel?: MODEL_TYPE;
|
||||
onClose?: () => void;
|
||||
isLoading?: boolean;
|
||||
hasPre?: boolean;
|
||||
hasNext?: boolean;
|
||||
selectIndex?: number;
|
||||
onSelectIndexChange?: (i: number) => void;
|
||||
dataSource: any[];
|
||||
dataSources: any[];
|
||||
relatedData?: any[];
|
||||
transformPropFunc: (item: any) => ISelectItem;
|
||||
transformVideoPropFunc: (item: ISelectItem) => Promise<Omit<VideoViewProps, 'screenshotButtonRender'>>;
|
||||
screenshotButtonRender?: (screenshotButtonProp: IScreenshotButtonProp) => React.ReactElement;
|
||||
showTool?: boolean;
|
||||
showCarousel?: boolean;
|
||||
imgViewProp?: Partial<ImgViewProps>;
|
||||
videoViewProp?: Partial<VideoViewProps>;
|
||||
ToolProps?: Partial<ToolProps>;
|
||||
nullDialogProp?: {
|
||||
emptyText?: string;
|
||||
};
|
||||
showHeader?: boolean;
|
||||
tabsFilter?: TAB_TYPE[];
|
||||
useVirtual?: boolean;
|
||||
loadNext?: (i: number) => Promise<void>;
|
||||
loadPre?: (i: number) => Promise<void>;
|
||||
children: React.ReactNode;
|
||||
title?: string;
|
||||
specialTitle?: string;
|
||||
isRelated?: boolean;
|
||||
carouselProp?: Partial<CarouselProps>;
|
||||
}
|
||||
export interface ToolProps {
|
||||
renderRight?: (props: ParamProps) => React.ReactNode;
|
||||
renderLeft?: (props: ParamProps) => React.ReactNode;
|
||||
renderVideoBtn?: boolean;
|
||||
param: ParamProps;
|
||||
disableVideo: boolean;
|
||||
}
|
||||
declare const _default: (data: IOldImageData) => IOldImageData;
|
||||
export default _default;
|
@ -1,217 +0,0 @@
|
||||
export type CamerasStatusList = [string[], string[], string[]];
|
||||
|
||||
export type Rect = { x: number; y: number; w: number; h: number };
|
||||
|
||||
export type StatusList = {
|
||||
taskOverview: any;
|
||||
taskIndex: {
|
||||
deviceId: string;
|
||||
solutionId: string;
|
||||
};
|
||||
}[];
|
||||
|
||||
export enum OperationType {
|
||||
OPERATION_TYPE_UNKNOW, // 未知状态,传该值会报错
|
||||
OPERATION_TYPE_START,
|
||||
OPERATION_TYPE_STOP
|
||||
}
|
||||
|
||||
|
||||
export enum AlgorithmVersion {
|
||||
VERSION_MGN_BNN, // MGN+BNN算法
|
||||
VERSION_BNN_PRO, // BNNPRO算法
|
||||
VERSION_BNN_PRO_ATTR, // BNNPROATTR算法
|
||||
VERSION_BNN_PRO_ATTR_SCORE, // BNNPROATTR算法
|
||||
VERSION_FACE, // 人脸算法
|
||||
VERSION_HEAD, // 头肩算法
|
||||
VERSION_NON_MOTOR_VEHICLE, // 非机动车的算法
|
||||
VERSION_REID_HEAD_ATTR, // 形体头肩属性三种特征融合的算法
|
||||
VERSION_MOTOR_VEHICLE, // 机动车的算法
|
||||
}
|
||||
|
||||
export enum AlgorithmVersionStr {
|
||||
VERSION_MGN_BNN = 'VERSION_MGN_BNN', // MGN+BNN算法
|
||||
VERSION_BNN_PRO = 'VERSION_BNN_PRO', // BNNPRO算法
|
||||
VERSION_BNN_PRO_ATTR = 'VERSION_BNN_PRO_ATTR', // BNNPROATTR算法
|
||||
VERSION_BNN_PRO_ATTR_SCORE = 'VERSION_BNN_PRO_ATTR_SCORE', // BNNPROATTR算法
|
||||
VERSION_FACE = 'VERSION_FACE', // 人脸算法
|
||||
VERSION_HEAD = 'VERSION_HEAD', // 头肩算法
|
||||
VERSION_NON_MOTOR_VEHICLE = 'VERSION_NON_MOTOR_VEHICLE', // 非机动车的算法
|
||||
VERSION_REID_HEAD_ATTR = 'VERSION_REID_HEAD_ATTR', // 形体头肩属性三种特征融合的算法
|
||||
VERSION_MOTOR_VEHICLE = 'VERSION_MOTOR_VEHICLE', // 机动车的算法
|
||||
}
|
||||
|
||||
类型枚举
|
||||
export enum ObjectType {
|
||||
OBJECT_TYPE_NULL,
|
||||
OBJECT_TYPE_PEDESTRAIN,
|
||||
OBJECT_TYPE_BICYCLE,
|
||||
OBJECT_TYPE_CAR,
|
||||
OBJECT_TYPE_MOTORBIKE,
|
||||
OBJECT_TYPE_AEROPLANE,
|
||||
OBJECT_TYPE_BUS,
|
||||
OBJECT_TYPE_TRAIN,
|
||||
OBJECT_TYPE_TRUCK,
|
||||
OBJECT_TYPE_MOTOR_RIDER,
|
||||
OBJECT_TYPE_BIKE_RIDER,
|
||||
OBJECT_TYPE_MAX,
|
||||
OBJECT_TYPE_FACE = 101,
|
||||
}
|
||||
|
||||
// 性别
|
||||
export enum Gender {
|
||||
GENDER_NONE = 'GENDER_NONE',
|
||||
GENDER_MAN = 'GENDER_MAN',
|
||||
GENDER_WOMAN = 'GENDER_WOMAN',
|
||||
}
|
||||
|
||||
// 年龄
|
||||
export enum Age {
|
||||
AGE_ALL = 'AGE_ALL',
|
||||
AGE_ZERO = 'AGE_ZERO',
|
||||
AGE_OVERENGHTEEN = 'AGE_OVERENGHTEEN',
|
||||
AGE_OVERSIXTY = 'AGE_OVERSIXTY',
|
||||
}
|
||||
|
||||
// 戴帽子状态
|
||||
export enum Hat {
|
||||
HAT_ALL = 'HAT_ALL',
|
||||
HAT_NONE = 'HAT_NONE',
|
||||
HAT_OWNED = 'HAT_OWNED',
|
||||
}
|
||||
|
||||
// 颜色
|
||||
export enum Color {
|
||||
COLOR_ALL = 'COLOR_ALL',
|
||||
COLOR_BLACK = 'COLOR_BLACK',
|
||||
COLOR_WHITE = 'COLOR_WHITE',
|
||||
COLOR_GRAY = 'COLOR_GRAY',
|
||||
COLOR_BROWN = 'COLOR_BROWN',
|
||||
COLOR_PINK = 'COLOR_PINK',
|
||||
COLOR_REDANDORANGE = 'COLOR_REDANDORANGE',
|
||||
COLOR_YELLOW = 'COLOR_YELLOW',
|
||||
COLOR_GREEN = 'COLOR_GREEN',
|
||||
COLOR_BLUE = 'COLOR_BLUE',
|
||||
COLOR_PURPLE = 'COLOR_PURPLE',
|
||||
}
|
||||
|
||||
// 背包
|
||||
export enum Package {
|
||||
PACKAGE_ALL = 'PACKAGE_ALL',
|
||||
PACKAGE_HANDBAG = 'PACKAGE_HANDBAG',
|
||||
PACKAGE_BACKPACK = 'PACKAGE_BACKPACK',
|
||||
PACKAGE_SHOULDERBAG = 'PACKAGE_SHOULDERBAG',
|
||||
PACKAGE_OTHER = 'PACKAGE_OTHER',
|
||||
PACKAGE_NONE = 'PACKAGE_NONE',
|
||||
}
|
||||
|
||||
// 行走模式
|
||||
export enum WalkPattern {
|
||||
WALKPATTERN_ALL = 'WALKPATTERN_ALL',
|
||||
WALKPATTERN_WALK = 'WALKPATTERN_WALK',
|
||||
WALKPATTERN_RIDING = 'WALKPATTERN_RIDING',
|
||||
}
|
||||
|
||||
// 人类属性
|
||||
export interface HumanProperty {
|
||||
age: Age;
|
||||
downColor: Color;
|
||||
gender: Gender;
|
||||
hat: Hat;
|
||||
package: Package;
|
||||
upColor: Color;
|
||||
walkPattern: WalkPattern;
|
||||
}
|
||||
|
||||
// 人类属性枚举
|
||||
export interface EnumHumanProperty {
|
||||
Gender: typeof Gender;
|
||||
Age: typeof Age;
|
||||
Hat: typeof Hat;
|
||||
Color: typeof Color;
|
||||
Package: typeof Package;
|
||||
WalkPattern: typeof WalkPattern;
|
||||
}
|
||||
|
||||
export interface IScreenshotButtonProp {
|
||||
model: 'VIDEO' | 'IMAGE';
|
||||
getCropInfo: () => Promise<RESP>;
|
||||
setShowCrop: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
cropType: typeof cropType[number];
|
||||
selectAlgorithmVersion: number;
|
||||
}
|
||||
|
||||
export interface AlignType {
|
||||
/**
|
||||
* move point of source node to align with point of target node.
|
||||
* Such as ['tr','cc'], align top right point of source node with center point of target node.
|
||||
* Point can be 't'(top), 'b'(bottom), 'c'(center), 'l'(left), 'r'(right) */
|
||||
points?: AlignPoint[];
|
||||
/**
|
||||
* offset source node by offset[0] in x and offset[1] in y.
|
||||
* If offset contains percentage string value, it is relative to sourceNode region.
|
||||
*/
|
||||
offset?: number[];
|
||||
/**
|
||||
* offset target node by offset[0] in x and offset[1] in y.
|
||||
* If targetOffset contains percentage string value, it is relative to targetNode region.
|
||||
*/
|
||||
targetOffset?: number[];
|
||||
/**
|
||||
* If adjustX field is true, will adjust source node in x direction if source node is invisible.
|
||||
* If adjustY field is true, will adjust source node in y direction if source node is invisible.
|
||||
*/
|
||||
overflow?: {
|
||||
adjustX?: boolean | number;
|
||||
adjustY?: boolean | number;
|
||||
};
|
||||
/**
|
||||
* Whether use css right instead of left to position
|
||||
*/
|
||||
useCssRight?: boolean;
|
||||
/**
|
||||
* Whether use css bottom instead of top to position
|
||||
*/
|
||||
useCssBottom?: boolean;
|
||||
/**
|
||||
* Whether use css transform instead of left/top/right/bottom to position if browser supports.
|
||||
* Defaults to false.
|
||||
*/
|
||||
useCssTransform?: boolean;
|
||||
ignoreShake?: boolean;
|
||||
}
|
||||
|
||||
export type ODRECT = {
|
||||
topleft: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
|
||||
export interface ViewOption {
|
||||
/* 图片url */
|
||||
image?: string | HTMLImageElement;
|
||||
|
||||
/* 缩放灵敏度(0,1],default: 0.1 */
|
||||
wheelZoomRatio?: number;
|
||||
|
||||
/*
|
||||
* 是否允许缩放
|
||||
* @default: true
|
||||
*/
|
||||
scaleAble?: boolean;
|
||||
|
||||
/*
|
||||
* 是否允许拖拽
|
||||
* @default: true
|
||||
*/
|
||||
dragAble?: boolean;
|
||||
|
||||
/*
|
||||
* fit scale 作为 最小缩放
|
||||
* @default: false
|
||||
*/
|
||||
fitScaleAsMinScale?: boolean;
|
||||
}
|
1
packages/biz/es/adapter/index.d.ts
vendored
Normal file
1
packages/biz/es/adapter/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export { default as BigImageModalAdapter } from './BigImageModalAdapter';
|
45
packages/biz/es/hooks/useIntelligentTracking/index.d.ts
vendored
Normal file
45
packages/biz/es/hooks/useIntelligentTracking/index.d.ts
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
import { Dayjs as Moment } from 'dayjs';
|
||||
export declare const getDefaultRadius: () => number;
|
||||
export declare const setDefaultRadius: (radius: number) => void;
|
||||
export declare const setSearchIntervalDuration: (duration: number) => void;
|
||||
export declare const getSearchIntervalDuration: (time: number) => number;
|
||||
export declare const operateTrackById: (smartTrackId: number, operationType: OperationType) => Promise<void>;
|
||||
export declare const deleteTrackById: (smartTrackId: number) => Promise<void>;
|
||||
export declare const modifyTrackImgs: (smartTrackId: number, images: Array<Object>) => Promise<void>;
|
||||
export declare const modifyTrackConf: (conf: any, smartTrackId: number) => Promise<void>;
|
||||
export declare const getTrackTaskById: (smartTrackId?: number) => Promise<any>;
|
||||
export declare const getTackDetailInfo: (smartTrackId?: number) => Promise<any>;
|
||||
export declare const getTaskCameraByCenterAndPower: (value: {
|
||||
taskPower: {
|
||||
facePower: number;
|
||||
bodyPower: number;
|
||||
};
|
||||
cameraInfos: Array<Object>;
|
||||
center: [number, number];
|
||||
}) => Promise<Object[]>;
|
||||
/**创建追踪任务 */
|
||||
export declare const createIntelligentTrack: (value: {
|
||||
images: Array<Object>;
|
||||
deviceIds: Array<string>;
|
||||
circleCenter: [number, number];
|
||||
model: number;
|
||||
circleRadius: number;
|
||||
facePower?: number;
|
||||
bodyPower?: number;
|
||||
historyTime?: [Moment, Moment];
|
||||
topping?: boolean;
|
||||
}) => Promise<any>;
|
||||
export declare const emitHeartbeat: (smartTrackId: number) => Promise<void>;
|
||||
export declare const ModifyTrackCameras: (value: {
|
||||
smartTrackId: number;
|
||||
deviceIds: Array<number>;
|
||||
centerPoint: [number, number];
|
||||
}) => Promise<void>;
|
||||
export declare const setIntelligentTrackCircleInfo: (smartTrackId: number, circleCenter: [number, number]) => Promise<void>;
|
||||
export declare const getTackCameraInfo: (value: {
|
||||
circleCenter: [Moment, Moment];
|
||||
radius: number;
|
||||
zoom: number;
|
||||
}) => Promise<any>;
|
||||
export declare const getCameraInfoByCircle: (circleCenter: any, radius: any, zoom?: number) => Promise<any>;
|
||||
export declare const taskInfoToSearchItem: (taskInfo: any) => any[];
|
3
packages/biz/es/index.d.ts
vendored
Normal file
3
packages/biz/es/index.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export { default as Demo } from './Demo';
|
||||
export * from './adapter';
|
||||
export { default as BigImageModal } from './BigImageModal';
|
26
packages/biz/es/useSocket/index.d.ts
vendored
Normal file
26
packages/biz/es/useSocket/index.d.ts
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
export declare const SocketApi: {
|
||||
CameraTaskStatue: string;
|
||||
DeviceStatus: string;
|
||||
SubscribeSolutionDeploy: string;
|
||||
SubscribeTasksSummary: string;
|
||||
MonitorSubscribeResult: string;
|
||||
MonitorSubscribeStatus: string;
|
||||
SubscribeArchiveGroupUpload: string;
|
||||
SubscribeJointTask: string;
|
||||
SubscribeGroupFragment: string;
|
||||
SubscribeGroup: string;
|
||||
SubscribeStreamEvent: string;
|
||||
};
|
||||
type ApiKeys = keyof typeof SocketApi;
|
||||
declare const _default: (topic: ApiKeys, iterator?: any, opt?: {
|
||||
req?: {
|
||||
[key: string]: any;
|
||||
} | undefined;
|
||||
throttle?: number | undefined;
|
||||
parseData?: boolean | undefined;
|
||||
beforeLoopTmp?: Function | undefined;
|
||||
shouldBreak: boolean;
|
||||
forceRefresh: any;
|
||||
close?: boolean | undefined;
|
||||
} | undefined) => void;
|
||||
export default _default;
|
2
packages/biz/es/useSocket/onceChannel.d.ts
vendored
Normal file
2
packages/biz/es/useSocket/onceChannel.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
declare const startChannel: (topic: any, req: any, callback: any) => () => void;
|
||||
export default startChannel;
|
31
packages/biz/es/useSocket/ws.d.ts
vendored
Normal file
31
packages/biz/es/useSocket/ws.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
declare class Channel {
|
||||
/**
|
||||
* io 实例化对象
|
||||
*/
|
||||
ioIns: any;
|
||||
/**
|
||||
* 已存在的订阅列表
|
||||
*/
|
||||
listeners: never[];
|
||||
/**
|
||||
* 调试信息 记录订阅/反订阅次数
|
||||
*/
|
||||
subscribeListenerId: never[];
|
||||
unSubscribeListenerId: never[];
|
||||
init: () => void;
|
||||
retry: (listener: {
|
||||
[x: string]: any;
|
||||
lastRetryInterval: number | undefined;
|
||||
intervalId: NodeJS.Timeout;
|
||||
} | undefined) => void;
|
||||
doEmit: (topic: any, req: any, listenerId: any) => void;
|
||||
subscribe(topic: any, req: any, handle: any): () => void;
|
||||
unSubscribe(topic: any, req: any, handleId: any, listenerId: any): void;
|
||||
}
|
||||
declare const channelIns: Channel;
|
||||
export default channelIns;
|
@ -5,6 +5,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
// @ts-nocheck
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { has } from '@zhst/func';
|
||||
import io from 'socket.io-client';
|
||||
|
23
packages/biz/es/utils/constants.d.ts
vendored
Normal file
23
packages/biz/es/utils/constants.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
export declare const OBJECT_GRNER_THRESHOLD = 0.8;
|
||||
export declare const OBJECT_AGE_TYPE_THRESHOLD = 0.5;
|
||||
export declare const MODE_KEY = "test_mode";
|
||||
export declare const SEARCH_IMG_COUNT = 10;
|
||||
export declare const GLOBAL_IS_ITEM_NUMBER_SHOW = false;
|
||||
export declare const publicPath = "hummingbird";
|
||||
export declare const ENTER_CIRCLE = "MONITORTYPE_ENTER_CIRCLE";
|
||||
export declare const OUT_CIRCLE = "MONITORTYPE_OUT_CIRCLE";
|
||||
export declare const TEMP = "MONITORTYPE_TEMP";
|
||||
export declare const GLOBAL_IS_BOX_VMS_SHOW = true;
|
||||
export declare const BODY_SEARCH_THRESHOID = 0.45;
|
||||
export declare const RECORD_VERSION = "3.0.0";
|
||||
export declare const DeviceTab: {
|
||||
EMPTY: number;
|
||||
REAL_CAMERA: number;
|
||||
PREPROCESS_CAMERA: number;
|
||||
TAG_CAMERA: number;
|
||||
HISTORY_VIDEO_GROUP: number;
|
||||
VIRTUAL_CAMERA: number;
|
||||
REAL_CAMERA_NOFACE: number;
|
||||
REAL_CAMERA_ONLYFACE: number;
|
||||
REAL_CAMERA_NOFACE_NOBOX_NODIRECONNECT: number;
|
||||
};
|
@ -1,16 +1,6 @@
|
||||
export var isDev = import.meta.env.DEV;
|
||||
export var host = isDev ? 'http://10.0.0.7' : "".concat(location.protocol, "//").concat(location.hostname);
|
||||
export var port = isDev ? '30003' : location.port;
|
||||
export var ProjectUrl = "".concat(host, ":").concat(port);
|
||||
export var MANAGER_URL = port ? ProjectUrl + '/manager' : host + '/manager';
|
||||
export var S3_HOST = location.port ? "".concat(host, ":").concat(port) : host;
|
||||
export var MapUrl = port ? ProjectUrl + '/map' : host + '/map';
|
||||
export var S3_V3_HOST = host; //minio 地址
|
||||
export var SOCKET_HOST = port ? ProjectUrl : host;
|
||||
export var OBJECT_GRNER_THRESHOLD = 0.8; //目标图判断性别阈值
|
||||
export var OBJECT_AGE_TYPE_THRESHOLD = 0.5; //目标图判断年龄段阈值
|
||||
export var MODE_KEY = 'test_mode';
|
||||
export var ROUTER_SHOULD_FILTER = isDev; //是否根据后台配置路由,开发环境全打开
|
||||
//业务约定
|
||||
export var SEARCH_IMG_COUNT = 10; //检索图片的最大个数
|
||||
export var GLOBAL_IS_ITEM_NUMBER_SHOW = false; //是否展示索引
|
||||
|
23
packages/biz/lib/BigImageModal/BigImageModal.d.ts
vendored
Normal file
23
packages/biz/lib/BigImageModal/BigImageModal.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import React from 'react';
|
||||
import type { ModalProps, DescriptionsProps, TabsProps } from 'antd';
|
||||
import './index.less';
|
||||
export declare const componentPrefix = "zhst-image";
|
||||
export interface BigImageModalProps extends ModalProps {
|
||||
visible: boolean;
|
||||
descriptionConfig: {
|
||||
data: {
|
||||
title: string;
|
||||
children: Pick<DescriptionsProps, 'items'>;
|
||||
}[];
|
||||
};
|
||||
tabsConfig: {
|
||||
data: Pick<TabsProps, 'items'> & {
|
||||
key: 'NORMAL' | 'COMPATER' | 'TRACK';
|
||||
};
|
||||
};
|
||||
dataSource: any;
|
||||
imageData: any;
|
||||
relatedData: any;
|
||||
}
|
||||
declare const BigImageModal: React.FC<BigImageModalProps>;
|
||||
export default BigImageModal;
|
169
packages/biz/lib/BigImageModal/BigImageModal.js
Normal file
169
packages/biz/lib/BigImageModal/BigImageModal.js
Normal file
@ -0,0 +1,169 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/BigImageModal/BigImageModal.tsx
|
||||
var BigImageModal_exports = {};
|
||||
__export(BigImageModal_exports, {
|
||||
componentPrefix: () => componentPrefix,
|
||||
default: () => BigImageModal_default
|
||||
});
|
||||
module.exports = __toCommonJS(BigImageModal_exports);
|
||||
var import_react = __toESM(require("react"));
|
||||
var import_antd = require("antd");
|
||||
var import_classnames = __toESM(require("classnames"));
|
||||
var import_func = require("@zhst/func");
|
||||
var import_index = require("./index.less");
|
||||
var import_navigation = __toESM(require("./components/navigation"));
|
||||
var DescriptionsItem = import_antd.Descriptions.Item;
|
||||
var componentPrefix = "zhst-image";
|
||||
var initialStyle = {
|
||||
fontSize: "12px"
|
||||
};
|
||||
var BigImageModal = (props) => {
|
||||
const {
|
||||
title = "-",
|
||||
open,
|
||||
visible,
|
||||
children,
|
||||
descriptionConfig = {
|
||||
data: []
|
||||
},
|
||||
tabsConfig = {
|
||||
data: [
|
||||
{
|
||||
label: "对比图模式",
|
||||
key: "1",
|
||||
children: "对比图组件"
|
||||
},
|
||||
{
|
||||
label: "场景图模式",
|
||||
key: "2",
|
||||
children: "场景图组件"
|
||||
}
|
||||
]
|
||||
},
|
||||
dataSource = [],
|
||||
imageData = [],
|
||||
relatedData = []
|
||||
} = props;
|
||||
const showCropRef = (0, import_react.useRef)(false);
|
||||
const scaleRef = (0, import_react.useRef)(0);
|
||||
const [activeKey, setActiveKey] = (0, import_react.useState)((0, import_func.get)(tabsConfig, "data[0].key"));
|
||||
const [previewIndex, setPreviewIndex] = (0, import_react.useState)(0);
|
||||
const [isRelated, setIsRelated] = (0, import_react.useState)(false);
|
||||
return /* @__PURE__ */ import_react.default.createElement(
|
||||
import_antd.Modal,
|
||||
{
|
||||
destroyOnClose: true,
|
||||
open: open || visible,
|
||||
footer: null,
|
||||
className: componentPrefix,
|
||||
title,
|
||||
...props
|
||||
},
|
||||
descriptionConfig.data.map((descriptions) => {
|
||||
var _a;
|
||||
return /* @__PURE__ */ import_react.default.createElement(
|
||||
import_antd.Descriptions,
|
||||
{
|
||||
key: descriptions.title,
|
||||
title: /* @__PURE__ */ import_react.default.createElement("p", { style: { margin: "12px 0 0", fontSize: initialStyle.fontSize } }, descriptions.title),
|
||||
column: 8,
|
||||
style: { padding: "0 64px" }
|
||||
},
|
||||
(_a = descriptions == null ? void 0 : descriptions.children) == null ? void 0 : _a.map((item) => /* @__PURE__ */ import_react.default.createElement(
|
||||
DescriptionsItem,
|
||||
{
|
||||
key: item.key,
|
||||
label: item.label,
|
||||
span: 1,
|
||||
contentStyle: { fontSize: initialStyle.fontSize },
|
||||
labelStyle: { fontSize: initialStyle.fontSize }
|
||||
},
|
||||
item.children
|
||||
))
|
||||
);
|
||||
}),
|
||||
/* @__PURE__ */ import_react.default.createElement(
|
||||
import_antd.Tabs,
|
||||
{
|
||||
defaultActiveKey: activeKey,
|
||||
centered: true,
|
||||
tabBarStyle: { fontSize: "18px" },
|
||||
items: tabsConfig.data,
|
||||
...tabsConfig
|
||||
}
|
||||
),
|
||||
/* @__PURE__ */ import_react.default.createElement(
|
||||
"div",
|
||||
{
|
||||
className: (0, import_classnames.default)(`${componentPrefix}-view-container`),
|
||||
style: activeKey === "TRACK" ? {
|
||||
height: "718px",
|
||||
marginBottom: "0px"
|
||||
} : {}
|
||||
},
|
||||
activeKey !== "TRACK" && /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
|
||||
import_navigation.default,
|
||||
{
|
||||
className: (0, import_classnames.default)(
|
||||
`${componentPrefix}-view-container__nav`,
|
||||
previewIndex <= 0 && `${componentPrefix}-view-container__nav--disabled`,
|
||||
`${componentPrefix}-view-container__nav--left`
|
||||
),
|
||||
show: isRelated ? imageData.length > 1 : dataSource.length > 1,
|
||||
disabled: previewIndex <= 0,
|
||||
prev: true,
|
||||
onClick: () => {
|
||||
setPreviewIndex((pre) => pre - 1);
|
||||
}
|
||||
}
|
||||
), /* @__PURE__ */ import_react.default.createElement(
|
||||
import_navigation.default,
|
||||
{
|
||||
className: (0, import_classnames.default)(
|
||||
`${componentPrefix}-view-container__nav`,
|
||||
(previewIndex >= imageData.length - 1 || previewIndex >= dataSource.length - 1) && `${componentPrefix}-view-container__nav--disabled`,
|
||||
`${componentPrefix}-view-container__nav--right`
|
||||
),
|
||||
show: isRelated ? imageData.length > 1 : dataSource.length > 1,
|
||||
disabled: previewIndex >= imageData.length - 1 || previewIndex >= dataSource.length - 1,
|
||||
next: true,
|
||||
onClick: async (e) => {
|
||||
setPreviewIndex((pre) => pre + 1);
|
||||
}
|
||||
}
|
||||
))
|
||||
)
|
||||
);
|
||||
};
|
||||
var BigImageModal_default = BigImageModal;
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
componentPrefix
|
||||
});
|
13
packages/biz/lib/BigImageModal/components/navigation/index.d.ts
vendored
Normal file
13
packages/biz/lib/BigImageModal/components/navigation/index.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import './index.less';
|
||||
declare const Navigation: React.FC<{
|
||||
show?: boolean;
|
||||
onClick?: React.MouseEventHandler<HTMLElement>;
|
||||
prev?: boolean;
|
||||
next?: boolean;
|
||||
disabled?: boolean;
|
||||
className?: string;
|
||||
color?: string;
|
||||
hoverColor?: string;
|
||||
}>;
|
||||
export default Navigation;
|
@ -0,0 +1,58 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/BigImageModal/components/navigation/index.tsx
|
||||
var navigation_exports = {};
|
||||
__export(navigation_exports, {
|
||||
default: () => navigation_default
|
||||
});
|
||||
module.exports = __toCommonJS(navigation_exports);
|
||||
var React = __toESM(require("react"));
|
||||
var import_classnames = __toESM(require("classnames"));
|
||||
var import_antd = require("antd");
|
||||
var import_meta = require("@zhst/meta");
|
||||
var import_index = require("./index.less");
|
||||
var componentName = `zhst-image__nav`;
|
||||
var Navigation = (props) => {
|
||||
const { show, prev, next, disabled, onClick, className, color } = props;
|
||||
return /* @__PURE__ */ React.createElement(
|
||||
"div",
|
||||
{
|
||||
className: (0, import_classnames.default)(
|
||||
`${componentName}`,
|
||||
prev && `${componentName}-prev`,
|
||||
next && `${componentName}-next`,
|
||||
disabled && `${componentName}--disable`,
|
||||
!show && `${componentName}--hide`,
|
||||
className
|
||||
)
|
||||
},
|
||||
/* @__PURE__ */ React.createElement(import_antd.Button, { type: "text", disabled, onClick }, /* @__PURE__ */ React.createElement(import_meta.Icon, { size: 28, color, icon: prev ? "icon-qiehuanzuo" : "icon-qiehuanyou" }))
|
||||
);
|
||||
};
|
||||
var navigation_default = Navigation;
|
@ -0,0 +1,44 @@
|
||||
.zhst-image__nav {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
width: 48px;
|
||||
height: 100%;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
font-size: 0;
|
||||
|
||||
&>button {
|
||||
& span {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
:global {
|
||||
i:hover {
|
||||
color: #f0f0f0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
&--disable {
|
||||
:global {
|
||||
i {
|
||||
color: #f0f0f0;
|
||||
cursor: not-allowed !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&--hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&-prev {
|
||||
left: 20px;
|
||||
}
|
||||
|
||||
&-next {
|
||||
right: 20px;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 514 B |
3
packages/biz/lib/BigImageModal/index.d.ts
vendored
Normal file
3
packages/biz/lib/BigImageModal/index.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import BigImageModal from "./BigImageModal";
|
||||
export type { BigImageModalProps } from './BigImageModal';
|
||||
export default BigImageModal;
|
36
packages/biz/lib/BigImageModal/index.js
Normal file
36
packages/biz/lib/BigImageModal/index.js
Normal file
@ -0,0 +1,36 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/BigImageModal/index.tsx
|
||||
var BigImageModal_exports = {};
|
||||
__export(BigImageModal_exports, {
|
||||
default: () => BigImageModal_default
|
||||
});
|
||||
module.exports = __toCommonJS(BigImageModal_exports);
|
||||
var import_BigImageModal = __toESM(require("./BigImageModal"));
|
||||
var BigImageModal_default = import_BigImageModal.default;
|
770
packages/biz/lib/BigImageModal/index.less
Normal file
770
packages/biz/lib/BigImageModal/index.less
Normal file
@ -0,0 +1,770 @@
|
||||
.zhst-image {
|
||||
.zhst-dialog-content {
|
||||
box-shadow: 0 4px 12px rgb(0 0 0 / 20%);
|
||||
}
|
||||
|
||||
|
||||
&-view-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 532px;
|
||||
margin-bottom: 16px;
|
||||
|
||||
&__nav {
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
top: 50%;
|
||||
width: 40px !important;
|
||||
height: 40px !important;
|
||||
background: #d9d9d9;
|
||||
border-radius: 100%;
|
||||
cursor: pointer;
|
||||
transform: translateY(-50%);
|
||||
|
||||
&>button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
&--disabled {
|
||||
opacity: 0.3;
|
||||
|
||||
&>button {
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__nav:hover {
|
||||
background: #09f;
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
|
||||
&-tool-container {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
&__face-score {
|
||||
position: absolute;
|
||||
right: 90px;
|
||||
bottom: 80px;
|
||||
color: red;
|
||||
font-family: 'Microsoft YaHei';
|
||||
font-size: 19px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
&-carousel-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
margin-top: 16px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.zhst-image__tool {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
|
||||
&-split {
|
||||
width: 0;
|
||||
height: 14px;
|
||||
|
||||
&::before {
|
||||
display: block;
|
||||
height: 100%;
|
||||
border-left: 1px solid #e6e7eb;
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
|
||||
&-zoom {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
&> :not(:last-child) {
|
||||
margin-right: 14px;
|
||||
}
|
||||
|
||||
&__scale {
|
||||
display: inline-block;
|
||||
width: 38px;
|
||||
height: 14px;
|
||||
|
||||
// margin-left: 15px;
|
||||
box-sizing: content-box;
|
||||
border: 1px solid rgb(77 77 77 / 100%);
|
||||
margin-top: 2px; //对齐
|
||||
background: rgb(255 255 255 / 100%);
|
||||
border-radius: 2px;
|
||||
color: #4d4d4d;
|
||||
cursor: default;
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
&-switch {
|
||||
display: flex;
|
||||
width: 30px;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0 26px;
|
||||
}
|
||||
|
||||
&-left {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
|
||||
&> :not(:last-child) {
|
||||
margin-right: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
&-right {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
|
||||
&> :not(:first-child) {
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
&-icon-container {
|
||||
font-size: 14px;
|
||||
|
||||
&--active {
|
||||
color: #5584ff !important;
|
||||
}
|
||||
|
||||
&> :first-child {
|
||||
margin-right: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.zhst-image__carousel {
|
||||
position: relative;
|
||||
display: flex;
|
||||
width: 742px;
|
||||
height: 100px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 1px solid #f0f0f0;
|
||||
margin: 0 auto;
|
||||
background: #fafafa;
|
||||
border-radius: 2px;
|
||||
user-select: none;
|
||||
|
||||
&-container {
|
||||
width: (58px + 8px) * 10;
|
||||
}
|
||||
|
||||
&-item {
|
||||
display: flex;
|
||||
width: 58px + 8px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
&-item-img {
|
||||
/* 尝试消除transform 副作用 */
|
||||
position: relative;
|
||||
z-index: 99;
|
||||
|
||||
// width: 58px;
|
||||
// height: 76px;
|
||||
display: flex;
|
||||
width: 66px;
|
||||
height: 84px;
|
||||
box-sizing: border-box;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #fafafa;
|
||||
cursor: pointer;
|
||||
|
||||
/* 尝试消除transform 副作用 end */
|
||||
&--active {
|
||||
border: 2px solid #09f;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
&>div {
|
||||
/* 尝试消除transform 副作用 */
|
||||
position: relative;
|
||||
z-index: 99;
|
||||
overflow: hidden;
|
||||
width: 58px;
|
||||
height: 76px;
|
||||
|
||||
/* 尝试消除transform 副作用 end */
|
||||
&>img {
|
||||
width: 58px;
|
||||
height: 76px;
|
||||
object-fit: contain;
|
||||
transition: all 0.2s;
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.zhst-image__header {
|
||||
width: 100%;
|
||||
// margin-top: 3px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
&__pad0 {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
&__pad66 {
|
||||
padding: 0 66px;
|
||||
}
|
||||
|
||||
&__bar {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
background: #f6f6f6;
|
||||
// box-shadow: 0px 0px 8px 0px rgba(172, 172, 172, 0.5);
|
||||
justify-content: center;
|
||||
// border-color: #f0f0f0;
|
||||
// border-bottom-width: 1px;
|
||||
// border-bottom-style: solid;
|
||||
}
|
||||
|
||||
&__barNoColor {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
border-color: #f0f0f0;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
}
|
||||
|
||||
&__item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
height: 40px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 0 15px;
|
||||
color: #999;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
line-height: 19px;
|
||||
transition: font-size 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
// font-size: 18px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
width: 0;
|
||||
border-bottom: 2px solid #09f;
|
||||
content: '';
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
&--active {
|
||||
background-color: transparent;
|
||||
color: #333;
|
||||
font-size: 18px;
|
||||
|
||||
// color: #0099ff;
|
||||
&::before {
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.zhst-image__compater-view {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&>div:first-child {
|
||||
margin-right: 25px;
|
||||
}
|
||||
|
||||
&>div:last-child {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
&__container {
|
||||
position: relative;
|
||||
width: 345px;
|
||||
height: 460px;
|
||||
box-sizing: content-box;
|
||||
border: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
&__view {
|
||||
width: 345px;
|
||||
height: 460px;
|
||||
}
|
||||
|
||||
&__label {
|
||||
position: absolute;
|
||||
z-index: 99;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
height: 34px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
// width: 48px;
|
||||
padding: 0 6px;
|
||||
background: #09f;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&__tool {
|
||||
display: flex;
|
||||
width: 345px;
|
||||
height: 40px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f9f9f9;
|
||||
|
||||
i,
|
||||
span {
|
||||
color: #333 !important;
|
||||
}
|
||||
|
||||
i {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
&>*:not(:last-child) {
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
&__scale {
|
||||
display: inline-block;
|
||||
width: 38px;
|
||||
height: 16px;
|
||||
|
||||
// margin-left: 15px;
|
||||
box-sizing: content-box;
|
||||
border: 1px solid rgb(77 77 77 / 100%);
|
||||
background: rgb(255 255 255 / 100%);
|
||||
border-radius: 2px;
|
||||
color: #4d4d4d;
|
||||
cursor: default;
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&__line {
|
||||
width: 1px;
|
||||
height: 14px;
|
||||
background: #e6e6e6;
|
||||
}
|
||||
}
|
||||
|
||||
&__empty {
|
||||
position: absolute;
|
||||
z-index: 9;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f9f9f9;
|
||||
transform: translateY(-100%);
|
||||
|
||||
&>img {
|
||||
width: 140px;
|
||||
height: 80px;
|
||||
}
|
||||
|
||||
&--text {
|
||||
color: #999;
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
&__scoll-module {
|
||||
position: absolute;
|
||||
top: 0%;
|
||||
left: 0%;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
pointer-events: none;
|
||||
|
||||
&__btn {
|
||||
display: flex;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 6px;
|
||||
border-radius: 50%;
|
||||
opacity: 0.5;
|
||||
pointer-events: all;
|
||||
|
||||
&>span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
&__btn:hover {
|
||||
background-color: #09f !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.zhst-image__trackmodel {
|
||||
&__panel {
|
||||
position: relative;
|
||||
z-index: 99;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 320px;
|
||||
height: 100%;
|
||||
background-color: #fff;
|
||||
|
||||
&--head {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
padding: 0 16px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
line-height: 40px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
&--track {
|
||||
height: calc(100% - 40px);
|
||||
}
|
||||
|
||||
&-date {
|
||||
padding: 10px 6px;
|
||||
|
||||
// position: absolute;
|
||||
}
|
||||
}
|
||||
|
||||
&--bigImage {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
justify-content: center;
|
||||
padding-top: 59px;
|
||||
background: rgb(0 0 0 / 40%);
|
||||
|
||||
&--image {
|
||||
width: 946px;
|
||||
height: 532px;
|
||||
|
||||
&>img {
|
||||
width: 946px;
|
||||
height: 532px;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
&--close {
|
||||
margin-left: 16px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
&__flooter {
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
bottom: -124px;
|
||||
left: 0;
|
||||
width: calc(100% - 320px - 10px);
|
||||
height: 144px;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 8px 0 rgb(172 172 172 / 50%);
|
||||
|
||||
&--head {
|
||||
display: flex;
|
||||
height: 20px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f6f6f6;
|
||||
color: #999;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
&--body {
|
||||
display: flex;
|
||||
height: calc(100% - 20px);
|
||||
padding-left: 50px;
|
||||
|
||||
&__title {
|
||||
color: #333;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
&__text {
|
||||
overflow: hidden;
|
||||
color: #333;
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&--left {
|
||||
display: flex;
|
||||
width: 75px;
|
||||
height: 100;
|
||||
align-items: center;
|
||||
|
||||
&>img {
|
||||
width: 75px;
|
||||
height: 100px;
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
&--middle {
|
||||
display: grid;
|
||||
width: 331px;
|
||||
justify-content: flex-start;
|
||||
padding: 8px 20px;
|
||||
border-right: 1px solid #f0f0f0;
|
||||
|
||||
&>div {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
&--right {
|
||||
display: grid;
|
||||
width: calc(100% - 331px - 75px);
|
||||
padding: 8px 20px;
|
||||
|
||||
&>div {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
&__button-list {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&>button {
|
||||
margin-right: 20px;
|
||||
|
||||
&>span {
|
||||
color: #09f !important;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
&>span {
|
||||
color: #247fdb !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes close {
|
||||
from {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
to {
|
||||
bottom: -124px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes open {
|
||||
from {
|
||||
bottom: -124px;
|
||||
}
|
||||
|
||||
to {
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&--close {
|
||||
bottom: -124px;
|
||||
animation-duration: 1s;
|
||||
animation-name: close;
|
||||
}
|
||||
|
||||
&--open {
|
||||
bottom: 0;
|
||||
animation-duration: 1s;
|
||||
animation-name: open;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.zhst-image__null {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&__text {
|
||||
// margin-left: 105px;
|
||||
margin-top: 8px;
|
||||
color: #999;
|
||||
font-size: 14px;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.zhst-image__attributePanel {
|
||||
margin: 0 66px;
|
||||
background: #f6f6f6;
|
||||
margin-top: 20px;
|
||||
padding-top: 16px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
&>div:first-child {
|
||||
width: fit-content;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
&-title {
|
||||
color: rgb(0 0 0 / 88%);
|
||||
font-weight: bold;
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
&-item {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
&-label {
|
||||
color: rgb(0 0 0 / 45%);
|
||||
}
|
||||
|
||||
&-value {
|
||||
color: rgb(0 0 0 / 88%);
|
||||
}
|
||||
}
|
||||
|
||||
.relatedWrapper {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
padding: 0 30px;
|
||||
margin-bottom: 30px;
|
||||
box-sizing: border-box;
|
||||
|
||||
.relatedTabs {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.relatedContent {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
|
||||
.relatedPics {
|
||||
width: 742px;
|
||||
height: 100px;
|
||||
// display: flex;
|
||||
// box-sizing: border-box;
|
||||
// background: #fafafa;
|
||||
// border-radius: 2px;
|
||||
// border: 1px solid #f0f0f0;
|
||||
// .LeftBtn,
|
||||
// .RighttBtn {
|
||||
// width: 34px;
|
||||
// height: 100%;
|
||||
// display: flex;
|
||||
// justify-content: center;
|
||||
// align-items: center;
|
||||
// }
|
||||
// .ListContent {
|
||||
// flex: 1;
|
||||
// height: 100%;
|
||||
// }
|
||||
}
|
||||
|
||||
.disabled {
|
||||
color: rgba(0, 0, 0, 25%);
|
||||
}
|
||||
|
||||
.relatedBtn {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: #09f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:global {
|
||||
.ant-tabs-left>.ant-tabs-content-holder>.ant-tabs-content>.ant-tabs-tabpane {
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.ant-tabs-tab {
|
||||
padding: 8px 12px !important;
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.ant-tabs .ant-tabs-tab {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
}
|
294
packages/biz/lib/BigImageModal/mock.d.ts
vendored
Normal file
294
packages/biz/lib/BigImageModal/mock.d.ts
vendored
Normal file
@ -0,0 +1,294 @@
|
||||
export declare const IMAGE_DATA: {
|
||||
enAbleDeleteFeature: boolean;
|
||||
tabsFilter: string[];
|
||||
dataSources: {
|
||||
objectId: string;
|
||||
condition: {
|
||||
featureInfo: null;
|
||||
featureData: string;
|
||||
imageData: string;
|
||||
alg: string;
|
||||
rect: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
objectImageUrl: string;
|
||||
srcImageUrl: string;
|
||||
};
|
||||
score: number;
|
||||
timestamp: number;
|
||||
deviceId: string;
|
||||
id: string;
|
||||
name: string;
|
||||
dirid: string;
|
||||
status: string;
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
caseId: string;
|
||||
caseGroup: string;
|
||||
isDeleted: string;
|
||||
extendInfo: {
|
||||
vmsPlatformId: string;
|
||||
vmsChannel: string;
|
||||
vmsCameraDecoderTag: string;
|
||||
platformPluginType: string;
|
||||
deviceVender: string;
|
||||
type: string;
|
||||
ip: string;
|
||||
port: string;
|
||||
username: string;
|
||||
passwd: string;
|
||||
rtspAddress: string;
|
||||
facesnapChannel: string;
|
||||
edgeDeviceSn: string;
|
||||
platform1400Id: number;
|
||||
useRtspAddress: boolean;
|
||||
frameCheck: boolean;
|
||||
frameRectX: number;
|
||||
frameRectY: number;
|
||||
frameRectW: number;
|
||||
frameRectH: number;
|
||||
edgeNodeId: string;
|
||||
processStatus: string;
|
||||
};
|
||||
objectIndex: {
|
||||
objectId: string;
|
||||
solutionId: string;
|
||||
deviceId: string;
|
||||
fragmentId: string;
|
||||
};
|
||||
objectType: string;
|
||||
isObjectTrack: boolean;
|
||||
pathId: string;
|
||||
frameInfo: {
|
||||
frameId: string;
|
||||
frameTimestamp: string;
|
||||
width: number;
|
||||
height: number;
|
||||
originWidth: number;
|
||||
originHeight: number;
|
||||
offsetTime: string;
|
||||
skipNumber: string;
|
||||
};
|
||||
level: number;
|
||||
bboxInFrame: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
bboxExtInFrame: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
objectImageKey: string;
|
||||
objectExtImageKey: string;
|
||||
frameImageKey: string;
|
||||
confidence: number;
|
||||
sourceObjectId: string;
|
||||
storeTimestamp: string;
|
||||
gbNumber: string;
|
||||
qualityScore: number;
|
||||
subObjectCount: number;
|
||||
subObjectType: string[];
|
||||
subObjectIds: string[];
|
||||
cameraInfo: {
|
||||
id: string;
|
||||
name: string;
|
||||
dirid: string;
|
||||
status: string;
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
caseId: string;
|
||||
caseGroup: string;
|
||||
isDeleted: string;
|
||||
extendInfo: {
|
||||
vmsPlatformId: string;
|
||||
vmsChannel: string;
|
||||
vmsCameraDecoderTag: string;
|
||||
platformPluginType: string;
|
||||
deviceVender: string;
|
||||
type: string;
|
||||
ip: string;
|
||||
port: string;
|
||||
username: string;
|
||||
passwd: string;
|
||||
rtspAddress: string;
|
||||
facesnapChannel: string;
|
||||
edgeDeviceSn: string;
|
||||
platform1400Id: number;
|
||||
useRtspAddress: boolean;
|
||||
frameCheck: boolean;
|
||||
frameRectX: number;
|
||||
frameRectY: number;
|
||||
frameRectW: number;
|
||||
frameRectH: number;
|
||||
edgeNodeId: string;
|
||||
processStatus: string;
|
||||
};
|
||||
};
|
||||
solutionId: string;
|
||||
fragmentId: string;
|
||||
contrastKey: string;
|
||||
compaterImages: string[];
|
||||
imgSummary: string;
|
||||
imageKey: string;
|
||||
srcImageUrl: string;
|
||||
algorithmVersion: string;
|
||||
cameraId: string;
|
||||
cameraName: string;
|
||||
}[];
|
||||
selectIndex: number;
|
||||
disableBtn: number[];
|
||||
dataSource: {
|
||||
objectId: string;
|
||||
condition: {
|
||||
featureInfo: null;
|
||||
featureData: string;
|
||||
imageData: string;
|
||||
alg: string;
|
||||
rect: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
objectImageUrl: string;
|
||||
srcImageUrl: string;
|
||||
};
|
||||
score: number;
|
||||
timestamp: number;
|
||||
deviceId: string;
|
||||
id: string;
|
||||
name: string;
|
||||
dirid: string;
|
||||
status: string;
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
caseId: string;
|
||||
caseGroup: string;
|
||||
isDeleted: string;
|
||||
extendInfo: {
|
||||
vmsPlatformId: string;
|
||||
vmsChannel: string;
|
||||
vmsCameraDecoderTag: string;
|
||||
platformPluginType: string;
|
||||
deviceVender: string;
|
||||
type: string;
|
||||
ip: string;
|
||||
port: string;
|
||||
username: string;
|
||||
passwd: string;
|
||||
rtspAddress: string;
|
||||
facesnapChannel: string;
|
||||
edgeDeviceSn: string;
|
||||
platform1400Id: number;
|
||||
useRtspAddress: boolean;
|
||||
frameCheck: boolean;
|
||||
frameRectX: number;
|
||||
frameRectY: number;
|
||||
frameRectW: number;
|
||||
frameRectH: number;
|
||||
edgeNodeId: string;
|
||||
processStatus: string;
|
||||
};
|
||||
objectIndex: {
|
||||
objectId: string;
|
||||
solutionId: string;
|
||||
deviceId: string;
|
||||
fragmentId: string;
|
||||
};
|
||||
objectType: string;
|
||||
isObjectTrack: boolean;
|
||||
pathId: string;
|
||||
frameInfo: {
|
||||
frameId: string;
|
||||
frameTimestamp: string;
|
||||
width: number;
|
||||
height: number;
|
||||
originWidth: number;
|
||||
originHeight: number;
|
||||
offsetTime: string;
|
||||
skipNumber: string;
|
||||
};
|
||||
level: number;
|
||||
bboxInFrame: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
bboxExtInFrame: {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
objectImageKey: string;
|
||||
objectExtImageKey: string;
|
||||
frameImageKey: string;
|
||||
confidence: number;
|
||||
sourceObjectId: string;
|
||||
storeTimestamp: string;
|
||||
gbNumber: string;
|
||||
qualityScore: number;
|
||||
subObjectCount: number;
|
||||
subObjectType: string[];
|
||||
subObjectIds: string[];
|
||||
cameraInfo: {
|
||||
id: string;
|
||||
name: string;
|
||||
dirid: string;
|
||||
status: string;
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
caseId: string;
|
||||
caseGroup: string;
|
||||
isDeleted: string;
|
||||
extendInfo: {
|
||||
vmsPlatformId: string;
|
||||
vmsChannel: string;
|
||||
vmsCameraDecoderTag: string;
|
||||
platformPluginType: string;
|
||||
deviceVender: string;
|
||||
type: string;
|
||||
ip: string;
|
||||
port: string;
|
||||
username: string;
|
||||
passwd: string;
|
||||
rtspAddress: string;
|
||||
facesnapChannel: string;
|
||||
edgeDeviceSn: string;
|
||||
platform1400Id: number;
|
||||
useRtspAddress: boolean;
|
||||
frameCheck: boolean;
|
||||
frameRectX: number;
|
||||
frameRectY: number;
|
||||
frameRectW: number;
|
||||
frameRectH: number;
|
||||
edgeNodeId: string;
|
||||
processStatus: string;
|
||||
};
|
||||
};
|
||||
solutionId: string;
|
||||
fragmentId: string;
|
||||
contrastKey: string;
|
||||
compaterImages: string[];
|
||||
imgSummary: string;
|
||||
imageKey: string;
|
||||
srcImageUrl: string;
|
||||
algorithmVersion: string;
|
||||
cameraId: string;
|
||||
cameraName: string;
|
||||
}[];
|
||||
isArchiveDetail: boolean;
|
||||
ToolProps: {
|
||||
renderVideoBtn: boolean;
|
||||
disableVideo: boolean;
|
||||
};
|
||||
specialTitle: string;
|
||||
};
|
930
packages/biz/lib/BigImageModal/mock.js
Normal file
930
packages/biz/lib/BigImageModal/mock.js
Normal file
@ -0,0 +1,930 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/BigImageModal/mock.ts
|
||||
var mock_exports = {};
|
||||
__export(mock_exports, {
|
||||
IMAGE_DATA: () => IMAGE_DATA
|
||||
});
|
||||
module.exports = __toCommonJS(mock_exports);
|
||||
var IMAGE_DATA = {
|
||||
"enAbleDeleteFeature": true,
|
||||
"tabsFilter": [
|
||||
"COMPATER",
|
||||
"NORMAL"
|
||||
],
|
||||
"dataSources": [
|
||||
{
|
||||
"objectId": "1742110565582518272",
|
||||
"condition": {
|
||||
"featureInfo": null,
|
||||
"featureData": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"imageData": "",
|
||||
"alg": "VERSION_REID_HEAD_ATTR",
|
||||
"rect": {
|
||||
"x": 0.271875,
|
||||
"y": 0.32222223,
|
||||
"w": 0.2859375,
|
||||
"h": 0.67777777
|
||||
},
|
||||
"objectImageUrl": "singer-20240102/1/129529/1742047651878156288.jpg",
|
||||
"srcImageUrl": "singer-20240102/1/129529/1742047652511496192.jpg"
|
||||
},
|
||||
"score": 0.7163062,
|
||||
"timestamp": 1704186491979,
|
||||
"deviceId": "129533",
|
||||
"id": "129533",
|
||||
"name": "4楼门口过道人脸",
|
||||
"dirid": "0",
|
||||
"status": "1",
|
||||
"longitude": 120.125,
|
||||
"latitude": 30.280500411987305,
|
||||
"caseId": "0",
|
||||
"caseGroup": "",
|
||||
"isDeleted": "DEVICEMANAGER_BOOL_DEFAULT",
|
||||
"extendInfo": {
|
||||
"vmsPlatformId": "29",
|
||||
"vmsChannel": "38",
|
||||
"vmsCameraDecoderTag": "hikvision",
|
||||
"platformPluginType": "PLATFORM_PLUGIN_TYPE_HAIKANG_NVR",
|
||||
"deviceVender": "0",
|
||||
"type": "DEVICEMANAGER_CAMERA_TYPE_NORMAL",
|
||||
"ip": "",
|
||||
"port": "0",
|
||||
"username": "",
|
||||
"passwd": "",
|
||||
"rtspAddress": "",
|
||||
"facesnapChannel": "",
|
||||
"edgeDeviceSn": "",
|
||||
"platform1400Id": 0,
|
||||
"useRtspAddress": false,
|
||||
"frameCheck": false,
|
||||
"frameRectX": 0,
|
||||
"frameRectY": 0,
|
||||
"frameRectW": 0,
|
||||
"frameRectH": 0,
|
||||
"edgeNodeId": "0",
|
||||
"processStatus": "FILTER_REALTIME_DEFAULT"
|
||||
},
|
||||
"objectIndex": {
|
||||
"objectId": "1742110565582518272",
|
||||
"solutionId": "1",
|
||||
"deviceId": "129533",
|
||||
"fragmentId": "0"
|
||||
},
|
||||
"objectType": "OBJECT_TYPE_PEDESTRAIN",
|
||||
"isObjectTrack": true,
|
||||
"pathId": "1742110532019697664",
|
||||
"frameInfo": {
|
||||
"frameId": "0",
|
||||
"frameTimestamp": "1704186491979",
|
||||
"width": 0,
|
||||
"height": 0,
|
||||
"originWidth": 1920,
|
||||
"originHeight": 1080,
|
||||
"offsetTime": "24714687",
|
||||
"skipNumber": "0"
|
||||
},
|
||||
"level": 1,
|
||||
"bboxInFrame": {
|
||||
"x": 0.603125,
|
||||
"y": 0.3314815,
|
||||
"w": 0.0578125,
|
||||
"h": 0.2712963
|
||||
},
|
||||
"bboxExtInFrame": {
|
||||
"x": 0.546875,
|
||||
"y": 0.2638889,
|
||||
"w": 0.17135416,
|
||||
"h": 0.40648147
|
||||
},
|
||||
"objectImageKey": "",
|
||||
"objectExtImageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742110565582518272.jpg",
|
||||
"frameImageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742110565603489792.jpg",
|
||||
"confidence": 0.817271,
|
||||
"sourceObjectId": "1742110565603489792",
|
||||
"storeTimestamp": "0",
|
||||
"gbNumber": "",
|
||||
"qualityScore": 0,
|
||||
"subObjectCount": 1,
|
||||
"subObjectType": [
|
||||
"OBJECT_TYPE_FACE"
|
||||
],
|
||||
"subObjectIds": [
|
||||
"1742110532015503360"
|
||||
],
|
||||
"cameraInfo": {
|
||||
"id": "129533",
|
||||
"name": "4楼门口过道人脸",
|
||||
"dirid": "0",
|
||||
"status": "1",
|
||||
"longitude": 120.125,
|
||||
"latitude": 30.280500411987305,
|
||||
"caseId": "0",
|
||||
"caseGroup": "",
|
||||
"isDeleted": "DEVICEMANAGER_BOOL_DEFAULT",
|
||||
"extendInfo": {
|
||||
"vmsPlatformId": "29",
|
||||
"vmsChannel": "38",
|
||||
"vmsCameraDecoderTag": "hikvision",
|
||||
"platformPluginType": "PLATFORM_PLUGIN_TYPE_HAIKANG_NVR",
|
||||
"deviceVender": "0",
|
||||
"type": "DEVICEMANAGER_CAMERA_TYPE_NORMAL",
|
||||
"ip": "",
|
||||
"port": "0",
|
||||
"username": "",
|
||||
"passwd": "",
|
||||
"rtspAddress": "",
|
||||
"facesnapChannel": "",
|
||||
"edgeDeviceSn": "",
|
||||
"platform1400Id": 0,
|
||||
"useRtspAddress": false,
|
||||
"frameCheck": false,
|
||||
"frameRectX": 0,
|
||||
"frameRectY": 0,
|
||||
"frameRectW": 0,
|
||||
"frameRectH": 0,
|
||||
"edgeNodeId": "0",
|
||||
"processStatus": "FILTER_REALTIME_DEFAULT"
|
||||
}
|
||||
},
|
||||
"solutionId": "1",
|
||||
"fragmentId": "0",
|
||||
"contrastKey": "singer-20240102/1/129533/1742110565582518272.jpg",
|
||||
"compaterImages": [
|
||||
"http://10.0.0.7:30003/file/singer-20240102/1/129529/1742047651878156288.jpg"
|
||||
],
|
||||
"imgSummary": "singer-20240102/1/129533/1742110565582518272.jpg",
|
||||
"imageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742110565582518272.jpg",
|
||||
"srcImageUrl": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742110565603489792.jpg",
|
||||
"algorithmVersion": "VERSION_REID_HEAD_ATTR",
|
||||
"cameraId": "129533",
|
||||
"cameraName": "4楼门口过道人脸"
|
||||
},
|
||||
{
|
||||
"objectId": "1742092780462684161",
|
||||
"condition": {
|
||||
"featureInfo": null,
|
||||
"featureData": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"imageData": "",
|
||||
"alg": "VERSION_REID_HEAD_ATTR",
|
||||
"rect": {
|
||||
"x": 0.271875,
|
||||
"y": 0.32222223,
|
||||
"w": 0.2859375,
|
||||
"h": 0.67777777
|
||||
},
|
||||
"objectImageUrl": "singer-20240102/1/129529/1742047651878156288.jpg",
|
||||
"srcImageUrl": "singer-20240102/1/129529/1742047652511496192.jpg"
|
||||
},
|
||||
"score": 0.70154816,
|
||||
"timestamp": 1704182251640,
|
||||
"deviceId": "129533",
|
||||
"id": "129533",
|
||||
"name": "4楼门口过道人脸",
|
||||
"dirid": "0",
|
||||
"status": "1",
|
||||
"longitude": 120.125,
|
||||
"latitude": 30.280500411987305,
|
||||
"caseId": "0",
|
||||
"caseGroup": "",
|
||||
"isDeleted": "DEVICEMANAGER_BOOL_DEFAULT",
|
||||
"extendInfo": {
|
||||
"vmsPlatformId": "29",
|
||||
"vmsChannel": "38",
|
||||
"vmsCameraDecoderTag": "hikvision",
|
||||
"platformPluginType": "PLATFORM_PLUGIN_TYPE_HAIKANG_NVR",
|
||||
"deviceVender": "0",
|
||||
"type": "DEVICEMANAGER_CAMERA_TYPE_NORMAL",
|
||||
"ip": "",
|
||||
"port": "0",
|
||||
"username": "",
|
||||
"passwd": "",
|
||||
"rtspAddress": "",
|
||||
"facesnapChannel": "",
|
||||
"edgeDeviceSn": "",
|
||||
"platform1400Id": 0,
|
||||
"useRtspAddress": false,
|
||||
"frameCheck": false,
|
||||
"frameRectX": 0,
|
||||
"frameRectY": 0,
|
||||
"frameRectW": 0,
|
||||
"frameRectH": 0,
|
||||
"edgeNodeId": "0",
|
||||
"processStatus": "FILTER_REALTIME_DEFAULT"
|
||||
},
|
||||
"objectIndex": {
|
||||
"objectId": "1742092780462684161",
|
||||
"solutionId": "1",
|
||||
"deviceId": "129533",
|
||||
"fragmentId": "0"
|
||||
},
|
||||
"objectType": "OBJECT_TYPE_PEDESTRAIN",
|
||||
"isObjectTrack": true,
|
||||
"pathId": "1742092746237163520",
|
||||
"frameInfo": {
|
||||
"frameId": "0",
|
||||
"frameTimestamp": "1704182251640",
|
||||
"width": 0,
|
||||
"height": 0,
|
||||
"originWidth": 1920,
|
||||
"originHeight": 1080,
|
||||
"offsetTime": "20474348",
|
||||
"skipNumber": "0"
|
||||
},
|
||||
"level": 1,
|
||||
"bboxInFrame": {
|
||||
"x": 0.63177085,
|
||||
"y": 0.38333333,
|
||||
"w": 0.078125,
|
||||
"h": 0.3537037
|
||||
},
|
||||
"bboxExtInFrame": {
|
||||
"x": 0.55885416,
|
||||
"y": 0.29537037,
|
||||
"w": 0.22447917,
|
||||
"h": 0.5314815
|
||||
},
|
||||
"objectImageKey": "",
|
||||
"objectExtImageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742092780462684161.jpg",
|
||||
"frameImageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742092780768868352.jpg",
|
||||
"confidence": 0.888334,
|
||||
"sourceObjectId": "1742092780768868352",
|
||||
"storeTimestamp": "0",
|
||||
"gbNumber": "",
|
||||
"qualityScore": 0,
|
||||
"subObjectCount": 1,
|
||||
"subObjectType": [
|
||||
"OBJECT_TYPE_FACE"
|
||||
],
|
||||
"subObjectIds": [
|
||||
"1742092746232969217"
|
||||
],
|
||||
"cameraInfo": {
|
||||
"id": "129533",
|
||||
"name": "4楼门口过道人脸",
|
||||
"dirid": "0",
|
||||
"status": "1",
|
||||
"longitude": 120.125,
|
||||
"latitude": 30.280500411987305,
|
||||
"caseId": "0",
|
||||
"caseGroup": "",
|
||||
"isDeleted": "DEVICEMANAGER_BOOL_DEFAULT",
|
||||
"extendInfo": {
|
||||
"vmsPlatformId": "29",
|
||||
"vmsChannel": "38",
|
||||
"vmsCameraDecoderTag": "hikvision",
|
||||
"platformPluginType": "PLATFORM_PLUGIN_TYPE_HAIKANG_NVR",
|
||||
"deviceVender": "0",
|
||||
"type": "DEVICEMANAGER_CAMERA_TYPE_NORMAL",
|
||||
"ip": "",
|
||||
"port": "0",
|
||||
"username": "",
|
||||
"passwd": "",
|
||||
"rtspAddress": "",
|
||||
"facesnapChannel": "",
|
||||
"edgeDeviceSn": "",
|
||||
"platform1400Id": 0,
|
||||
"useRtspAddress": false,
|
||||
"frameCheck": false,
|
||||
"frameRectX": 0,
|
||||
"frameRectY": 0,
|
||||
"frameRectW": 0,
|
||||
"frameRectH": 0,
|
||||
"edgeNodeId": "0",
|
||||
"processStatus": "FILTER_REALTIME_DEFAULT"
|
||||
}
|
||||
},
|
||||
"solutionId": "1",
|
||||
"fragmentId": "0",
|
||||
"contrastKey": "singer-20240102/1/129533/1742092780462684161.jpg",
|
||||
"compaterImages": [
|
||||
"http://10.0.0.7:30003/file/singer-20240102/1/129529/1742047651878156288.jpg"
|
||||
],
|
||||
"imgSummary": "singer-20240102/1/129533/1742092780462684161.jpg",
|
||||
"imageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742092780462684161.jpg",
|
||||
"srcImageUrl": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742092780768868352.jpg",
|
||||
"algorithmVersion": "VERSION_REID_HEAD_ATTR",
|
||||
"cameraId": "129533",
|
||||
"cameraName": "4楼门口过道人脸"
|
||||
},
|
||||
{
|
||||
"objectId": "1742092514409592832",
|
||||
"condition": {
|
||||
"featureInfo": null,
|
||||
"featureData": "AAAAAAAAAAAAAAA==",
|
||||
"imageData": "",
|
||||
"alg": "VERSION_REID_HEAD_ATTR",
|
||||
"rect": {
|
||||
"x": 0.271875,
|
||||
"y": 0.32222223,
|
||||
"w": 0.2859375,
|
||||
"h": 0.67777777
|
||||
},
|
||||
"objectImageUrl": "singer-20240102/1/129529/1742047651878156288.jpg",
|
||||
"srcImageUrl": "singer-20240102/1/129529/1742047652511496192.jpg"
|
||||
},
|
||||
"score": 0.703765,
|
||||
"timestamp": 1704182186451,
|
||||
"deviceId": "129529",
|
||||
"id": "129529",
|
||||
"name": "4入口人脸",
|
||||
"dirid": "0",
|
||||
"status": "1",
|
||||
"longitude": 120.12100219726562,
|
||||
"latitude": 30.280099868774414,
|
||||
"caseId": "0",
|
||||
"caseGroup": "",
|
||||
"isDeleted": "DEVICEMANAGER_BOOL_DEFAULT",
|
||||
"extendInfo": {
|
||||
"vmsPlatformId": "29",
|
||||
"vmsChannel": "34",
|
||||
"vmsCameraDecoderTag": "hikvision",
|
||||
"platformPluginType": "PLATFORM_PLUGIN_TYPE_HAIKANG_NVR",
|
||||
"deviceVender": "0",
|
||||
"type": "DEVICEMANAGER_CAMERA_TYPE_NORMAL",
|
||||
"ip": "",
|
||||
"port": "0",
|
||||
"username": "",
|
||||
"passwd": "",
|
||||
"rtspAddress": "",
|
||||
"facesnapChannel": "",
|
||||
"edgeDeviceSn": "",
|
||||
"platform1400Id": 0,
|
||||
"useRtspAddress": false,
|
||||
"frameCheck": false,
|
||||
"frameRectX": 0,
|
||||
"frameRectY": 0,
|
||||
"frameRectW": 0,
|
||||
"frameRectH": 0,
|
||||
"edgeNodeId": "0",
|
||||
"processStatus": "FILTER_REALTIME_DEFAULT"
|
||||
},
|
||||
"objectIndex": {
|
||||
"objectId": "1742092514409592832",
|
||||
"solutionId": "1",
|
||||
"deviceId": "129529",
|
||||
"fragmentId": "0"
|
||||
},
|
||||
"objectType": "OBJECT_TYPE_PEDESTRAIN",
|
||||
"isObjectTrack": true,
|
||||
"pathId": "1742092482440607744",
|
||||
"frameInfo": {
|
||||
"frameId": "0",
|
||||
"frameTimestamp": "1704182186451",
|
||||
"width": 0,
|
||||
"height": 0,
|
||||
"originWidth": 2560,
|
||||
"originHeight": 1440,
|
||||
"offsetTime": "20409182",
|
||||
"skipNumber": "0"
|
||||
},
|
||||
"level": 1,
|
||||
"bboxInFrame": {
|
||||
"x": 0.6195313,
|
||||
"y": 0.24583334,
|
||||
"w": 0.09804688,
|
||||
"h": 0.41944444
|
||||
},
|
||||
"bboxExtInFrame": {
|
||||
"x": 0.53515625,
|
||||
"y": 0.14027777,
|
||||
"w": 0.26640624,
|
||||
"h": 0.63125
|
||||
},
|
||||
"objectImageKey": "",
|
||||
"objectExtImageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129529/1742092514409592832.jpg",
|
||||
"frameImageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129529/1742092515508500480.jpg",
|
||||
"confidence": 0.92494,
|
||||
"sourceObjectId": "1742092515508500480",
|
||||
"storeTimestamp": "0",
|
||||
"gbNumber": "",
|
||||
"qualityScore": 0,
|
||||
"subObjectCount": 1,
|
||||
"subObjectType": [
|
||||
"OBJECT_TYPE_FACE"
|
||||
],
|
||||
"subObjectIds": [
|
||||
"1742092482432219136"
|
||||
],
|
||||
"cameraInfo": {
|
||||
"id": "129529",
|
||||
"name": "4入口人脸",
|
||||
"dirid": "0",
|
||||
"status": "1",
|
||||
"longitude": 120.12100219726562,
|
||||
"latitude": 30.280099868774414,
|
||||
"caseId": "0",
|
||||
"caseGroup": "",
|
||||
"isDeleted": "DEVICEMANAGER_BOOL_DEFAULT",
|
||||
"extendInfo": {
|
||||
"vmsPlatformId": "29",
|
||||
"vmsChannel": "34",
|
||||
"vmsCameraDecoderTag": "hikvision",
|
||||
"platformPluginType": "PLATFORM_PLUGIN_TYPE_HAIKANG_NVR",
|
||||
"deviceVender": "0",
|
||||
"type": "DEVICEMANAGER_CAMERA_TYPE_NORMAL",
|
||||
"ip": "",
|
||||
"port": "0",
|
||||
"username": "",
|
||||
"passwd": "",
|
||||
"rtspAddress": "",
|
||||
"facesnapChannel": "",
|
||||
"edgeDeviceSn": "",
|
||||
"platform1400Id": 0,
|
||||
"useRtspAddress": false,
|
||||
"frameCheck": false,
|
||||
"frameRectX": 0,
|
||||
"frameRectY": 0,
|
||||
"frameRectW": 0,
|
||||
"frameRectH": 0,
|
||||
"edgeNodeId": "0",
|
||||
"processStatus": "FILTER_REALTIME_DEFAULT"
|
||||
}
|
||||
},
|
||||
"solutionId": "1",
|
||||
"fragmentId": "0",
|
||||
"contrastKey": "singer-20240102/1/129529/1742092514409592832.jpg",
|
||||
"compaterImages": [
|
||||
"http://10.0.0.7:30003/file/singer-20240102/1/129529/1742047651878156288.jpg"
|
||||
],
|
||||
"imgSummary": "singer-20240102/1/129529/1742092514409592832.jpg",
|
||||
"imageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129529/1742092514409592832.jpg",
|
||||
"srcImageUrl": "http://10.0.0.7:30003/file/singer-20240102/1/129529/1742092515508500480.jpg",
|
||||
"algorithmVersion": "VERSION_REID_HEAD_ATTR",
|
||||
"cameraId": "129529",
|
||||
"cameraName": "4入口人脸"
|
||||
}
|
||||
],
|
||||
"selectIndex": 4,
|
||||
"disableBtn": [
|
||||
0,
|
||||
1,
|
||||
4,
|
||||
20
|
||||
],
|
||||
"dataSource": [
|
||||
{
|
||||
"objectId": "1742110565582518272",
|
||||
"condition": {
|
||||
"featureInfo": null,
|
||||
"featureData": "AAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"imageData": "",
|
||||
"alg": "VERSION_REID_HEAD_ATTR",
|
||||
"rect": {
|
||||
"x": 0.271875,
|
||||
"y": 0.32222223,
|
||||
"w": 0.2859375,
|
||||
"h": 0.67777777
|
||||
},
|
||||
"objectImageUrl": "singer-20240102/1/129529/1742047651878156288.jpg",
|
||||
"srcImageUrl": "singer-20240102/1/129529/1742047652511496192.jpg"
|
||||
},
|
||||
"score": 0.7163062,
|
||||
"timestamp": 1704186491979,
|
||||
"deviceId": "129533",
|
||||
"id": "129533",
|
||||
"name": "4楼门口过道人脸",
|
||||
"dirid": "0",
|
||||
"status": "1",
|
||||
"longitude": 120.125,
|
||||
"latitude": 30.280500411987305,
|
||||
"caseId": "0",
|
||||
"caseGroup": "",
|
||||
"isDeleted": "DEVICEMANAGER_BOOL_DEFAULT",
|
||||
"extendInfo": {
|
||||
"vmsPlatformId": "29",
|
||||
"vmsChannel": "38",
|
||||
"vmsCameraDecoderTag": "hikvision",
|
||||
"platformPluginType": "PLATFORM_PLUGIN_TYPE_HAIKANG_NVR",
|
||||
"deviceVender": "0",
|
||||
"type": "DEVICEMANAGER_CAMERA_TYPE_NORMAL",
|
||||
"ip": "",
|
||||
"port": "0",
|
||||
"username": "",
|
||||
"passwd": "",
|
||||
"rtspAddress": "",
|
||||
"facesnapChannel": "",
|
||||
"edgeDeviceSn": "",
|
||||
"platform1400Id": 0,
|
||||
"useRtspAddress": false,
|
||||
"frameCheck": false,
|
||||
"frameRectX": 0,
|
||||
"frameRectY": 0,
|
||||
"frameRectW": 0,
|
||||
"frameRectH": 0,
|
||||
"edgeNodeId": "0",
|
||||
"processStatus": "FILTER_REALTIME_DEFAULT"
|
||||
},
|
||||
"objectIndex": {
|
||||
"objectId": "1742110565582518272",
|
||||
"solutionId": "1",
|
||||
"deviceId": "129533",
|
||||
"fragmentId": "0"
|
||||
},
|
||||
"objectType": "OBJECT_TYPE_PEDESTRAIN",
|
||||
"isObjectTrack": true,
|
||||
"pathId": "1742110532019697664",
|
||||
"frameInfo": {
|
||||
"frameId": "0",
|
||||
"frameTimestamp": "1704186491979",
|
||||
"width": 0,
|
||||
"height": 0,
|
||||
"originWidth": 1920,
|
||||
"originHeight": 1080,
|
||||
"offsetTime": "24714687",
|
||||
"skipNumber": "0"
|
||||
},
|
||||
"level": 1,
|
||||
"bboxInFrame": {
|
||||
"x": 0.603125,
|
||||
"y": 0.3314815,
|
||||
"w": 0.0578125,
|
||||
"h": 0.2712963
|
||||
},
|
||||
"bboxExtInFrame": {
|
||||
"x": 0.546875,
|
||||
"y": 0.2638889,
|
||||
"w": 0.17135416,
|
||||
"h": 0.40648147
|
||||
},
|
||||
"objectImageKey": "",
|
||||
"objectExtImageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742110565582518272.jpg",
|
||||
"frameImageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742110565603489792.jpg",
|
||||
"confidence": 0.817271,
|
||||
"sourceObjectId": "1742110565603489792",
|
||||
"storeTimestamp": "0",
|
||||
"gbNumber": "",
|
||||
"qualityScore": 0,
|
||||
"subObjectCount": 1,
|
||||
"subObjectType": [
|
||||
"OBJECT_TYPE_FACE"
|
||||
],
|
||||
"subObjectIds": [
|
||||
"1742110532015503360"
|
||||
],
|
||||
"cameraInfo": {
|
||||
"id": "129533",
|
||||
"name": "4楼门口过道人脸",
|
||||
"dirid": "0",
|
||||
"status": "1",
|
||||
"longitude": 120.125,
|
||||
"latitude": 30.280500411987305,
|
||||
"caseId": "0",
|
||||
"caseGroup": "",
|
||||
"isDeleted": "DEVICEMANAGER_BOOL_DEFAULT",
|
||||
"extendInfo": {
|
||||
"vmsPlatformId": "29",
|
||||
"vmsChannel": "38",
|
||||
"vmsCameraDecoderTag": "hikvision",
|
||||
"platformPluginType": "PLATFORM_PLUGIN_TYPE_HAIKANG_NVR",
|
||||
"deviceVender": "0",
|
||||
"type": "DEVICEMANAGER_CAMERA_TYPE_NORMAL",
|
||||
"ip": "",
|
||||
"port": "0",
|
||||
"username": "",
|
||||
"passwd": "",
|
||||
"rtspAddress": "",
|
||||
"facesnapChannel": "",
|
||||
"edgeDeviceSn": "",
|
||||
"platform1400Id": 0,
|
||||
"useRtspAddress": false,
|
||||
"frameCheck": false,
|
||||
"frameRectX": 0,
|
||||
"frameRectY": 0,
|
||||
"frameRectW": 0,
|
||||
"frameRectH": 0,
|
||||
"edgeNodeId": "0",
|
||||
"processStatus": "FILTER_REALTIME_DEFAULT"
|
||||
}
|
||||
},
|
||||
"solutionId": "1",
|
||||
"fragmentId": "0",
|
||||
"contrastKey": "singer-20240102/1/129533/1742110565582518272.jpg",
|
||||
"compaterImages": [
|
||||
"http://10.0.0.7:30003/file/singer-20240102/1/129529/1742047651878156288.jpg"
|
||||
],
|
||||
"imgSummary": "singer-20240102/1/129533/1742110565582518272.jpg",
|
||||
"imageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742110565582518272.jpg",
|
||||
"srcImageUrl": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742110565603489792.jpg",
|
||||
"algorithmVersion": "VERSION_REID_HEAD_ATTR",
|
||||
"cameraId": "129533",
|
||||
"cameraName": "4楼门口过道人脸"
|
||||
},
|
||||
{
|
||||
"objectId": "1742092680994764802",
|
||||
"condition": {
|
||||
"featureInfo": null,
|
||||
"featureData": "AAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"imageData": "",
|
||||
"alg": "VERSION_REID_HEAD_ATTR",
|
||||
"rect": {
|
||||
"x": 0.271875,
|
||||
"y": 0.32222223,
|
||||
"w": 0.2859375,
|
||||
"h": 0.67777777
|
||||
},
|
||||
"objectImageUrl": "singer-20240102/1/129529/1742047651878156288.jpg",
|
||||
"srcImageUrl": "singer-20240102/1/129529/1742047652511496192.jpg"
|
||||
},
|
||||
"score": 0.7007122,
|
||||
"timestamp": 1704182225679,
|
||||
"deviceId": "129533",
|
||||
"id": "129533",
|
||||
"name": "4楼门口过道人脸",
|
||||
"dirid": "0",
|
||||
"status": "1",
|
||||
"longitude": 120.125,
|
||||
"latitude": 30.280500411987305,
|
||||
"caseId": "0",
|
||||
"caseGroup": "",
|
||||
"isDeleted": "DEVICEMANAGER_BOOL_DEFAULT",
|
||||
"extendInfo": {
|
||||
"vmsPlatformId": "29",
|
||||
"vmsChannel": "38",
|
||||
"vmsCameraDecoderTag": "hikvision",
|
||||
"platformPluginType": "PLATFORM_PLUGIN_TYPE_HAIKANG_NVR",
|
||||
"deviceVender": "0",
|
||||
"type": "DEVICEMANAGER_CAMERA_TYPE_NORMAL",
|
||||
"ip": "",
|
||||
"port": "0",
|
||||
"username": "",
|
||||
"passwd": "",
|
||||
"rtspAddress": "",
|
||||
"facesnapChannel": "",
|
||||
"edgeDeviceSn": "",
|
||||
"platform1400Id": 0,
|
||||
"useRtspAddress": false,
|
||||
"frameCheck": false,
|
||||
"frameRectX": 0,
|
||||
"frameRectY": 0,
|
||||
"frameRectW": 0,
|
||||
"frameRectH": 0,
|
||||
"edgeNodeId": "0",
|
||||
"processStatus": "FILTER_REALTIME_DEFAULT"
|
||||
},
|
||||
"objectIndex": {
|
||||
"objectId": "1742092680994764802",
|
||||
"solutionId": "1",
|
||||
"deviceId": "129533",
|
||||
"fragmentId": "0"
|
||||
},
|
||||
"objectType": "OBJECT_TYPE_PEDESTRAIN",
|
||||
"isObjectTrack": true,
|
||||
"pathId": "1742092646219790337",
|
||||
"frameInfo": {
|
||||
"frameId": "0",
|
||||
"frameTimestamp": "1704182225679",
|
||||
"width": 0,
|
||||
"height": 0,
|
||||
"originWidth": 1920,
|
||||
"originHeight": 1080,
|
||||
"offsetTime": "20448387",
|
||||
"skipNumber": "0"
|
||||
},
|
||||
"level": 1,
|
||||
"bboxInFrame": {
|
||||
"x": 0.5265625,
|
||||
"y": 0.49537036,
|
||||
"w": 0.104166664,
|
||||
"h": 0.35833332
|
||||
},
|
||||
"bboxExtInFrame": {
|
||||
"x": 0.465625,
|
||||
"y": 0.40648147,
|
||||
"w": 0.22708334,
|
||||
"h": 0.537963
|
||||
},
|
||||
"objectImageKey": "",
|
||||
"objectExtImageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742092680994764802.jpg",
|
||||
"frameImageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742092681720379392.jpg",
|
||||
"confidence": 0.769764,
|
||||
"sourceObjectId": "1742092681720379392",
|
||||
"storeTimestamp": "0",
|
||||
"gbNumber": "",
|
||||
"qualityScore": 0,
|
||||
"subObjectCount": 0,
|
||||
"subObjectType": [],
|
||||
"subObjectIds": [],
|
||||
"cameraInfo": {
|
||||
"id": "129533",
|
||||
"name": "4楼门口过道人脸",
|
||||
"dirid": "0",
|
||||
"status": "1",
|
||||
"longitude": 120.125,
|
||||
"latitude": 30.280500411987305,
|
||||
"caseId": "0",
|
||||
"caseGroup": "",
|
||||
"isDeleted": "DEVICEMANAGER_BOOL_DEFAULT",
|
||||
"extendInfo": {
|
||||
"vmsPlatformId": "29",
|
||||
"vmsChannel": "38",
|
||||
"vmsCameraDecoderTag": "hikvision",
|
||||
"platformPluginType": "PLATFORM_PLUGIN_TYPE_HAIKANG_NVR",
|
||||
"deviceVender": "0",
|
||||
"type": "DEVICEMANAGER_CAMERA_TYPE_NORMAL",
|
||||
"ip": "",
|
||||
"port": "0",
|
||||
"username": "",
|
||||
"passwd": "",
|
||||
"rtspAddress": "",
|
||||
"facesnapChannel": "",
|
||||
"edgeDeviceSn": "",
|
||||
"platform1400Id": 0,
|
||||
"useRtspAddress": false,
|
||||
"frameCheck": false,
|
||||
"frameRectX": 0,
|
||||
"frameRectY": 0,
|
||||
"frameRectW": 0,
|
||||
"frameRectH": 0,
|
||||
"edgeNodeId": "0",
|
||||
"processStatus": "FILTER_REALTIME_DEFAULT"
|
||||
}
|
||||
},
|
||||
"solutionId": "1",
|
||||
"fragmentId": "0",
|
||||
"contrastKey": "singer-20240102/1/129533/1742092680994764802.jpg",
|
||||
"compaterImages": [
|
||||
"http://10.0.0.7:30003/file/singer-20240102/1/129529/1742047651878156288.jpg"
|
||||
],
|
||||
"imgSummary": "singer-20240102/1/129533/1742092680994764802.jpg",
|
||||
"imageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742092680994764802.jpg",
|
||||
"srcImageUrl": "http://10.0.0.7:30003/file/singer-20240102/1/129533/1742092681720379392.jpg",
|
||||
"algorithmVersion": "VERSION_REID_HEAD_ATTR",
|
||||
"cameraId": "129533",
|
||||
"cameraName": "4楼门口过道人脸"
|
||||
},
|
||||
{
|
||||
"objectId": "1742092514409592832",
|
||||
"condition": {
|
||||
"featureInfo": null,
|
||||
"featureData": "AAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"imageData": "",
|
||||
"alg": "VERSION_REID_HEAD_ATTR",
|
||||
"rect": {
|
||||
"x": 0.271875,
|
||||
"y": 0.32222223,
|
||||
"w": 0.2859375,
|
||||
"h": 0.67777777
|
||||
},
|
||||
"objectImageUrl": "singer-20240102/1/129529/1742047651878156288.jpg",
|
||||
"srcImageUrl": "singer-20240102/1/129529/1742047652511496192.jpg"
|
||||
},
|
||||
"score": 0.703765,
|
||||
"timestamp": 1704182186451,
|
||||
"deviceId": "129529",
|
||||
"id": "129529",
|
||||
"name": "4入口人脸",
|
||||
"dirid": "0",
|
||||
"status": "1",
|
||||
"longitude": 120.12100219726562,
|
||||
"latitude": 30.280099868774414,
|
||||
"caseId": "0",
|
||||
"caseGroup": "",
|
||||
"isDeleted": "DEVICEMANAGER_BOOL_DEFAULT",
|
||||
"extendInfo": {
|
||||
"vmsPlatformId": "29",
|
||||
"vmsChannel": "34",
|
||||
"vmsCameraDecoderTag": "hikvision",
|
||||
"platformPluginType": "PLATFORM_PLUGIN_TYPE_HAIKANG_NVR",
|
||||
"deviceVender": "0",
|
||||
"type": "DEVICEMANAGER_CAMERA_TYPE_NORMAL",
|
||||
"ip": "",
|
||||
"port": "0",
|
||||
"username": "",
|
||||
"passwd": "",
|
||||
"rtspAddress": "",
|
||||
"facesnapChannel": "",
|
||||
"edgeDeviceSn": "",
|
||||
"platform1400Id": 0,
|
||||
"useRtspAddress": false,
|
||||
"frameCheck": false,
|
||||
"frameRectX": 0,
|
||||
"frameRectY": 0,
|
||||
"frameRectW": 0,
|
||||
"frameRectH": 0,
|
||||
"edgeNodeId": "0",
|
||||
"processStatus": "FILTER_REALTIME_DEFAULT"
|
||||
},
|
||||
"objectIndex": {
|
||||
"objectId": "1742092514409592832",
|
||||
"solutionId": "1",
|
||||
"deviceId": "129529",
|
||||
"fragmentId": "0"
|
||||
},
|
||||
"objectType": "OBJECT_TYPE_PEDESTRAIN",
|
||||
"isObjectTrack": true,
|
||||
"pathId": "1742092482440607744",
|
||||
"frameInfo": {
|
||||
"frameId": "0",
|
||||
"frameTimestamp": "1704182186451",
|
||||
"width": 0,
|
||||
"height": 0,
|
||||
"originWidth": 2560,
|
||||
"originHeight": 1440,
|
||||
"offsetTime": "20409182",
|
||||
"skipNumber": "0"
|
||||
},
|
||||
"level": 1,
|
||||
"bboxInFrame": {
|
||||
"x": 0.6195313,
|
||||
"y": 0.24583334,
|
||||
"w": 0.09804688,
|
||||
"h": 0.41944444
|
||||
},
|
||||
"bboxExtInFrame": {
|
||||
"x": 0.53515625,
|
||||
"y": 0.14027777,
|
||||
"w": 0.26640624,
|
||||
"h": 0.63125
|
||||
},
|
||||
"objectImageKey": "",
|
||||
"objectExtImageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129529/1742092514409592832.jpg",
|
||||
"frameImageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129529/1742092515508500480.jpg",
|
||||
"confidence": 0.92494,
|
||||
"sourceObjectId": "1742092515508500480",
|
||||
"storeTimestamp": "0",
|
||||
"gbNumber": "",
|
||||
"qualityScore": 0,
|
||||
"subObjectCount": 1,
|
||||
"subObjectType": [
|
||||
"OBJECT_TYPE_FACE"
|
||||
],
|
||||
"subObjectIds": [
|
||||
"1742092482432219136"
|
||||
],
|
||||
"cameraInfo": {
|
||||
"id": "129529",
|
||||
"name": "4入口人脸",
|
||||
"dirid": "0",
|
||||
"status": "1",
|
||||
"longitude": 120.12100219726562,
|
||||
"latitude": 30.280099868774414,
|
||||
"caseId": "0",
|
||||
"caseGroup": "",
|
||||
"isDeleted": "DEVICEMANAGER_BOOL_DEFAULT",
|
||||
"extendInfo": {
|
||||
"vmsPlatformId": "29",
|
||||
"vmsChannel": "34",
|
||||
"vmsCameraDecoderTag": "hikvision",
|
||||
"platformPluginType": "PLATFORM_PLUGIN_TYPE_HAIKANG_NVR",
|
||||
"deviceVender": "0",
|
||||
"type": "DEVICEMANAGER_CAMERA_TYPE_NORMAL",
|
||||
"ip": "",
|
||||
"port": "0",
|
||||
"username": "",
|
||||
"passwd": "",
|
||||
"rtspAddress": "",
|
||||
"facesnapChannel": "",
|
||||
"edgeDeviceSn": "",
|
||||
"platform1400Id": 0,
|
||||
"useRtspAddress": false,
|
||||
"frameCheck": false,
|
||||
"frameRectX": 0,
|
||||
"frameRectY": 0,
|
||||
"frameRectW": 0,
|
||||
"frameRectH": 0,
|
||||
"edgeNodeId": "0",
|
||||
"processStatus": "FILTER_REALTIME_DEFAULT"
|
||||
}
|
||||
},
|
||||
"solutionId": "1",
|
||||
"fragmentId": "0",
|
||||
"contrastKey": "singer-20240102/1/129529/1742092514409592832.jpg",
|
||||
"compaterImages": [
|
||||
"http://10.0.0.7:30003/file/singer-20240102/1/129529/1742047651878156288.jpg"
|
||||
],
|
||||
"imgSummary": "singer-20240102/1/129529/1742092514409592832.jpg",
|
||||
"imageKey": "http://10.0.0.7:30003/file/singer-20240102/1/129529/1742092514409592832.jpg",
|
||||
"srcImageUrl": "http://10.0.0.7:30003/file/singer-20240102/1/129529/1742092515508500480.jpg",
|
||||
"algorithmVersion": "VERSION_REID_HEAD_ATTR",
|
||||
"cameraId": "129529",
|
||||
"cameraName": "4入口人脸"
|
||||
}
|
||||
],
|
||||
"isArchiveDetail": false,
|
||||
"ToolProps": {
|
||||
"renderVideoBtn": true,
|
||||
"disableVideo": false
|
||||
},
|
||||
"specialTitle": ""
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
IMAGE_DATA
|
||||
});
|
3
packages/biz/lib/Demo/index.d.ts
vendored
Normal file
3
packages/biz/lib/Demo/index.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
declare const _default: () => React.JSX.Element;
|
||||
export default _default;
|
41
packages/biz/lib/Demo/index.js
Normal file
41
packages/biz/lib/Demo/index.js
Normal file
@ -0,0 +1,41 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/Demo/index.tsx
|
||||
var Demo_exports = {};
|
||||
__export(Demo_exports, {
|
||||
default: () => Demo_default
|
||||
});
|
||||
module.exports = __toCommonJS(Demo_exports);
|
||||
var import_react = __toESM(require("react"));
|
||||
var import_antd = require("antd");
|
||||
var import_hooks = require("@zhst/hooks");
|
||||
var Demo_default = () => {
|
||||
const { run } = (0, import_hooks.useThrottleFn)(() => console.log("123"));
|
||||
return /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: () => run() }, "测试");
|
||||
};
|
153
packages/biz/lib/adapter/BigImageModalAdapter/index.d.ts
vendored
Normal file
153
packages/biz/lib/adapter/BigImageModalAdapter/index.d.ts
vendored
Normal file
@ -0,0 +1,153 @@
|
||||
/**
|
||||
* 适配老的大屏组件数据格式传入
|
||||
*/
|
||||
import React from 'react';
|
||||
import { AlgorithmVersionStr, HumanProperty, ObjectType, Rect, ViewOption, AlignType, IScreenshotButtonProp, ODRECT } from '@zhst/types';
|
||||
export type TAB_TYPE = 'COMPATER' | 'NORMAL' | 'TRACK';
|
||||
export type MODEL_TYPE = 'VIDEO' | 'IMAGE';
|
||||
export interface ImgViewProps extends React.HTMLAttributes<HTMLElement> {
|
||||
imageKey: string;
|
||||
odRect: ODRECT;
|
||||
attachImg?: Array<{
|
||||
label: string;
|
||||
url: string;
|
||||
}>;
|
||||
showAttachImgLabel: boolean;
|
||||
screenshotButtonAlign: AlignType;
|
||||
screenshotButtonRender: (screenshotButtonProp: IScreenshotButtonProp) => React.ReactElement;
|
||||
scale$?: number;
|
||||
showCrop$?: boolean;
|
||||
hideLeftTopBtn?: boolean;
|
||||
score?: number;
|
||||
viewOption?: ViewOption;
|
||||
}
|
||||
export interface VideoViewProps {
|
||||
flvUrl: string;
|
||||
maxDuration?: number;
|
||||
screenshotButtonAlign?: AlignType;
|
||||
screenshotButtonRender?: (screenshotButtonProp: IScreenshotButtonProp) => React.ReactElement;
|
||||
defautlNormalizationRect?: Rect;
|
||||
onCropChange?: (showCrop: boolean, normalizationRect: null | Rect) => void;
|
||||
showCrop$?: boolean;
|
||||
}
|
||||
export interface CarouselProps {
|
||||
hasPre?: boolean;
|
||||
hasNext?: boolean;
|
||||
selectIndex: number;
|
||||
setSelectIndex: React.Dispatch<React.SetStateAction<number>>;
|
||||
dataSource: Array<{
|
||||
key: string;
|
||||
url: string;
|
||||
}>;
|
||||
}
|
||||
export type ISelectItem = Partial<Omit<ImgViewProps, 'screenshotButtonRender'>> & Partial<Omit<VideoViewProps, 'screenshotButtonRender'>>;
|
||||
export interface HeaderProps {
|
||||
value: TAB_TYPE;
|
||||
onChange: (type: TAB_TYPE) => void;
|
||||
tabsFilter: TAB_TYPE[];
|
||||
}
|
||||
export interface ImgViewRef {
|
||||
imgInsRef: React.MutableRefObject<any>;
|
||||
setShowCrop: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
}
|
||||
export interface VideoViewRef {
|
||||
cropAble: boolean;
|
||||
setShowCrop: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
downloadVideoframe: () => void;
|
||||
}
|
||||
export interface ParamProps {
|
||||
tab: string;
|
||||
selectItem: ISelectItem;
|
||||
imgViewRef: React.MutableRefObject<ImgViewRef>;
|
||||
VideoViewRef: React.MutableRefObject<VideoViewRef>;
|
||||
model: MODEL_TYPE;
|
||||
setModel: React.Dispatch<React.SetStateAction<MODEL_TYPE>>;
|
||||
scale$: number;
|
||||
showCrop$: boolean;
|
||||
}
|
||||
export interface BigImageData {
|
||||
extendRectList: (Rect & {
|
||||
algorithmVersion: AlgorithmVersionStr;
|
||||
imageKey: string;
|
||||
})[];
|
||||
rectList: (Rect & {
|
||||
algorithmVersion: AlgorithmVersionStr;
|
||||
imageKey: string;
|
||||
})[];
|
||||
attachImg: {
|
||||
url: string;
|
||||
label: '形体' | '人脸';
|
||||
}[];
|
||||
odRect: Rect;
|
||||
imageKey: string;
|
||||
imgSummary: string;
|
||||
objectExtImageKey: string;
|
||||
attributeList: {
|
||||
label: string;
|
||||
list: any[];
|
||||
}[];
|
||||
archiveImages?: any;
|
||||
spaceName: string;
|
||||
objectType: ObjectType;
|
||||
objectId: string;
|
||||
bodyObjectId?: string;
|
||||
faceObjectId?: string;
|
||||
sourceObjectId?: string;
|
||||
cameraId: string;
|
||||
cameraName: string;
|
||||
selectIndex: number;
|
||||
humanProperty: HumanProperty;
|
||||
qualityScore?: number;
|
||||
score: number;
|
||||
timestamp: string;
|
||||
bodyImageUrl: string;
|
||||
faceImageUrl: string;
|
||||
algorithmVersion: AlgorithmVersionStr;
|
||||
bodySpaceName: string;
|
||||
faceSpaceName: string;
|
||||
solutionId?: string;
|
||||
[index: string]: any;
|
||||
}
|
||||
interface IOldImageData {
|
||||
visible?: boolean;
|
||||
defaultModel?: MODEL_TYPE;
|
||||
onClose?: () => void;
|
||||
isLoading?: boolean;
|
||||
hasPre?: boolean;
|
||||
hasNext?: boolean;
|
||||
selectIndex?: number;
|
||||
onSelectIndexChange?: (i: number) => void;
|
||||
dataSource: any[];
|
||||
dataSources: any[];
|
||||
relatedData?: any[];
|
||||
transformPropFunc: (item: any) => ISelectItem;
|
||||
transformVideoPropFunc: (item: ISelectItem) => Promise<Omit<VideoViewProps, 'screenshotButtonRender'>>;
|
||||
screenshotButtonRender?: (screenshotButtonProp: IScreenshotButtonProp) => React.ReactElement;
|
||||
showTool?: boolean;
|
||||
showCarousel?: boolean;
|
||||
imgViewProp?: Partial<ImgViewProps>;
|
||||
videoViewProp?: Partial<VideoViewProps>;
|
||||
ToolProps?: Partial<ToolProps>;
|
||||
nullDialogProp?: {
|
||||
emptyText?: string;
|
||||
};
|
||||
showHeader?: boolean;
|
||||
tabsFilter?: TAB_TYPE[];
|
||||
useVirtual?: boolean;
|
||||
loadNext?: (i: number) => Promise<void>;
|
||||
loadPre?: (i: number) => Promise<void>;
|
||||
children: React.ReactNode;
|
||||
title?: string;
|
||||
specialTitle?: string;
|
||||
isRelated?: boolean;
|
||||
carouselProp?: Partial<CarouselProps>;
|
||||
}
|
||||
export interface ToolProps {
|
||||
renderRight?: (props: ParamProps) => React.ReactNode;
|
||||
renderLeft?: (props: ParamProps) => React.ReactNode;
|
||||
renderVideoBtn?: boolean;
|
||||
param: ParamProps;
|
||||
disableVideo: boolean;
|
||||
}
|
||||
declare const _default: (data: IOldImageData) => IOldImageData;
|
||||
export default _default;
|
28
packages/biz/lib/adapter/BigImageModalAdapter/index.js
Normal file
28
packages/biz/lib/adapter/BigImageModalAdapter/index.js
Normal file
@ -0,0 +1,28 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/adapter/BigImageModalAdapter/index.tsx
|
||||
var BigImageModalAdapter_exports = {};
|
||||
__export(BigImageModalAdapter_exports, {
|
||||
default: () => BigImageModalAdapter_default
|
||||
});
|
||||
module.exports = __toCommonJS(BigImageModalAdapter_exports);
|
||||
var BigImageModalAdapter_default = (data) => {
|
||||
const newData = data;
|
||||
return newData;
|
||||
};
|
1
packages/biz/lib/adapter/index.d.ts
vendored
Normal file
1
packages/biz/lib/adapter/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export { default as BigImageModalAdapter } from './BigImageModalAdapter';
|
39
packages/biz/lib/adapter/index.js
Normal file
39
packages/biz/lib/adapter/index.js
Normal file
@ -0,0 +1,39 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/adapter/index.ts
|
||||
var adapter_exports = {};
|
||||
__export(adapter_exports, {
|
||||
BigImageModalAdapter: () => import_BigImageModalAdapter.default
|
||||
});
|
||||
module.exports = __toCommonJS(adapter_exports);
|
||||
var import_BigImageModalAdapter = __toESM(require("./BigImageModalAdapter"));
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
BigImageModalAdapter
|
||||
});
|
45
packages/biz/lib/hooks/useIntelligentTracking/index.d.ts
vendored
Normal file
45
packages/biz/lib/hooks/useIntelligentTracking/index.d.ts
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
import { Dayjs as Moment } from 'dayjs';
|
||||
export declare const getDefaultRadius: () => number;
|
||||
export declare const setDefaultRadius: (radius: number) => void;
|
||||
export declare const setSearchIntervalDuration: (duration: number) => void;
|
||||
export declare const getSearchIntervalDuration: (time: number) => number;
|
||||
export declare const operateTrackById: (smartTrackId: number, operationType: OperationType) => Promise<void>;
|
||||
export declare const deleteTrackById: (smartTrackId: number) => Promise<void>;
|
||||
export declare const modifyTrackImgs: (smartTrackId: number, images: Array<Object>) => Promise<void>;
|
||||
export declare const modifyTrackConf: (conf: any, smartTrackId: number) => Promise<void>;
|
||||
export declare const getTrackTaskById: (smartTrackId?: number) => Promise<any>;
|
||||
export declare const getTackDetailInfo: (smartTrackId?: number) => Promise<any>;
|
||||
export declare const getTaskCameraByCenterAndPower: (value: {
|
||||
taskPower: {
|
||||
facePower: number;
|
||||
bodyPower: number;
|
||||
};
|
||||
cameraInfos: Array<Object>;
|
||||
center: [number, number];
|
||||
}) => Promise<Object[]>;
|
||||
/**创建追踪任务 */
|
||||
export declare const createIntelligentTrack: (value: {
|
||||
images: Array<Object>;
|
||||
deviceIds: Array<string>;
|
||||
circleCenter: [number, number];
|
||||
model: number;
|
||||
circleRadius: number;
|
||||
facePower?: number;
|
||||
bodyPower?: number;
|
||||
historyTime?: [Moment, Moment];
|
||||
topping?: boolean;
|
||||
}) => Promise<any>;
|
||||
export declare const emitHeartbeat: (smartTrackId: number) => Promise<void>;
|
||||
export declare const ModifyTrackCameras: (value: {
|
||||
smartTrackId: number;
|
||||
deviceIds: Array<number>;
|
||||
centerPoint: [number, number];
|
||||
}) => Promise<void>;
|
||||
export declare const setIntelligentTrackCircleInfo: (smartTrackId: number, circleCenter: [number, number]) => Promise<void>;
|
||||
export declare const getTackCameraInfo: (value: {
|
||||
circleCenter: [Moment, Moment];
|
||||
radius: number;
|
||||
zoom: number;
|
||||
}) => Promise<any>;
|
||||
export declare const getCameraInfoByCircle: (circleCenter: any, radius: any, zoom?: number) => Promise<any>;
|
||||
export declare const taskInfoToSearchItem: (taskInfo: any) => any[];
|
371
packages/biz/lib/hooks/useIntelligentTracking/index.js
Normal file
371
packages/biz/lib/hooks/useIntelligentTracking/index.js
Normal file
@ -0,0 +1,371 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/hooks/useIntelligentTracking/index.tsx
|
||||
var useIntelligentTracking_exports = {};
|
||||
__export(useIntelligentTracking_exports, {
|
||||
ModifyTrackCameras: () => ModifyTrackCameras,
|
||||
createIntelligentTrack: () => createIntelligentTrack,
|
||||
deleteTrackById: () => deleteTrackById,
|
||||
emitHeartbeat: () => emitHeartbeat,
|
||||
getCameraInfoByCircle: () => getCameraInfoByCircle,
|
||||
getDefaultRadius: () => getDefaultRadius,
|
||||
getSearchIntervalDuration: () => getSearchIntervalDuration,
|
||||
getTackCameraInfo: () => getTackCameraInfo,
|
||||
getTackDetailInfo: () => getTackDetailInfo,
|
||||
getTaskCameraByCenterAndPower: () => getTaskCameraByCenterAndPower,
|
||||
getTrackTaskById: () => getTrackTaskById,
|
||||
modifyTrackConf: () => modifyTrackConf,
|
||||
modifyTrackImgs: () => modifyTrackImgs,
|
||||
operateTrackById: () => operateTrackById,
|
||||
setDefaultRadius: () => setDefaultRadius,
|
||||
setIntelligentTrackCircleInfo: () => setIntelligentTrackCircleInfo,
|
||||
setSearchIntervalDuration: () => setSearchIntervalDuration,
|
||||
taskInfoToSearchItem: () => taskInfoToSearchItem
|
||||
});
|
||||
module.exports = __toCommonJS(useIntelligentTracking_exports);
|
||||
var turf = __toESM(require("@turf/turf"));
|
||||
var import_useTaskState = require("../useTaskState");
|
||||
var import_Tree = __toESM(require("@common/components/CameraTree/Tree"));
|
||||
var import_request = __toESM(require("../../utils/request"));
|
||||
var import_antd = require("antd");
|
||||
var import_utils = require("@common/components/CameraTree/utils");
|
||||
var import_func = require("@zhst/func");
|
||||
var defaultFaceThreshold = 0.68;
|
||||
var defaultBodyThreshold = 0.7;
|
||||
var defaultFaceResultNum = 5;
|
||||
var defaultRadius = 0.15;
|
||||
var defaultQueryCycle = 10;
|
||||
var getDefaultRadius = () => {
|
||||
return defaultRadius;
|
||||
};
|
||||
var setDefaultRadius = (radius) => {
|
||||
defaultRadius = radius;
|
||||
};
|
||||
var searchIntervalDuration = 10;
|
||||
var setSearchIntervalDuration = (duration) => {
|
||||
searchIntervalDuration = duration;
|
||||
};
|
||||
var getSearchIntervalDuration = (time) => {
|
||||
return time;
|
||||
};
|
||||
var operateTrackById = async (smartTrackId, operationType) => {
|
||||
try {
|
||||
const data = {
|
||||
operationType,
|
||||
smartTrackId
|
||||
};
|
||||
await (0, import_request.default)({
|
||||
method: "PUT",
|
||||
url: "/singer.SmartTrackService/OperationSmartTrack",
|
||||
data
|
||||
});
|
||||
import_antd.message.success("操作成功");
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
import_antd.message.success("操作失败");
|
||||
}
|
||||
};
|
||||
var deleteTrackById = async (smartTrackId) => {
|
||||
try {
|
||||
await (0, import_request.default)({
|
||||
method: "DELETE",
|
||||
url: "/singer.SmartTrackService/DeleteSmartTrack",
|
||||
data: {
|
||||
smartTrackId
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
var modifyTrackImgs = async (smartTrackId, images) => {
|
||||
try {
|
||||
await (0, import_request.default)({
|
||||
method: "PUT",
|
||||
url: "/singer.SmartTrackService/ModifyTrackImg",
|
||||
data: {
|
||||
images,
|
||||
smartTrackId
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.log("err", err);
|
||||
}
|
||||
};
|
||||
var modifyTrackConf = async (conf, smartTrackId) => {
|
||||
try {
|
||||
await (0, import_request.default)({
|
||||
method: "PUT",
|
||||
url: "/singer.SmartTrackService/ModifyTrackConf",
|
||||
data: {
|
||||
conf,
|
||||
smartTrackId
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.log("err", err);
|
||||
}
|
||||
};
|
||||
var getTrackTaskById = async (smartTrackId = 0) => {
|
||||
try {
|
||||
const data = smartTrackId ? {
|
||||
smartTrackId
|
||||
} : {};
|
||||
let req = await (0, import_request.default)({
|
||||
method: "POST",
|
||||
url: "/singer.SmartTrackService/GetSmartTrack",
|
||||
data
|
||||
});
|
||||
return req;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
var getTackDetailInfo = async (smartTrackId = 0) => {
|
||||
const data = smartTrackId ? {
|
||||
smartTrackId
|
||||
} : {};
|
||||
let req = await (0, import_request.default)({
|
||||
method: "POST",
|
||||
url: "/singer.SmartTrackService/GetTrackOverView",
|
||||
data
|
||||
});
|
||||
return req;
|
||||
};
|
||||
var getTaskCameraByCenterAndPower = async (value) => {
|
||||
let realCameraInfos = value["cameraInfos"];
|
||||
let realPreprocessInfos = [];
|
||||
if (!(0, import_func.isEmpty)(realCameraInfos)) {
|
||||
const { taskStatus } = await (0, import_useTaskState.getListTaskStatus)();
|
||||
realPreprocessInfos = (0, import_useTaskState.getCameraStatusFunc)(taskStatus);
|
||||
}
|
||||
const runRealCameraInfos = [];
|
||||
realCameraInfos = realCameraInfos.filter((v) => {
|
||||
if (import_Tree.default.judgeOccupyPowerById(v["id"], realPreprocessInfos)) {
|
||||
runRealCameraInfos.push(v);
|
||||
}
|
||||
return !import_Tree.default.judgeOccupyPowerById(v["id"], realPreprocessInfos);
|
||||
});
|
||||
let from = turf.point(value["center"]);
|
||||
if (realCameraInfos.length > value["taskPower"]["bodyPower"]) {
|
||||
realCameraInfos.map((v) => {
|
||||
let dis = turf.distance(from, turf.point([v["longitude"], v["latitude"]]));
|
||||
return {
|
||||
...v,
|
||||
dis
|
||||
};
|
||||
}).sort((a, b) => {
|
||||
return a - b;
|
||||
});
|
||||
realCameraInfos = realCameraInfos.slice(0, value["taskPower"]["bodyPower"]);
|
||||
}
|
||||
return [...runRealCameraInfos, ...realCameraInfos];
|
||||
};
|
||||
var createIntelligentTrack = async (value) => {
|
||||
const data = {
|
||||
images: value["images"],
|
||||
type: value["model"],
|
||||
normalComputerPower: value["bodyPower"] || 0,
|
||||
faceComputerPower: value["facePower"] || 0,
|
||||
// deviceIds: ['129537'],
|
||||
deviceIds: value["deviceIds"],
|
||||
conf: {
|
||||
faceThreshold: defaultFaceThreshold,
|
||||
bodyThreshold: defaultBodyThreshold,
|
||||
faceResultNum: defaultFaceResultNum,
|
||||
radius: value["circleRadius"] * 1e3,
|
||||
queryCycle: defaultQueryCycle
|
||||
},
|
||||
centerConf: {
|
||||
centerX: value["circleCenter"][0],
|
||||
centerY: value["circleCenter"][1]
|
||||
}
|
||||
};
|
||||
const res = await (0, import_request.default)({
|
||||
method: "PUT",
|
||||
url: "/singer.SmartTrackService/CreateSmartTrack",
|
||||
data
|
||||
});
|
||||
return res;
|
||||
};
|
||||
var emitHeartbeat = async (smartTrackId) => {
|
||||
try {
|
||||
await (0, import_request.default)({
|
||||
method: "POST",
|
||||
url: "/singer.SmartTrackService/SmartTrackHeartBeat",
|
||||
data: {
|
||||
smartTrackId
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
var ModifyTrackCameras = async (value) => {
|
||||
try {
|
||||
await setIntelligentTrackCircleInfo(value["smartTrackId"], value["centerPoint"]);
|
||||
await (0, import_request.default)({
|
||||
url: "/singer.SmartTrackService/ModifyTrackCameras",
|
||||
method: "PUT",
|
||||
data: {
|
||||
smartTrackId: value["smartTrackId"],
|
||||
deviceIds: value["deviceIds"]
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
import_antd.message.error(err);
|
||||
}
|
||||
};
|
||||
var setIntelligentTrackCircleInfo = async (smartTrackId, circleCenter) => {
|
||||
try {
|
||||
await (0, import_request.default)({
|
||||
url: "/singer.SmartTrackService/ModifyTrackScopeConf",
|
||||
method: "PUT",
|
||||
data: {
|
||||
smartTrackId,
|
||||
centerConf: {
|
||||
centerX: (0, import_func.get)(circleCenter, "0"),
|
||||
centerY: (0, import_func.get)(circleCenter, "1")
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
import_antd.message.error(err);
|
||||
}
|
||||
};
|
||||
var getTackCameraInfo = async (value) => {
|
||||
let circleCameraInfos = await getCameraInfoByCircle(
|
||||
value["circleCenter"],
|
||||
value["radius"],
|
||||
value["zoom"]
|
||||
);
|
||||
return circleCameraInfos;
|
||||
};
|
||||
var getCameraInfoByCircle = async (circleCenter, radius, zoom = 16) => {
|
||||
try {
|
||||
let centerFeature = turf.circle(turf.point(circleCenter), radius, {
|
||||
units: "kilometers",
|
||||
steps: 64
|
||||
});
|
||||
let minx = 0;
|
||||
let maxx = 0;
|
||||
let miny = 0;
|
||||
let maxy = 0;
|
||||
for (let i = 0; i < 4; i++) {
|
||||
let point2 = turf.destination(turf.point(circleCenter), radius, 90 * i, {
|
||||
units: "kilometers"
|
||||
}).geometry.coordinates;
|
||||
if (point2[0] < minx || minx === 0) {
|
||||
minx = point2[0];
|
||||
}
|
||||
if (point2[0] > maxx || maxx === 0) {
|
||||
maxx = point2[0];
|
||||
}
|
||||
if (point2[1] < miny || miny === 0) {
|
||||
miny = point2[1];
|
||||
}
|
||||
if (point2[1] > maxy || maxy === 0) {
|
||||
maxy = point2[1];
|
||||
}
|
||||
}
|
||||
let { clusterPoint } = await (0, import_request.default)({
|
||||
url: "/singer.DeviceService/GetClusters",
|
||||
method: "POST",
|
||||
data: {
|
||||
northEast: { X: maxx, Y: maxy },
|
||||
southWest: { X: minx, Y: miny },
|
||||
zoom
|
||||
}
|
||||
});
|
||||
let cameraIds = [];
|
||||
clusterPoint.forEach((v) => {
|
||||
cameraIds.push(...v["cameraIDs"]);
|
||||
});
|
||||
const { cameras } = await (0, import_utils.SearchCamera)({
|
||||
cameraId: cameraIds,
|
||||
maxResults: cameraIds.length
|
||||
});
|
||||
const cameraInfos = cameras.filter((v) => {
|
||||
let cameraPoint = turf.point([(0, import_func.get)(v, "longitude"), (0, import_func.get)(v, "latitude")]);
|
||||
return turf.booleanPointInPolygon(cameraPoint, centerFeature);
|
||||
});
|
||||
return cameraInfos;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
var taskInfoToSearchItem = (taskInfo) => {
|
||||
let imageList = [];
|
||||
(0, import_func.get)(taskInfo, "images", []).forEach((v) => {
|
||||
const url = (0, import_func.get)(v, "conds.0.srcImageUrl");
|
||||
const objectId = (0, import_func.get)(v, "conds.0.featureInfo.objectId");
|
||||
let imageItem = {
|
||||
index: 0,
|
||||
url,
|
||||
objectId,
|
||||
odRects: (0, import_func.get)(v, "conds").map((item) => {
|
||||
return {
|
||||
fileKey: (0, import_func.get)(item, "objectImageUrl"),
|
||||
extendRect: {
|
||||
algorithmVersion: (0, import_func.get)(item, "alg", ""),
|
||||
...(0, import_func.get)(item, "rect", {})
|
||||
},
|
||||
rect: {
|
||||
algorithmVersion: (0, import_func.get)(item, "alg", ""),
|
||||
rect: (0, import_func.get)(item, "rect", {})
|
||||
}
|
||||
};
|
||||
})
|
||||
};
|
||||
imageList.push(imageItem);
|
||||
});
|
||||
return imageList;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ModifyTrackCameras,
|
||||
createIntelligentTrack,
|
||||
deleteTrackById,
|
||||
emitHeartbeat,
|
||||
getCameraInfoByCircle,
|
||||
getDefaultRadius,
|
||||
getSearchIntervalDuration,
|
||||
getTackCameraInfo,
|
||||
getTackDetailInfo,
|
||||
getTaskCameraByCenterAndPower,
|
||||
getTrackTaskById,
|
||||
modifyTrackConf,
|
||||
modifyTrackImgs,
|
||||
operateTrackById,
|
||||
setDefaultRadius,
|
||||
setIntelligentTrackCircleInfo,
|
||||
setSearchIntervalDuration,
|
||||
taskInfoToSearchItem
|
||||
});
|
3
packages/biz/lib/index.d.ts
vendored
Normal file
3
packages/biz/lib/index.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export { default as Demo } from './Demo';
|
||||
export * from './adapter';
|
||||
export { default as BigImageModal } from './BigImageModal';
|
45
packages/biz/lib/index.js
Normal file
45
packages/biz/lib/index.js
Normal file
@ -0,0 +1,45 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/index.tsx
|
||||
var src_exports = {};
|
||||
__export(src_exports, {
|
||||
BigImageModal: () => import_BigImageModal.default,
|
||||
Demo: () => import_Demo.default
|
||||
});
|
||||
module.exports = __toCommonJS(src_exports);
|
||||
var import_Demo = __toESM(require("./Demo"));
|
||||
__reExport(src_exports, require("./adapter"), module.exports);
|
||||
var import_BigImageModal = __toESM(require("./BigImageModal"));
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
BigImageModal,
|
||||
Demo,
|
||||
...require("./adapter")
|
||||
});
|
26
packages/biz/lib/useSocket/index.d.ts
vendored
Normal file
26
packages/biz/lib/useSocket/index.d.ts
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
export declare const SocketApi: {
|
||||
CameraTaskStatue: string;
|
||||
DeviceStatus: string;
|
||||
SubscribeSolutionDeploy: string;
|
||||
SubscribeTasksSummary: string;
|
||||
MonitorSubscribeResult: string;
|
||||
MonitorSubscribeStatus: string;
|
||||
SubscribeArchiveGroupUpload: string;
|
||||
SubscribeJointTask: string;
|
||||
SubscribeGroupFragment: string;
|
||||
SubscribeGroup: string;
|
||||
SubscribeStreamEvent: string;
|
||||
};
|
||||
type ApiKeys = keyof typeof SocketApi;
|
||||
declare const _default: (topic: ApiKeys, iterator?: any, opt?: {
|
||||
req?: {
|
||||
[key: string]: any;
|
||||
} | undefined;
|
||||
throttle?: number | undefined;
|
||||
parseData?: boolean | undefined;
|
||||
beforeLoopTmp?: Function | undefined;
|
||||
shouldBreak: boolean;
|
||||
forceRefresh: any;
|
||||
close?: boolean | undefined;
|
||||
} | undefined) => void;
|
||||
export default _default;
|
120
packages/biz/lib/useSocket/index.js
Normal file
120
packages/biz/lib/useSocket/index.js
Normal file
@ -0,0 +1,120 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/useSocket/index.ts
|
||||
var useSocket_exports = {};
|
||||
__export(useSocket_exports, {
|
||||
SocketApi: () => SocketApi,
|
||||
default: () => useSocket_default
|
||||
});
|
||||
module.exports = __toCommonJS(useSocket_exports);
|
||||
var import_react = require("react");
|
||||
var import_func = require("@zhst/func");
|
||||
var import_hooks = require("@zhst/hooks");
|
||||
var import_ws = __toESM(require("./ws"));
|
||||
var noop = (v) => null;
|
||||
var getSelf = (v) => v;
|
||||
var SocketApi = {
|
||||
CameraTaskStatue: "singer.DeviceService/SubScribeCameraTaskStatus",
|
||||
DeviceStatus: "singer.TaskManagerService/SubscribeTaskStatus",
|
||||
SubscribeSolutionDeploy: "singer.SolutionManagerService/SubscribeSolutionDeploy",
|
||||
SubscribeTasksSummary: "singer.TaskManagerService/SubscribeTasksSummary",
|
||||
MonitorSubscribeResult: "singer.MonitorService/MonitorSubscribeResult",
|
||||
MonitorSubscribeStatus: "singer.MonitorService/MonitorSubscribeStatus",
|
||||
SubscribeArchiveGroupUpload: "singer.ArchiveGroupService/CreateArchiveByImport",
|
||||
SubscribeJointTask: "singer.JointTaskService/SubscribeJointTask",
|
||||
SubscribeGroupFragment: "singer.VideoService/SubscribeVideoFragmentStatus",
|
||||
// 监听视频分片状态变化,包括新建、删除、变化
|
||||
SubscribeGroup: "singer.VideoService/SubscribeGroup",
|
||||
// 监听视频分组状态变化,列表变化也通知
|
||||
SubscribeStreamEvent: "singer.MediaManagerService/SubscribeStreamEvent"
|
||||
// 监听视频分组状态变化,列表变化也通知
|
||||
};
|
||||
var useSocket_default = (topic, iterator = noop, opt) => {
|
||||
const {
|
||||
req = {},
|
||||
throttle = 0,
|
||||
parseData = true,
|
||||
beforeLoopTmp = getSelf,
|
||||
shouldBreak = false,
|
||||
forceRefresh,
|
||||
close
|
||||
} = opt || {};
|
||||
const reqstring = (0, import_react.useMemo)(() => {
|
||||
const newReq = {
|
||||
...req,
|
||||
extraHeaders: {
|
||||
authorization: localStorage.getItem("USER-TOKEN")
|
||||
}
|
||||
};
|
||||
return JSON.stringify(newReq);
|
||||
}, [req]);
|
||||
const latestIterator = (0, import_hooks.useLatest)(iterator);
|
||||
(0, import_hooks.useDeepEffect)(() => {
|
||||
if (close) {
|
||||
return;
|
||||
}
|
||||
if (shouldBreak) {
|
||||
return;
|
||||
}
|
||||
let tmpData = [];
|
||||
const throttleUpdate = (0, import_func.throttle)(() => {
|
||||
if (tmpData.length == 0) {
|
||||
return;
|
||||
}
|
||||
const _tmpData = beforeLoopTmp(tmpData);
|
||||
latestIterator.current(_tmpData);
|
||||
tmpData = [];
|
||||
}, throttle);
|
||||
const unSubscribe = import_ws.default.subscribe(SocketApi[topic], reqstring, (socketData) => {
|
||||
try {
|
||||
if (!throttle) {
|
||||
latestIterator.current(socketData);
|
||||
} else {
|
||||
tmpData.push(socketData);
|
||||
throttleUpdate();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("useSocke:", error);
|
||||
}
|
||||
});
|
||||
return () => {
|
||||
try {
|
||||
unSubscribe();
|
||||
throttleUpdate.cancel();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}, [topic, reqstring, shouldBreak, forceRefresh, close]);
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
SocketApi
|
||||
});
|
2
packages/biz/lib/useSocket/onceChannel.d.ts
vendored
Normal file
2
packages/biz/lib/useSocket/onceChannel.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
declare const startChannel: (topic: any, req: any, callback: any) => () => void;
|
||||
export default startChannel;
|
51
packages/biz/lib/useSocket/onceChannel.js
Normal file
51
packages/biz/lib/useSocket/onceChannel.js
Normal file
@ -0,0 +1,51 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/useSocket/onceChannel.tsx
|
||||
var onceChannel_exports = {};
|
||||
__export(onceChannel_exports, {
|
||||
default: () => onceChannel_default
|
||||
});
|
||||
module.exports = __toCommonJS(onceChannel_exports);
|
||||
var import_ws = __toESM(require("./ws"));
|
||||
var startChannel = (topic, req, callback) => {
|
||||
let reqstring = JSON.stringify({
|
||||
...req,
|
||||
extraHeaders: {
|
||||
authorization: localStorage.getItem("USER-TOKEN")
|
||||
}
|
||||
});
|
||||
let unSubscribe = import_ws.default.subscribe(topic, reqstring, (socketData) => {
|
||||
let shouldStop = callback(socketData);
|
||||
if (shouldStop) {
|
||||
unSubscribe == null ? void 0 : unSubscribe();
|
||||
}
|
||||
});
|
||||
return unSubscribe;
|
||||
};
|
||||
var onceChannel_default = startChannel;
|
31
packages/biz/lib/useSocket/ws.d.ts
vendored
Normal file
31
packages/biz/lib/useSocket/ws.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
declare class Channel {
|
||||
/**
|
||||
* io 实例化对象
|
||||
*/
|
||||
ioIns: any;
|
||||
/**
|
||||
* 已存在的订阅列表
|
||||
*/
|
||||
listeners: never[];
|
||||
/**
|
||||
* 调试信息 记录订阅/反订阅次数
|
||||
*/
|
||||
subscribeListenerId: never[];
|
||||
unSubscribeListenerId: never[];
|
||||
init: () => void;
|
||||
retry: (listener: {
|
||||
[x: string]: any;
|
||||
lastRetryInterval: number | undefined;
|
||||
intervalId: NodeJS.Timeout;
|
||||
} | undefined) => void;
|
||||
doEmit: (topic: any, req: any, listenerId: any) => void;
|
||||
subscribe(topic: any, req: any, handle: any): () => void;
|
||||
unSubscribe(topic: any, req: any, handleId: any, listenerId: any): void;
|
||||
}
|
||||
declare const channelIns: Channel;
|
||||
export default channelIns;
|
224
packages/biz/lib/useSocket/ws.js
Normal file
224
packages/biz/lib/useSocket/ws.js
Normal file
@ -0,0 +1,224 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/useSocket/ws.ts
|
||||
var ws_exports = {};
|
||||
__export(ws_exports, {
|
||||
default: () => ws_default
|
||||
});
|
||||
module.exports = __toCommonJS(ws_exports);
|
||||
var import_uuid = require("uuid");
|
||||
var import_func = require("@zhst/func");
|
||||
var import_socket = __toESM(require("socket.io-client"));
|
||||
var import_constants = require("@common/constants");
|
||||
var EMITSTATE = {
|
||||
NOT_CONNECT: 0,
|
||||
WAITING: 1,
|
||||
CONNECT: 2
|
||||
};
|
||||
var initRetryTime = 0;
|
||||
var intervalTime = 5 * 1e3;
|
||||
var maxIntervalTime = 1 * 60 * 60 * 1e3;
|
||||
var Channel = class {
|
||||
constructor() {
|
||||
/**
|
||||
* 已存在的订阅列表
|
||||
*/
|
||||
this.listeners = [
|
||||
// {
|
||||
// topic: "",
|
||||
// req: "",
|
||||
// suInfo: {},
|
||||
// hasEmit: false,//是否已经订阅
|
||||
// lastRetryInterval: 0,
|
||||
// handles: {
|
||||
// }
|
||||
// }
|
||||
];
|
||||
/**
|
||||
* 调试信息 记录订阅/反订阅次数
|
||||
*/
|
||||
this.subscribeListenerId = [];
|
||||
this.unSubscribeListenerId = [];
|
||||
this.init = () => {
|
||||
const ioIns = this.ioIns = (0, import_socket.default)(import_constants.SOCKET_HOST, {
|
||||
reconnection: true,
|
||||
transports: ["websocket"],
|
||||
forceNew: true
|
||||
});
|
||||
ioIns.on("connect", (...arg) => {
|
||||
console.debug("connect", arg);
|
||||
this.ioIns = ioIns;
|
||||
this.listeners.forEach((v) => {
|
||||
this.doEmit(v["topic"], v["req"], v["id"]);
|
||||
});
|
||||
});
|
||||
ioIns.on("event", (...arg) => {
|
||||
console.debug("event", arg);
|
||||
});
|
||||
ioIns.on("disconnect", (...arg) => {
|
||||
console.debug("disconnect", arg);
|
||||
this.subscribeListenerId = [];
|
||||
this.unSubscribeListenerId = [];
|
||||
});
|
||||
ioIns.on("reconnect", (...arg) => {
|
||||
console.debug("reconnect", arg);
|
||||
this.listeners.forEach((v) => {
|
||||
v["hasEmit"] = EMITSTATE.NOT_CONNECT;
|
||||
this.doEmit(v["topic"], v["req"], v["id"]);
|
||||
});
|
||||
});
|
||||
};
|
||||
this.retry = (listener) => {
|
||||
const intervalId = setTimeout(() => {
|
||||
const hasExit = this.listeners.find(
|
||||
(v) => v["topic"] === (listener == null ? void 0 : listener["topic"]) && v["req"] === listener["req"]
|
||||
);
|
||||
if (!hasExit)
|
||||
return;
|
||||
listener["hasEmit"] = EMITSTATE.NOT_CONNECT;
|
||||
this.doEmit(listener["topic"], listener["req"], listener["id"]);
|
||||
}, listener.lastRetryInterval);
|
||||
listener.intervalId = intervalId;
|
||||
listener.lastRetryInterval = intervalTime + listener.lastRetryInterval > maxIntervalTime ? maxIntervalTime : intervalTime + listener.lastRetryInterval;
|
||||
};
|
||||
this.doEmit = (topic, req, listenerId) => {
|
||||
var _a, _b;
|
||||
if (!this.ioIns) {
|
||||
this.init();
|
||||
}
|
||||
const hasEmit = this.listeners.find(
|
||||
(v) => v["topic"] === topic && v["req"] === req && v["hasEmit"] !== EMITSTATE.NOT_CONNECT
|
||||
);
|
||||
if (hasEmit) {
|
||||
return;
|
||||
}
|
||||
const listener = this.listeners.find((v) => v["topic"] === topic && v["req"] === req);
|
||||
listener["hasEmit"] = EMITSTATE.WAITING;
|
||||
(_b = (_a = this.ioIns) == null ? void 0 : _a.emit) == null ? void 0 : _b.call(_a, topic, req, (data) => {
|
||||
var _a2, _b2;
|
||||
console.info("emit", topic, req, data);
|
||||
const suInfo = JSON.parse(data);
|
||||
if ((0, import_func.has)(suInfo, "Error.code")) {
|
||||
if (suInfo.Error.code === 500) {
|
||||
this.retry(listener);
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.subscribeListenerId.push(listenerId);
|
||||
const currentTopicIndex = this.listeners.findIndex(
|
||||
(v) => v["topic"] === topic && v["req"] === req && v["id"] === listenerId
|
||||
);
|
||||
if (currentTopicIndex == -1) {
|
||||
this.ioIns.emit("UnSubscribe", JSON.stringify(suInfo), (data2) => {
|
||||
this.unSubscribeListenerId.push(listenerId);
|
||||
console.debug("UNSUBSCRIBE", listenerId, topic, req, data2);
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!suInfo["SubscribeID"]) {
|
||||
this.listeners.splice(currentTopicIndex, 0);
|
||||
} else {
|
||||
this.listeners[currentTopicIndex]["suInfo"] = suInfo;
|
||||
this.listeners[currentTopicIndex]["hasEmit"] = EMITSTATE.CONNECT;
|
||||
}
|
||||
(_b2 = (_a2 = this.ioIns) == null ? void 0 : _a2.on) == null ? void 0 : _b2.call(_a2, suInfo["SubscribeID"], (data2) => {
|
||||
console.info("on", suInfo["SubscribeID"], data2);
|
||||
try {
|
||||
const socketData = JSON.parse(data2);
|
||||
if ((0, import_func.has)(socketData, "Error.code")) {
|
||||
if (socketData.Error.code === 500) {
|
||||
this.retry(listener);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const { handles = {} } = this.listeners.find((v) => v["topic"] === topic && v["req"] === req) || {};
|
||||
Object.keys(handles).forEach((key) => {
|
||||
try {
|
||||
const func = handles[key];
|
||||
if (!func)
|
||||
return;
|
||||
func(socketData);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.debug("error", error);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
subscribe(topic, req, handle) {
|
||||
const handleId = (0, import_uuid.v4)();
|
||||
const listenerId = (0, import_uuid.v4)();
|
||||
const listener = this.listeners.find((v) => v["topic"] === topic && v["req"] === req);
|
||||
if (listener) {
|
||||
listener["handles"][handleId] = handle;
|
||||
} else {
|
||||
this.listeners.push({
|
||||
topic,
|
||||
req,
|
||||
suInfo: {},
|
||||
id: listenerId,
|
||||
hasEmit: EMITSTATE.NOT_CONNECT,
|
||||
lastRetryInterval: initRetryTime,
|
||||
handles: {
|
||||
[`${handleId}`]: handle
|
||||
}
|
||||
});
|
||||
this.doEmit(topic, req, listenerId);
|
||||
}
|
||||
return this.unSubscribe.bind(this, topic, req, handleId, listenerId);
|
||||
}
|
||||
unSubscribe(topic, req, handleId, listenerId) {
|
||||
const listener = this.listeners.find(
|
||||
(v) => v["topic"] === topic && v["req"] === req && v["id"] === listenerId
|
||||
);
|
||||
const { handles = {}, suInfo } = listener || {};
|
||||
if (handles[handleId]) {
|
||||
delete handles[handleId];
|
||||
if (Object.keys(handles).length === 0) {
|
||||
if (this.intervalId) {
|
||||
clearTimeout(this.intervalId);
|
||||
}
|
||||
if (listener["hasEmit"] === EMITSTATE["CONNECT"]) {
|
||||
this.ioIns.emit("UnSubscribe", JSON.stringify(suInfo), (data) => {
|
||||
this.unSubscribeListenerId.push(listenerId);
|
||||
console.debug("UNSUBSCRIBE", listener["id"], topic, req, data);
|
||||
});
|
||||
}
|
||||
this.listeners = this.listeners.filter((v) => !(v["topic"] === topic && v["req"] === req));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var channelIns = new Channel();
|
||||
window.__channel__ = channelIns;
|
||||
var ws_default = channelIns;
|
23
packages/biz/lib/utils/constants.d.ts
vendored
Normal file
23
packages/biz/lib/utils/constants.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
export declare const OBJECT_GRNER_THRESHOLD = 0.8;
|
||||
export declare const OBJECT_AGE_TYPE_THRESHOLD = 0.5;
|
||||
export declare const MODE_KEY = "test_mode";
|
||||
export declare const SEARCH_IMG_COUNT = 10;
|
||||
export declare const GLOBAL_IS_ITEM_NUMBER_SHOW = false;
|
||||
export declare const publicPath = "hummingbird";
|
||||
export declare const ENTER_CIRCLE = "MONITORTYPE_ENTER_CIRCLE";
|
||||
export declare const OUT_CIRCLE = "MONITORTYPE_OUT_CIRCLE";
|
||||
export declare const TEMP = "MONITORTYPE_TEMP";
|
||||
export declare const GLOBAL_IS_BOX_VMS_SHOW = true;
|
||||
export declare const BODY_SEARCH_THRESHOID = 0.45;
|
||||
export declare const RECORD_VERSION = "3.0.0";
|
||||
export declare const DeviceTab: {
|
||||
EMPTY: number;
|
||||
REAL_CAMERA: number;
|
||||
PREPROCESS_CAMERA: number;
|
||||
TAG_CAMERA: number;
|
||||
HISTORY_VIDEO_GROUP: number;
|
||||
VIRTUAL_CAMERA: number;
|
||||
REAL_CAMERA_NOFACE: number;
|
||||
REAL_CAMERA_ONLYFACE: number;
|
||||
REAL_CAMERA_NOFACE_NOBOX_NODIRECONNECT: number;
|
||||
};
|
80
packages/biz/lib/utils/constants.js
Normal file
80
packages/biz/lib/utils/constants.js
Normal file
@ -0,0 +1,80 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/utils/constants.ts
|
||||
var constants_exports = {};
|
||||
__export(constants_exports, {
|
||||
BODY_SEARCH_THRESHOID: () => BODY_SEARCH_THRESHOID,
|
||||
DeviceTab: () => DeviceTab,
|
||||
ENTER_CIRCLE: () => ENTER_CIRCLE,
|
||||
GLOBAL_IS_BOX_VMS_SHOW: () => GLOBAL_IS_BOX_VMS_SHOW,
|
||||
GLOBAL_IS_ITEM_NUMBER_SHOW: () => GLOBAL_IS_ITEM_NUMBER_SHOW,
|
||||
MODE_KEY: () => MODE_KEY,
|
||||
OBJECT_AGE_TYPE_THRESHOLD: () => OBJECT_AGE_TYPE_THRESHOLD,
|
||||
OBJECT_GRNER_THRESHOLD: () => OBJECT_GRNER_THRESHOLD,
|
||||
OUT_CIRCLE: () => OUT_CIRCLE,
|
||||
RECORD_VERSION: () => RECORD_VERSION,
|
||||
SEARCH_IMG_COUNT: () => SEARCH_IMG_COUNT,
|
||||
TEMP: () => TEMP,
|
||||
publicPath: () => publicPath
|
||||
});
|
||||
module.exports = __toCommonJS(constants_exports);
|
||||
var OBJECT_GRNER_THRESHOLD = 0.8;
|
||||
var OBJECT_AGE_TYPE_THRESHOLD = 0.5;
|
||||
var MODE_KEY = "test_mode";
|
||||
var SEARCH_IMG_COUNT = 10;
|
||||
var GLOBAL_IS_ITEM_NUMBER_SHOW = false;
|
||||
var publicPath = "hummingbird";
|
||||
var ENTER_CIRCLE = "MONITORTYPE_ENTER_CIRCLE";
|
||||
var OUT_CIRCLE = "MONITORTYPE_OUT_CIRCLE";
|
||||
var TEMP = "MONITORTYPE_TEMP";
|
||||
var GLOBAL_IS_BOX_VMS_SHOW = true;
|
||||
var BODY_SEARCH_THRESHOID = 0.45;
|
||||
var RECORD_VERSION = "3.0.0";
|
||||
var DeviceTab = {
|
||||
EMPTY: 0,
|
||||
REAL_CAMERA: 1,
|
||||
PREPROCESS_CAMERA: 2,
|
||||
//摄像头列表
|
||||
TAG_CAMERA: 3,
|
||||
//预案列表
|
||||
HISTORY_VIDEO_GROUP: 4,
|
||||
//录像回放
|
||||
VIRTUAL_CAMERA: 5,
|
||||
//离线视频
|
||||
REAL_CAMERA_NOFACE: 6,
|
||||
REAL_CAMERA_ONLYFACE: 7,
|
||||
REAL_CAMERA_NOFACE_NOBOX_NODIRECONNECT: 8
|
||||
// 只有普通摄像头,没有人脸、没有盒子、直连
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
BODY_SEARCH_THRESHOID,
|
||||
DeviceTab,
|
||||
ENTER_CIRCLE,
|
||||
GLOBAL_IS_BOX_VMS_SHOW,
|
||||
GLOBAL_IS_ITEM_NUMBER_SHOW,
|
||||
MODE_KEY,
|
||||
OBJECT_AGE_TYPE_THRESHOLD,
|
||||
OBJECT_GRNER_THRESHOLD,
|
||||
OUT_CIRCLE,
|
||||
RECORD_VERSION,
|
||||
SEARCH_IMG_COUNT,
|
||||
TEMP,
|
||||
publicPath
|
||||
});
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/biz",
|
||||
"version": "0.2.4",
|
||||
"version": "0.3.0",
|
||||
"description": "业务库",
|
||||
"keywords": [
|
||||
"business",
|
||||
@ -40,9 +40,7 @@
|
||||
"@zhst/hooks": "workspace:^",
|
||||
"@zhst/meta": "workspace:^",
|
||||
"antd": "^5.12.5",
|
||||
"base-64": "^1.0.0",
|
||||
"classnames": "^2.5.1",
|
||||
"rc-util": "^5.38.1",
|
||||
"umi-request": "^1.4.0"
|
||||
"rc-util": "^5.38.1"
|
||||
}
|
||||
}
|
||||
|
162
packages/biz/src/BigImageModal/BigImageModal.tsx
Normal file
162
packages/biz/src/BigImageModal/BigImageModal.tsx
Normal file
@ -0,0 +1,162 @@
|
||||
// @ts-nocheck
|
||||
import React, { useRef, useState } from 'react'
|
||||
import { Descriptions, Modal, Tabs } from 'antd';
|
||||
import classNames from 'classnames'
|
||||
import type { ModalProps, DescriptionsProps, TabsProps } from 'antd'
|
||||
import { get } from '@zhst/func';
|
||||
import './index.less'
|
||||
import Navigation from './components/navigation';
|
||||
|
||||
const DescriptionsItem = Descriptions.Item
|
||||
|
||||
export const componentPrefix = 'zhst-image'
|
||||
|
||||
export interface BigImageModalProps extends ModalProps {
|
||||
visible: boolean // 弹框显示隐藏
|
||||
descriptionConfig: {
|
||||
data: { // 描述列表
|
||||
title: string; // 标题
|
||||
children: Pick<DescriptionsProps, 'items'> // 描述项
|
||||
}[]
|
||||
}
|
||||
tabsConfig: { // 导航栏配置
|
||||
data: Pick<TabsProps, 'items'> & {
|
||||
key: 'NORMAL' | 'COMPATER' | 'TRACK'
|
||||
} // 导航栏列表
|
||||
}
|
||||
dataSource: any
|
||||
imageData: any
|
||||
relatedData: any
|
||||
}
|
||||
|
||||
const initialStyle ={
|
||||
fontSize: '12px'
|
||||
}
|
||||
|
||||
const BigImageModal: React.FC<BigImageModalProps> = (props) => {
|
||||
const {
|
||||
title = '-',
|
||||
open,
|
||||
visible,
|
||||
children,
|
||||
descriptionConfig = {
|
||||
data: []
|
||||
},
|
||||
tabsConfig = {
|
||||
data: [
|
||||
{
|
||||
label: '对比图模式',
|
||||
key: '1',
|
||||
children: '对比图组件',
|
||||
},
|
||||
{
|
||||
label: '场景图模式',
|
||||
key: '2',
|
||||
children: '场景图组件',
|
||||
}
|
||||
],
|
||||
},
|
||||
dataSource = [],
|
||||
imageData = [],
|
||||
relatedData = [],
|
||||
} = props
|
||||
|
||||
const showCropRef = useRef(false);
|
||||
const scaleRef = useRef(0);
|
||||
|
||||
// ========================== 头切换 =========================
|
||||
const [activeKey, setActiveKey] = useState<string>(get(tabsConfig, 'data[0].key'));
|
||||
|
||||
// ========================= 预览切换下标 =========================
|
||||
const [previewIndex, setPreviewIndex] = useState<number>(0)
|
||||
const [isRelated, setIsRelated] = useState<number>(false)
|
||||
|
||||
return (
|
||||
<Modal
|
||||
destroyOnClose
|
||||
open={open || visible}
|
||||
footer={null}
|
||||
className={componentPrefix}
|
||||
title={title}
|
||||
{...props}
|
||||
>
|
||||
{descriptionConfig.data.map(descriptions => (
|
||||
<Descriptions
|
||||
key={descriptions.title}
|
||||
title={
|
||||
<p style={{ margin: '12px 0 0', fontSize: initialStyle.fontSize }}>
|
||||
{descriptions.title}
|
||||
</p>
|
||||
}
|
||||
column={8}
|
||||
style={{ padding: '0 64px' }}
|
||||
>
|
||||
{descriptions?.children?.map(item => (
|
||||
<DescriptionsItem
|
||||
key={item.key}
|
||||
label={item.label}
|
||||
span={1}
|
||||
contentStyle={{ fontSize: initialStyle.fontSize }}
|
||||
labelStyle={{ fontSize: initialStyle.fontSize }}
|
||||
>{item.children}</DescriptionsItem>
|
||||
))}
|
||||
</Descriptions>
|
||||
))}
|
||||
<Tabs
|
||||
defaultActiveKey={activeKey}
|
||||
centered
|
||||
tabBarStyle={{ fontSize: '18px' }}
|
||||
items={tabsConfig.data}
|
||||
{...tabsConfig}
|
||||
/>
|
||||
<div
|
||||
className={classNames(`${componentPrefix}-view-container`)}
|
||||
style={
|
||||
activeKey === 'TRACK'
|
||||
? {
|
||||
height: '718px',
|
||||
marginBottom: '0px',
|
||||
}
|
||||
: {}
|
||||
}
|
||||
>
|
||||
{
|
||||
activeKey !== 'TRACK' && (
|
||||
<>
|
||||
{/* ----------------------------------- 上一张按钮 ---------------------------------- */}
|
||||
<Navigation
|
||||
className={classNames(
|
||||
`${componentPrefix}-view-container__nav`,
|
||||
previewIndex <= 0 && `${componentPrefix}-view-container__nav--disabled`,
|
||||
`${componentPrefix}-view-container__nav--left`
|
||||
)}
|
||||
show={isRelated ? (imageData.length > 1) : (dataSource.length > 1)}
|
||||
disabled={previewIndex <= 0}
|
||||
prev
|
||||
onClick={() => {
|
||||
setPreviewIndex((pre) => pre - 1);
|
||||
}}
|
||||
/>
|
||||
{/* ----------------------------------- 下一张按钮 ---------------------------------- */}
|
||||
<Navigation
|
||||
className={classNames(
|
||||
`${componentPrefix}-view-container__nav`,
|
||||
((previewIndex >= imageData.length - 1) || (previewIndex >= dataSource.length - 1)) && `${componentPrefix}-view-container__nav--disabled`,
|
||||
`${componentPrefix}-view-container__nav--right`
|
||||
)}
|
||||
show={isRelated ? (imageData.length > 1) : (dataSource.length > 1)}
|
||||
disabled={((previewIndex >= imageData.length - 1) || (previewIndex >= dataSource.length - 1))}
|
||||
next
|
||||
onClick={async (e) => {
|
||||
setPreviewIndex((pre) => pre + 1);
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
|
||||
export default BigImageModal
|
@ -1,696 +0,0 @@
|
||||
// @ts-nocheck
|
||||
import React, { ReactElement, useEffect, useRef, useState, useMemo } from 'react';
|
||||
import { useLatest, useThrottleFn } from 'ahooks';
|
||||
import { isFunction, pick, noop, get, isEmpty } from 'lodash-es';
|
||||
import classNames from 'classnames';
|
||||
import { message, Modal, Tabs as TabPane } from 'antd';
|
||||
import KeyCode from 'rc-util/lib/KeyCode';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import ImgView, { ImgViewProps, ImgViewRef } from './ImgView';
|
||||
import VideoView, { VideoViewProps, VideoViewRef } from './VideoView';
|
||||
import CompareView from './CompareView';
|
||||
import Tool, { ToolProps } from './Tool';
|
||||
import Header, { Tabs, TabsType, tabsFilter } from './Header';
|
||||
import Navigation from './Nav';
|
||||
import AttributePanel from './AttributePanel';
|
||||
import { usePropState, cssPrefix, getSolt } from './utils';
|
||||
import { screenshotButtonProp, MODEL_TYPE, Rect } from '../adapter/BigImageModalAdapter/interface';
|
||||
import NullView, { NullDialogProp } from './NullDialog';
|
||||
import styles from './index.module.scss';
|
||||
import { generateImg } from '@common/utils';
|
||||
import IconFont from '../iconfont/IconFont';
|
||||
import addEventListenerWrap from '@common/utils/addEventListener';
|
||||
import Carousel, { CarouselProps } from './Carousel';
|
||||
import { doubleClick } from '@common/components/doubleCheck';
|
||||
import { store } from '@store/index';
|
||||
import { store as achieveStore } from '@pages/archive/store';
|
||||
import { ObjectType } from '@store/Monitor';
|
||||
|
||||
const componentName = cssPrefix;
|
||||
|
||||
export type selecItem = Partial<Omit<ImgViewProps, 'screenshotButtonRender'>> &
|
||||
Partial<Omit<VideoViewProps, 'screenshotButtonRender'>>;
|
||||
|
||||
export interface ParamProps {
|
||||
tab: string;
|
||||
selectItem: selecItem;
|
||||
imgViewRef: React.MutableRefObject<ImgViewRef>;
|
||||
VideoViewRef: React.MutableRefObject<VideoViewRef>;
|
||||
model: MODEL_TYPE;
|
||||
setModel: React.Dispatch<React.SetStateAction<MODEL_TYPE>>;
|
||||
/* 可观测值 */
|
||||
scale$: number;
|
||||
showCrop$: boolean;
|
||||
}
|
||||
|
||||
export interface BigImageData {
|
||||
//imageKey 小图
|
||||
extendRectList: (Rect & { algorithmVersion: AlgorithmVersionStr; imageKey: string })[];
|
||||
rectList: (Rect & { algorithmVersion: AlgorithmVersionStr; imageKey: string })[];
|
||||
attachImg: { url: string; label: '形体' | '人脸' }[];
|
||||
odRect: Rect;
|
||||
imageKey: string; //大图
|
||||
imgSummary: string; //摘要图
|
||||
|
||||
objectExtImageKey: string; //比对到的目标图扩展图 === imgSummary
|
||||
attributeList: { label: string; list: any[] }[];
|
||||
archiveImages?: any;
|
||||
spaceName: string;
|
||||
|
||||
objectType: ObjectType;
|
||||
objectId: string; //这张摘要本身的Id
|
||||
bodyObjectId?: string;
|
||||
faceObjectId?: string; //这张摘要下的人脸Id(如果有)
|
||||
sourceObjectId?: string; //这张摘要上游的形体Id(如果有)
|
||||
cameraId: string;
|
||||
cameraName: string;
|
||||
selectIndex: number;
|
||||
humanProperty: HumanProperty;
|
||||
qualityScore?: number; //人脸质量分
|
||||
score: number; //相似度
|
||||
timestamp: string;
|
||||
bodyImageUrl: string;
|
||||
faceImageUrl: string;
|
||||
algorithmVersion: AlgorithmVersionStr;
|
||||
|
||||
bodySpaceName: string;
|
||||
faceSpaceName: string;
|
||||
|
||||
solutionId?: Solution;
|
||||
[index: string]: any;
|
||||
}
|
||||
|
||||
export interface BigImageDialogProps {
|
||||
visible?: boolean;
|
||||
defaultModel?: MODEL_TYPE;
|
||||
onClose?: () => void;
|
||||
isLoading?: boolean;
|
||||
hasPre?: boolean;
|
||||
hasNext?: boolean;
|
||||
selectIndex?: number;
|
||||
onSelectIndexChange?: (index: number) => void;
|
||||
dataSource: any[];
|
||||
relatedData?: any[];
|
||||
transformPropFunc: (item: any) => selecItem;
|
||||
transformVideoPropFunc: (
|
||||
item: selecItem
|
||||
) => Promise<Omit<VideoViewProps, 'screenshotButtonRender'>>;
|
||||
screenshotButtonRender?: (screenshotButtonProp: screenshotButtonProp) => ReactElement;
|
||||
showTool?: boolean;
|
||||
showCarousel?: boolean;
|
||||
imgViewProp?: Partial<ImgViewProps>;
|
||||
videoViewProp?: Partial<VideoViewProps>;
|
||||
ToolProps?: Partial<ToolProps>;
|
||||
nullDialogProp?: Partial<NullDialogProp>;
|
||||
showHeader?: boolean;
|
||||
tabsFilter?: tabsFilter;
|
||||
useVirtual?: boolean;
|
||||
loadNext?: (index: number) => Promise<void>;
|
||||
loadPre?: (index: number) => Promise<void>;
|
||||
children: React.ReactNode;
|
||||
title?: string;
|
||||
specialTitle?: string;
|
||||
isRelated?: boolean;
|
||||
carouselProp?: Partial<CarouselProps>;
|
||||
}
|
||||
|
||||
//查看对比图和场景图组件
|
||||
const BigImageDialog: React.FC<BigImageDialogProps> = (props) => {
|
||||
const {
|
||||
hasPre: propHasPre = false,
|
||||
hasNext: propHasNext = false,
|
||||
loadNext = noop,
|
||||
loadPre = noop,
|
||||
visible = true,
|
||||
onClose,
|
||||
isLoading: propIsLoading = false,
|
||||
selectIndex: propSelectIndex = 0,
|
||||
onSelectIndexChange,
|
||||
dataSource = [],
|
||||
relatedData = [],
|
||||
screenshotButtonRender,
|
||||
transformPropFunc,
|
||||
transformVideoPropFunc,
|
||||
defaultModel = 'IMAGE',
|
||||
imgViewProp: otherImgViewProp,
|
||||
videoViewProp: otherVideoViewProp,
|
||||
carouselProp: otherCarouselProp,
|
||||
ToolProps: otherToolProp,
|
||||
showTool = true,
|
||||
children,
|
||||
nullDialogProp,
|
||||
showHeader = true,
|
||||
tabsFilter = ['COMPATER', 'NORMAL'],
|
||||
useVirtual,
|
||||
title = '查看大图',
|
||||
specialTitle = '',
|
||||
showCarousel = true,
|
||||
isRelated = false,
|
||||
} = props;
|
||||
|
||||
console.log('props', props)
|
||||
//可观测值
|
||||
const showCrop$Ref = useRef(false);
|
||||
const scale$Ref = useRef(0);
|
||||
const showCrop$ = showCrop$Ref.current;
|
||||
const scale$ = scale$Ref.current;
|
||||
// ========================== 头切换 =========================
|
||||
const [tab, setTab] = useState<TAB_TYPE>(
|
||||
tabsFilter.length > 1 ? (Object.keys(Tabs)[0] as TAB_TYPE) : (Object.keys(Tabs)[1] as TAB_TYPE)
|
||||
);
|
||||
const [activeKey, setActiveKey] = useState<string>('related');
|
||||
const [similarList, setSimilarList] = useState<any>(dataSource); // 其他相似目标列表
|
||||
const [relatedList, setRelatedList] = useState<any>(relatedData); // 已关联列表
|
||||
const [imageData, setImageData] = useState<any>(dataSource); // 其他相似目标列表
|
||||
const lastSimData = useLatest(similarList);
|
||||
const lastRelatedData = useLatest(relatedList);
|
||||
|
||||
// ========================== 内部转换 =========================
|
||||
const [model, setModel] = useState<MODEL_TYPE>(defaultModel); // 图片/视频模式
|
||||
useEffect(() => {
|
||||
if (activeKey === 'unRlated') {
|
||||
setImageData(lastSimData.current);
|
||||
setSelectIndex(0);
|
||||
}
|
||||
if (activeKey === 'related') {
|
||||
setImageData(lastRelatedData.current);
|
||||
setSelectIndex(0);
|
||||
}
|
||||
}, [activeKey]);
|
||||
useEffect(() => {
|
||||
setSimilarList(dataSource);
|
||||
if (activeKey === 'unRelated') {
|
||||
setImageData(dataSource);
|
||||
}
|
||||
}, [dataSource]);
|
||||
|
||||
const carouseDataSource = useMemo(() => {
|
||||
return imageData.map((v: any, index: number) => {
|
||||
return {
|
||||
url: generateImg(get(v, 'passerbyImage.objectRects.0.fileKey')),
|
||||
key: index,
|
||||
passerbyId: get(v, 'passerbyId'),
|
||||
};
|
||||
});
|
||||
}, [imageData, dataSource]);
|
||||
|
||||
//选择
|
||||
const [selectIndex, setSelectIndex] = usePropState(propSelectIndex);
|
||||
const hasPre = propHasPre ? true : selectIndex > 0;
|
||||
const changeIndex = isRelated ? imageData.length - 1 : dataSource.length - 1;
|
||||
const hasNext = propHasNext ? true : selectIndex < changeIndex;
|
||||
//设置选中
|
||||
const latestSelectIndex = useLatest(selectIndex);
|
||||
const latestDataSource = isRelated ? useLatest(imageData) : useLatest(dataSource);
|
||||
//加一个防背推
|
||||
const seq = useRef(0);
|
||||
const { run: setSelectIndexWrapper } = useThrottleFn(
|
||||
async (arg: ((num: number) => void) | number) => {
|
||||
const _seq = ++seq.current;
|
||||
const selectIndex = latestSelectIndex.current;
|
||||
const dataSource = latestDataSource.current;
|
||||
let newIndex = isFunction(arg) ? arg(selectIndex) : arg;
|
||||
if (newIndex > dataSource.length - 1) {
|
||||
if (propHasNext) {
|
||||
await loadNext(newIndex);
|
||||
} else {
|
||||
newIndex = dataSource.length - 1;
|
||||
}
|
||||
}
|
||||
if (newIndex < 0) {
|
||||
newIndex = 0;
|
||||
}
|
||||
if (_seq !== seq.current) {
|
||||
return;
|
||||
}
|
||||
|
||||
onSelectIndexChange && onSelectIndexChange(newIndex);
|
||||
setSelectIndex(newIndex);
|
||||
},
|
||||
{ wait: 500 }
|
||||
);
|
||||
|
||||
//异步获取数据
|
||||
const [selectItem, setSelectItem] = useState(null);
|
||||
const [isFetching, setIsFetching] = useState(true);
|
||||
//人员属性
|
||||
const [attributeList, setAttributeList] = useState([]);
|
||||
const isLoading = useMemo(() => propIsLoading || isFetching, [propIsLoading, isFetching]);
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
setIsFetching(true);
|
||||
let data: any = {};
|
||||
if (isRelated) {
|
||||
data = await transformPropFunc(imageData[selectIndex]);
|
||||
} else {
|
||||
data = await transformPropFunc(dataSource[selectIndex]);
|
||||
}
|
||||
setAttributeList(get(data, 'attributeList', []));
|
||||
//防背推
|
||||
if (selectIndex === latestSelectIndex.current) {
|
||||
setSelectItem(data);
|
||||
setIsFetching(false);
|
||||
}
|
||||
})();
|
||||
}, [selectIndex, dataSource, imageData, isRelated]);
|
||||
|
||||
const selectqualityScore = useMemo(() => {
|
||||
return get(selectItem, 'qualityScore');
|
||||
}, [selectItem]);
|
||||
//支持视频url异步获取
|
||||
const [flvUrl, setFlvUrl] = useState(null);
|
||||
const [maxDuration, setMaxDuration] = useState(null);
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
if (model === 'IMAGE') {
|
||||
setFlvUrl(null);
|
||||
setMaxDuration(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isFunction(transformVideoPropFunc)) {
|
||||
//先情空
|
||||
setFlvUrl(null);
|
||||
setMaxDuration(null);
|
||||
const { flvUrl, maxDuration } = await transformVideoPropFunc(selectItem);
|
||||
//防背推
|
||||
if (selectIndex === latestSelectIndex.current) {
|
||||
setMaxDuration(maxDuration);
|
||||
setFlvUrl(flvUrl);
|
||||
}
|
||||
} else {
|
||||
setFlvUrl(get(selectItem, 'flvUrl'));
|
||||
setMaxDuration(get(selectItem, 'maxDuration'));
|
||||
}
|
||||
})();
|
||||
}, [selectItem, model]);
|
||||
|
||||
//切换选中index时候变更key 让组件走销毁逻辑 减少大图/视频组件内部逻辑复杂度
|
||||
const key = 0
|
||||
const imgCmpKey = useMemo(() => `img-key-${key}`, [key]);
|
||||
const videoCmpKey = useMemo(() => `video-key-${key}`, [key]);
|
||||
|
||||
// ========================== 分离参数 =========================
|
||||
const CompareViewProp = {
|
||||
targertImg: generateImg(get(selectItem, 'imgSummary', '')), // 对比图
|
||||
score: get(selectItem, 'score'),
|
||||
similarScore: get(selectItem, 'similarScore'),
|
||||
sourceImg:
|
||||
get(selectItem, 'constractKey', '') ||
|
||||
get(selectItem, 'compaterImages.0') ||
|
||||
generateImg(get(selectItem, 'imgSummary', '')),
|
||||
compaterImages: get(selectItem, 'compaterImages', []),
|
||||
specialTitle,
|
||||
isRelated,
|
||||
};
|
||||
const carouselProp = {
|
||||
selectIndex,
|
||||
setSelectIndex: setSelectIndexWrapper,
|
||||
hasPre,
|
||||
hasNext,
|
||||
dataSource: carouseDataSource,
|
||||
...otherCarouselProp,
|
||||
} as CarouselProps;
|
||||
const imgViewProp = {
|
||||
...pick(selectItem, ['imageKey', 'odRect', 'attachImg', 'score']),
|
||||
screenshotButtonRender,
|
||||
...otherImgViewProp,
|
||||
showCrop$,
|
||||
scale$,
|
||||
} as ImgViewProps;
|
||||
|
||||
const videoViewProp = {
|
||||
flvUrl,
|
||||
maxDuration,
|
||||
screenshotButtonRender,
|
||||
...otherVideoViewProp,
|
||||
showCrop$,
|
||||
} as VideoViewProps;
|
||||
|
||||
const ToolProps = {
|
||||
...otherToolProp,
|
||||
isGray: true,
|
||||
} as ToolProps;
|
||||
|
||||
// ========================== 插槽参数 =========================
|
||||
const imgViewRef = useRef<ImgViewRef>(null);
|
||||
const VideoViewRef = useRef<VideoViewRef>(null);
|
||||
scale$;
|
||||
const param: ParamProps = {
|
||||
tab,
|
||||
selectItem,
|
||||
imgViewRef,
|
||||
VideoViewRef,
|
||||
model,
|
||||
setModel,
|
||||
showCrop$,
|
||||
scale$,
|
||||
};
|
||||
const slots = getSolt(children, param);
|
||||
|
||||
// ========================== 监听键盘 =========================
|
||||
useEffect(() => {
|
||||
const onKeyDown = (event) => {
|
||||
const { keyCode } = event;
|
||||
if (keyCode === KeyCode.LEFT) {
|
||||
setSelectIndexWrapper((pre) => --pre);
|
||||
}
|
||||
if (keyCode === KeyCode.RIGHT) {
|
||||
setSelectIndexWrapper((pre) => ++pre);
|
||||
}
|
||||
};
|
||||
document.addEventListener('keydown', onKeyDown);
|
||||
return () => {
|
||||
document.removeEventListener('keydownm', onKeyDown);
|
||||
};
|
||||
}, []);
|
||||
|
||||
// ========================== 监听滚轮 =========================
|
||||
React.useEffect(() => {
|
||||
const mousewheelListener = (e) => {
|
||||
e.preventDefault();
|
||||
let direction = 0;
|
||||
if (e.wheelDelta) {
|
||||
//IE/Opera/Chrome
|
||||
if (e.wheelDelta > 0) {
|
||||
//向上滚动事件
|
||||
direction = 1;
|
||||
} else {
|
||||
//向下滚动事件
|
||||
direction = -1;
|
||||
}
|
||||
} else if (e.detail) {
|
||||
//Firefox
|
||||
if (e.detail < 0) {
|
||||
//向上滚动事件
|
||||
direction = 1;
|
||||
} else {
|
||||
//向下滚动事件
|
||||
direction = -1;
|
||||
}
|
||||
}
|
||||
setSelectIndexWrapper((pre) => {
|
||||
return direction < 0 ? pre + 1 : pre - 1;
|
||||
});
|
||||
};
|
||||
let handleMouseWheel;
|
||||
if (store.bigImgScrollEmit) {
|
||||
handleMouseWheel = addEventListenerWrap(document, 'mousewheel', mousewheelListener);
|
||||
} else {
|
||||
handleMouseWheel?.remove();
|
||||
}
|
||||
return () => {
|
||||
handleMouseWheel?.remove();
|
||||
};
|
||||
}, [store.bigImgScrollEmit]);
|
||||
|
||||
const tabList = [
|
||||
{
|
||||
key: 'related',
|
||||
label: '关联的目标',
|
||||
children: (
|
||||
<div className={styles.relatedContent}>
|
||||
{showCarousel && (
|
||||
<div className={classNames(styles.relatedPics)}>
|
||||
<Carousel {...carouselProp} />
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
style={
|
||||
isEmpty(relatedList) ? { color: 'rgba(0, 0, 0, 0.25)', cursor: 'not-allowed' } : {}
|
||||
}
|
||||
className={classNames(styles.relatedBtn)}
|
||||
onClick={async (e) => {
|
||||
if (isEmpty(relatedList)) {
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
try {
|
||||
const { archiveId, passerbyId } = selectItem;
|
||||
if (archiveId && passerbyId) {
|
||||
doubleClick({
|
||||
title: '确认取消关联,取消后可在“其他相似目标推荐”处再次关联',
|
||||
checkboxLabel: '同时移除档案对应轨迹',
|
||||
checked: true,
|
||||
onOk: async () => {
|
||||
try {
|
||||
await achieveStore.archive.UnLinkTarget(passerbyId, archiveId);
|
||||
message.success('目标已成功取消关联!');
|
||||
// 更新已关联目标列表
|
||||
const { relatedPassersby } = await achieveStore.archive.GetRelatedArchive(
|
||||
archiveId
|
||||
);
|
||||
setRelatedList(relatedPassersby);
|
||||
setImageData(relatedPassersby);
|
||||
// 更新当前相似目标列表
|
||||
const { similarPassersby } =
|
||||
await achieveStore.archive.GetSimilarPasserbyList(archiveId);
|
||||
setSimilarList(similarPassersby);
|
||||
setSelectIndex((pre) => {
|
||||
if (pre > 0) {
|
||||
return pre - 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
message.success('目标取消关联失败!');
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
<IconFont
|
||||
icon="icon-guanlian"
|
||||
styles={{ fontWeight: 'bold', margin: '0px 4px 0px 17px' }}
|
||||
size={16}
|
||||
/>
|
||||
取消关联
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: 'unRlated',
|
||||
label: '其他相似目标推荐',
|
||||
children: (
|
||||
<div className={styles.relatedContent}>
|
||||
{showCarousel && (
|
||||
<div className={classNames(styles.relatedPics)}>
|
||||
<Carousel {...carouselProp} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div
|
||||
style={
|
||||
isEmpty(lastSimData.current)
|
||||
? { color: 'rgba(0, 0, 0, 0.25)', cursor: 'not-allowed' }
|
||||
: {}
|
||||
}
|
||||
className={classNames(styles.relatedBtn)}
|
||||
onClick={async (e) => {
|
||||
if (isEmpty(lastSimData.current)) {
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
try {
|
||||
const { archiveId, passerbyId, archiveGroupId, trajectoryId } = selectItem;
|
||||
|
||||
if (archiveId && passerbyId && archiveGroupId && trajectoryId) {
|
||||
await achieveStore.archive.LinkTarget({
|
||||
passerbyId,
|
||||
archiveId,
|
||||
archiveGroupId,
|
||||
trajectoryId,
|
||||
});
|
||||
message.success('目标已成功关联!');
|
||||
// 更新当前相似目标列表
|
||||
const { similarPassersby } = await achieveStore.archive.GetSimilarPasserbyList(
|
||||
archiveId
|
||||
);
|
||||
setSimilarList(similarPassersby);
|
||||
setImageData(similarPassersby);
|
||||
|
||||
// 更新已关联目标列表
|
||||
const { relatedPassersby } = await achieveStore.archive.GetRelatedArchive(
|
||||
archiveId
|
||||
);
|
||||
setRelatedList(relatedPassersby);
|
||||
setSelectIndex((pre) => {
|
||||
if (pre > 0) {
|
||||
return pre - 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
message.error('目标关联失败!');
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
<IconFont
|
||||
icon="icon-guanlian"
|
||||
styles={{ fontWeight: 'bold', margin: '0px 4px 0px 17px' }}
|
||||
size={16}
|
||||
/>
|
||||
关联
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
return (
|
||||
<Modal
|
||||
open={visible}
|
||||
onCancel={onClose}
|
||||
footer={null}
|
||||
className={classNames(componentName)}
|
||||
centered
|
||||
title={title}
|
||||
>
|
||||
{!isEmpty(attributeList) && <AttributePanel attributeList={attributeList} />}
|
||||
{showHeader && (
|
||||
<Header
|
||||
noBgColor={!isEmpty(attributeList)}
|
||||
value={tab}
|
||||
onChange={setTab}
|
||||
tabsFilter={tabsFilter}
|
||||
/>
|
||||
)}
|
||||
<div
|
||||
className={classNames(`${componentName}-view-container`)}
|
||||
style={
|
||||
tab === 'TRACK'
|
||||
? {
|
||||
height: '718px',
|
||||
marginBottom: '0px',
|
||||
}
|
||||
: {}
|
||||
}
|
||||
>
|
||||
{tab !== 'TRACK' && (
|
||||
<>
|
||||
{/* ---------------------------------- 对比图模式 --------------------------------- */}
|
||||
{model == 'IMAGE' && tab === 'COMPATER' && !isEmpty(selectItem) && (
|
||||
<CompareView {...CompareViewProp} />
|
||||
)}
|
||||
{/* ---------------------------------- 场景图模式 --------------------------------- */}
|
||||
{!isLoading &&
|
||||
model == 'IMAGE' &&
|
||||
tab === 'NORMAL' &&
|
||||
!isEmpty(selectItem?.rectList) && (
|
||||
<ImgView key={imgCmpKey} {...imgViewProp} ref={imgViewRef} />
|
||||
)}
|
||||
{/* -------------------------------- 暂无图片数据 -------------------------------- */}
|
||||
{!isLoading && model == 'IMAGE' && isEmpty(selectItem) && tab === 'COMPATER' && (
|
||||
<NullView {...nullDialogProp}></NullView>
|
||||
)}
|
||||
{!isLoading && model == 'IMAGE' && isEmpty(selectItem.rectList) && tab === 'NORMAL' && (
|
||||
<NullView emptyText={isRelated ? '暂无匹配数据' : '暂无数据'}></NullView>
|
||||
)}
|
||||
{/* --------------------------------- 视频播放模式 --------------------------------- */}
|
||||
{!isLoading && model == 'VIDEO' && (
|
||||
<VideoView key={videoCmpKey} {...videoViewProp} ref={VideoViewRef} />
|
||||
)}
|
||||
{/* ----------------------------------- 左导航 ---------------------------------- */}
|
||||
<Navigation
|
||||
className={classNames(
|
||||
`${componentName}-view-container__nav`,
|
||||
!hasPre && `${componentName}-view-container__nav--disabled`,
|
||||
`${componentName}-view-container__nav--left`
|
||||
)}
|
||||
show={isRelated ? imageData.length !== 1 : dataSource.length !== 1}
|
||||
disabled={!hasPre}
|
||||
prev
|
||||
onClick={(e) => {
|
||||
if (useVirtual && selectIndex === 0) {
|
||||
!!loadPre && loadPre();
|
||||
//都跳转到第一个
|
||||
setSelectIndexWrapper(0);
|
||||
} else {
|
||||
setSelectIndexWrapper((pre) => pre - 1);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{/* ----------------------------------- 右导航 ---------------------------------- */}
|
||||
<Navigation
|
||||
className={classNames(
|
||||
`${componentName}-view-container__nav`,
|
||||
!hasNext && `${componentName}-view-container__nav--disabled`,
|
||||
`${componentName}-view-container__nav--right`
|
||||
)}
|
||||
show={isRelated ? imageData.length !== 1 : dataSource.length !== 1}
|
||||
disabled={!hasNext}
|
||||
next
|
||||
onClick={async (e) => {
|
||||
if (isRelated) {
|
||||
if (useVirtual && selectIndex === imageData.length - 1) {
|
||||
!!loadNext && (await loadNext());
|
||||
//都跳转到第一个
|
||||
setSelectIndexWrapper(0);
|
||||
} else {
|
||||
setSelectIndexWrapper((pre) => pre + 1);
|
||||
}
|
||||
} else {
|
||||
if (useVirtual && selectIndex === dataSource.length - 1) {
|
||||
!!loadNext && (await loadNext());
|
||||
//都跳转到第一个
|
||||
setSelectIndexWrapper(0);
|
||||
} else {
|
||||
setSelectIndexWrapper((pre) => pre + 1);
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{/* 工具集合 */}
|
||||
{tab !== 'TRACK' && showTool && (
|
||||
<>
|
||||
<div className={classNames(`${componentName}-tool-container`)}>
|
||||
<Tool {...ToolProps} param={param} />
|
||||
</div>
|
||||
{slots['after-tool']}
|
||||
</>
|
||||
)}
|
||||
{/* 人脸质量分 */}
|
||||
{!!selectqualityScore && store.user.isfaceScore && model == 'IMAGE' && tab === 'NORMAL' && (
|
||||
<div
|
||||
style={isRelated ? { bottom: 220 } : { bottom: 90 }}
|
||||
slot={'after-tool'}
|
||||
className={classNames(`${componentName}__face-score`)}
|
||||
>{`人脸质量分:${(selectqualityScore as number).toFixed(2)}`}</div>
|
||||
)}
|
||||
{/* --------------------------------- 模型碰撞组件 --------------------------------- */}
|
||||
{isRelated && tab !== 'TRACK' && (
|
||||
<div className={styles.relatedWrapper}>
|
||||
<TabPane
|
||||
className={styles.relatedTabs}
|
||||
tabPosition={'left'}
|
||||
activeKey={activeKey}
|
||||
onChange={(key: string) => {
|
||||
setActiveKey(key);
|
||||
}}
|
||||
items={tabList.map((item) => {
|
||||
return {
|
||||
label: item.label,
|
||||
key: item.key,
|
||||
children: item.children,
|
||||
};
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default observer(BigImageDialog);
|
@ -1,162 +1,5 @@
|
||||
// @ts-nocheck
|
||||
import React, { useRef, useState } from 'react'
|
||||
import { Descriptions, Modal, Tabs } from 'antd';
|
||||
import classNames from 'classnames'
|
||||
import type { ModalProps, DescriptionsProps, TabsProps } from 'antd'
|
||||
import { get } from '@zhst/func';
|
||||
import './index.less'
|
||||
import Navigation from './components/navigation';
|
||||
import BigImageModal from "./BigImageModal";
|
||||
|
||||
const DescriptionsItem = Descriptions.Item
|
||||
|
||||
export const componentPrefix = 'zhst-image'
|
||||
|
||||
export interface BigImageModalProps extends ModalProps {
|
||||
visible: boolean // 弹框显示隐藏
|
||||
descriptionConfig: {
|
||||
data: { // 描述列表
|
||||
title: string; // 标题
|
||||
children: Pick<DescriptionsProps, 'items'> // 描述项
|
||||
}[]
|
||||
}
|
||||
tabsConfig: { // 导航栏配置
|
||||
data: Pick<TabsProps, 'items'> & {
|
||||
key: 'NORMAL' | 'COMPATER' | 'TRACK'
|
||||
} // 导航栏列表
|
||||
}
|
||||
dataSource: any
|
||||
imageData: any
|
||||
relatedData: any
|
||||
}
|
||||
|
||||
const initialStyle ={
|
||||
fontSize: '12px'
|
||||
}
|
||||
|
||||
const BigImageModal: React.FC<BigImageModalProps> = (props) => {
|
||||
const {
|
||||
title = '-',
|
||||
open,
|
||||
visible,
|
||||
children,
|
||||
descriptionConfig = {
|
||||
data: []
|
||||
},
|
||||
tabsConfig = {
|
||||
data: [
|
||||
{
|
||||
label: '对比图模式',
|
||||
key: '1',
|
||||
children: '对比图组件',
|
||||
},
|
||||
{
|
||||
label: '场景图模式',
|
||||
key: '2',
|
||||
children: '场景图组件',
|
||||
}
|
||||
],
|
||||
},
|
||||
dataSource = [],
|
||||
imageData = [],
|
||||
relatedData = [],
|
||||
} = props
|
||||
|
||||
const showCropRef = useRef(false);
|
||||
const scaleRef = useRef(0);
|
||||
|
||||
// ========================== 头切换 =========================
|
||||
const [activeKey, setActiveKey] = useState<string>(get(tabsConfig, 'data[0].key'));
|
||||
|
||||
// ========================= 预览切换下标 =========================
|
||||
const [previewIndex, setPreviewIndex] = useState<number>(0)
|
||||
const [isRelated, setIsRelated] = useState<number>(false)
|
||||
|
||||
return (
|
||||
<Modal
|
||||
destroyOnClose
|
||||
open={open || visible}
|
||||
footer={null}
|
||||
className={componentPrefix}
|
||||
title={title}
|
||||
{...props}
|
||||
>
|
||||
{descriptionConfig.data.map(descriptions => (
|
||||
<Descriptions
|
||||
key={descriptions.title}
|
||||
title={
|
||||
<p style={{ margin: '12px 0 0', fontSize: initialStyle.fontSize }}>
|
||||
{descriptions.title}
|
||||
</p>
|
||||
}
|
||||
column={8}
|
||||
style={{ padding: '0 64px' }}
|
||||
>
|
||||
{descriptions?.children?.map(item => (
|
||||
<DescriptionsItem
|
||||
key={item.key}
|
||||
label={item.label}
|
||||
span={1}
|
||||
contentStyle={{ fontSize: initialStyle.fontSize }}
|
||||
labelStyle={{ fontSize: initialStyle.fontSize }}
|
||||
>{item.children}</DescriptionsItem>
|
||||
))}
|
||||
</Descriptions>
|
||||
))}
|
||||
<Tabs
|
||||
defaultActiveKey={activeKey}
|
||||
centered
|
||||
tabBarStyle={{ fontSize: '18px' }}
|
||||
items={tabsConfig.data}
|
||||
{...tabsConfig}
|
||||
/>
|
||||
<div
|
||||
className={classNames(`${componentPrefix}-view-container`)}
|
||||
style={
|
||||
activeKey === 'TRACK'
|
||||
? {
|
||||
height: '718px',
|
||||
marginBottom: '0px',
|
||||
}
|
||||
: {}
|
||||
}
|
||||
>
|
||||
{
|
||||
activeKey !== 'TRACK' && (
|
||||
<>
|
||||
{/* ----------------------------------- 上一张按钮 ---------------------------------- */}
|
||||
<Navigation
|
||||
className={classNames(
|
||||
`${componentPrefix}-view-container__nav`,
|
||||
previewIndex <= 0 && `${componentPrefix}-view-container__nav--disabled`,
|
||||
`${componentPrefix}-view-container__nav--left`
|
||||
)}
|
||||
show={isRelated ? (imageData.length > 1) : (dataSource.length > 1)}
|
||||
disabled={previewIndex <= 0}
|
||||
prev
|
||||
onClick={() => {
|
||||
setPreviewIndex((pre) => pre - 1);
|
||||
}}
|
||||
/>
|
||||
{/* ----------------------------------- 下一张按钮 ---------------------------------- */}
|
||||
<Navigation
|
||||
className={classNames(
|
||||
`${componentPrefix}-view-container__nav`,
|
||||
((previewIndex >= imageData.length - 1) || (previewIndex >= dataSource.length - 1)) && `${componentPrefix}-view-container__nav--disabled`,
|
||||
`${componentPrefix}-view-container__nav--right`
|
||||
)}
|
||||
show={isRelated ? (imageData.length > 1) : (dataSource.length > 1)}
|
||||
disabled={((previewIndex >= imageData.length - 1) || (previewIndex >= dataSource.length - 1))}
|
||||
next
|
||||
onClick={async (e) => {
|
||||
setPreviewIndex((pre) => pre + 1);
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
export type { BigImageModalProps } from './BigImageModal'
|
||||
|
||||
export default BigImageModal
|
||||
|
@ -1,103 +0,0 @@
|
||||
import doRequest from '../../utils/request';
|
||||
import { NetworkType, useStores } from '@store/index';
|
||||
import { useMount, useUnmount } from '@zhst/hooks';
|
||||
import { useRef, useState } from 'react';
|
||||
import type { CamerasStatusList, StatusList } from '../../interface'
|
||||
|
||||
const Streams = [
|
||||
'TASK_OVERVIEW_WAIT_START_STREAM',
|
||||
'TASK_OVERVIEW_WAIT_STREAM',
|
||||
'TASK_OVERVIEW_WAIT_START_SVINFER',
|
||||
];
|
||||
|
||||
const StreamsNum = [1, 2, 3];
|
||||
const RunsNum = [5, 9];
|
||||
const ErrorsNum = [7];
|
||||
|
||||
const Runs = ['TASK_OVERVIEW_RUNNING', 'TASK_OVERVIEW_FINISH'];
|
||||
|
||||
const Errors = ['TASK_OVERVIEW_ERROR'];
|
||||
|
||||
export const getListTaskStatus = async (data?: { taskIndex: { deviceId: string }[] }) => {
|
||||
const res = await doRequest<{
|
||||
taskStatus: StatusList;
|
||||
}>({
|
||||
url: '/singer.TaskManagerService/ListTaskStatusResponse',
|
||||
method: 'POST',
|
||||
data: data || {}
|
||||
});
|
||||
return res;
|
||||
};
|
||||
export const getCameraStatusFunc = (list: StatusList, useNum = false) => {
|
||||
const _Runs: any = useNum ? RunsNum : Runs;
|
||||
const _Errors: any = useNum ? ErrorsNum : Errors;
|
||||
const _Streams: any = useNum ? StreamsNum : Streams;
|
||||
const res = list.reduce((res, cur) => {
|
||||
const cameraId = cur.taskIndex.deviceId;
|
||||
const status = cur.taskOverview;
|
||||
res.some((ids, i) => {
|
||||
if (ids.includes(cameraId)) {
|
||||
res[i] = ids.filter((id) => id !== cameraId);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (_Runs.includes(status)) {
|
||||
res[0].push(cameraId);
|
||||
} else if (_Errors.includes(status)) {
|
||||
res[1].push(cameraId);
|
||||
} else if (_Streams.includes(status)) {
|
||||
res[2].push(cameraId);
|
||||
}
|
||||
return res;
|
||||
}, [[], [], []]);
|
||||
return [...res];
|
||||
};
|
||||
let camerasStatusStoreList: CamerasStatusList = [[], [], []];
|
||||
let num = 0;
|
||||
const useTaskState = () => {
|
||||
const { store } = useStores();
|
||||
const [camerasStatusList, setCamerasStatusList] =
|
||||
useState<CamerasStatusList>(camerasStatusStoreList);
|
||||
const timerRef = useRef(null);
|
||||
|
||||
const getCameraStatus = (list: StatusList, useNum = false) => {
|
||||
const res = getCameraStatusFunc(list, useNum);
|
||||
setCamerasStatusList(res);
|
||||
};
|
||||
const request = (data: { taskStatus: StatusList }[]) => {
|
||||
if (data) {
|
||||
const list: StatusList = [];
|
||||
data.forEach((v) => {
|
||||
list.push(...v.taskStatus);
|
||||
});
|
||||
getCameraStatus(list, store.networkType === NetworkType.NORMAL);
|
||||
}
|
||||
};
|
||||
useMount(async () => {
|
||||
num++;
|
||||
if (num - 1 > 0) {
|
||||
return;
|
||||
}
|
||||
const res = await getListTaskStatus();
|
||||
getCameraStatus(res.taskStatus);
|
||||
if (store.networkType === NetworkType.DUAL_NETWORK) {
|
||||
timerRef.current = setInterval(async () => {
|
||||
const res = await getListTaskStatus();
|
||||
request([res]);
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
useUnmount(() => {
|
||||
clearInterval(timerRef.current);
|
||||
setCamerasStatusList([[], [], []]);
|
||||
num--;
|
||||
if (num === 0) {
|
||||
camerasStatusStoreList = [[], [], []];
|
||||
}
|
||||
});
|
||||
|
||||
return camerasStatusList;
|
||||
};
|
||||
|
||||
export default useTaskState;
|
@ -1,7 +1,6 @@
|
||||
export const OBJECT_GRNER_THRESHOLD = 0.8; //目标图判断性别阈值
|
||||
export const OBJECT_AGE_TYPE_THRESHOLD = 0.5; //目标图判断年龄段阈值
|
||||
export const MODE_KEY = 'test_mode';
|
||||
export const ROUTER_SHOULD_FILTER = isDev; //是否根据后台配置路由,开发环境全打开
|
||||
//业务约定
|
||||
export const SEARCH_IMG_COUNT = 10; //检索图片的最大个数
|
||||
export const GLOBAL_IS_ITEM_NUMBER_SHOW = false; //是否展示索引
|
||||
|
@ -1,77 +0,0 @@
|
||||
import { extend } from 'umi-request';
|
||||
import type { RequestOptionsInit } from 'umi-request';
|
||||
import { get } from '@zhst/func';
|
||||
import { message } from 'antd';
|
||||
import base64 from 'base-64';
|
||||
|
||||
export class ResponseError<D> extends Error {
|
||||
name;
|
||||
data;
|
||||
response;
|
||||
request;
|
||||
type;
|
||||
constructor(
|
||||
response: Response,
|
||||
text: string,
|
||||
data: D,
|
||||
request: {
|
||||
url: string;
|
||||
options: RequestOptionsInit;
|
||||
},
|
||||
type = 'ResponseError'
|
||||
) {
|
||||
super(text || response.statusText);
|
||||
this.name = 'ResponseError';
|
||||
this.data = data;
|
||||
this.response = response;
|
||||
this.request = request;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
export const request = extend({
|
||||
getResponse: true,
|
||||
// timeout: 1000,
|
||||
parseResponse: false,
|
||||
});
|
||||
|
||||
//错误处理中间件
|
||||
request.use(async (ctx, next) => {
|
||||
const { req } = ctx;
|
||||
const { toast = true } = req?.options || {};
|
||||
try {
|
||||
await next();
|
||||
const { res } = ctx;
|
||||
const d = await res.text();
|
||||
if (res.status === 401) {
|
||||
message.warning('登录过期,请重新登录!');
|
||||
return;
|
||||
}
|
||||
const isEmptyRes = d === ''; //有些后端接口成功会返回空 做下兼容
|
||||
const body = !isEmptyRes ? JSON.parse(d) : d;
|
||||
if (res.status >= 200 && res.status < 300) {
|
||||
ctx.res = body;
|
||||
} else {
|
||||
// 先判断Grpc-Metadata-Errorx-Message
|
||||
let errMsg = res.headers.get('Grpc-Metadata-Errorx-Message');
|
||||
if (errMsg) {
|
||||
errMsg = window.utf8?.decode(base64.decode(errMsg));
|
||||
// 后判断 body中的message
|
||||
} else if (!errMsg && get(body, 'message')) {
|
||||
errMsg = `${get(body, 'message')}`;
|
||||
} else {
|
||||
// 最后看状态码
|
||||
errMsg = '您的网络发生异常,无法连接服务器';
|
||||
}
|
||||
toast && message.error(errMsg);
|
||||
throw new ResponseError(res, errMsg, d, req, 'CustomError');
|
||||
}
|
||||
} catch (error) {
|
||||
if (get(error, 'type') !== 'CustomError') {
|
||||
toast && message.error('您的网络发生异常,无法连接服务器');
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
||||
export default request
|
@ -1,5 +1,11 @@
|
||||
# @zhst/biz
|
||||
|
||||
## 0.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 初始化项目包
|
||||
|
||||
## 0.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zhst/constants",
|
||||
"version": "0.2.4",
|
||||
"version": "0.3.0",
|
||||
"description": "常量库",
|
||||
"keywords": [
|
||||
"constants",
|
||||
@ -33,6 +33,5 @@
|
||||
"access": "public",
|
||||
"registry": "http://10.0.0.77:4874"
|
||||
},
|
||||
"dependencies": {
|
||||
}
|
||||
"dependencies": {}
|
||||
}
|
||||
|
@ -1,2 +1,3 @@
|
||||
export * from './camera'
|
||||
export * from './base'
|
||||
export * from './user'
|
||||
|
@ -0,0 +1 @@
|
||||
export default {}
|
@ -1,5 +1,16 @@
|
||||
# @zhst/utils
|
||||
|
||||
## 0.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: 初始化项目包
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies
|
||||
- @zhst/request@0.3.0
|
||||
|
||||
## 0.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
41
packages/func/es/camera/constants.d.ts
vendored
Normal file
41
packages/func/es/camera/constants.d.ts
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 设备类型枚举
|
||||
*/
|
||||
export declare const DeviceType: {
|
||||
VMS: string;
|
||||
DIR: string;
|
||||
CAMERA: string;
|
||||
};
|
||||
export declare const LOCAL_KEY = "local";
|
||||
export declare const DIRE_CONNECT_KEY = "direconnect";
|
||||
export declare const BOX_LIST_KEY = "boxlist";
|
||||
export declare enum VmsplatformOpt {
|
||||
VMSPLATFORMOPT_ID = 0,
|
||||
VMSPLATFORMOPT_PLATFORMNAME = 1,
|
||||
VMSPLATFORMOPT_PLUGINNAME = 2,
|
||||
VMSPLATFORMOPT_IP = 3,
|
||||
VMSPLATFORMOPT_PORT = 4,
|
||||
VMSPLATFORMOPT_USERNAME = 5,
|
||||
VMSPLATFORMOPT_PASSWORD = 6
|
||||
}
|
||||
export declare enum OPT {
|
||||
OR = 0,
|
||||
AND = 1,
|
||||
ORNOT = 2,
|
||||
ANDNOT = 3
|
||||
}
|
||||
export declare enum DevicemanagerCameraType {
|
||||
DEVICEMANAGER_CAMERA_TYPE_DEFAULT = 0,
|
||||
DEVICEMANAGER_CAMERA_TYPE_NORMAL = 1,
|
||||
DEVICEMANAGER_CAMERA_TYPE_1400 = 97,
|
||||
DEVICEMANAGER_CAMERA_TYPE_DHGRABBER = 98,
|
||||
DEVICEMANAGER_CAMERA_TYPE_HKGRABBER = 99,
|
||||
DEVICEMANAGER_CAMERA_TYPE_LOCAL = 100
|
||||
}
|
||||
export declare const BOX_DIRECONNECT_PLATFORM_FILTER: {
|
||||
filtervmsplatformList: {
|
||||
opt: OPT;
|
||||
vmsplatformOpt: VmsplatformOpt;
|
||||
value: string;
|
||||
}[];
|
||||
};
|
40
packages/func/es/camera/index.d.ts
vendored
Normal file
40
packages/func/es/camera/index.d.ts
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
import { DevicemanagerCameraType } from './constants';
|
||||
export declare const isFaceCamera: (type: DevicemanagerCameraType) => boolean;
|
||||
/**
|
||||
*
|
||||
* @param value 传入的数据 可以是 item(camera/vms/dirs)/ deviceID
|
||||
* @param isId
|
||||
*/
|
||||
export declare function getDeviceType(value: {
|
||||
[x: string]: any;
|
||||
id: any;
|
||||
} | string): any;
|
||||
/**
|
||||
* 后端设备id/vmsid/dirid是三张表 合并在一起不保证唯一 前端生成唯一key
|
||||
* @param id 设备id
|
||||
* @param type 设备类型
|
||||
*/
|
||||
export declare function deviceIDToDeviceKey(id: any, type: string, vmsId?: any): string;
|
||||
/**
|
||||
* 后端设备id/vmsid/dirid是三张表 合并在一起不保证唯一 前端生成唯一key
|
||||
* @param item camera/vms/dirs
|
||||
*/
|
||||
export declare function deviceToDeviceKey(item: {
|
||||
[x: string]: any;
|
||||
id: any;
|
||||
}): string;
|
||||
/**
|
||||
* 设备树key 转 后端设备原始id dirid是string/vms&camera 是number 和后端保持一致
|
||||
* @param deviceKey 设备树的id
|
||||
*/
|
||||
export declare function deviceKeyToDeviceId(deviceKey: {
|
||||
split: (arg0: string) => [any, any];
|
||||
}): any;
|
||||
export declare const getVmsIdByDeviceId: (key: string) => string;
|
||||
/**
|
||||
* 通过设备id或设备key在树里面找摄像头
|
||||
* @param ids cameraId
|
||||
* @param deviceTree 树
|
||||
* @param type "id" | "key"
|
||||
*/
|
||||
export declare const findCamerasByInDeviceTree: (ids: never[] | undefined, deviceTree: any, type?: string) => any[];
|
75
packages/func/es/file/index.d.ts
vendored
Normal file
75
packages/func/es/file/index.d.ts
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
import { Rect } from '@zhst/types';
|
||||
/**
|
||||
*
|
||||
* @param url 需要转为图片的链接
|
||||
* @returns 图片的 dom
|
||||
*/
|
||||
export declare const urlToImg: (url: string) => Promise<HTMLImageElement>;
|
||||
export declare const base64DecodeImageKey: (base64ImgKey: string) => string;
|
||||
/**
|
||||
* 通过url获取图片的base64字符串
|
||||
* @param src 图片链接
|
||||
* @param outputFormat 图片格式
|
||||
* @returns base64 @string
|
||||
*/
|
||||
export declare const getBase64ByUrl: (src: string | URL, outputFormat?: string) => Promise<unknown>;
|
||||
/**
|
||||
* 把文件转base64
|
||||
* @param file @file 文件
|
||||
* @returns @string
|
||||
*/
|
||||
export declare const fileToBase64: (file: any) => Promise<string>;
|
||||
/**
|
||||
*
|
||||
* @param image @file 图片文件
|
||||
* @param width @number 宽度
|
||||
* @param height @number 高度
|
||||
* @returns @string base64
|
||||
*/
|
||||
export declare const getBase64Image: (image: any, width?: any, height?: any) => string;
|
||||
/**
|
||||
* 通过图片获取base64
|
||||
* @param src 图片地址
|
||||
* @returns @string
|
||||
*/
|
||||
export declare const getBase64ByImage: (src: string) => Promise<unknown>;
|
||||
/**
|
||||
* url转base64
|
||||
* @param {String} url - url地址
|
||||
*/
|
||||
export declare const urlToBase64V2: (url: string) => Promise<unknown>;
|
||||
/**
|
||||
* base64转Blob
|
||||
* @param {String} base64 - base64
|
||||
*/
|
||||
export declare function base64toBlob(base64: string): Blob | undefined;
|
||||
/**
|
||||
* 图片集打包压缩下载
|
||||
* 1. url -> base64 -> blob
|
||||
* 2. 将blob加入jsZip文件夹内,用file-saver保存
|
||||
* @param {Array<{url:string,name:string}>} imgDataList
|
||||
* @param {string} zipName
|
||||
*/
|
||||
export declare const downloadPackageImages: (imgDataList: string | any[], zipName: string) => Promise<void>;
|
||||
export declare function getFileSize(size: number): string;
|
||||
export declare const dataURLToBlob: (dataurl: string) => Blob;
|
||||
/**
|
||||
* key 转 http 链接
|
||||
* @param originImgkey 图片的值 ,可以是 base64 也可以是 http链接
|
||||
* @param host 图片的域值
|
||||
* @returns {string}
|
||||
*/
|
||||
export declare const generateImg: (imgKey: string, host?: string) => string;
|
||||
/**
|
||||
* 获取指定字符串后面的部分
|
||||
* @param imageKey v1_开头的字符串
|
||||
* @returns
|
||||
*/
|
||||
export declare const getImageKey: (imageKey: string, preFix?: string) => string;
|
||||
/**
|
||||
* 获取图片
|
||||
* @param img 图片的url链接
|
||||
* @param odRect
|
||||
* @returns file
|
||||
*/
|
||||
export declare const getFileByRect: (img: string, odRect: Rect) => Promise<File>;
|
@ -12,8 +12,7 @@ import Base64 from 'base-64';
|
||||
import JSZip from 'jszip';
|
||||
import FileSaver from 'file-saver';
|
||||
import { matchS3Prefix } from "../utils";
|
||||
import { get } from 'lodash-es';
|
||||
|
||||
import { get, isString } from 'lodash-es';
|
||||
/**
|
||||
*
|
||||
* @param url 需要转为图片的链接
|
||||
@ -323,9 +322,10 @@ export var generateImg = function generateImg(_imgKey) {
|
||||
var imgUrl = '';
|
||||
//判空
|
||||
if (!imgKey) return '';
|
||||
if (/^(http:|https:)/.test(imgKey)) {
|
||||
if (/(http|https):\/\/([\w.]+\/?)\S*/ig.test(imgKey)) {
|
||||
return imgKey;
|
||||
}
|
||||
console.log('imgKey', imgKey);
|
||||
try {
|
||||
if (matchS3Prefix(imgKey)) {
|
||||
imgKey = base64DecodeImageKey(imgKey);
|
||||
@ -357,4 +357,57 @@ export var getImageKey = function getImageKey(imageKey, preFix) {
|
||||
} else {
|
||||
return imageKey;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取图片
|
||||
* @param img 图片的url链接
|
||||
* @param odRect
|
||||
* @returns file
|
||||
*/
|
||||
export var getFileByRect = /*#__PURE__*/function () {
|
||||
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(img, odRect) {
|
||||
var _commonCanvas$parentN;
|
||||
var image, url, commonCanvas, commonCtx, base64, blobData, file;
|
||||
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
||||
while (1) switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
if (!isString(img)) {
|
||||
_context2.next = 7;
|
||||
break;
|
||||
}
|
||||
url = generateImg(img);
|
||||
_context2.next = 4;
|
||||
return urlToImg(url);
|
||||
case 4:
|
||||
image = _context2.sent;
|
||||
_context2.next = 8;
|
||||
break;
|
||||
case 7:
|
||||
image = img;
|
||||
case 8:
|
||||
commonCanvas = document.createElement('canvas');
|
||||
commonCanvas.width = odRect.w * image.width;
|
||||
commonCanvas.height = odRect.h * image.height;
|
||||
commonCanvas.style.display = 'none';
|
||||
document.body.appendChild(commonCanvas);
|
||||
commonCtx = commonCanvas.getContext('2d');
|
||||
commonCtx === null || commonCtx === void 0 || commonCtx.translate(-odRect.x * image.width, -odRect.y * image.height);
|
||||
commonCtx === null || commonCtx === void 0 || commonCtx.drawImage(image, 0, 0);
|
||||
base64 = commonCanvas.toDataURL('image/jpeg');
|
||||
blobData = dataURLToBlob(base64);
|
||||
(_commonCanvas$parentN = commonCanvas.parentNode) === null || _commonCanvas$parentN === void 0 || _commonCanvas$parentN.removeChild(commonCanvas);
|
||||
file = new window.File([blobData], "".concat(new Date().getTime()), {
|
||||
type: 'image/jpeg'
|
||||
});
|
||||
return _context2.abrupt("return", file);
|
||||
case 21:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
}, _callee2);
|
||||
}));
|
||||
return function getFileByRect(_x3, _x4) {
|
||||
return _ref2.apply(this, arguments);
|
||||
};
|
||||
}();
|
11
packages/func/es/index.d.ts
vendored
Normal file
11
packages/func/es/index.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
export * from 'lodash-es';
|
||||
export * from './file';
|
||||
export * from './map';
|
||||
export * from './performance';
|
||||
export * from './string';
|
||||
export * from './number';
|
||||
export * from './time';
|
||||
export * from './utils';
|
||||
export * from './camera';
|
||||
export * from './math';
|
||||
export * from './upload';
|
@ -7,4 +7,5 @@ export * from "./number";
|
||||
export * from "./time";
|
||||
export * from "./utils";
|
||||
export * from "./camera";
|
||||
export * from "./math";
|
||||
export * from "./math";
|
||||
export * from "./upload";
|
10
packages/func/es/map/index.d.ts
vendored
Normal file
10
packages/func/es/map/index.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 获取经纬信息
|
||||
* @param lngLat 位置信息
|
||||
* @returns @object { long, lat }
|
||||
*/
|
||||
export declare const fixedLngLat: (lngLat?: string) => string;
|
||||
export declare const transformLngLat: (lngLat?: string) => {
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
} | null;
|
70
packages/func/es/math/index.d.ts
vendored
Normal file
70
packages/func/es/math/index.d.ts
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
import { IOdRectOrigin, Rect } from '@zhst/types';
|
||||
export declare const ALGORITHM_VERSION: {
|
||||
7: string;
|
||||
4: string;
|
||||
6: string;
|
||||
};
|
||||
export declare const algorithmVersions: string[];
|
||||
export declare const getBikeExtendRect: (rect: Rect, maxW: number) => {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
export declare const getOtherExtendRect: (srcRect: Rect, maxW: number, maxH: number, type: string) => {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
export declare const getNormalization: (srcRect: Rect, maxW: number, maxH: number) => {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
export declare const getExtendRect: (normalizationRect: Rect, imgW: number, imgH: number, type: string) => {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
export declare const getTransformRect: (image: {
|
||||
height: number;
|
||||
width: number;
|
||||
}, transform: {
|
||||
translateX: any;
|
||||
translateY: any;
|
||||
scale: any;
|
||||
rotate: any;
|
||||
}, rect: Rect) => {
|
||||
x: number;
|
||||
y: number;
|
||||
w: number;
|
||||
h: number;
|
||||
};
|
||||
export declare const getRotateImg: (image: HTMLImageElement, rotate: number) => File;
|
||||
/**
|
||||
* 格式化工具
|
||||
* @param originData
|
||||
* @returns
|
||||
*/
|
||||
export declare const getOdRect: (originData: IOdRectOrigin) => {
|
||||
x: any;
|
||||
y: any;
|
||||
w: any;
|
||||
h: any;
|
||||
id: any;
|
||||
qualityScore: any;
|
||||
algorithmVersion: string;
|
||||
featureData: any;
|
||||
objectRectIndex: number;
|
||||
objectType: any;
|
||||
objectId: any;
|
||||
frameTimestamp: any;
|
||||
sourceObjectId: any;
|
||||
extendBox: any;
|
||||
}[];
|
||||
export declare const getOdRectV2: (originData: {
|
||||
odv2Result: any[];
|
||||
}) => any;
|
File diff suppressed because one or more lines are too long
14
packages/func/es/number/index.d.ts
vendored
Normal file
14
packages/func/es/number/index.d.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 设置数据的精度
|
||||
* @param originNumber
|
||||
* @param accuracy 精度 以原点为中心向左为正,向右为负,
|
||||
* @param isCeil 是否为向上取整
|
||||
* @returns number
|
||||
*/
|
||||
export declare const setNumberAccuracy: (originNumber: number, accuracy?: number, isCeil?: boolean) => number;
|
||||
/**
|
||||
* 获取数字
|
||||
* @param number 需要校验的数值
|
||||
* @returns @number
|
||||
*/
|
||||
export declare const toRealNumber: (number: any) => any;
|
@ -24,4 +24,15 @@ export var setNumberAccuracy = function setNumberAccuracy(originNumber) {
|
||||
returnData = Number(returnData.toFixed(0));
|
||||
}
|
||||
return returnData;
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取数字
|
||||
* @param number 需要校验的数值
|
||||
* @returns @number
|
||||
*/
|
||||
export var toRealNumber = function toRealNumber(number) {
|
||||
if (isNaN(number) || number === Infinity) {
|
||||
return 0;
|
||||
} else return number;
|
||||
};
|
1
packages/func/es/performance/index.d.ts
vendored
Normal file
1
packages/func/es/performance/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare const speedConvert: (bps: number, contertUnit?: number) => string;
|
7
packages/func/es/string/index.d.ts
vendored
Normal file
7
packages/func/es/string/index.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
export declare const getStrLength: (str: string) => number;
|
||||
/**
|
||||
* js截取字符串,中英文都能用
|
||||
* @param str:需要截取的字符串
|
||||
* @param len: 需要截取的长度
|
||||
*/
|
||||
export declare const cutStr: (str: string, len: number) => string | String | undefined;
|
11
packages/func/es/time/index.d.ts
vendored
Normal file
11
packages/func/es/time/index.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
export declare const formateDuration: (diff: number) => string;
|
||||
export declare function generateTime(): {
|
||||
startDateTime: number;
|
||||
endDateTime: number;
|
||||
};
|
||||
/**
|
||||
* 格式化时间为 00:00
|
||||
* @param seconds 时间,单位秒
|
||||
* @returns
|
||||
*/
|
||||
export declare function formatDurationTime(seconds: number): string;
|
@ -46,4 +46,15 @@ export function generateTime() {
|
||||
startDateTime: startDateTime,
|
||||
endDateTime: endDateTime
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化时间为 00:00
|
||||
* @param seconds 时间,单位秒
|
||||
* @returns
|
||||
*/
|
||||
export function formatDurationTime(seconds) {
|
||||
var minutes = Math.floor(seconds / 60) || 0;
|
||||
var remainingSeconds = Math.floor(seconds % 60);
|
||||
return (minutes < 10 ? "0".concat(minutes) : minutes) + ":" + (remainingSeconds < 10 ? "0" : "") + remainingSeconds;
|
||||
}
|
8
packages/func/es/upload/index.d.ts
vendored
Normal file
8
packages/func/es/upload/index.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
type uploadOption = {
|
||||
bucket?: string;
|
||||
dir?: string;
|
||||
withSuFuffix?: boolean;
|
||||
};
|
||||
export declare const commonUpload: (file: File, option: uploadOption | undefined, type: string) => Promise<unknown>;
|
||||
export declare const upload: (file: File, option?: uploadOption) => Promise<unknown>;
|
||||
export {};
|
@ -7,6 +7,7 @@ import { getFileSuffix, getImageSuffixByFileType } from "../utils";
|
||||
import base64 from "base-64";
|
||||
import { v4 as uuidV4 } from 'uuid';
|
||||
import { get } from "lodash-es";
|
||||
import request from '@zhst/request';
|
||||
|
||||
//小文件上传走s3
|
||||
var defaultBucket = 'public';
|
||||
@ -60,7 +61,7 @@ export var commonUpload = /*#__PURE__*/function () {
|
||||
break;
|
||||
}
|
||||
_context.next = 3;
|
||||
return doRequest({
|
||||
return request({
|
||||
method: 'PUT',
|
||||
url: '/singer.FileServerService/PutObject',
|
||||
data: {
|
||||
@ -71,6 +72,7 @@ export var commonUpload = /*#__PURE__*/function () {
|
||||
putObjectOption: {
|
||||
contentType: file.type
|
||||
},
|
||||
// @ts-ignore
|
||||
fileDataBase64: (_reader$result = reader.result) === null || _reader$result === void 0 ? void 0 : _reader$result.split(';base64,')[1]
|
||||
}
|
||||
});
|
||||
|
36
packages/func/es/utils/index.d.ts
vendored
Normal file
36
packages/func/es/utils/index.d.ts
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
export { default as isChrome } from './isChrome';
|
||||
export declare const matchS3Prefix: (str: string) => boolean;
|
||||
/**
|
||||
* 通过文件名获取文件类型
|
||||
* @param fileName 文件名称
|
||||
* @returns 文件类型
|
||||
*/
|
||||
export declare const getFileSuffix: (fileName: string) => string;
|
||||
/**
|
||||
* 通过类型获取文件名
|
||||
* @param type 类型
|
||||
* @returns
|
||||
*/
|
||||
export declare const getImageSuffixByFileType: (type: string) => string;
|
||||
export declare function getChromeVersion(): number | false;
|
||||
export declare const nextTick: (func: (value: void) => void | PromiseLike<void>) => void;
|
||||
export declare const loop: (items: string | any[], callback: (arg0: any) => any) => void;
|
||||
export declare const addEventListenerWrapper: (target: any, eventType: string, cb: any, option?: any) => {
|
||||
remove: () => void;
|
||||
};
|
||||
/**
|
||||
* Get transforms base on the given object.
|
||||
* @param {Object} obj - The target object.
|
||||
* @returns {string} A string contains transform values.
|
||||
*/
|
||||
export declare function getTransforms({ rotate, scaleX, scaleY, translateX, translateY, }: {
|
||||
rotate?: number;
|
||||
scaleX?: number;
|
||||
scaleY?: number;
|
||||
translateX?: number;
|
||||
translateY?: number;
|
||||
}): {
|
||||
WebkitTransform: string;
|
||||
msTransform: string;
|
||||
transform: string;
|
||||
};
|
@ -89,7 +89,7 @@ export var loop = function loop(items, callback) {
|
||||
}
|
||||
}
|
||||
};
|
||||
export var addEventListener = function addEventListener(target, eventType, cb, option) {
|
||||
export var addEventListenerWrapper = function addEventListenerWrapper(target, eventType, cb, option) {
|
||||
/* eslint camelcase: 2 */
|
||||
var callback = ReactDOM.unstable_batchedUpdates ? function run(e) {
|
||||
ReactDOM.unstable_batchedUpdates(cb, e);
|
||||
|
3
packages/func/es/utils/isChrome.d.ts
vendored
Normal file
3
packages/func/es/utils/isChrome.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export declare const isBrowser: boolean;
|
||||
declare const isChrome: () => boolean;
|
||||
export default isChrome;
|
@ -1,7 +1,7 @@
|
||||
export var isBrowser = !!(typeof window !== 'undefined' && window);
|
||||
export var isBrowser = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
||||
var isChrome = function isChrome() {
|
||||
var winNav = isBrowser && window.navigator;
|
||||
var vendorName = winNav && winNav.vendor;
|
||||
var vendorName = winNav && (winNav === null || winNav === void 0 ? void 0 : winNav.vendor);
|
||||
var userAgent = winNav && winNav.userAgent;
|
||||
|
||||
//@ts-ignore
|
||||
|
41
packages/func/lib/camera/constants.d.ts
vendored
Normal file
41
packages/func/lib/camera/constants.d.ts
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 设备类型枚举
|
||||
*/
|
||||
export declare const DeviceType: {
|
||||
VMS: string;
|
||||
DIR: string;
|
||||
CAMERA: string;
|
||||
};
|
||||
export declare const LOCAL_KEY = "local";
|
||||
export declare const DIRE_CONNECT_KEY = "direconnect";
|
||||
export declare const BOX_LIST_KEY = "boxlist";
|
||||
export declare enum VmsplatformOpt {
|
||||
VMSPLATFORMOPT_ID = 0,
|
||||
VMSPLATFORMOPT_PLATFORMNAME = 1,
|
||||
VMSPLATFORMOPT_PLUGINNAME = 2,
|
||||
VMSPLATFORMOPT_IP = 3,
|
||||
VMSPLATFORMOPT_PORT = 4,
|
||||
VMSPLATFORMOPT_USERNAME = 5,
|
||||
VMSPLATFORMOPT_PASSWORD = 6
|
||||
}
|
||||
export declare enum OPT {
|
||||
OR = 0,
|
||||
AND = 1,
|
||||
ORNOT = 2,
|
||||
ANDNOT = 3
|
||||
}
|
||||
export declare enum DevicemanagerCameraType {
|
||||
DEVICEMANAGER_CAMERA_TYPE_DEFAULT = 0,
|
||||
DEVICEMANAGER_CAMERA_TYPE_NORMAL = 1,
|
||||
DEVICEMANAGER_CAMERA_TYPE_1400 = 97,
|
||||
DEVICEMANAGER_CAMERA_TYPE_DHGRABBER = 98,
|
||||
DEVICEMANAGER_CAMERA_TYPE_HKGRABBER = 99,
|
||||
DEVICEMANAGER_CAMERA_TYPE_LOCAL = 100
|
||||
}
|
||||
export declare const BOX_DIRECONNECT_PLATFORM_FILTER: {
|
||||
filtervmsplatformList: {
|
||||
opt: OPT;
|
||||
vmsplatformOpt: VmsplatformOpt;
|
||||
value: string;
|
||||
}[];
|
||||
};
|
90
packages/func/lib/camera/constants.js
Normal file
90
packages/func/lib/camera/constants.js
Normal file
@ -0,0 +1,90 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/camera/constants.ts
|
||||
var constants_exports = {};
|
||||
__export(constants_exports, {
|
||||
BOX_DIRECONNECT_PLATFORM_FILTER: () => BOX_DIRECONNECT_PLATFORM_FILTER,
|
||||
BOX_LIST_KEY: () => BOX_LIST_KEY,
|
||||
DIRE_CONNECT_KEY: () => DIRE_CONNECT_KEY,
|
||||
DeviceType: () => DeviceType,
|
||||
DevicemanagerCameraType: () => DevicemanagerCameraType,
|
||||
LOCAL_KEY: () => LOCAL_KEY,
|
||||
OPT: () => OPT,
|
||||
VmsplatformOpt: () => VmsplatformOpt
|
||||
});
|
||||
module.exports = __toCommonJS(constants_exports);
|
||||
var DeviceType = {
|
||||
VMS: "vms",
|
||||
DIR: "dir",
|
||||
CAMERA: "camera"
|
||||
};
|
||||
var LOCAL_KEY = "local";
|
||||
var DIRE_CONNECT_KEY = "direconnect";
|
||||
var BOX_LIST_KEY = "boxlist";
|
||||
var VmsplatformOpt = /* @__PURE__ */ ((VmsplatformOpt2) => {
|
||||
VmsplatformOpt2[VmsplatformOpt2["VMSPLATFORMOPT_ID"] = 0] = "VMSPLATFORMOPT_ID";
|
||||
VmsplatformOpt2[VmsplatformOpt2["VMSPLATFORMOPT_PLATFORMNAME"] = 1] = "VMSPLATFORMOPT_PLATFORMNAME";
|
||||
VmsplatformOpt2[VmsplatformOpt2["VMSPLATFORMOPT_PLUGINNAME"] = 2] = "VMSPLATFORMOPT_PLUGINNAME";
|
||||
VmsplatformOpt2[VmsplatformOpt2["VMSPLATFORMOPT_IP"] = 3] = "VMSPLATFORMOPT_IP";
|
||||
VmsplatformOpt2[VmsplatformOpt2["VMSPLATFORMOPT_PORT"] = 4] = "VMSPLATFORMOPT_PORT";
|
||||
VmsplatformOpt2[VmsplatformOpt2["VMSPLATFORMOPT_USERNAME"] = 5] = "VMSPLATFORMOPT_USERNAME";
|
||||
VmsplatformOpt2[VmsplatformOpt2["VMSPLATFORMOPT_PASSWORD"] = 6] = "VMSPLATFORMOPT_PASSWORD";
|
||||
return VmsplatformOpt2;
|
||||
})(VmsplatformOpt || {});
|
||||
var OPT = /* @__PURE__ */ ((OPT2) => {
|
||||
OPT2[OPT2["OR"] = 0] = "OR";
|
||||
OPT2[OPT2["AND"] = 1] = "AND";
|
||||
OPT2[OPT2["ORNOT"] = 2] = "ORNOT";
|
||||
OPT2[OPT2["ANDNOT"] = 3] = "ANDNOT";
|
||||
return OPT2;
|
||||
})(OPT || {});
|
||||
var DevicemanagerCameraType = /* @__PURE__ */ ((DevicemanagerCameraType2) => {
|
||||
DevicemanagerCameraType2[DevicemanagerCameraType2["DEVICEMANAGER_CAMERA_TYPE_DEFAULT"] = 0] = "DEVICEMANAGER_CAMERA_TYPE_DEFAULT";
|
||||
DevicemanagerCameraType2[DevicemanagerCameraType2["DEVICEMANAGER_CAMERA_TYPE_NORMAL"] = 1] = "DEVICEMANAGER_CAMERA_TYPE_NORMAL";
|
||||
DevicemanagerCameraType2[DevicemanagerCameraType2["DEVICEMANAGER_CAMERA_TYPE_1400"] = 97] = "DEVICEMANAGER_CAMERA_TYPE_1400";
|
||||
DevicemanagerCameraType2[DevicemanagerCameraType2["DEVICEMANAGER_CAMERA_TYPE_DHGRABBER"] = 98] = "DEVICEMANAGER_CAMERA_TYPE_DHGRABBER";
|
||||
DevicemanagerCameraType2[DevicemanagerCameraType2["DEVICEMANAGER_CAMERA_TYPE_HKGRABBER"] = 99] = "DEVICEMANAGER_CAMERA_TYPE_HKGRABBER";
|
||||
DevicemanagerCameraType2[DevicemanagerCameraType2["DEVICEMANAGER_CAMERA_TYPE_LOCAL"] = 100] = "DEVICEMANAGER_CAMERA_TYPE_LOCAL";
|
||||
return DevicemanagerCameraType2;
|
||||
})(DevicemanagerCameraType || {});
|
||||
var BOX_DIRECONNECT_PLATFORM_FILTER = {
|
||||
filtervmsplatformList: [
|
||||
{
|
||||
opt: 0 /* OR */,
|
||||
vmsplatformOpt: 1 /* VMSPLATFORMOPT_PLATFORMNAME */,
|
||||
value: "direconnect"
|
||||
},
|
||||
{
|
||||
opt: 0 /* OR */,
|
||||
vmsplatformOpt: 1 /* VMSPLATFORMOPT_PLATFORMNAME */,
|
||||
value: "boxlist"
|
||||
}
|
||||
]
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
BOX_DIRECONNECT_PLATFORM_FILTER,
|
||||
BOX_LIST_KEY,
|
||||
DIRE_CONNECT_KEY,
|
||||
DeviceType,
|
||||
DevicemanagerCameraType,
|
||||
LOCAL_KEY,
|
||||
OPT,
|
||||
VmsplatformOpt
|
||||
});
|
40
packages/func/lib/camera/index.d.ts
vendored
Normal file
40
packages/func/lib/camera/index.d.ts
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
import { DevicemanagerCameraType } from './constants';
|
||||
export declare const isFaceCamera: (type: DevicemanagerCameraType) => boolean;
|
||||
/**
|
||||
*
|
||||
* @param value 传入的数据 可以是 item(camera/vms/dirs)/ deviceID
|
||||
* @param isId
|
||||
*/
|
||||
export declare function getDeviceType(value: {
|
||||
[x: string]: any;
|
||||
id: any;
|
||||
} | string): any;
|
||||
/**
|
||||
* 后端设备id/vmsid/dirid是三张表 合并在一起不保证唯一 前端生成唯一key
|
||||
* @param id 设备id
|
||||
* @param type 设备类型
|
||||
*/
|
||||
export declare function deviceIDToDeviceKey(id: any, type: string, vmsId?: any): string;
|
||||
/**
|
||||
* 后端设备id/vmsid/dirid是三张表 合并在一起不保证唯一 前端生成唯一key
|
||||
* @param item camera/vms/dirs
|
||||
*/
|
||||
export declare function deviceToDeviceKey(item: {
|
||||
[x: string]: any;
|
||||
id: any;
|
||||
}): string;
|
||||
/**
|
||||
* 设备树key 转 后端设备原始id dirid是string/vms&camera 是number 和后端保持一致
|
||||
* @param deviceKey 设备树的id
|
||||
*/
|
||||
export declare function deviceKeyToDeviceId(deviceKey: {
|
||||
split: (arg0: string) => [any, any];
|
||||
}): any;
|
||||
export declare const getVmsIdByDeviceId: (key: string) => string;
|
||||
/**
|
||||
* 通过设备id或设备key在树里面找摄像头
|
||||
* @param ids cameraId
|
||||
* @param deviceTree 树
|
||||
* @param type "id" | "key"
|
||||
*/
|
||||
export declare const findCamerasByInDeviceTree: (ids: never[] | undefined, deviceTree: any, type?: string) => any[];
|
143
packages/func/lib/camera/index.js
Normal file
143
packages/func/lib/camera/index.js
Normal file
@ -0,0 +1,143 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/camera/index.ts
|
||||
var camera_exports = {};
|
||||
__export(camera_exports, {
|
||||
deviceIDToDeviceKey: () => deviceIDToDeviceKey,
|
||||
deviceKeyToDeviceId: () => deviceKeyToDeviceId,
|
||||
deviceToDeviceKey: () => deviceToDeviceKey,
|
||||
findCamerasByInDeviceTree: () => findCamerasByInDeviceTree,
|
||||
getDeviceType: () => getDeviceType,
|
||||
getVmsIdByDeviceId: () => getVmsIdByDeviceId,
|
||||
isFaceCamera: () => isFaceCamera
|
||||
});
|
||||
module.exports = __toCommonJS(camera_exports);
|
||||
var import_lodash_es = require("lodash-es");
|
||||
var import_utils = require("../utils");
|
||||
var import_constants = require("./constants");
|
||||
var isFaceCamera = (type) => {
|
||||
return [
|
||||
import_constants.DevicemanagerCameraType.DEVICEMANAGER_CAMERA_TYPE_1400,
|
||||
import_constants.DevicemanagerCameraType.DEVICEMANAGER_CAMERA_TYPE_HKGRABBER,
|
||||
import_constants.DevicemanagerCameraType.DEVICEMANAGER_CAMERA_TYPE_DHGRABBER
|
||||
].includes(type);
|
||||
};
|
||||
function getDeviceType(value) {
|
||||
let type;
|
||||
let isDeviceKey = (0, import_lodash_es.isString)(value);
|
||||
if (isDeviceKey) {
|
||||
type = value.split("_")[0];
|
||||
} else {
|
||||
if ((0, import_lodash_es.has)(value, "longitude")) {
|
||||
type = import_constants.DeviceType["CAMERA"];
|
||||
}
|
||||
if ((0, import_lodash_es.has)(value, "ip")) {
|
||||
type = import_constants.DeviceType["VMS"];
|
||||
}
|
||||
if (!type) {
|
||||
type = import_constants.DeviceType["DIR"];
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
function deviceIDToDeviceKey(id, type, vmsId) {
|
||||
if (type == import_constants.DeviceType["DIR"]) {
|
||||
return `${type}_${id}_${vmsId}`;
|
||||
} else {
|
||||
return `${type}_${id}`;
|
||||
}
|
||||
}
|
||||
function deviceToDeviceKey(item) {
|
||||
let deviceKey = "";
|
||||
let type = getDeviceType(item);
|
||||
if (!type) {
|
||||
console.error("device type is null!");
|
||||
}
|
||||
switch (type) {
|
||||
case import_constants.DeviceType["DIR"]:
|
||||
{
|
||||
let dirId = item["dirid"] || item["dirId"];
|
||||
if (!dirId && dirId !== 0) {
|
||||
console.error("dirId type is null!");
|
||||
}
|
||||
let vmsId = (0, import_lodash_es.get)(item, "extendInfo.vmsPlatformId");
|
||||
if (!vmsId && vmsId !== 0) {
|
||||
console.error("vmsId type is null!");
|
||||
}
|
||||
deviceKey = `${type}_${dirId}_${vmsId}`;
|
||||
}
|
||||
break;
|
||||
case import_constants.DeviceType["VMS"]:
|
||||
deviceKey = `${type}_${item["id"]}`;
|
||||
break;
|
||||
case import_constants.DeviceType["CAMERA"]:
|
||||
{
|
||||
let vmsId = (0, import_lodash_es.get)(item, "extendInfo.vmsPlatformId");
|
||||
if (!vmsId && vmsId !== 0) {
|
||||
console.error("vmsId type is null!");
|
||||
}
|
||||
deviceKey = `${type}_${item.id}`;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return deviceKey;
|
||||
}
|
||||
function deviceKeyToDeviceId(deviceKey) {
|
||||
let [type, id] = deviceKey.split("_");
|
||||
return type === import_constants.DeviceType["DIR"] ? id : Number(id);
|
||||
}
|
||||
var getVmsIdByDeviceId = (key) => {
|
||||
const type = getDeviceType(key);
|
||||
let vmsId = "";
|
||||
switch (type) {
|
||||
case import_constants.DeviceType["CAMERA"]:
|
||||
case import_constants.DeviceType["DIR"]:
|
||||
vmsId = key.split("_")[2];
|
||||
break;
|
||||
case import_constants.DeviceType["VMS"]:
|
||||
vmsId = key.split("_")[1];
|
||||
break;
|
||||
}
|
||||
if (!vmsId) {
|
||||
console.error("vmsid is null!");
|
||||
}
|
||||
return vmsId;
|
||||
};
|
||||
var findCamerasByInDeviceTree = (ids = [], deviceTree, type = "id") => {
|
||||
let cameraInfoList = [];
|
||||
let _ids = ids.map((v) => String(v));
|
||||
(0, import_utils.loop)(deviceTree, (item) => {
|
||||
let isCamera = getDeviceType((0, import_lodash_es.get)(item, "key", "")) === import_constants.DeviceType["CAMERA"];
|
||||
let isMatch = type === "key" ? _ids.includes((0, import_lodash_es.get)(item, "key")) : _ids.includes(`${(0, import_lodash_es.get)(item, "origin.id")}`);
|
||||
if (isCamera && isMatch) {
|
||||
cameraInfoList.push(item);
|
||||
}
|
||||
});
|
||||
return cameraInfoList;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
deviceIDToDeviceKey,
|
||||
deviceKeyToDeviceId,
|
||||
deviceToDeviceKey,
|
||||
findCamerasByInDeviceTree,
|
||||
getDeviceType,
|
||||
getVmsIdByDeviceId,
|
||||
isFaceCamera
|
||||
});
|
75
packages/func/lib/file/index.d.ts
vendored
Normal file
75
packages/func/lib/file/index.d.ts
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
import { Rect } from '@zhst/types';
|
||||
/**
|
||||
*
|
||||
* @param url 需要转为图片的链接
|
||||
* @returns 图片的 dom
|
||||
*/
|
||||
export declare const urlToImg: (url: string) => Promise<HTMLImageElement>;
|
||||
export declare const base64DecodeImageKey: (base64ImgKey: string) => string;
|
||||
/**
|
||||
* 通过url获取图片的base64字符串
|
||||
* @param src 图片链接
|
||||
* @param outputFormat 图片格式
|
||||
* @returns base64 @string
|
||||
*/
|
||||
export declare const getBase64ByUrl: (src: string | URL, outputFormat?: string) => Promise<unknown>;
|
||||
/**
|
||||
* 把文件转base64
|
||||
* @param file @file 文件
|
||||
* @returns @string
|
||||
*/
|
||||
export declare const fileToBase64: (file: any) => Promise<string>;
|
||||
/**
|
||||
*
|
||||
* @param image @file 图片文件
|
||||
* @param width @number 宽度
|
||||
* @param height @number 高度
|
||||
* @returns @string base64
|
||||
*/
|
||||
export declare const getBase64Image: (image: any, width?: any, height?: any) => string;
|
||||
/**
|
||||
* 通过图片获取base64
|
||||
* @param src 图片地址
|
||||
* @returns @string
|
||||
*/
|
||||
export declare const getBase64ByImage: (src: string) => Promise<unknown>;
|
||||
/**
|
||||
* url转base64
|
||||
* @param {String} url - url地址
|
||||
*/
|
||||
export declare const urlToBase64V2: (url: string) => Promise<unknown>;
|
||||
/**
|
||||
* base64转Blob
|
||||
* @param {String} base64 - base64
|
||||
*/
|
||||
export declare function base64toBlob(base64: string): Blob | undefined;
|
||||
/**
|
||||
* 图片集打包压缩下载
|
||||
* 1. url -> base64 -> blob
|
||||
* 2. 将blob加入jsZip文件夹内,用file-saver保存
|
||||
* @param {Array<{url:string,name:string}>} imgDataList
|
||||
* @param {string} zipName
|
||||
*/
|
||||
export declare const downloadPackageImages: (imgDataList: string | any[], zipName: string) => Promise<void>;
|
||||
export declare function getFileSize(size: number): string;
|
||||
export declare const dataURLToBlob: (dataurl: string) => Blob;
|
||||
/**
|
||||
* key 转 http 链接
|
||||
* @param originImgkey 图片的值 ,可以是 base64 也可以是 http链接
|
||||
* @param host 图片的域值
|
||||
* @returns {string}
|
||||
*/
|
||||
export declare const generateImg: (imgKey: string, host?: string) => string;
|
||||
/**
|
||||
* 获取指定字符串后面的部分
|
||||
* @param imageKey v1_开头的字符串
|
||||
* @returns
|
||||
*/
|
||||
export declare const getImageKey: (imageKey: string, preFix?: string) => string;
|
||||
/**
|
||||
* 获取图片
|
||||
* @param img 图片的url链接
|
||||
* @param odRect
|
||||
* @returns file
|
||||
*/
|
||||
export declare const getFileByRect: (img: string, odRect: Rect) => Promise<File>;
|
318
packages/func/lib/file/index.js
Normal file
318
packages/func/lib/file/index.js
Normal file
@ -0,0 +1,318 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/file/index.ts
|
||||
var file_exports = {};
|
||||
__export(file_exports, {
|
||||
base64DecodeImageKey: () => base64DecodeImageKey,
|
||||
base64toBlob: () => base64toBlob,
|
||||
dataURLToBlob: () => dataURLToBlob,
|
||||
downloadPackageImages: () => downloadPackageImages,
|
||||
fileToBase64: () => fileToBase64,
|
||||
generateImg: () => generateImg,
|
||||
getBase64ByImage: () => getBase64ByImage,
|
||||
getBase64ByUrl: () => getBase64ByUrl,
|
||||
getBase64Image: () => getBase64Image,
|
||||
getFileByRect: () => getFileByRect,
|
||||
getFileSize: () => getFileSize,
|
||||
getImageKey: () => getImageKey,
|
||||
urlToBase64V2: () => urlToBase64V2,
|
||||
urlToImg: () => urlToImg
|
||||
});
|
||||
module.exports = __toCommonJS(file_exports);
|
||||
var import_base_64 = __toESM(require("base-64"));
|
||||
var import_jszip = __toESM(require("jszip"));
|
||||
var import_file_saver = __toESM(require("file-saver"));
|
||||
var import_utils = require("../utils");
|
||||
var import_lodash_es = require("lodash-es");
|
||||
var urlToImg = (url) => {
|
||||
const resImage = new Promise((resolve) => {
|
||||
const image = new Image();
|
||||
image.crossOrigin = "";
|
||||
image.src = url;
|
||||
image.onload = () => {
|
||||
resolve(image);
|
||||
};
|
||||
});
|
||||
return resImage;
|
||||
};
|
||||
var base64DecodeImageKey = (base64ImgKey) => {
|
||||
let tempStr = base64ImgKey;
|
||||
if ((0, import_utils.matchS3Prefix)(tempStr)) {
|
||||
tempStr = tempStr.replace(/^v[0-9]_/, "");
|
||||
tempStr = import_base_64.default.decode(tempStr);
|
||||
}
|
||||
const [bucket, ...pathArr] = tempStr.split("_");
|
||||
return tempStr = `${bucket}/${pathArr.join("_")}`;
|
||||
};
|
||||
var getBase64ByUrl = function(src, outputFormat = "image/png") {
|
||||
return new Promise((resolve, reject) => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", src, true);
|
||||
xhr.responseType = "arraybuffer";
|
||||
xhr.onload = function(e) {
|
||||
if (Number(xhr.status) === 200) {
|
||||
const uInt8Array = new Uint8Array(xhr.response);
|
||||
let i = uInt8Array.length;
|
||||
const binaryString = new Array(i);
|
||||
while (i--) {
|
||||
binaryString[i] = String.fromCharCode(uInt8Array[i]);
|
||||
}
|
||||
const data = binaryString.join("");
|
||||
const base64 = window.btoa(data);
|
||||
const dataUrl = "data:" + (outputFormat || "image/png") + ";base64," + base64;
|
||||
resolve(dataUrl);
|
||||
} else {
|
||||
reject(e);
|
||||
}
|
||||
};
|
||||
xhr.onerror = (e) => {
|
||||
reject(e);
|
||||
};
|
||||
xhr.send();
|
||||
});
|
||||
};
|
||||
var fileToBase64 = (file) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = function(e) {
|
||||
resolve(e == null ? void 0 : e.target.result);
|
||||
};
|
||||
reader.onerror = function(e) {
|
||||
reject(e);
|
||||
};
|
||||
});
|
||||
};
|
||||
var getBase64Image = (image, width, height) => {
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = width !== void 0 ? width : image.width;
|
||||
canvas.height = height !== void 0 ? height : image.height;
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx == null ? void 0 : ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
|
||||
const ext = image.src.substring(image.src.lastIndexOf(".") + 1).toLowerCase();
|
||||
const dataURL = canvas.toDataURL("image/" + ext);
|
||||
return dataURL;
|
||||
};
|
||||
var getBase64ByImage = function(src) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const image = new Image();
|
||||
const timestamp = (/* @__PURE__ */ new Date()).getTime();
|
||||
const imgUrl = src + "?" + timestamp;
|
||||
image.src = imgUrl;
|
||||
image.onload = function() {
|
||||
function getBase64Image2(img) {
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = img.width;
|
||||
canvas.height = img.height;
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx == null ? void 0 : ctx.drawImage(img, 0, 0, img.width, img.height);
|
||||
const ext = img.src.substring(img.src.lastIndexOf(".") + 1).toLowerCase();
|
||||
const dataURL = canvas.toDataURL("image/" + ext);
|
||||
return dataURL;
|
||||
}
|
||||
const base64 = getBase64Image2(image);
|
||||
resolve(base64);
|
||||
};
|
||||
image.onerror = (e) => {
|
||||
reject(e);
|
||||
};
|
||||
});
|
||||
};
|
||||
var urlToBase64V2 = (url) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let image = new Image();
|
||||
image.onload = function() {
|
||||
var _a;
|
||||
let canvas = document.createElement("canvas");
|
||||
canvas.width = image.naturalWidth;
|
||||
canvas.height = image.naturalHeight;
|
||||
(_a = canvas == null ? void 0 : canvas.getContext("2d")) == null ? void 0 : _a.drawImage(image, 0, 0);
|
||||
let result = canvas.toDataURL("image/png");
|
||||
resolve(result);
|
||||
};
|
||||
const imgUrl = url;
|
||||
image.setAttribute("crossOrigin", "Anonymous");
|
||||
image.src = imgUrl;
|
||||
image.onerror = () => {
|
||||
reject(new Error("Images fail to load"));
|
||||
};
|
||||
}).catch((error) => {
|
||||
throw new Error(error);
|
||||
});
|
||||
};
|
||||
function base64toBlob(base64) {
|
||||
if (!base64)
|
||||
return;
|
||||
var arr = base64.split(","), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
|
||||
while (n--) {
|
||||
u8arr[n] = bstr.charCodeAt(n);
|
||||
}
|
||||
return new Blob([u8arr], { type: mime });
|
||||
}
|
||||
var downloadPackageImages = async (imgDataList, zipName) => {
|
||||
let imgDataDownLoadList = [];
|
||||
let imgBlobList = [];
|
||||
let imageSuffix = [];
|
||||
let zip = new import_jszip.default();
|
||||
let img = zip.folder(zipName);
|
||||
try {
|
||||
for (let i2 = 0; i2 < imgDataList.length; i2++) {
|
||||
let src = imgDataList[i2].url;
|
||||
let suffix = src.substring(src.lastIndexOf("."));
|
||||
let base64ByUrl = await urlToBase64V2(imgDataList[i2].url);
|
||||
if (!base64ByUrl)
|
||||
continue;
|
||||
let blob = base64toBlob(base64ByUrl);
|
||||
imgDataDownLoadList.push(imgDataList[i2]);
|
||||
imgBlobList.push(blob);
|
||||
imageSuffix.push(suffix);
|
||||
}
|
||||
if (imgBlobList.length === 0)
|
||||
throw new Error("The number of pictures is zero !");
|
||||
if (imgBlobList.length > 0) {
|
||||
for (var i = 0; i < imgBlobList.length; i++) {
|
||||
img == null ? void 0 : img.file(
|
||||
imgDataDownLoadList[i].name + (0, import_lodash_es.get)(imageSuffix, `.${i}`, imageSuffix[0]),
|
||||
// @ts-ignore
|
||||
imgBlobList[i],
|
||||
{
|
||||
base64: true
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
zip.generateAsync({ type: "blob" }).then(function(content) {
|
||||
import_file_saver.default.saveAs(content, zipName + ".zip");
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error(error);
|
||||
}
|
||||
};
|
||||
function getFileSize(size) {
|
||||
if (!size)
|
||||
return "";
|
||||
var num = 1024;
|
||||
if (size < num)
|
||||
return size + "B";
|
||||
if (size < Math.pow(num, 2))
|
||||
return (size / num).toFixed(2) + "K";
|
||||
if (size < Math.pow(num, 3))
|
||||
return (size / Math.pow(num, 2)).toFixed(2) + "M";
|
||||
if (size < Math.pow(num, 4))
|
||||
return (size / Math.pow(num, 3)).toFixed(2) + "G";
|
||||
return (size / Math.pow(num, 4)).toFixed(2) + "T";
|
||||
}
|
||||
var dataURLToBlob = (dataurl) => {
|
||||
const arr = dataurl.split(",");
|
||||
const mime = arr[0].match(/:(.*?);/)[1];
|
||||
const bstr = atob(arr[1]);
|
||||
let n = bstr.length;
|
||||
const u8arr = new Uint8Array(n);
|
||||
while (n--) {
|
||||
u8arr[n] = bstr.charCodeAt(n);
|
||||
}
|
||||
return new Blob([u8arr], { type: mime });
|
||||
};
|
||||
var generateImg = (_imgKey, host = "http://10.0.0.120") => {
|
||||
let imgKey = _imgKey;
|
||||
let imgUrl = "";
|
||||
if (!imgKey)
|
||||
return "";
|
||||
if (/(http|https):\/\/([\w.]+\/?)\S*/ig.test(imgKey)) {
|
||||
return imgKey;
|
||||
}
|
||||
console.log("imgKey", imgKey);
|
||||
try {
|
||||
if ((0, import_utils.matchS3Prefix)(imgKey)) {
|
||||
imgKey = base64DecodeImageKey(imgKey);
|
||||
if (imgKey.endsWith("/")) {
|
||||
const i = imgKey.substring(0, imgKey.length - 1);
|
||||
imgKey = i;
|
||||
}
|
||||
}
|
||||
imgUrl = `${host}/file/${imgKey}`;
|
||||
if (_imgKey.includes("v3")) {
|
||||
imgUrl = `${host}/minio/${imgKey}`;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
imgUrl = "";
|
||||
}
|
||||
return imgUrl;
|
||||
};
|
||||
var getImageKey = (imageKey, preFix) => {
|
||||
const splitIndex = preFix || "v1_";
|
||||
if (imageKey.startsWith(splitIndex)) {
|
||||
return window.atob(imageKey.split(splitIndex)[1]).replace("_", "/");
|
||||
} else {
|
||||
return imageKey;
|
||||
}
|
||||
};
|
||||
var getFileByRect = async (img, odRect) => {
|
||||
var _a;
|
||||
let image;
|
||||
if ((0, import_lodash_es.isString)(img)) {
|
||||
const url = generateImg(img);
|
||||
image = await urlToImg(url);
|
||||
} else {
|
||||
image = img;
|
||||
}
|
||||
const commonCanvas = document.createElement("canvas");
|
||||
commonCanvas.width = odRect.w * image.width;
|
||||
commonCanvas.height = odRect.h * image.height;
|
||||
commonCanvas.style.display = "none";
|
||||
document.body.appendChild(commonCanvas);
|
||||
const commonCtx = commonCanvas.getContext("2d");
|
||||
commonCtx == null ? void 0 : commonCtx.translate(-odRect.x * image.width, -odRect.y * image.height);
|
||||
commonCtx == null ? void 0 : commonCtx.drawImage(image, 0, 0);
|
||||
const base64 = commonCanvas.toDataURL("image/jpeg");
|
||||
const blobData = dataURLToBlob(base64);
|
||||
(_a = commonCanvas.parentNode) == null ? void 0 : _a.removeChild(commonCanvas);
|
||||
const file = new window.File([blobData], `${(/* @__PURE__ */ new Date()).getTime()}`, {
|
||||
type: "image/jpeg"
|
||||
});
|
||||
return file;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
base64DecodeImageKey,
|
||||
base64toBlob,
|
||||
dataURLToBlob,
|
||||
downloadPackageImages,
|
||||
fileToBase64,
|
||||
generateImg,
|
||||
getBase64ByImage,
|
||||
getBase64ByUrl,
|
||||
getBase64Image,
|
||||
getFileByRect,
|
||||
getFileSize,
|
||||
getImageKey,
|
||||
urlToBase64V2,
|
||||
urlToImg
|
||||
});
|
11
packages/func/lib/index.d.ts
vendored
Normal file
11
packages/func/lib/index.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
export * from 'lodash-es';
|
||||
export * from './file';
|
||||
export * from './map';
|
||||
export * from './performance';
|
||||
export * from './string';
|
||||
export * from './number';
|
||||
export * from './time';
|
||||
export * from './utils';
|
||||
export * from './camera';
|
||||
export * from './math';
|
||||
export * from './upload';
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user