update pay function

This commit is contained in:
2025-11-22 18:58:14 +08:00
parent 6c99cb83bf
commit cde849b3a4
2 changed files with 43 additions and 24 deletions

View File

@@ -63,8 +63,7 @@
"react-scroll": "^1.8.4", "react-scroll": "^1.8.4",
"react-scroll-into-view": "^2.1.3", "react-scroll-into-view": "^2.1.3",
"react-table": "^7.7.0", "react-table": "^7.7.0",
"react-to-print": "^2.13.0", "react-to-print": "^3.0.3",
"react-wordcloud": "^1.2.7",
"recharts": "^3.1.2", "recharts": "^3.1.2",
"sass": "^1.49.9", "sass": "^1.49.9",
"socket.io-client": "^4.7.4", "socket.io-client": "^4.7.4",

View File

@@ -51,14 +51,15 @@ import {
Treemap, Treemap,
Area, AreaChart, Area, AreaChart,
} from 'recharts'; } from 'recharts';
import ReactWordcloud from 'react-wordcloud'; import ReactECharts from 'echarts-for-react';
import 'echarts-wordcloud';
// 颜色配置 // 颜色配置
const CHART_COLORS = [ const CHART_COLORS = [
'#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEEAD', '#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEEAD',
'#D4A5A5', '#9B6B6B', '#E9967A', '#B19CD9', '#87CEEB' '#D4A5A5', '#9B6B6B', '#E9967A', '#B19CD9', '#87CEEB'
]; ];
// 词云图组件 // 词云图组件(使用 ECharts Wordcloud
const WordCloud = ({ data }) => { const WordCloud = ({ data }) => {
if (!data || data.length === 0) { if (!data || data.length === 0) {
return ( return (
@@ -71,32 +72,51 @@ const WordCloud = ({ data }) => {
} }
const words = data.slice(0, 100).map(item => ({ const words = data.slice(0, 100).map(item => ({
text: item.name || item.text, name: item.name || item.text,
value: item.value || item.count || 1 value: item.value || item.count || 1
})); }));
const options = { const option = {
rotations: 2, tooltip: {
rotationAngles: [-90, 0], show: true
},
series: [{
type: 'wordCloud',
shape: 'circle',
left: 'center',
top: 'center',
width: '100%',
height: '100%',
sizeRange: [16, 80],
rotationRange: [-90, 0],
rotationStep: 90,
gridSize: 8,
drawOutOfBound: false,
layoutAnimation: true,
textStyle: {
fontFamily: 'Microsoft YaHei, sans-serif', fontFamily: 'Microsoft YaHei, sans-serif',
fontSizes: [16, 80],
fontWeight: 'bold', fontWeight: 'bold',
padding: 3, color: function () {
scale: 'sqrt',
};
const callbacks = {
getWordColor: () => {
const colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEEAD']; const colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEEAD'];
return colors[Math.floor(Math.random() * colors.length)]; return colors[Math.floor(Math.random() * colors.length)];
} }
},
emphasis: {
focus: 'self',
textStyle: {
textShadowBlur: 10,
textShadowColor: '#333'
}
},
data: words
}]
}; };
return ( return (
<ReactWordcloud <ReactECharts
words={words} option={option}
options={options} style={{ height: '400px', width: '100%' }}
callbacks={callbacks} opts={{ renderer: 'canvas' }}
/> />
); );
}; };