Commit 43ce00ec authored by cellee's avatar cellee

修复bug

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 966f6305
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
'/cash/tos-manager/': { '/cash/tos-manager/': {
target: 'http://acc-huahui.oss-cn-shenzhen.aliyuncs.com', target: 'https://acc-huahui.oss-cn-shenzhen.aliyuncs.com',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
'/cash/tos-manager/': { '/cash/tos-manager/': {
target: 'http://acc-huahui.oss-cn-shenzhen.aliyuncs.com', target: 'https://acc-huahui.oss-cn-shenzhen.aliyuncs.com',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
'/cash/tos-manager/': { '/cash/tos-manager/': {
target: 'http://acc-huahui.oss-cn-shenzhen.aliyuncs.com', target: 'https://acc-huahui.oss-cn-shenzhen.aliyuncs.com',
changeOrigin: true, changeOrigin: true,
pathRewrite: { '^': '' }, pathRewrite: { '^': '' },
}, },
......
...@@ -63,9 +63,10 @@ ...@@ -63,9 +63,10 @@
"react": "^16.8.6", "react": "^16.8.6",
"react-dom": "^16.8.6", "react-dom": "^16.8.6",
"react-helmet-async": "^1.0.4", "react-helmet-async": "^1.0.4",
"react-pdf": "^4.2.0", "react-pdf": "^5.0.0",
"react-pdf-js": "^5.1.0", "react-pdf-js": "^5.1.0",
"react-persist": "^1.0.2", "react-persist": "^1.0.2",
"react-file-viewer": "^1.2.1",
"redux-persist": "^6.0.0", "redux-persist": "^6.0.0",
"umi": "^3.1.2", "umi": "^3.1.2",
"umi-request": "^1.0.8", "umi-request": "^1.0.8",
...@@ -103,7 +104,6 @@ ...@@ -103,7 +104,6 @@
"prettier": "^2.0.1", "prettier": "^2.0.1",
"pro-download": "1.0.1", "pro-download": "1.0.1",
"puppeteer-core": "^3.0.0", "puppeteer-core": "^3.0.0",
"react-file-viewer": "^1.2.1",
"stylelint": "^13.0.0" "stylelint": "^13.0.0"
}, },
"engines": { "engines": {
......
{
"compact": false
}
\ No newline at end of file
declare module 'react-file-viewer'; declare module 'react-file-viewer';
declare module 'react-pdf'; declare module 'react-pdf';
declare module '@/assets/d1.pdf';
...@@ -121,6 +121,7 @@ const Account = (props: any) => { ...@@ -121,6 +121,7 @@ const Account = (props: any) => {
onClick={() => { onClick={() => {
edit(record); edit(record);
}} }}
disabled={record.userStatus == 1 ? true : false}
> >
Edit Edit
</Button> </Button>
......
...@@ -94,7 +94,15 @@ const Account = (props: any) => { ...@@ -94,7 +94,15 @@ const Account = (props: any) => {
// 保存提交 // 保存提交
const onFinishContract = async (value: any) => { const onFinishContract = async (value: any) => {
// console.log(value); // console.log(value);
if (checkedKeys.length == 0) { if (
value.tosAccountName.length <= 2 &&
value.tosUserPhone.length != 8 &&
value.tosUserPhone.length != 11
) {
// 姓名联系方式
message.error('Please enter the correct name and contact information!');
return false;
} else if (checkedKeys.length == 0) {
// 权限 // 权限
message.error('Please Select Permission!'); message.error('Please Select Permission!');
return false; return false;
......
...@@ -22,7 +22,7 @@ const Account = (props: any) => { ...@@ -22,7 +22,7 @@ const Account = (props: any) => {
// 权限列表 // 权限列表
const treeData = enUsFaci || zhCnFaci; const treeData = enUsFaci || zhCnFaci;
const [expandedKeys, setExpandedKeys] = useState<string[]>([]); // 展开栏目 const [expandedKeys, setExpandedKeys] = useState<string[]>(['0']); // 展开栏目
const [checkedKeys, setCheckedKeys] = useState<string[]>([]); // 默认已选栏目 const [checkedKeys, setCheckedKeys] = useState<string[]>([]); // 默认已选栏目
const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点 const [selectedKeys, setSelectedKeys] = useState<string[]>([]); // 设置选中的树节点
const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭 const [autoExpandParent, setAutoExpandParent] = useState<boolean>(true); // 树形菜单展开关闭
...@@ -249,7 +249,9 @@ const Account = (props: any) => { ...@@ -249,7 +249,9 @@ const Account = (props: any) => {
</Descriptions> </Descriptions>
<Form.Item name="community" label="Community"> <Form.Item name="community" label="Community">
<SelectCommunity /> <SelectCommunity
checklist={DataSave == null ? null : DataSave.tosUserServiceCell.split(',')}
/>
</Form.Item> </Form.Item>
<div className="diy" style={{ marginBottom: '14px' }}> <div className="diy" style={{ marginBottom: '14px' }}>
......
...@@ -30,9 +30,6 @@ const Account = (props: any) => { ...@@ -30,9 +30,6 @@ const Account = (props: any) => {
// 单选 二级还是三级管理员 // 单选 二级还是三级管理员
const [values, setvalues] = useState(2); // 树形菜单展开关闭 const [values, setvalues] = useState(2); // 树形菜单展开关闭
// 已选小区
const [ServiceCell, setServiceCell] = useState(null as any);
const [over, setOver] = useState(false); // 关闭账号确认弹窗 const [over, setOver] = useState(false); // 关闭账号确认弹窗
const [accountName, setaccountName] = useState(null as any); // 弹窗账号信息 const [accountName, setaccountName] = useState(null as any); // 弹窗账号信息
...@@ -57,7 +54,6 @@ const Account = (props: any) => { ...@@ -57,7 +54,6 @@ const Account = (props: any) => {
}); });
setvalues(DataSave.tosUserLevel); // 等级 setvalues(DataSave.tosUserLevel); // 等级
setServiceCell(DataSave.tosUserServiceCell.split(',')); // 已选小区
// 发起获取权限请求 // 发起获取权限请求
RA(54, { tosUserName: DataSave.tosUserName }, module, dispatch); // 发起获取权限请求 RA(54, { tosUserName: DataSave.tosUserName }, module, dispatch); // 发起获取权限请求
...@@ -135,7 +131,15 @@ const Account = (props: any) => { ...@@ -135,7 +131,15 @@ const Account = (props: any) => {
// 保存提交 // 保存提交
const onFinishContract = async (value: any) => { const onFinishContract = async (value: any) => {
// console.log(value); // console.log(value);
if (checkedKeys.length == 0) { if (
value.tosAccountName.length <= 2 &&
value.tosUserPhone.length != 8 &&
value.tosUserPhone.length != 11
) {
// 姓名联系方式
message.error('Please enter the correct name and contact information!');
return false;
} else if (checkedKeys.length == 0) {
// 权限 // 权限
message.error('Please Select Permission!'); message.error('Please Select Permission!');
return false; return false;
...@@ -164,10 +168,11 @@ const Account = (props: any) => { ...@@ -164,10 +168,11 @@ const Account = (props: any) => {
return parseInt(n1) - parseInt(n2); return parseInt(n1) - parseInt(n2);
}), }),
}; };
// console.log(obj); console.log(value);
console.log(obj);
RA(38, value, module, dispatch); // 信息上传 // RA(38, value, module, dispatch); // 信息上传
RA(42, obj, module, dispatch); // 权限上传 // RA(42, obj, module, dispatch); // 权限上传
} }
}; };
...@@ -295,7 +300,9 @@ const Account = (props: any) => { ...@@ -295,7 +300,9 @@ const Account = (props: any) => {
</Descriptions> </Descriptions>
<Form.Item name="community" label="Community"> <Form.Item name="community" label="Community">
<SelectCommunity /> <SelectCommunity
checklist={DataSave == null ? null : DataSave.tosUserServiceCell.split(',')}
/>
</Form.Item> </Form.Item>
<div className="diy" style={{ marginBottom: '14px' }}> <div className="diy" style={{ marginBottom: '14px' }}>
...@@ -303,7 +310,7 @@ const Account = (props: any) => { ...@@ -303,7 +310,7 @@ const Account = (props: any) => {
<span className="title">Privilege Level:</span> <span className="title">Privilege Level:</span>
</div> </div>
<div className="label"> <div className="label">
<Radio.Group defaultValue={values} onChange={onRadio}> <Radio.Group defaultValue={DataSave.tosUserLevel} onChange={onRadio}>
<Radio style={radioStyle} value={2}> <Radio style={radioStyle} value={2}>
Two Level Administrator Two Level Administrator
</Radio> </Radio>
......
...@@ -45,7 +45,7 @@ const VisitorRecord = (props: any) => { ...@@ -45,7 +45,7 @@ const VisitorRecord = (props: any) => {
{ {
title: 'Unit', title: 'Unit',
dataIndex: 'inviterAddress', dataIndex: 'inviterAddress',
render: (text) => <span>BLK {text}</span>, render: (text) => <span>{text}</span>,
}, },
// ["Actions",null, (text: any, record: any) => (<Space size="middle"> <a>Detail</a></Space>)], // ["Actions",null, (text: any, record: any) => (<Space size="middle"> <a>Detail</a></Space>)],
]; ];
......
...@@ -45,7 +45,7 @@ const VisitorRecord = (props: any) => { ...@@ -45,7 +45,7 @@ const VisitorRecord = (props: any) => {
{ {
title: 'Unit', title: 'Unit',
dataIndex: 'inviterAddress', dataIndex: 'inviterAddress',
render: (text) => <span>BLK {text}</span>, render: (text) => <span>{text}</span>,
}, },
// ["Actions",null, (text: any, record: any) => (<Space size="middle"> <a>Detail</a></Space>)], // ["Actions",null, (text: any, record: any) => (<Space size="middle"> <a>Detail</a></Space>)],
]; ];
......
import React, { useState, useEffect, useRef } from 'react';
import styles from './ContractContent.less';
import {
Input,
Form,
message,
Upload,
Button,
DatePicker,
Pagination,
Modal,
Spin,
Image,
} from 'antd';
import { PlusOutlined, LeftOutlined, LoadingOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch, Loading } from 'umi';
import { RA } from '@/services/tos';
import LINE from '../../components/Line/Line';
import TextArea from 'antd/lib/input/TextArea';
import moment from 'moment';
import './ContractContent.less';
// 配置英文
import 'moment/locale/en-au';
import locale from 'antd/es/date-picker/locale/en_US';
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
import { tipList } from '@/utils/tip';
import FileViewer from 'react-file-viewer';
import PDF from 'react-pdf-js';
import { stringSplit } from '@/utils/string';
const ContractContent = (props: any) => {
const { Contract, dispatch, FileImg, loading } = props;
const { DataSaveDetail } = Contract;
const { RangePicker } = DatePicker; // 日期组件
const [form] = Form.useForm(); // 表单
const RA = (index: any, values: any) => {
dispatch({ type: 'Contract/RA', playload: { index: index, body: values } });
};
// 设置之前时间不能选择
function disabledDate(current: any) {
return current && current <= moment().subtract(1, 'days').endOf('day');
}
const [fileList, setFileList] = useState([] as any); // 图片列表
const [uploadUp, setUploadUp] = useState(true); // 禁止上传 直到选择了小区后
const [comtyName, setComtyName] = useState(null); // 小区名字
const [tipTime, setTipTime] = useState(['previous month', 'two months'] as any); //提示时间
const [tipModal, settipModal] = useState(false); //附件弹窗
const [fileInfo, setfileInfo] = useState(null as any); //附件内容
//pdf 页码内容
const [numPages, setNumPages] = useState(1 as any); // 总页码数
const [pageNumber, setPageNumber] = useState(1); // 当前页码数
const [imgInfo, setimgInfo] = useState(null as any); //本地图片预览
const [previewVisible, setPreviewVisible] = useState(false); //本地图片预览弹窗
const [imgLoad, setimgLoad] = useState(false); //本地图片预览
useEffect(() => {
// 如果是添加传来没有值的时候 就清空 否则 赋值给表单
if (DataSaveDetail == null) {
// 清空表单
form.resetFields();
} else {
// 发起图片请求
let objData = {
type: 'tosContractPreview',
fileName: DataSaveDetail.contractFileName,
extends: DataSaveDetail.communityName,
};
RA(47, objData);
// 打开禁止
setUploadUp(false);
// 提示时间
let a1 = moment(DataSaveDetail.contractValidEndDate)
.subtract(2, 'month')
.format('YYYY-MM-DD');
let a2 = moment(DataSaveDetail.contractValidEndDate)
.subtract(1, 'month')
.format('YYYY-MM-DD');
setTipTime([a1, a2]);
// 给到上传绑定
setComtyName(DataSaveDetail.communityName);
// 表单内容
form.setFieldsValue({
...DataSaveDetail,
upload: 'ok',
time: [
moment(DataSaveDetail.contractValidStartDate),
moment(DataSaveDetail.contractValidEndDate),
],
});
}
}, [DataSaveDetail]);
// 监听上传图片列表
useEffect(() => {
if (FileImg != null) {
let obj = new Array();
for (var i in FileImg) {
let a = {
uid: i,
name: FileImg[i].fileName,
status: 'done',
type: FileImg[i].fileName.match(/\.([^\.]+)$/)[1].toLowerCase(),
url: FileImg[i].fileUrl,
};
console.log();
obj.push(a);
}
setFileList([...obj]);
} else {
setFileList([]);
}
}, [FileImg]);
// 监听列表
useEffect(() => {
if (fileList.length == 0) {
form.setFieldsValue['upload'] = null;
}
}, [fileList]);
// 返回
const goToReturn = () => {
// console.log(fileList)
history.back();
};
// 提交
const onFinish = (values: any) => {
// 判断有没有文件
if (fileList.length == 0) {
message.error('Please upload the attachment!');
} else {
values.contractValidStartDate = values.time[0].format('YYYY-MM-DD');
values.contractValidEndDate = values.time[1].format('YYYY-MM-DD');
let data = new Array();
for (let i = 0; i < fileList.length; i++) {
data.push(fileList[i].name);
}
values.contractFileNameList = data;
// 编辑
if (DataSaveDetail != null) {
values.id = DataSaveDetail.id;
}
RA(27, values);
// RA(27, values)
}
};
// 上传文件设置
const uploadProps = {
accept: '.doc,.docx,.jpg,.png,.pdf',
action: '/tos/image/upload',
data: { imageType: 'tosContract', extends: comtyName },
fileList: fileList,
onChange: ({ file }: { file: any }) => {
if (file.status === 'uploading') {
setimgLoad(true);
}
if (file.status == 'done') {
message.success(file.name + ' Upload Successful !');
setFileList([...fileList, file]);
// 添加到表单
form.setFieldsValue({
upload: 'ok',
});
setimgLoad(false);
}
},
};
// // 设置提示倒计时
const changeTime = (data: any, dateStrings: any) => {
if (data != null) {
let a1 = moment(data[1]).subtract(2, 'month').format('YYYY-MM-DD');
let a2 = moment(data[1]).subtract(1, 'month').format('YYYY-MM-DD');
setTipTime([a1, a2]);
}
};
// 选择小区名字并赋值
const opname = (value: any) => {
// 打开上传 如果选择了 小区就打开 否则 禁止上传
value ? setUploadUp(false) : setUploadUp(true);
// 如果切换了 清掉上传的图片
if (value != comtyName) {
setFileList([]);
}
setComtyName(value); // 赋值小区名字 给到上传
form.setFieldsValue({
communityName: value,
});
};
//本地图预览处理
function getBase64(file: any) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
});
}
//点击预览
const onPreviews = async (file: any) => {
// 有值的话 就是本地预览
if (file.size) {
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
let info = {
previewImage: file.url || file.preview,
previewTitle: file.name || file.url.substring(file.url.lastIndexOf('/') + 1),
};
setPreviewVisible(true); // 弹窗
setimgInfo(info); // 图片信息
} else {
setfileInfo(file); // 设置选择的文件
console.log(file);
settipModal(true);
}
};
// 关闭预览弹窗
const handleCancel = () => {
settipModal(false);
};
// pdf 总页数
const onDocumentLoadSuccess = (pages: any) => {
setNumPages(pages);
};
// 切换pdf 总数
const onChangePage = (page: any) => {
setPageNumber(page);
};
// 文件上传判断
function beforeUpload(file: any) {
// 文件大小判断
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('Image must smaller than 2MB!');
}
return isLt2M;
}
// 移除文件
const onRemove = async (file: any) => {
let fileListArr = fileList;
for (let i in fileListArr) {
if (fileListArr[i].uid == file.uid) {
fileListArr.splice(i, 1);
}
}
setFileList([...fileListArr]);
};
// 文件上传按钮
const uploadButton = (
<div>
{imgLoad ? <LoadingOutlined /> : <PlusOutlined />}
<div style={{ marginTop: 5 }}>Upload</div>
</div>
);
return (
<>
<Spin spinning={loading}>
<div className={styles.base}>
{/* 头部组件 */}
<div className={styles.box}>
<div className={styles.item1}>{DataSaveDetail ? 'Edit' : 'Add'} Contract</div>
<button className={styles.item3} onClick={goToReturn}>
<LeftOutlined />
Back
</button>
</div>
{/* 表单 initialValues={defForm} */}
<Form
// ref={formRef}
autoComplete="off"
form={form}
name="basic"
initialValues={DataSaveDetail}
onFinish={onFinish}
// initialValues={defForm}
>
<div className="contract_box">
{/* 合同编号、甲方、乙方 */}
<div className="list_1">
<div className="item_1">
<Form.Item
name="contractNumber"
label="Contract Number"
rules={[{ required: true, message: `${tipList[0]}` }]}
>
<Input style={{ width: 200 }} placeholder="Contract Number" />
</Form.Item>
</div>
<div className="item_1">
<Form.Item
name="contractPartyA"
label="Contract Party A"
rules={[{ required: true, message: `${tipList[1]}` }]}
>
<Input style={{ width: 200 }} placeholder="Contract Party A" />
</Form.Item>
</div>
<div className="item_1">
<Form.Item
name="contractPartyB"
label="Contract Party B"
rules={[{ required: true, message: `${tipList[2]}` }]}
>
<Input style={{ width: 200 }} placeholder="Contract Party B" />
</Form.Item>
</div>
</div>
{/* 小区 */}
<div className="list2">
<div className="main">
<Form.Item
labelAlign="right"
name="communityName"
label="Community Name"
rules={[{ required: true, message: `${tipList[3]}` }]}
>
<SearchOptionsCommnity
defaultName={DataSaveDetail ? DataSaveDetail.communityName : null}
// ubmit={extendName}
opname={opname}
/>
</Form.Item>
</div>
</div>
{/* 合同标题 */}
<div className="list2">
<Form.Item
labelAlign="right"
name="contractTitle"
label="Contract Title"
rules={[{ required: true, message: `${tipList[4]}` }]}
>
<Input style={{ width: 200 }} placeholder="Contract Title" />
</Form.Item>
</div>
{/* 起止时间 */}
<div className="list2">
<Form.Item
name="time"
labelAlign="right"
label="Contract Time"
rules={[{ required: true, message: `${tipList[5]}` }]}
>
<RangePicker
locale={locale}
defaultValue={DataSaveDetail ? DataSaveDetail.time : null}
disabledDate={disabledDate}
placeholder={['Effective Date', 'Expiration Date']}
onChange={changeTime}
/>
</Form.Item>
</div>
{/* 附件上传 */}
<div className="list2">
<Form.Item
labelAlign="right"
name="upload"
label="Contract Annex"
rules={[{ required: true, message: `Please upload the attachment!` }]}
>
<Upload
{...uploadProps}
listType={'picture-card'}
disabled={uploadUp}
beforeUpload={beforeUpload}
onPreview={onPreviews}
onRemove={onRemove}
>
{fileList.length >= 3 ? null : uploadButton}
</Upload>
</Form.Item>
</div>
{/* 合同内容 */}
<div className="list2">
<div className={styles.box8item2x1}>
<Form.Item
rules={[{ required: true, message: `${tipList[5]}` }]}
label="Contract Remarks"
name="contractRemindContent"
style={{ marginBottom: 0 }}
>
<TextArea
style={{ padding: 8, width: 600 }}
placeholder="Remarks"
showCount={true}
autoSize={{ minRows: 6, maxRows: 6 }}
></TextArea>
</Form.Item>
</div>
<div
className={styles.box8item2x2}
style={{ marginLeft: 150, textTransform: 'capitalize' }}
>
<p style={{ marginBottom: 0 }}>
The system will send e-mail notification in the{' '}
<span style={{ color: 'red' }}>{tipTime[0]}</span> and{' '}
<span style={{ color: 'red' }}>{tipTime[1]}</span> that the contract is about to
expire !
</p>
<p style={{ marginBottom: 0 }}>
<span style={{ color: 'red' }}>*</span> If the time has passed, it will not be
sent
</p>
{/* <span style={{color:'#f00'}}>&nbsp;{stateTime}</span> */}
</div>
</div>
<div>
<LINE />
<Button type="primary" htmlType="submit" loading={loading}>
Submit
</Button>
</div>
</div>
</Form>
{/* 附件预览 */}
<Modal
title="File Preview"
visible={tipModal}
width={800}
onCancel={handleCancel}
style={{ textAlign: 'center' }}
footer={null}
>
{fileInfo != null ? (
fileInfo.type == 'pdf' ? (
// pdf 换一种
<>
<PDF
file={stringSplit(fileInfo.url, 'm/cash')}
page={pageNumber}
scale={1.25}
onDocumentComplete={onDocumentLoadSuccess}
/>
<Pagination
style={{ textAlign: 'center', marginTop: 10, display: 'block' }}
simple
defaultCurrent={pageNumber}
total={numPages * 10}
onChange={onChangePage}
/>
</>
) : fileInfo.type == 'jpg' || fileInfo.type == 'png' ? (
// 图片用指定格式
<Image
src={fileInfo.url}
preview={false}
style={{ margin: '0 auto', textAlign: 'center' }}
/>
) : (
<FileViewer
fileType={fileInfo.type}
filePath={stringSplit(fileInfo.url, 'm/cash')}
/>
)
) : (
''
)}
</Modal>
{/* 本地附件预览 */}
{imgInfo != null ? (
<Modal
visible={previewVisible}
title={imgInfo.previewTitle}
footer={null}
onCancel={() => {
setPreviewVisible(false);
}}
>
<img alt="example" style={{ width: '100%' }} src={imgInfo.previewImage} />
</Modal>
) : (
''
)}
</div>
</Spin>
</>
);
};
function mapStateToProps(state: any) {
const { ContractModel, Contract } = state;
const FileImg = Contract.FileImg;
const loading = state.loading.models.Contract || false;
return {
ContractModel,
Contract,
FileImg,
loading,
};
}
export default connect(mapStateToProps)(ContractContent);
...@@ -32,8 +32,6 @@ import { tipList } from '@/utils/tip'; ...@@ -32,8 +32,6 @@ import { tipList } from '@/utils/tip';
import FileViewer from 'react-file-viewer'; import FileViewer from 'react-file-viewer';
import PDF from 'react-pdf-js'; import PDF from 'react-pdf-js';
import { Document, Page } from 'react-pdf';
import { stringSplit } from '@/utils/string'; import { stringSplit } from '@/utils/string';
const ContractContent = (props: any) => { const ContractContent = (props: any) => {
...@@ -245,16 +243,15 @@ const ContractContent = (props: any) => { ...@@ -245,16 +243,15 @@ const ContractContent = (props: any) => {
}; };
// pdf 总页数 // pdf 总页数
// const onDocumentLoadSuccess = (pages: any) => { const onDocumentLoadSuccess = (pages: any) => {
// setNumPages(pages); setNumPages(pages);
// setNumPages()
// };
const onDocumentLoadSuccess = ({ numPages }: any) => {
//numPages是总页数
setNumPages(numPages);
}; };
// const onDocumentLoadSuccess = ({ numPages }: any) => {
// //numPages是总页数
// setNumPages(numPages);
// };
// 切换pdf 总数 // 切换pdf 总数
const onChangePage = (page: any) => { const onChangePage = (page: any) => {
setPageNumber(page); setPageNumber(page);
...@@ -467,7 +464,7 @@ const ContractContent = (props: any) => { ...@@ -467,7 +464,7 @@ const ContractContent = (props: any) => {
fileInfo.type == 'pdf' ? ( fileInfo.type == 'pdf' ? (
// pdf 换一种 // pdf 换一种
<> <>
{/* <PDF <PDF
file={stringSplit(fileInfo.url, 'm/cash')} file={stringSplit(fileInfo.url, 'm/cash')}
page={pageNumber} page={pageNumber}
scale={1.25} scale={1.25}
...@@ -479,9 +476,9 @@ const ContractContent = (props: any) => { ...@@ -479,9 +476,9 @@ const ContractContent = (props: any) => {
defaultCurrent={pageNumber} defaultCurrent={pageNumber}
total={numPages * 10} total={numPages * 10}
onChange={onChangePage} onChange={onChangePage}
/> */} />
<Document {/* <Document
// file={stringSplit(fileInfo.url, 'm/cash')} //文档地址 // file={stringSplit(fileInfo.url, 'm/cash')} //文档地址
file={stringSplit(fileInfo.url, 'm/cash')} //文档地址 file={stringSplit(fileInfo.url, 'm/cash')} //文档地址
onLoadSuccess={onDocumentLoadSuccess} onLoadSuccess={onDocumentLoadSuccess}
...@@ -501,7 +498,7 @@ const ContractContent = (props: any) => { ...@@ -501,7 +498,7 @@ const ContractContent = (props: any) => {
defaultCurrent={pageNumber} defaultCurrent={pageNumber}
total={numPages * 10} total={numPages * 10}
onChange={onChangePage} onChange={onChangePage}
/> /> */}
</> </>
) : fileInfo.type == 'jpg' || fileInfo.type == 'png' ? ( ) : fileInfo.type == 'jpg' || fileInfo.type == 'png' ? (
// 图片用指定格式 // 图片用指定格式
......
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