addProductTrend.js 932 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import React from "react";
  2. import { connect } from "dva";
  3. import PanelNav from "./PanelNav";
  4. import BarChart from "./BarChart";
  5. import styles from "../styles/common.less";
  6. const AddProductTrend = ({ data, loading, dispatch }) => {
  7. const parseData = (barData) => {
  8. const xAxisdata = [];
  9. const seriesData = [];
  10. barData.forEach((item) => {
  11. xAxisdata.push(item.month);
  12. seriesData.push(item.newGoodsNum);
  13. });
  14. return {
  15. xAxisdata,
  16. seriesData,
  17. };
  18. };
  19. return (
  20. <div className={styles.common}>
  21. <div className={styles.common_header}>
  22. <PanelNav title="新增商品趋势" />
  23. </div>
  24. <div className={styles.common_content}>
  25. <BarChart {...parseData(data)} />
  26. </div>
  27. </div>
  28. );
  29. };
  30. export default connect(({ bigscreen }) => ({
  31. data: bigscreen.productAddTrendData.data,
  32. loading: bigscreen.productAddTrendData.loading,
  33. }))(AddProductTrend);