bhd-components 0.9.17 → 0.9.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.es5.development.css +1165 -1127
- package/dist/index.esm.es5.development.js +108 -61
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +1 -1
- package/dist/vendor.esm.es5.production.js +1 -1
- package/es2017/customerService/index.module.less +15 -4
- package/es2017/customerService/index2.module.less +14 -4
- package/es2017/icons/components/custom-screen-xuanzuan.d.ts +4 -0
- package/es2017/icons/components/custom-screen-xuanzuan.js +28 -0
- package/es2017/icons/components/custom-xuanzuan.js +16 -14
- package/es2017/icons/components/index.d.ts +1 -0
- package/es2017/icons/components/index.js +1 -0
- package/es2017/viewImage/index(/345/216/237).d.ts +31 -0
- package/es2017/viewImage/index(/345/216/237).js +384 -0
- package/es2017/viewImage/index.d.ts +1 -0
- package/es2017/viewImage/index.js +90 -45
- package/es2017/viewImage/index.module(/345/216/237).less +173 -0
- package/es2017/viewImage/index.module.less +29 -9
- package/esm/customerService/index.module.less +15 -4
- package/esm/customerService/index2.module.less +14 -4
- package/esm/icons/components/custom-screen-xuanzuan.d.ts +4 -0
- package/esm/icons/components/custom-screen-xuanzuan.js +30 -0
- package/esm/icons/components/custom-xuanzuan.js +16 -14
- package/esm/icons/components/index.d.ts +1 -0
- package/esm/icons/components/index.js +1 -0
- package/esm/viewImage/index(/345/216/237).d.ts +31 -0
- package/esm/viewImage/index(/345/216/237).js +480 -0
- package/esm/viewImage/index.d.ts +1 -0
- package/esm/viewImage/index.js +90 -45
- package/esm/viewImage/index.module(/345/216/237).less +173 -0
- package/esm/viewImage/index.module.less +29 -9
- package/package.json +1 -1
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
align-items: center;
|
|
61
61
|
background-color: #fff;
|
|
62
62
|
line-height: 1;
|
|
63
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
|
63
64
|
.user {
|
|
64
65
|
color: #000;
|
|
65
66
|
font-size: 16px;
|
|
@@ -396,6 +397,11 @@
|
|
|
396
397
|
color: @color-text-tertiary-Tr !important;
|
|
397
398
|
}
|
|
398
399
|
}
|
|
400
|
+
> li:last-of-type{
|
|
401
|
+
pre{
|
|
402
|
+
margin-bottom: 0;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
399
405
|
}
|
|
400
406
|
// li{
|
|
401
407
|
// margin-top:16px;
|
|
@@ -417,13 +423,17 @@
|
|
|
417
423
|
}
|
|
418
424
|
}
|
|
419
425
|
> h3,> h4{
|
|
420
|
-
padding-top:
|
|
426
|
+
padding-top: 8px;
|
|
421
427
|
padding-bottom: 4px;
|
|
422
428
|
}
|
|
423
429
|
> p + p{
|
|
424
430
|
padding-top: 4px;
|
|
425
431
|
padding-bottom: 4px;
|
|
426
432
|
}
|
|
433
|
+
|
|
434
|
+
> pre:last-of-type{
|
|
435
|
+
margin-bottom:0 ;
|
|
436
|
+
}
|
|
427
437
|
}
|
|
428
438
|
table {
|
|
429
439
|
width: 100%;
|
|
@@ -456,6 +466,7 @@
|
|
|
456
466
|
padding: 12px;
|
|
457
467
|
line-height: 1.5;
|
|
458
468
|
margin: 4px 0;
|
|
469
|
+
margin-bottom: 16px;
|
|
459
470
|
border-radius: 0 0 4px 4px;
|
|
460
471
|
}
|
|
461
472
|
// 最后一行操作按钮
|
|
@@ -1489,7 +1500,7 @@
|
|
|
1489
1500
|
right: 568px;
|
|
1490
1501
|
|
|
1491
1502
|
border-radius: 8px;
|
|
1492
|
-
background: rgba(255, 255, 255, 0.
|
|
1503
|
+
background: rgba(255, 255, 255, 0.85);
|
|
1493
1504
|
box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.05);
|
|
1494
1505
|
backdrop-filter: blur(7.5px);
|
|
1495
1506
|
width: 80px;
|
|
@@ -1506,7 +1517,7 @@
|
|
|
1506
1517
|
position: relative;
|
|
1507
1518
|
cursor: pointer;
|
|
1508
1519
|
&:hover {
|
|
1509
|
-
background-color:
|
|
1520
|
+
background-color: rgba(0, 0, 0, 0.04);
|
|
1510
1521
|
.delete {
|
|
1511
1522
|
display: block;
|
|
1512
1523
|
}
|
|
@@ -1551,7 +1562,7 @@
|
|
|
1551
1562
|
margin: 8px;
|
|
1552
1563
|
}
|
|
1553
1564
|
.top .shrink {
|
|
1554
|
-
border-bottom: 1px solid @color-border-secondary;
|
|
1565
|
+
// border-bottom: 1px solid @color-border-secondary;
|
|
1555
1566
|
border-radius: 0;
|
|
1556
1567
|
margin-bottom: 8px;
|
|
1557
1568
|
margin-top: 8px;
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
align-items: center;
|
|
58
58
|
background-color: #fff;
|
|
59
59
|
line-height: 1;
|
|
60
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
|
|
60
61
|
.user {
|
|
61
62
|
color: #000;
|
|
62
63
|
font-size: 16px;
|
|
@@ -392,6 +393,11 @@
|
|
|
392
393
|
color: @color-text-tertiary-Tr !important;
|
|
393
394
|
}
|
|
394
395
|
}
|
|
396
|
+
> li:last-of-type{
|
|
397
|
+
pre{
|
|
398
|
+
margin-bottom: 0;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
395
401
|
}
|
|
396
402
|
// li{
|
|
397
403
|
// margin-top:16px;
|
|
@@ -413,13 +419,16 @@
|
|
|
413
419
|
}
|
|
414
420
|
}
|
|
415
421
|
> h3,> h4{
|
|
416
|
-
padding-top:
|
|
422
|
+
padding-top: 8px;
|
|
417
423
|
padding-bottom: 4px;
|
|
418
424
|
}
|
|
419
425
|
> p + p{
|
|
420
426
|
padding-top: 4px;
|
|
421
427
|
padding-bottom: 4px;
|
|
422
428
|
}
|
|
429
|
+
> pre:last-of-type{
|
|
430
|
+
margin-bottom:0 ;
|
|
431
|
+
}
|
|
423
432
|
}
|
|
424
433
|
table {
|
|
425
434
|
width: 100%;
|
|
@@ -451,6 +460,7 @@
|
|
|
451
460
|
padding: 12px;
|
|
452
461
|
line-height: 1.5;
|
|
453
462
|
margin: 4px 0;
|
|
463
|
+
margin-bottom: 16px;
|
|
454
464
|
border-radius: 0 0 4px 4px;
|
|
455
465
|
}
|
|
456
466
|
// 最后一行操作按钮
|
|
@@ -1483,7 +1493,7 @@
|
|
|
1483
1493
|
right: 568px;
|
|
1484
1494
|
|
|
1485
1495
|
border-radius: 8px;
|
|
1486
|
-
background: rgba(255, 255, 255, 0.
|
|
1496
|
+
background: rgba(255, 255, 255, 0.85);
|
|
1487
1497
|
box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.05);
|
|
1488
1498
|
backdrop-filter: blur(7.5px);
|
|
1489
1499
|
width: 80px;
|
|
@@ -1500,7 +1510,7 @@
|
|
|
1500
1510
|
position: relative;
|
|
1501
1511
|
cursor: pointer;
|
|
1502
1512
|
&:hover {
|
|
1503
|
-
background-color:
|
|
1513
|
+
background-color: rgba(0, 0, 0, 0.04);
|
|
1504
1514
|
.delete {
|
|
1505
1515
|
display: block;
|
|
1506
1516
|
}
|
|
@@ -1545,7 +1555,7 @@
|
|
|
1545
1555
|
margin: 8px;
|
|
1546
1556
|
}
|
|
1547
1557
|
.top .shrink {
|
|
1548
|
-
border-bottom: 1px solid @color-border-secondary;
|
|
1558
|
+
// border-bottom: 1px solid @color-border-secondary;
|
|
1549
1559
|
border-radius: 0;
|
|
1550
1560
|
margin-bottom: 8px;
|
|
1551
1561
|
margin-top: 8px;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import Icon from "@ant-design/icons";
|
|
6
|
+
const CustomScreenXuanZuanSvg = ()=>/*#__PURE__*/ _jsxs("svg", {
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
width: "20",
|
|
9
|
+
height: "20",
|
|
10
|
+
viewBox: "0 0 20 20",
|
|
11
|
+
fill: "none",
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ _jsx("path", {
|
|
14
|
+
d: "M7.82075 2.72072H11.7854L10.8078 1.74313C10.4141 1.34937 10.4141 0.697643 10.8078 0.303889C10.9995 0.114507 11.258 0.00830078 11.5275 0.00830078C11.7969 0.00830078 12.0554 0.114507 12.2471 0.303889L14.5146 2.57136C14.7046 2.76145 14.854 3.11447 14.854 3.38603C14.854 3.65758 14.7046 4.0106 14.5146 4.20069L12.2471 6.46816C12.0434 6.67183 11.7854 6.76687 11.5275 6.76687C11.2695 6.76687 11.0115 6.67183 10.8078 6.46816C10.4141 6.07441 10.4141 5.42268 10.8078 5.02893L11.0794 4.75737H7.80718C6.27784 4.76096 4.81217 5.37008 3.73076 6.45148C2.64936 7.53289 2.04024 8.99856 2.03665 10.5279C2.03665 11.0846 1.57501 11.5462 1.01833 11.5462C0.461642 11.5462 0 11.0846 0 10.5279C0.0135777 6.22377 3.50305 2.72072 7.82075 2.72072Z",
|
|
15
|
+
fill: "white"
|
|
16
|
+
}),
|
|
17
|
+
/*#__PURE__*/ _jsx("path", {
|
|
18
|
+
d: "M5.21389 7.81238H18.5743C19.3618 7.81238 20 8.45053 20 9.23804V18.5659C20 19.3534 19.3618 19.9916 18.5743 19.9916H5.21389C4.42638 19.9916 3.78823 19.3534 3.78823 18.5659V9.23804C3.77465 8.45053 4.42638 7.81238 5.21389 7.81238ZM5.81131 17.9549H17.9633V9.84904H5.81131V17.9549Z",
|
|
19
|
+
fill: "white"
|
|
20
|
+
})
|
|
21
|
+
]
|
|
22
|
+
});
|
|
23
|
+
const CustomScreenXuanZuan = (props)=>{
|
|
24
|
+
return /*#__PURE__*/ _jsx(Icon, _object_spread_props(_object_spread({}, props), {
|
|
25
|
+
component: CustomScreenXuanZuanSvg
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
28
|
+
export default CustomScreenXuanZuan;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
|
-
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import Icon from "@ant-design/icons";
|
|
6
|
-
const CustomXuanZuanSvg = ()=>/*#__PURE__*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const CustomXuanZuanSvg = ()=>/*#__PURE__*/ _jsxs("svg", {
|
|
7
|
+
width: "24",
|
|
8
|
+
height: "24",
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
fill: "none",
|
|
10
11
|
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ _jsx("path", {
|
|
14
|
+
d: "M9.82075 4.72072H13.7854L12.8078 3.74313C12.4141 3.34937 12.4141 2.69764 12.8078 2.30389C12.9995 2.11451 13.258 2.0083 13.5275 2.0083C13.7969 2.0083 14.0554 2.11451 14.2471 2.30389L16.5146 4.57136C16.7046 4.76145 16.854 5.11447 16.854 5.38603C16.854 5.65758 16.7046 6.0106 16.5146 6.20069L14.2471 8.46816C14.0434 8.67183 13.7854 8.76687 13.5275 8.76687C13.2695 8.76687 13.0115 8.67183 12.8078 8.46816C12.4141 8.07441 12.4141 7.42268 12.8078 7.02893L13.0794 6.75737H9.80718C8.27784 6.76096 6.81217 7.37008 5.73076 8.45148C4.64936 9.53289 4.04024 10.9986 4.03665 12.5279C4.03665 13.0846 3.57501 13.5462 3.01833 13.5462C2.46164 13.5462 2 13.0846 2 12.5279C2.01358 8.22377 5.50305 4.72072 9.82075 4.72072Z",
|
|
15
|
+
fill: "white"
|
|
16
|
+
}),
|
|
17
|
+
/*#__PURE__*/ _jsx("path", {
|
|
18
|
+
d: "M7.21389 9.81238H20.5743C21.3618 9.81238 22 10.4505 22 11.238V20.5659C22 21.3534 21.3618 21.9916 20.5743 21.9916H7.21389C6.42638 21.9916 5.78823 21.3534 5.78823 20.5659V11.238C5.77465 10.4505 6.42638 9.81238 7.21389 9.81238ZM7.81131 19.9549H19.9633V11.849H7.81131V19.9549Z",
|
|
19
|
+
fill: "white"
|
|
20
|
+
})
|
|
21
|
+
]
|
|
20
22
|
});
|
|
21
23
|
const CustomXuanZuan = (props)=>{
|
|
22
24
|
return /*#__PURE__*/ _jsx(Icon, _object_spread_props(_object_spread({}, props), {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as CustomClose } from "./custom-close";
|
|
2
2
|
export { default as CustomXuanZuan } from "./custom-xuanzuan";
|
|
3
|
+
export { default as CustomScreenXuanZuan } from "./custom-xuanzuan";
|
|
3
4
|
export { default as CustomDownLoad } from "./custom-download";
|
|
4
5
|
export { default as CustomArrow } from "./custom-arrow";
|
|
5
6
|
export { default as CustomRecord } from "./custom-record";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* 自定义icon */ export { default as CustomClose } from "./custom-close";
|
|
2
2
|
export { default as CustomXuanZuan } from "./custom-xuanzuan";
|
|
3
|
+
export { default as CustomScreenXuanZuan } from "./custom-xuanzuan";
|
|
3
4
|
export { default as CustomDownLoad } from "./custom-download";
|
|
4
5
|
export { default as CustomArrow } from "./custom-arrow";
|
|
5
6
|
export { default as CustomRecord } from "./custom-record";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface AppViewImageProps {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
onCancel: () => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
content?: () => React.ReactElement;
|
|
7
|
+
download?: boolean;
|
|
8
|
+
getSrc: (index?: number) => Promise<string>;
|
|
9
|
+
filename?: string;
|
|
10
|
+
multiSelect?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface AppViewImageRef {
|
|
13
|
+
updateSrc: () => void;
|
|
14
|
+
}
|
|
15
|
+
export interface ViewImageState {
|
|
16
|
+
scaleValue: number;
|
|
17
|
+
maxScale: number;
|
|
18
|
+
minScale: number;
|
|
19
|
+
imgSrc: string;
|
|
20
|
+
imgLeft: any;
|
|
21
|
+
imgTop: any;
|
|
22
|
+
rotateValue: number;
|
|
23
|
+
loading: boolean;
|
|
24
|
+
curIndex: number;
|
|
25
|
+
imgError: boolean;
|
|
26
|
+
multiSelect: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface ViewImageProps extends AppViewImageProps {
|
|
29
|
+
}
|
|
30
|
+
declare const AppViewImage: React.ForwardRefExoticComponent<AppViewImageProps & React.RefAttributes<AppViewImageRef>>;
|
|
31
|
+
export default AppViewImage;
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
2
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
3
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { useRef, useImperativeHandle, forwardRef } from "react";
|
|
7
|
+
import styles from "./index.module.less";
|
|
8
|
+
import { Modal } from "antd";
|
|
9
|
+
import { LeftOutlined, RightOutlined, MinusOutlined, PlusOutlined, CustomClose, CustomXuanZuan, CustomDownLoad } from "../icons";
|
|
10
|
+
import { getStyle } from "../utils/dom";
|
|
11
|
+
import { Loading } from "../images";
|
|
12
|
+
import BhdTipModal from "../bhdTipModal";
|
|
13
|
+
class ViewImage extends React.Component {
|
|
14
|
+
componentDidMount() {
|
|
15
|
+
this.setState({
|
|
16
|
+
multiSelect: !!this.props.multiSelect || false
|
|
17
|
+
}, ()=>{
|
|
18
|
+
if (!this.state.multiSelect) {
|
|
19
|
+
this.getSrc();
|
|
20
|
+
} else {
|
|
21
|
+
//多张
|
|
22
|
+
this.getSrc(0);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
document.oncontextmenu = function() {
|
|
26
|
+
return false;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
componentWillUnmount() {
|
|
30
|
+
document.oncontextmenu = null;
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
let { scaleValue, imgSrc, imgLeft, imgTop, rotateValue, loading, multiSelect, imgError } = this.state;
|
|
34
|
+
let { content, download } = this.props;
|
|
35
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
36
|
+
className: styles.viewImgBody,
|
|
37
|
+
children: [
|
|
38
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
39
|
+
className: styles.viewImgContent,
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
42
|
+
className: styles.viewImgAction,
|
|
43
|
+
children: [
|
|
44
|
+
/*#__PURE__*/ _jsx("span", {
|
|
45
|
+
title: "旋转",
|
|
46
|
+
onClick: this.rotate,
|
|
47
|
+
children: /*#__PURE__*/ _jsx(CustomXuanZuan, {})
|
|
48
|
+
}),
|
|
49
|
+
download && !imgError && /*#__PURE__*/ _jsx("span", {
|
|
50
|
+
title: "下载",
|
|
51
|
+
onClick: this.downloadUrl,
|
|
52
|
+
children: /*#__PURE__*/ _jsx(CustomDownLoad, {})
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ _jsx("span", {
|
|
55
|
+
title: "关闭",
|
|
56
|
+
onClick: this.close,
|
|
57
|
+
children: /*#__PURE__*/ _jsx(CustomClose, {})
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
62
|
+
className: styles.viewImgBody,
|
|
63
|
+
children: [
|
|
64
|
+
loading ? /*#__PURE__*/ _jsx("img", {
|
|
65
|
+
src: Loading,
|
|
66
|
+
className: styles.viewImgBody_load
|
|
67
|
+
}, "load") : imgError ? /*#__PURE__*/ _jsx("div", {
|
|
68
|
+
style: {
|
|
69
|
+
color: "#FFFFFF"
|
|
70
|
+
},
|
|
71
|
+
children: imgSrc ? "图片加载错误" : "暂无内容"
|
|
72
|
+
}) : /*#__PURE__*/ _jsx("img", {
|
|
73
|
+
src: imgSrc,
|
|
74
|
+
alt: "图片加载错误",
|
|
75
|
+
draggable: "false",
|
|
76
|
+
onMouseDown: this.moveImg,
|
|
77
|
+
style: {
|
|
78
|
+
transform: `scale(${scaleValue / 100},${scaleValue / 100}) rotate(${rotateValue}deg)`,
|
|
79
|
+
left: imgLeft == "auto" ? "auto" : imgLeft + "px",
|
|
80
|
+
top: imgTop == "auto" ? "auto" : imgTop + "px"
|
|
81
|
+
},
|
|
82
|
+
className: styles.viewImgBody_pic,
|
|
83
|
+
onLoad: this.imgLoad,
|
|
84
|
+
onError: this.imgErr
|
|
85
|
+
}, "img"),
|
|
86
|
+
multiSelect && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
87
|
+
children: [
|
|
88
|
+
this.state.curIndex !== 0 && /*#__PURE__*/ _jsx("div", {
|
|
89
|
+
className: styles.viewImgBody_pre,
|
|
90
|
+
onClick: this.preChange,
|
|
91
|
+
children: /*#__PURE__*/ _jsx(LeftOutlined, {})
|
|
92
|
+
}),
|
|
93
|
+
this.state.curIndex < this.props.multiSelect.length - 1 && /*#__PURE__*/ _jsx("div", {
|
|
94
|
+
className: styles.viewImgBody_next,
|
|
95
|
+
onClick: this.nextChange,
|
|
96
|
+
children: /*#__PURE__*/ _jsx(RightOutlined, {})
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
}),
|
|
102
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
103
|
+
className: styles.viewImgBodyScale,
|
|
104
|
+
children: [
|
|
105
|
+
/*#__PURE__*/ _jsx("span", {
|
|
106
|
+
className: styles.viewImgBodyScale_minu,
|
|
107
|
+
onClick: ()=>{
|
|
108
|
+
scaleValue = scaleValue - 10;
|
|
109
|
+
this.scaleChange(scaleValue);
|
|
110
|
+
},
|
|
111
|
+
children: /*#__PURE__*/ _jsx(MinusOutlined, {})
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
114
|
+
className: styles.viewImgBodyScale_value,
|
|
115
|
+
onClick: this.reset,
|
|
116
|
+
children: [
|
|
117
|
+
scaleValue,
|
|
118
|
+
"%"
|
|
119
|
+
]
|
|
120
|
+
}),
|
|
121
|
+
/*#__PURE__*/ _jsx("span", {
|
|
122
|
+
className: styles.viewImgBodyScale_add,
|
|
123
|
+
onClick: ()=>{
|
|
124
|
+
scaleValue = scaleValue + 10;
|
|
125
|
+
this.scaleChange(scaleValue);
|
|
126
|
+
},
|
|
127
|
+
children: /*#__PURE__*/ _jsx(PlusOutlined, {})
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
}),
|
|
133
|
+
content && /*#__PURE__*/ _jsx("div", {
|
|
134
|
+
className: styles.viewImgInfo,
|
|
135
|
+
children: content()
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
constructor(...args){
|
|
141
|
+
super(...args);
|
|
142
|
+
_define_property(this, "state", {
|
|
143
|
+
scaleValue: 100,
|
|
144
|
+
maxScale: 500,
|
|
145
|
+
minScale: 1,
|
|
146
|
+
imgSrc: "",
|
|
147
|
+
imgLeft: "auto",
|
|
148
|
+
imgTop: "auto",
|
|
149
|
+
rotateValue: 0,
|
|
150
|
+
loading: false,
|
|
151
|
+
curIndex: 0,
|
|
152
|
+
multiSelect: false,
|
|
153
|
+
imgError: false
|
|
154
|
+
});
|
|
155
|
+
_define_property(this, "scaleChange", (value)=>{
|
|
156
|
+
let { maxScale, minScale } = this.state;
|
|
157
|
+
if (value >= maxScale) {
|
|
158
|
+
value = maxScale;
|
|
159
|
+
}
|
|
160
|
+
if (value <= minScale) {
|
|
161
|
+
value = minScale;
|
|
162
|
+
}
|
|
163
|
+
this.setState({
|
|
164
|
+
scaleValue: value
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
_define_property(this, "moveImg", (ev)=>{
|
|
168
|
+
let { imgLeft, imgTop } = this.state;
|
|
169
|
+
ev.preventDefault();
|
|
170
|
+
let dom = document.getElementsByClassName(`${styles.viewImgBody_pic}`)[0];
|
|
171
|
+
if (!dom) return;
|
|
172
|
+
if (imgLeft == "auto") {
|
|
173
|
+
imgLeft = getStyle(dom, "left");
|
|
174
|
+
}
|
|
175
|
+
if (imgTop == "auto") {
|
|
176
|
+
imgTop = getStyle(dom, "top");
|
|
177
|
+
}
|
|
178
|
+
var disx = ev.pageX - imgLeft;
|
|
179
|
+
var disy = ev.pageY - imgTop;
|
|
180
|
+
const mouseMove = (ev)=>{
|
|
181
|
+
this.setState({
|
|
182
|
+
imgLeft: ev.pageX - disx,
|
|
183
|
+
imgTop: ev.pageY - disy
|
|
184
|
+
}, ()=>{});
|
|
185
|
+
};
|
|
186
|
+
const mouseUp = ()=>{
|
|
187
|
+
document.removeEventListener("mousemove", mouseMove);
|
|
188
|
+
document.removeEventListener("mouseup", mouseUp);
|
|
189
|
+
};
|
|
190
|
+
document.addEventListener("mousemove", mouseMove);
|
|
191
|
+
document.addEventListener("mouseup", mouseUp);
|
|
192
|
+
});
|
|
193
|
+
_define_property(this, "base64Down", (src)=>{
|
|
194
|
+
let { filename } = this.props;
|
|
195
|
+
var base64 = src.toString(); // imgSrc 就是base64哈
|
|
196
|
+
let type = "png";
|
|
197
|
+
var byteCharacters = atob(base64.replace(/^data:image\/(png|jpeg|jpg);base64,/, (a, b)=>{
|
|
198
|
+
type = b;
|
|
199
|
+
return "";
|
|
200
|
+
}));
|
|
201
|
+
var byteNumbers = new Array(byteCharacters.length);
|
|
202
|
+
for(var i = 0; i < byteCharacters.length; i++){
|
|
203
|
+
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
|
204
|
+
}
|
|
205
|
+
var byteArray = new Uint8Array(byteNumbers);
|
|
206
|
+
var blob = new Blob([
|
|
207
|
+
byteArray
|
|
208
|
+
], {
|
|
209
|
+
type: undefined
|
|
210
|
+
});
|
|
211
|
+
var aLink = document.createElement("a");
|
|
212
|
+
aLink.download = `${filename || "download"}.${type}`; //这里写保存时的图片名称
|
|
213
|
+
let blobUrl = URL.createObjectURL(blob);
|
|
214
|
+
aLink.href = blobUrl;
|
|
215
|
+
aLink.click();
|
|
216
|
+
URL.revokeObjectURL(blobUrl);
|
|
217
|
+
});
|
|
218
|
+
_define_property(this, "downloadUrl", ()=>{
|
|
219
|
+
let { imgSrc } = this.state;
|
|
220
|
+
if (/^data:/.test(imgSrc)) {
|
|
221
|
+
try {
|
|
222
|
+
this.base64Down(imgSrc);
|
|
223
|
+
} catch (error) {
|
|
224
|
+
BhdTipModal.confirm({
|
|
225
|
+
title: "提示信息",
|
|
226
|
+
centered: true,
|
|
227
|
+
content: "图片资源不支持下载",
|
|
228
|
+
cancelBtn: false
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
} else if (/^(https?:\/\/[^\s]+)/.test(imgSrc)) {
|
|
232
|
+
//在线url
|
|
233
|
+
try {
|
|
234
|
+
this.downloadFile(imgSrc);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
BhdTipModal.confirm({
|
|
237
|
+
title: "提示信息",
|
|
238
|
+
centered: true,
|
|
239
|
+
content: "图片资源不支持下载",
|
|
240
|
+
cancelBtn: false
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
} else {
|
|
244
|
+
//不支持下载
|
|
245
|
+
BhdTipModal.confirm({
|
|
246
|
+
title: "提示信息",
|
|
247
|
+
centered: true,
|
|
248
|
+
content: "图片资源不支持下载",
|
|
249
|
+
cancelBtn: false
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
_define_property(this, "downloadFile", (url, headers, callback = ()=>{})=>{
|
|
254
|
+
let { filename } = this.props;
|
|
255
|
+
let suffix = "png";
|
|
256
|
+
var xhr = new XMLHttpRequest();
|
|
257
|
+
if (url.indexOf("?") != -1) {
|
|
258
|
+
url = url + "&down_t=" + new Date().valueOf();
|
|
259
|
+
} else {
|
|
260
|
+
url = url + "?down_t=" + new Date().valueOf();
|
|
261
|
+
}
|
|
262
|
+
xhr.open("GET", url, true);
|
|
263
|
+
for(let key in headers){
|
|
264
|
+
xhr.setRequestHeader(key, headers[key]);
|
|
265
|
+
}
|
|
266
|
+
xhr.responseType = "blob";
|
|
267
|
+
//关键部分
|
|
268
|
+
xhr.onload = function(e) {
|
|
269
|
+
//如果请求执行成功
|
|
270
|
+
if (this.status == 200) {
|
|
271
|
+
var blob = this.response;
|
|
272
|
+
var a = document.createElement("a");
|
|
273
|
+
if (this.response.type) {
|
|
274
|
+
try {
|
|
275
|
+
suffix = this.response.type.replace("image/", "");
|
|
276
|
+
} catch (error) {
|
|
277
|
+
suffix = "png";
|
|
278
|
+
console.error(error);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
//创键临时url对象
|
|
282
|
+
var url = URL.createObjectURL(blob);
|
|
283
|
+
a.href = url;
|
|
284
|
+
a.download = `${filename || "download"}.${suffix}`;
|
|
285
|
+
a.click();
|
|
286
|
+
//释放之前创建的URL对象
|
|
287
|
+
window.URL.revokeObjectURL(url);
|
|
288
|
+
typeof callback == "function" && callback();
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
xhr.onerror = function() {
|
|
292
|
+
BhdTipModal.confirm({
|
|
293
|
+
title: "提示信息",
|
|
294
|
+
centered: true,
|
|
295
|
+
content: "图片资源不支持下载",
|
|
296
|
+
cancelBtn: false
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
//发送请求
|
|
300
|
+
xhr.send();
|
|
301
|
+
});
|
|
302
|
+
_define_property(this, "reset", ()=>{
|
|
303
|
+
this.setState({
|
|
304
|
+
imgLeft: "auto",
|
|
305
|
+
imgTop: "auto",
|
|
306
|
+
rotateValue: 0,
|
|
307
|
+
scaleValue: 100
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
_define_property(this, "rotate", ()=>{
|
|
311
|
+
this.setState({
|
|
312
|
+
rotateValue: this.state.rotateValue + 90
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
_define_property(this, "close", ()=>{
|
|
316
|
+
this.props.onCancel();
|
|
317
|
+
});
|
|
318
|
+
//获取图片
|
|
319
|
+
_define_property(this, "getSrc", async (curIndex)=>{
|
|
320
|
+
this.setState({
|
|
321
|
+
loading: true,
|
|
322
|
+
curIndex
|
|
323
|
+
});
|
|
324
|
+
let src;
|
|
325
|
+
if (this.state.multiSelect) {
|
|
326
|
+
src = await this.props.getSrc(curIndex);
|
|
327
|
+
} else {
|
|
328
|
+
src = await this.props.getSrc();
|
|
329
|
+
}
|
|
330
|
+
this.setState({
|
|
331
|
+
imgSrc: src,
|
|
332
|
+
loading: false
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
_define_property(this, "preChange", async ()=>{
|
|
336
|
+
let { curIndex } = this.state;
|
|
337
|
+
if (curIndex == 0) return;
|
|
338
|
+
await this.getSrc(curIndex - 1);
|
|
339
|
+
});
|
|
340
|
+
_define_property(this, "nextChange", async ()=>{
|
|
341
|
+
let { curIndex } = this.state;
|
|
342
|
+
if (curIndex == this.props.multiSelect.length - 1) return;
|
|
343
|
+
await this.getSrc(curIndex + 1);
|
|
344
|
+
});
|
|
345
|
+
_define_property(this, "imgLoad", ()=>{
|
|
346
|
+
this.setState({
|
|
347
|
+
imgError: false
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
_define_property(this, "imgErr", ()=>{
|
|
351
|
+
this.setState({
|
|
352
|
+
imgError: true
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
const AppViewImage = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
358
|
+
let { visible, className } = props;
|
|
359
|
+
const viewRef = useRef(null);
|
|
360
|
+
useImperativeHandle(ref, ()=>({
|
|
361
|
+
updateSrc: ()=>{
|
|
362
|
+
viewRef.current.getSrc();
|
|
363
|
+
}
|
|
364
|
+
}));
|
|
365
|
+
return /*#__PURE__*/ _jsx(Modal, {
|
|
366
|
+
transitionName: "",
|
|
367
|
+
maskTransitionName: "",
|
|
368
|
+
title: null,
|
|
369
|
+
footer: null,
|
|
370
|
+
closable: false,
|
|
371
|
+
centered: true,
|
|
372
|
+
// destroyOnClose
|
|
373
|
+
open: visible,
|
|
374
|
+
keyboard: false,
|
|
375
|
+
maskStyle: {
|
|
376
|
+
background: "rgba(0, 0, 0, 0.65)"
|
|
377
|
+
},
|
|
378
|
+
wrapClassName: `${styles.AppViewImage} ${className || ""}`,
|
|
379
|
+
children: visible && /*#__PURE__*/ _jsx(ViewImage, _object_spread_props(_object_spread({}, props), {
|
|
380
|
+
ref: viewRef
|
|
381
|
+
}))
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
export default AppViewImage;
|