index.js 1.68 KB
Newer Older
周宏民's avatar
周宏民 committed
1 2 3 4 5 6 7 8 9 10 11
/*
 * @Title:新产品动态
 * @Author: hongmye
 * @Date: 2023-12-26 18:34:42
 */
import React, { useMemo, useEffect, useState, memo } from 'react';
import { Tooltip } from 'antd';
import classNames from 'classnames';
import DataCarousel from '../DataCarousel';
import styles from './index.less';
const RightItem = props => {
12
  const { listData, handToPage, handlePage, handToProduct } = props;
周宏民's avatar
周宏民 committed
13 14 15 16
  const toPage = row => {
    if (row.site) {
      handToProduct(row);
    } else if (row['产品地址']) {
17
      row['产品地址'].includes('https') && handToPage(row['产品地址']);
周宏民's avatar
周宏民 committed
18 19 20 21 22
    }
  };
  const renderRow = (row, index) => {
    const rIndex = `r_${index % 7}`;
    return (
23 24 25 26
      <div
        className={styles.r_list_item}
        key={row['产品名称']}
        rIndex={rIndex}
27
        type={(row['产品地址'] && row['产品地址'].includes('https')) || row.site ? 'jump' : 'none'}
28
        onClick={() => toPage(row)}
周宏民's avatar
周宏民 committed
29
      >
30 31 32
        <div className={styles.r_list_item_title}>{row['产品名称']}</div>
        <div className={styles.r_list_item_tip} />
      </div>
周宏民's avatar
周宏民 committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
    );
  };

  return (
    <div className={classNames(styles.right_item, 'right_item')}>
      <div className={styles.r_title_wrap}>
        <div className={styles.r_title_sub}>熊猫智慧水务</div>
        <div className={styles.r_title}>新产品动态:</div>
      </div>
      <div className={styles.r_list}>
        <DataCarousel
          gap={1}
          autoplay={5000}
          itemHeight={350}
          list={listData}
          renderItem={renderRow}
          config={{
            loop: false,
            slidesPerView: 7,
          }}
        />
      </div>
    </div>
  );
};
export default memo(RightItem);