win-chart 1.0.0
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/.eslintrc.json +3 -0
- package/.prettierrc.json +5 -0
- package/README.md +0 -0
- package/localhost-key.pem +28 -0
- package/localhost.pem +25 -0
- package/package.json +65 -0
- package/rsbuild.config.ts +48 -0
- package/src/api/README.md +15 -0
- package/src/api/index.js +5 -0
- package/src/api/layout/index.js +32 -0
- package/src/api/request.ts +87 -0
- package/src/api/url-map/index.js +10 -0
- package/src/api/user/index.js +12 -0
- package/src/components/FilterContext.tsx +6 -0
- package/src/components/GlobalStyle.tsx +25 -0
- package/src/components/HalfScreenBrowser.tsx +95 -0
- package/src/components/ImgBox.tsx +19 -0
- package/src/components/JumpBtn.tsx +38 -0
- package/src/components/MCardWrapper.tsx +33 -0
- package/src/components/NoContent/index.tsx +85 -0
- package/src/components/ResponsiveReactGridLayout.tsx +218 -0
- package/src/components/SliderDecoration.tsx +27 -0
- package/src/components/VisionUserConfigContext.ts +6 -0
- package/src/components/WinMenu/README.md +11 -0
- package/src/components/WinMenu/WinHeader.tsx +5 -0
- package/src/components/WinMenu/components/ExtraBox.tsx +61 -0
- package/src/components/WinMenu/components/FullMenuBox.tsx +80 -0
- package/src/components/WinMenu/components/FullMenuContainer.tsx +50 -0
- package/src/components/WinMenu/components/FullMenuItem.tsx +128 -0
- package/src/components/WinMenu/components/LangSwitch.tsx +84 -0
- package/src/components/WinMenu/components/LogoBox.tsx +29 -0
- package/src/components/WinMenu/components/PinDialog.tsx +72 -0
- package/src/components/WinMenu/components/PinnedMenuBox.tsx +183 -0
- package/src/components/WinMenu/components/UserBox.tsx +83 -0
- package/src/components/WinMenu/hooks/useUserInfo.ts +21 -0
- package/src/components/WinMenu/hooks/useUserMenu.ts +35 -0
- package/src/components/WinMenu/index.tsx +100 -0
- package/src/components/WinMenu/services/WinService.ts +79 -0
- package/src/components/WinMenu/services/request.ts +53 -0
- package/src/components/WinMenu/utils/const.ts +80 -0
- package/src/components/WinMenu/utils/enum.ts +19 -0
- package/src/components/WinMenu/utils/interface.ts +61 -0
- package/src/components/WinMenu/utils/map.ts +39 -0
- package/src/components/WinMenu/utils/tool.ts +142 -0
- package/src/components/WinMenu/utils/type.ts +1 -0
- package/src/components/hover-view.tsx +48 -0
- package/src/components/icon.tsx +44 -0
- package/src/components/indicator-remark.tsx +25 -0
- package/src/components/none-content.tsx +93 -0
- package/src/components/panel-tab.tsx +150 -0
- package/src/components/panel-title-tab.tsx +60 -0
- package/src/components/win-card/components/ChartContent.tsx +47 -0
- package/src/components/win-card/components/Indicator.tsx +42 -0
- package/src/components/win-card/components/IndicatorArea.tsx +63 -0
- package/src/components/win-card/components/IndicatorInfo.tsx +78 -0
- package/src/components/win-card/components/MatterContent.tsx +121 -0
- package/src/components/win-card/components/MatterList.tsx +141 -0
- package/src/components/win-card/components/NoticeContent.tsx +73 -0
- package/src/components/win-card/components/NoticeList.tsx +68 -0
- package/src/components/win-card/components/SelectDecoration.tsx +34 -0
- package/src/components/win-card/components/WinRankContent.tsx +102 -0
- package/src/components/win-card/index.tsx +298 -0
- package/src/components/win-card/utils/interface.ts +12 -0
- package/src/components/win-card/utils/tool.ts +11 -0
- package/src/components/win-card-mobile/components/ChartContent.tsx +47 -0
- package/src/components/win-card-mobile/components/DualLineBar.tsx +61 -0
- package/src/components/win-card-mobile/components/Indicator.tsx +42 -0
- package/src/components/win-card-mobile/components/IndicatorArea.tsx +65 -0
- package/src/components/win-card-mobile/components/IndicatorInfo.tsx +83 -0
- package/src/components/win-card-mobile/components/SelectDecoration.tsx +28 -0
- package/src/components/win-card-mobile/index.tsx +235 -0
- package/src/components/win-card-mobile/utils/interface.ts +12 -0
- package/src/components/win-card-mobile/utils/tool.ts +9 -0
- package/src/components/win-chart/components/chart-wrapper.tsx +5 -0
- package/src/components/win-chart/index.tsx +59 -0
- package/src/components/win-chart/theme/win-dark.json +372 -0
- package/src/components/win-chart/theme/win-light.json +372 -0
- package/src/components/win-chart/utils/const.ts +37 -0
- package/src/components/win-chart/utils/getAreaSpec.ts +150 -0
- package/src/components/win-chart/utils/getBarSpec.ts +60 -0
- package/src/components/win-chart/utils/getChartOptions.ts +59 -0
- package/src/components/win-chart/utils/getColumnSpec.ts +112 -0
- package/src/components/win-chart/utils/getDualSpec.ts +79 -0
- package/src/components/win-chart/utils/getFunnelSpec.ts +70 -0
- package/src/components/win-chart/utils/getLineSpec.ts +53 -0
- package/src/components/win-chart/utils/getPieSpec.ts +124 -0
- package/src/components/win-chart/utils/getRadarSpec.ts +87 -0
- package/src/components/win-chart/utils/tool.ts +163 -0
- package/src/components/win-chart/utils/type.ts +96 -0
- package/src/components/win-icon/index.tsx +97 -0
- package/src/components/win-v/components/EmptyBox.tsx +9 -0
- package/src/components/win-v/components/VDialog.tsx +173 -0
- package/src/components/win-v/components/VDialogBtn.tsx +119 -0
- package/src/components/win-v/components/VDialogMsg.tsx +325 -0
- package/src/components/win-v/components/VInput.tsx +15 -0
- package/src/components/win-v/components/VRemindMsgList.tsx +303 -0
- package/src/components/win-v/components/VRobot.tsx +97 -0
- package/src/components/win-v/hooks/useVDialogCore.ts +102 -0
- package/src/components/win-v/hooks/useVDialogOperate.ts +132 -0
- package/src/components/win-v/hooks/useVDialogState.ts +52 -0
- package/src/components/win-v/hooks/useVRemindMsgShow.ts +15 -0
- package/src/components/win-v/index.tsx +205 -0
- package/src/components/win-wrappers/card-wrapper.tsx +103 -0
- package/src/components/win-wrappers/dot-wrapper.tsx +18 -0
- package/src/components/win-wrappers/iframe-wrapper.tsx +7 -0
- package/src/components/win-wrappers/request-wrapper.tsx +190 -0
- package/src/global.d.ts +53 -0
- package/src/hooks/useCardOptionList.ts +23 -0
- package/src/hooks/useCostFiltersDicList.ts +22 -0
- package/src/hooks/useFbiUrl.ts +22 -0
- package/src/hooks/useHalfScreenState.ts +50 -0
- package/src/hooks/useHasIntersected.ts +36 -0
- package/src/hooks/useIndicatorCardInfo.ts +26 -0
- package/src/hooks/useIndicatorCardQueryList.ts +22 -0
- package/src/hooks/useIndicatorClassifyList.ts +25 -0
- package/src/hooks/useIndicatorDetailsDateList.ts +22 -0
- package/src/hooks/useIndicatorDetailsInfo.ts +49 -0
- package/src/hooks/useIndicatorDetailsTrend.ts +25 -0
- package/src/hooks/useIndicatorDicList.ts +22 -0
- package/src/hooks/useIndicatorLabelList.ts +20 -0
- package/src/hooks/useIndicatorList.ts +24 -0
- package/src/hooks/useIndicatorRangeList.ts +20 -0
- package/src/hooks/useIndicatorTypeList.ts +20 -0
- package/src/hooks/useIndicatorUnitList.ts +21 -0
- package/src/hooks/useListenQuery.ts +29 -0
- package/src/hooks/useMobile.ts +58 -0
- package/src/hooks/useNotice.ts +42 -0
- package/src/hooks/useOrgLevelList.ts +23 -0
- package/src/hooks/usePageSelection.ts +121 -0
- package/src/hooks/usePageState.ts +22 -0
- package/src/hooks/usePendingList.ts +27 -0
- package/src/hooks/usePortalPageInfo.ts +43 -0
- package/src/hooks/useRefreshByLocationChange.ts +16 -0
- package/src/hooks/useReportIndicatorList.ts +21 -0
- package/src/hooks/useReportInfo.ts +45 -0
- package/src/hooks/useReportPersonList.ts +21 -0
- package/src/hooks/useScriptLoader.ts +22 -0
- package/src/hooks/useUnreadMsgList.ts +26 -0
- package/src/hooks/useUserAvatar.ts +23 -0
- package/src/hooks/useVReportInfo.ts +50 -0
- package/src/hooks/useVisionUserConfig.ts +25 -0
- package/src/hooks/useWorkbenchOptions.ts +63 -0
- package/src/index.tsx +20 -0
- package/src/services/CardService.ts +91 -0
- package/src/services/CommonService.ts +23 -0
- package/src/services/CostService.ts +56 -0
- package/src/services/DialogService.ts +74 -0
- package/src/services/IndicatorService.ts +406 -0
- package/src/services/PageService.ts +204 -0
- package/src/services/ReportService.ts +335 -0
- package/src/services/WorkbenchService.ts +411 -0
- package/src/styles/README.md +12 -0
- package/src/styles/index.scss +9 -0
- package/src/styles/mixins/index.scss +25 -0
- package/src/styles/next-cover.scss +4 -0
- package/src/styles/normalize.scss +27 -0
- package/src/styles/utilities/index.scss +5 -0
- package/src/styles/vars/index.scss +17 -0
- package/src/types/enum-workbench.ts +29 -0
- package/src/types/enum.ts +156 -0
- package/src/types/index.ts +19 -0
- package/src/types/indicator.ts +299 -0
- package/src/types/interface.ts +303 -0
- package/src/types/portal.ts +211 -0
- package/src/types/report.ts +28 -0
- package/src/types/type.ts +11 -0
- package/src/types/user.ts +28 -0
- package/src/utils/README.md +4 -0
- package/src/utils/arms.ts +59 -0
- package/src/utils/arr.ts +123 -0
- package/src/utils/const-workbench.ts +9 -0
- package/src/utils/const.ts +18 -0
- package/src/utils/index.ts +18 -0
- package/src/utils/init.ts +5 -0
- package/src/utils/map-workbench.ts +66 -0
- package/src/utils/map.ts +377 -0
- package/src/utils/number.ts +101 -0
- package/src/utils/page.ts +81 -0
- package/src/utils/str.ts +26 -0
- package/src/utils/tools.ts +44 -0
- package/src/utils/tree.ts +145 -0
- package/src/utils/url.ts +40 -0
- package/src/utils/util.ts +99 -0
- package/src/utils/workbench.ts +25 -0
- package/tsconfig.json +33 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export interface IWinChartProps {
|
|
2
|
+
theme?: 'light' | 'dark';
|
|
3
|
+
sort?: 'asc' | 'desc';
|
|
4
|
+
color?: string[];
|
|
5
|
+
chartType?: WinChartType;
|
|
6
|
+
xAxisLabelRotate?: number;
|
|
7
|
+
xAxisLabelLength?: number;
|
|
8
|
+
data?: ICharInfo[];
|
|
9
|
+
extraData?: ICharInfo[];
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* label 与 value 取值互换 (只作用饼图、环图、雷达图图表)
|
|
15
|
+
*/
|
|
16
|
+
reserveValueWithLabelType?: boolean;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Y 轴起始值
|
|
20
|
+
*/
|
|
21
|
+
yStart?: number[];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 自定义配置,优先级最高,会覆盖默认配置(采用deepmerge,只覆盖差异部分)
|
|
25
|
+
*/
|
|
26
|
+
extraOption?: echarts.EChartsOption;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 图表类型
|
|
31
|
+
*/
|
|
32
|
+
export enum WinChartType {
|
|
33
|
+
/**
|
|
34
|
+
* MINI面积图
|
|
35
|
+
*/
|
|
36
|
+
MINI_AREA,
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 面积图
|
|
40
|
+
*/
|
|
41
|
+
AREA,
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 双轴图
|
|
45
|
+
*/
|
|
46
|
+
DUAL_LINE_BAR,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 柱状图
|
|
50
|
+
*/
|
|
51
|
+
COLUMN,
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 堆叠柱状图
|
|
55
|
+
*/
|
|
56
|
+
STACK_COLUMN,
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 折线图
|
|
60
|
+
*/
|
|
61
|
+
LINE,
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 条形图
|
|
65
|
+
*/
|
|
66
|
+
BAR,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 漏斗图
|
|
70
|
+
*/
|
|
71
|
+
FUNNEL,
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 饼图
|
|
75
|
+
*/
|
|
76
|
+
PIE,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 环形图
|
|
80
|
+
*/
|
|
81
|
+
CYCLE,
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 雷达图
|
|
85
|
+
*/
|
|
86
|
+
RADAR,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 标准图表数据
|
|
91
|
+
*/
|
|
92
|
+
export interface ICharInfo {
|
|
93
|
+
label: string;
|
|
94
|
+
value: number;
|
|
95
|
+
type?: string;
|
|
96
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { HTMLAttributes, CSSProperties, useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
interface IconProps extends HTMLAttributes<SVGElement> {
|
|
4
|
+
type?: string;
|
|
5
|
+
size?:
|
|
6
|
+
| number
|
|
7
|
+
| 'xs'
|
|
8
|
+
| 'small'
|
|
9
|
+
| 'medium'
|
|
10
|
+
| 'large'
|
|
11
|
+
| 'xl'
|
|
12
|
+
| 'xxl'
|
|
13
|
+
| 'xxxl'
|
|
14
|
+
| 'inherit';
|
|
15
|
+
color?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const sizeMap = {
|
|
19
|
+
xs: '0.5em',
|
|
20
|
+
small: '0.75em',
|
|
21
|
+
medium: '1em',
|
|
22
|
+
large: '1.25em',
|
|
23
|
+
xl: '1.5em',
|
|
24
|
+
xxl: '1.75em',
|
|
25
|
+
xxxl: '2em',
|
|
26
|
+
inherit: 'inherit',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const createIconComponent = (scriptUrl: string) => {
|
|
30
|
+
const Icon: React.FC<IconProps> = ({
|
|
31
|
+
type,
|
|
32
|
+
size = 'medium',
|
|
33
|
+
color,
|
|
34
|
+
style,
|
|
35
|
+
className,
|
|
36
|
+
...restProps
|
|
37
|
+
}) => {
|
|
38
|
+
const scriptLoaded = useIconLoader(scriptUrl);
|
|
39
|
+
|
|
40
|
+
if (!scriptLoaded) {
|
|
41
|
+
return null; // 或者可以返回一个占位符或者加载状态
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 根据size属性转换尺寸
|
|
45
|
+
const fontSize = typeof size === 'number' ? `${size}px` : sizeMap[size];
|
|
46
|
+
|
|
47
|
+
// 定义图标样式
|
|
48
|
+
const iconStyle: CSSProperties = {
|
|
49
|
+
width: fontSize,
|
|
50
|
+
height: fontSize,
|
|
51
|
+
verticalAlign: '-0.15em',
|
|
52
|
+
fill: color || 'currentColor',
|
|
53
|
+
overflow: 'hidden',
|
|
54
|
+
...style, // 合并外部传入的style对象
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// 使用type属性构建图标的引用链接
|
|
58
|
+
const href = `#${type}`;
|
|
59
|
+
|
|
60
|
+
// 合并额外的props和样式类名
|
|
61
|
+
const svgClassName = `icon ${className || ''}`.trim();
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<svg
|
|
65
|
+
className={svgClassName}
|
|
66
|
+
aria-hidden="true"
|
|
67
|
+
style={iconStyle}
|
|
68
|
+
{...restProps}
|
|
69
|
+
>
|
|
70
|
+
<use xlinkHref={href}></use>
|
|
71
|
+
</svg>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return Icon;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const useIconLoader = (scriptUrl: string) => {
|
|
79
|
+
const [loaded, setLoaded] = useState(false);
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (document.querySelector(`script[src="${scriptUrl}"]`)) {
|
|
83
|
+
setLoaded(true);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const script = document.createElement('script');
|
|
87
|
+
script.src = scriptUrl;
|
|
88
|
+
script.async = true;
|
|
89
|
+
script.onload = () => setLoaded(true);
|
|
90
|
+
document.body.appendChild(script);
|
|
91
|
+
return () => {
|
|
92
|
+
document.body.removeChild(script);
|
|
93
|
+
};
|
|
94
|
+
}, [scriptUrl]);
|
|
95
|
+
|
|
96
|
+
return loaded;
|
|
97
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { styled } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const EmptyBox = styled.img.attrs({
|
|
4
|
+
src: 'https://img.alicdn.com/imgextra/i4/O1CN01bkhh1m21HH4wlsyY9_!!6000000006959-55-tps-96-64.svg',
|
|
5
|
+
})`
|
|
6
|
+
width: 50vw;
|
|
7
|
+
object-fit: contain;
|
|
8
|
+
margin-bottom: 0.64rem;
|
|
9
|
+
`;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import $i18n from 'panda-i18n';
|
|
2
|
+
import { Box, CnButton, Input } from '@cainiaofe/cn-ui';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { css, styled } from 'styled-components';
|
|
5
|
+
import { VDialogMsg } from './VDialogMsg';
|
|
6
|
+
import { rgba } from 'polished';
|
|
7
|
+
import { insertTimeMarkers } from '@/utils';
|
|
8
|
+
import { CustomIcon } from '@/components/icon';
|
|
9
|
+
import { IStyleProps } from '@/types';
|
|
10
|
+
import { useVDialogCore } from '../hooks/useVDialogCore';
|
|
11
|
+
import { BackMyVisionBtn, ToolBtnBox } from './VDialogBtn';
|
|
12
|
+
import { useMobileState } from '@/hooks/useMobile';
|
|
13
|
+
|
|
14
|
+
interface IProps extends IStyleProps {
|
|
15
|
+
insertContent?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const VDialog = ({ style, insertContent }: IProps) => {
|
|
19
|
+
const {
|
|
20
|
+
dialogState,
|
|
21
|
+
scrollContainerRef,
|
|
22
|
+
handleSend,
|
|
23
|
+
handleFocus,
|
|
24
|
+
handleInputChange,
|
|
25
|
+
handleQueryDialogList,
|
|
26
|
+
} = useVDialogCore();
|
|
27
|
+
|
|
28
|
+
// 对话列表
|
|
29
|
+
const msgList = useMemo(() => {
|
|
30
|
+
return insertTimeMarkers(dialogState.dialogList).map((item) => {
|
|
31
|
+
const curIndex = dialogState.dialogList.findIndex(
|
|
32
|
+
(ele) => ele.id === item.id,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const getRetryContent = () => {
|
|
36
|
+
for (let i = curIndex - 1; i >= 0; i--) {
|
|
37
|
+
if (dialogState.dialogList.at(i)?.sender !== '0') {
|
|
38
|
+
return dialogState.dialogList.at(i)?.content;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<VDialogMsg key={item.id} data={item} retryMsg={getRetryContent()} />
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
}, [dialogState.dialogList]);
|
|
48
|
+
const isMobileDevice = useMobileState();
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Wrapper style={style} $show={dialogState.show}>
|
|
52
|
+
<MessageListWrapper ref={scrollContainerRef}>
|
|
53
|
+
{insertContent}
|
|
54
|
+
<ListBtnWrapper>
|
|
55
|
+
<div style={{ height: 16 }}>
|
|
56
|
+
<ListBtn
|
|
57
|
+
$show={
|
|
58
|
+
dialogState.dialogList.length < dialogState.paging.totalCount &&
|
|
59
|
+
!dialogState.loading
|
|
60
|
+
}
|
|
61
|
+
onClick={() => {
|
|
62
|
+
handleQueryDialogList(dialogState.paging.currentPage + 1);
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
{$i18n.get({ id: 'LoadMore', dm: '加载更多' })}
|
|
66
|
+
</ListBtn>
|
|
67
|
+
</div>
|
|
68
|
+
</ListBtnWrapper>
|
|
69
|
+
{msgList}
|
|
70
|
+
</MessageListWrapper>
|
|
71
|
+
<InputWrapper>
|
|
72
|
+
{isMobileDevice && (
|
|
73
|
+
<ToolBtnBox>
|
|
74
|
+
<BackMyVisionBtn />
|
|
75
|
+
</ToolBtnBox>
|
|
76
|
+
)}
|
|
77
|
+
|
|
78
|
+
<InputBox>
|
|
79
|
+
<InputDecoration
|
|
80
|
+
enterKeyHint="send"
|
|
81
|
+
disabled={dialogState.loading}
|
|
82
|
+
onFocus={() => {
|
|
83
|
+
handleFocus(true);
|
|
84
|
+
}}
|
|
85
|
+
onBlur={() => {
|
|
86
|
+
handleFocus(false);
|
|
87
|
+
}}
|
|
88
|
+
value={dialogState.input}
|
|
89
|
+
onChange={handleInputChange}
|
|
90
|
+
/>
|
|
91
|
+
<SendDecoration onClick={() => handleSend(dialogState.input)} />
|
|
92
|
+
</InputBox>
|
|
93
|
+
</InputWrapper>
|
|
94
|
+
</Wrapper>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const Wrapper = styled.div<{ $show?: boolean }>`
|
|
99
|
+
width: 100%;
|
|
100
|
+
height: 100%;
|
|
101
|
+
background: ${rgba('#fff', 0.6)};
|
|
102
|
+
padding: 16px;
|
|
103
|
+
position: relative;
|
|
104
|
+
display: flex;
|
|
105
|
+
flex-direction: column;
|
|
106
|
+
|
|
107
|
+
${(props) =>
|
|
108
|
+
!props.$show &&
|
|
109
|
+
css`
|
|
110
|
+
display: none;
|
|
111
|
+
`}
|
|
112
|
+
`;
|
|
113
|
+
|
|
114
|
+
const MessageListWrapper = styled.div`
|
|
115
|
+
display: grid;
|
|
116
|
+
gap: 8px;
|
|
117
|
+
flex: 1;
|
|
118
|
+
overflow: auto;
|
|
119
|
+
padding-bottom: 20px;
|
|
120
|
+
|
|
121
|
+
&::-webkit-scrollbar {
|
|
122
|
+
display: none;
|
|
123
|
+
}
|
|
124
|
+
`;
|
|
125
|
+
|
|
126
|
+
const InputWrapper = styled.div`
|
|
127
|
+
width: 100%;
|
|
128
|
+
background: #fff;
|
|
129
|
+
border-radius: 8px;
|
|
130
|
+
padding: 12px;
|
|
131
|
+
margin-top: 8px;
|
|
132
|
+
`;
|
|
133
|
+
|
|
134
|
+
const InputBox = styled.div`
|
|
135
|
+
display: grid;
|
|
136
|
+
grid: auto-flow / 1fr 30px;
|
|
137
|
+
gap: 8px;
|
|
138
|
+
place-items: end center;
|
|
139
|
+
`;
|
|
140
|
+
|
|
141
|
+
const InputDecoration = styled(Input.TextArea).attrs({
|
|
142
|
+
hasBorder: false,
|
|
143
|
+
placeholder: $i18n.get({ id: 'TERM.PleaseEnter', dm: '请输入' }),
|
|
144
|
+
autoHeight: {
|
|
145
|
+
minRows: 1,
|
|
146
|
+
maxRows: 3,
|
|
147
|
+
},
|
|
148
|
+
})`
|
|
149
|
+
width: 100%;
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
const SendDecoration = styled(CustomIcon).attrs({ type: 'icon-fasong' })`
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
margin-bottom: 8px;
|
|
155
|
+
`;
|
|
156
|
+
|
|
157
|
+
const ListBtnWrapper = styled(Box).attrs({
|
|
158
|
+
direction: 'row',
|
|
159
|
+
justify: 'center',
|
|
160
|
+
})`
|
|
161
|
+
margin: 16px 0;
|
|
162
|
+
`;
|
|
163
|
+
|
|
164
|
+
const ListBtn = styled(CnButton).attrs({
|
|
165
|
+
text: true,
|
|
166
|
+
type: 'primary',
|
|
167
|
+
})<{ $show: boolean }>`
|
|
168
|
+
${(props) =>
|
|
169
|
+
!props.$show &&
|
|
170
|
+
css`
|
|
171
|
+
display: none;
|
|
172
|
+
`}
|
|
173
|
+
`;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import $i18n from 'panda-i18n';
|
|
2
|
+
import { IDialogMsgInfo } from '@/types';
|
|
3
|
+
import { CnBox, CnMessage } from '@cainiaofe/cn-ui';
|
|
4
|
+
import { styled } from 'styled-components';
|
|
5
|
+
import { CustomIcon } from '../../icon';
|
|
6
|
+
import { useNavigate } from 'react-router-dom';
|
|
7
|
+
import { CnButton } from '@cainiaofe/cn-ui-m';
|
|
8
|
+
import { useVDialogOperate } from '../hooks/useVDialogOperate';
|
|
9
|
+
|
|
10
|
+
export const OperateBtnBox = styled(CnBox).attrs({
|
|
11
|
+
direction: 'row',
|
|
12
|
+
justify: 'flex-end',
|
|
13
|
+
onClick: (e: React.MouseEvent) => e.stopPropagation(),
|
|
14
|
+
})`
|
|
15
|
+
border-top: 1px solid #eef0f5;
|
|
16
|
+
padding-top: 8px;
|
|
17
|
+
margin-top: 8px;
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
export const ToolBtnBox = styled(CnBox).attrs({
|
|
21
|
+
direction: 'row',
|
|
22
|
+
justify: 'flex-start',
|
|
23
|
+
onClick: (e: React.MouseEvent) => e.stopPropagation(),
|
|
24
|
+
})`
|
|
25
|
+
border-bottom: 1px solid #eef0f5;
|
|
26
|
+
padding-bottom: 8px;
|
|
27
|
+
margin-bottom: 8px;
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
const OperateBtn = styled.div`
|
|
31
|
+
color: #828b9e;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
align-items: center;
|
|
36
|
+
line-height: 1;
|
|
37
|
+
margin-left: 16px;
|
|
38
|
+
|
|
39
|
+
span {
|
|
40
|
+
font-size: 12px;
|
|
41
|
+
margin-left: 4px;
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
export const RetryBtn = (data: IDialogMsgInfo & { retryMsg?: string }) => {
|
|
46
|
+
const { handleSend } = useVDialogOperate();
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<OperateBtn onClick={() => handleSend(data.retryMsg)}>
|
|
50
|
+
<CustomIcon type="icon-refresh" />
|
|
51
|
+
<span>{$i18n.get({ id: 'TryAgain', dm: '再试一次' })}</span>
|
|
52
|
+
</OperateBtn>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const CopyBtn = (data: IDialogMsgInfo) => {
|
|
57
|
+
return (
|
|
58
|
+
<OperateBtn
|
|
59
|
+
onClick={async () => {
|
|
60
|
+
if (data.content) {
|
|
61
|
+
await navigator.clipboard.writeText(data.content);
|
|
62
|
+
CnMessage.success(
|
|
63
|
+
$i18n.get({ id: 'TERM.CopySuccessful', dm: '复制成功' }),
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<CustomIcon type="icon-fuzhi" />
|
|
69
|
+
<span>{$i18n.get({ id: 'TERM.Copy', dm: '复制' })}</span>
|
|
70
|
+
</OperateBtn>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const LikeBtn = (data: IDialogMsgInfo) => {
|
|
75
|
+
const { handleUpdateDialogMsg } = useVDialogOperate();
|
|
76
|
+
const handleLike = () => {
|
|
77
|
+
handleUpdateDialogMsg({
|
|
78
|
+
id: data.id,
|
|
79
|
+
status: { 0: 2, 1: 2, 2: 1 }[data.status!],
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<OperateBtn onClick={handleLike}>
|
|
85
|
+
<CustomIcon type={data.status === 2 ? 'icon-like-2' : 'icon-like-0'} />
|
|
86
|
+
<span>{$i18n.get({ id: 'ThumbsUp', dm: '点赞' })}</span>
|
|
87
|
+
</OperateBtn>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const FeedbackBtn = () => {
|
|
92
|
+
const { handleSetDialogState } = useVDialogOperate();
|
|
93
|
+
const handleFeedback = () => {
|
|
94
|
+
handleSetDialogState((state) => ({
|
|
95
|
+
...state,
|
|
96
|
+
input: '/问题反馈 ',
|
|
97
|
+
}));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<OperateBtn onClick={handleFeedback}>
|
|
102
|
+
<CustomIcon type="icon-fankui" />
|
|
103
|
+
<span>{$i18n.get({ id: 'feedback', dm: '反馈' })}</span>
|
|
104
|
+
</OperateBtn>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const BackMyVisionBtn = () => {
|
|
109
|
+
const nav = useNavigate();
|
|
110
|
+
const handleClick = async () => {
|
|
111
|
+
nav('/');
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<CnButton size="small" onClick={handleClick}>
|
|
116
|
+
<span>{$i18n.get({ id: 'GoToMyVision', dm: '进入My Vision' })}</span>
|
|
117
|
+
</CnButton>
|
|
118
|
+
);
|
|
119
|
+
};
|