SearchRankCloud.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import React from "react";
  2. import { Spin } from "antd";
  3. import { connect } from "dva";
  4. import RadioButtonGroup from "./RadioButtonGroup";
  5. import WordCloud from "@/components/WordCloud";
  6. import styles from "../styles/common.less";
  7. import PanelNav from "./PanelNav";
  8. const SearchRankCloud = ({
  9. data,
  10. options,
  11. current,
  12. loading,
  13. currentSite,
  14. dispatch,
  15. }) => {
  16. const onChange = (val) => {
  17. dispatch({
  18. type: "bigscreen/setSearchRankData",
  19. payload: { current: val },
  20. });
  21. dispatch({
  22. type: "bigscreen/load_search_rank",
  23. });
  24. };
  25. const title = currentSite === "1" ? "海外" : "分销商";
  26. const parseData = (keywords) => {
  27. return keywords.map(item => decodeURIComponent(item))
  28. }
  29. return (
  30. <div className={styles.common}>
  31. <div className={styles.common_header}>
  32. <PanelNav title={title + "门户搜索关键词排行"} />
  33. <div className={styles.common_header_conditions}>
  34. <RadioButtonGroup
  35. options={options}
  36. label={current}
  37. onChange={onChange}
  38. />
  39. </div>
  40. </div>
  41. <div className={styles.common_content}>
  42. <WordCloud data={parseData(data)}></WordCloud>
  43. </div>
  44. </div>
  45. );
  46. };
  47. export default connect(({ bigscreen, global }) => ({
  48. data: bigscreen.searchRankData.data,
  49. options: bigscreen.searchRankData.options,
  50. current: bigscreen.searchRankData.current,
  51. loading: bigscreen.searchRankData.loading,
  52. currentSite: global.currentSite,
  53. }))(SearchRankCloud);