提交 6003dcbd 作者: ZhangLingKun

功能:问题修复

上级 b11499bd
......@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { message, Upload, UploadProps } from 'antd';
import { CommonAPI } from '~/api';
import './index.scss';
import Viewer from '~/components/viewer';
interface PropsType {
listType?: 'text' | 'picture' | 'picture-card'; // 上传列表的内建样式
......@@ -43,6 +44,11 @@ export const Uploader: React.FC<PropsType> = (props) => {
defaultFileList,
disabled,
} = props;
// 是否上传图片
const [visible, setVisible] = useState<boolean>(false);
// 当前选择的文件
const [currentFile, setCurrentFile] = useState<string>();
// 文件列表
const [fileList, setFileList] = useState<any[]>([]);
// 上传文件配置
const uploadProps: UploadProps = {
......@@ -114,7 +120,14 @@ export const Uploader: React.FC<PropsType> = (props) => {
setFileList(newFileList);
onChange?.(newFileList);
},
// onPreview: { onPreview },
onPreview: (res) => {
const { url } = res;
const fileType = url?.substring(url?.lastIndexOf('.') + 1) || '';
if (['png', 'jpg', 'bmp', 'gif', 'jpeg', 'webp'].includes(fileType)) {
setCurrentFile(url);
setVisible(true);
}
},
};
useEffect(() => {
// 如果有默认文件列表
......@@ -135,6 +148,19 @@ export const Uploader: React.FC<PropsType> = (props) => {
{fileList.length < (fileLength || 1) && children}
</Upload>
)}
<Viewer
visible={visible}
currentImgList={[
{
src: currentFile,
alt: '图片',
},
]}
activeViewerIndex={0}
setVisible={() => {
setVisible(false);
}}
/>
</div>
);
};
......@@ -5,6 +5,7 @@ interface propsType {
visible: boolean;
currentImgList: any;
activeViewerIndex: number;
// eslint-disable-next-line @typescript-eslint/ban-types
setVisible: Function;
}
......
......@@ -65,9 +65,9 @@ export const ChangeModal: FC<PropsType> = (props) => {
return (
<Modal open={open} title='变更' onCancel={handleClosed} destroyOnClose onOk={handleSubmit}>
<Form form={form} labelCol={{ span: 5 }} wrapperCol={{ span: 16 }}>
<Form.Item label='等级标签' name='cooperationTagIds'>
<Form.Item label='加盟身份' name='cooperationTagIds'>
<Select
placeholder='请选择等级标签'
placeholder='请选择加盟身份'
disabled={!data?.userName && !data?.companyName}
allowClear
options={cooperationTagIdList}
......
......@@ -147,7 +147,7 @@ function CustomListView() {
render: (text) => (text ? '普通用户' : '游客用户'),
},
{
title: '渠道等级',
title: '加盟身份',
dataIndex: 'cooperationTagVOS',
align: 'center',
render: (_text, record) =>
......
......@@ -184,7 +184,7 @@ const MaterielManageView = () => {
search={[
{
label: '模块名称',
name: 'keyword',
name: 'moduleName',
type: 'input',
placeholder: '请输入模块名称',
},
......
......@@ -138,7 +138,7 @@ const TenderManageFeedback = () => {
placeholder: '请选择编号',
options: tenderInfoList,
},
{ label: '用户姓名', name: 'userName', type: 'input', placeholder: '请输入编号' },
{ label: '用户姓名', name: 'userName', type: 'input', placeholder: '请输入用户姓名' },
]}
searchData={onFinish}
child={
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论