提交 6003dcbd 作者: ZhangLingKun

功能:问题修复

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