Commit 5e77ceb9 authored by 周宏民's avatar 周宏民

fix: 修改

parent 61b4010f
Pipeline #53962 failed with stages
in 5 seconds
/* eslint-disable react-hooks/exhaustive-deps */
import { Spin } from 'antd';
import PropTypes from 'prop-types';
import { useEffect, useState } from 'react';
let timer = null;
const LoadBox = ({
delay,
indicator,
size,
tip,
wrapperClassName,
timeout,
timeoutTip,
spinning,
}) => {
const [loadTip, setloadTip] = useState(tip);
useEffect(() => {
setloadTip(tip);
if (timer) clearTimeout(timer);
if (spinning)
timer = setTimeout(() => {
setloadTip(timeoutTip);
}, timeout);
return () => {
if (timer) clearTimeout(timer);
};
}, [spinning]);
return (
<Spin
delay={delay}
spinning={spinning}
indicator={indicator}
size={size}
tip={loadTip}
wrapperClassName={wrapperClassName}
></Spin>
);
};
LoadBox.defaultProps = {
spinning: true,
delay: 0,
indicator: '',
size: 'default',
tip: '',
wrapperClassName: '',
timeout: 3000,
timeoutTip: '正在加载数据,请耐心等待...',
};
LoadBox.propTypes = {
spinning: PropTypes.bool, // 是否为加载中状态
delay: PropTypes.number, // 延迟显示加载效果的时间(防止闪烁)
indicator: PropTypes.node, // 加载指示符
size: PropTypes.string, // 组件大小,可选值为 small default large
tip: PropTypes.string, // 当作为包裹元素时,可以自定义描述文案
wrapperClassName: PropTypes.string, // 包装器的类属性
timeout: PropTypes.number, // 超时时间
timeoutTip: PropTypes.string, // 超时时间提示
};
export default LoadBox;
/*
* @Title:富文本编辑器
* @Author: hongmye
* @Date: 2022-03-01 14:23:55
*/
/**
* 1.引入组件 import RichText from '@/components/RichText';
* 示例:<RichText
content={this.state.content}
personList={this.state.personList}
placeholder={'placeholder属性值'}
onChange={val => {
this.setState({ content: val });
}}
onChangeFile={arr => {
this.setState({ fileList: arr });
}}
fileList={this.state.fileList}
projectId={19}
ref={this.myRichText}
/>
*
* 2.传递方法 onChange 每次更改内容回调
*
* 3.传值接收 可选值 projectId 项目id,根据项目id获取项目参与人员,
* 可选值 personList 人员列表 示例:[{userId:1,userName:'xxx'}]
* 可选值 config 框架wangEditor的配置参数
*
* 4.注意事项 projectId和personList只用传一个,projectId优先级高于personList
* content内容如果不是初始有的,可调用setHtml设置内容
*
* 2022-03-21新增图片预览,附件上传功能
* 新增方法:onChangeFile 每次附件更改回调 若不传则不显示附件上传按钮
* fileList 附件列表 示例:[{name:'xxx.jpg',type:'image/jpg',size:8192,path:'xxxx'}]
* 其中name和path是必传的,type为图片可以预览,其它类型文件直接下载
*
* 2022-04-29 修改@人员列表逻辑
* personList 传任务相关人员列表(如 创建、负责、跟进人),同时传入projectId,personList
* 下拉列表默认显示为任务相关人员,加项目人员(做了去重,任务相关人员在最上面)
* @搜索时,搜索全部人员
*/
import { Image, message, Spin } from 'antd'; import { Image, message, Spin } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'; import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment