SpinPercent.js 1.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/**
 * 钟是志
 * 2022年8月15日
 * 百分比进度条组件 只负责渲染
 * */
import React, { useEffect, useState, useRef } from 'react';
import { Spin, Progress } from 'antd';
import styles from './styles.less';

export default function SpinPercent(props) {
  const {
    loadingPercent = false,
    percent,
    status,
    total,
    speed,
    message,
钟是志's avatar
钟是志 committed
18
    progressDefaultProps,
19 20 21 22 23 24 25 26 27 28 29 30 31
  } = props;
  if(loadingPercent){
    return (
      <div className={styles.juzhongSpin}>
        <div style={{textAlign: 'center'}}>
          <Progress type='circle'
                    strokeColor={{
                      '0%': '#108ee9',
                      '100%': '#87d068',
                    }}
                    percent={percent}
                    status={status}
                    format={percent => `${speed}/${total}`}
钟是志's avatar
钟是志 committed
32
                    {...progressDefaultProps}
33 34 35 36 37 38 39 40 41 42
          />
          <div className={styles.textCenter}>
            {message}
          </div>
        </div>
      </div>
    );
  }
  return null;
}