Commit 0c4521f1 authored by cellee's avatar cellee

Merge branch 'final' of http://120.77.240.215:9701/Maple/tostumi.git into final

parents 43ce00ec d49960c9
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Upload, Modal, Row, Col, Input, List, Card, Button, message } from 'antd'; import { Upload, Modal, message } from 'antd';
import { PlusOutlined, PictureFilled } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
function getBase64(file) { function getBase64(file: File) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const reader = new FileReader(); const reader = new FileReader();
reader.readAsDataURL(file); reader.readAsDataURL(file);
...@@ -21,7 +20,7 @@ const uploadButton = ( ...@@ -21,7 +20,7 @@ const uploadButton = (
); );
import { getUrlPicName } from '../../utils/string'; import { getUrlPicName } from '../../utils/string';
const PictureOptionsRow = (props: any) => { const PictureOptionsRow = (props: any) => {
const { value, onChange, limitNums, over } = props; const { value, onChange, limitNums } = props;
const [fileList, setFileList] = useState([] as any); const [fileList, setFileList] = useState([] as any);
const [previewVisible, setPreviewVisible] = useState(false); const [previewVisible, setPreviewVisible] = useState(false);
const [previewImage, setPreviewImage] = useState(''); const [previewImage, setPreviewImage] = useState('');
...@@ -98,7 +97,7 @@ const PictureOptionsRow = (props: any) => { ...@@ -98,7 +97,7 @@ const PictureOptionsRow = (props: any) => {
// } // }
// }, [value]) // }, [value])
const handlePreview = async (file) => { const handlePreview = async (file: any) => {
if (!file.url && !file.preview) { if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj); file.preview = await getBase64(file.originFileObj);
} }
...@@ -106,16 +105,15 @@ const PictureOptionsRow = (props: any) => { ...@@ -106,16 +105,15 @@ const PictureOptionsRow = (props: any) => {
setPreviewVisible(true); setPreviewVisible(true);
}; };
const handleChange = ({ file, fileList }) => { const handleChange = ({ file, fileList }: any) => {
// 给传递的附加名字 // 给传递的附加名字
// props.data.fileName = fileList[0].name; // props.data.fileName = fileList[0].name;
let tmp = fileList; let tmp = fileList;
setFileList(tmp.filter((file) => !!file.status || file.status == null)); setFileList(tmp.filter((file: any) => !!file.status || file.status == null));
var result = new Array(); var result = new Array();
fileList.map((item, index) => { fileList.map((item: { name: string }, index: number) => {
result.push(item.name); result.push(item.name);
}); });
onChange(result); onChange(result);
}; };
function beforeUpload(file: any) { function beforeUpload(file: any) {
...@@ -126,12 +124,11 @@ const PictureOptionsRow = (props: any) => { ...@@ -126,12 +124,11 @@ const PictureOptionsRow = (props: any) => {
message.error('You can only upload JPG/PNG file!'); message.error('You can only upload JPG/PNG file!');
} }
// 文件大小判断 // 文件大小判断
// const isLt2M = file.size / 1024 / 1024 < 2; const isLt2M = file.size / 1024 / 1024 < 2;
// if (!isLt2M) { if (!isLt2M) {
// message.error('Image must smaller than 2MB!'); message.error('Image must smaller than 2MB!');
// } }
// return isJpgOrPng && isLt2M; return isJpgOrPng && isLt2M;
return isJpgOrPng;
} }
return ( return (
......
...@@ -74,16 +74,34 @@ export default { ...@@ -74,16 +74,34 @@ export default {
var tmp = resp.data.tosOwerModel; var tmp = resp.data.tosOwerModel;
var tmp2 = resp.data; var tmp2 = resp.data;
console.log(resp); console.log(resp);
var CurDataDetail = { if (!tmp) {
message.error('Data loading error!');
history.go(-1);
return;
}
var CurDataDetail: {
community: string;
address: string;
home: string;
name: string;
phone: string;
email: string;
content: string;
replyContent: string;
replyImgUrl: string[];
status: number;
pictrues: string[];
time: string;
} = {
community: tmp.communityName, community: tmp.communityName,
address: tmp.addressAndpostalCode, address: tmp.addressAndpostalCode,
home: tmp.buildingNumber + ' #' + tmp.floorNumber + '-' + tmp.roomNumber, home: tmp.buildingNumber + ' #' + tmp.floorNumber + '-' + tmp.roomNumber,
name: tmp.owerName, name: tmp.owerName,
phone: tmp.owerPhone, phone: tmp.owerPhone,
email: tmp.owerEmail, email: tmp.owerEmail,
content: resp.data.serviceContent, content: tmp2.serviceContent,
replyContent: resp.data.replyContent, replyContent: tmp2.replyContent,
replyImgUrl: Fromate(resp.data.replyImgUrl, [['url', null]]), replyImgUrl: Fromate(tmp2.replyImgUrl, [['url', null]]),
status: tmp2.handleStatus, status: tmp2.handleStatus,
pictrues: picFromate(tmp2.imgUrl), pictrues: picFromate(tmp2.imgUrl),
time: timestampToTime4(tmp2.createTime.time), time: timestampToTime4(tmp2.createTime.time),
......
...@@ -145,6 +145,7 @@ const Users = (props: any) => { ...@@ -145,6 +145,7 @@ const Users = (props: any) => {
// 监听小区列表是否回来 // 监听小区列表是否回来
useEffect(() => { useEffect(() => {
if (CommunityList && flag === false) { if (CommunityList && flag === false) {
readyData.serviceCommunityList = [];
flag = true; flag = true;
getList(CommunityList); getList(CommunityList);
} }
......
...@@ -172,6 +172,7 @@ const ServiceProviderManagement = (props: propsType) => { ...@@ -172,6 +172,7 @@ const ServiceProviderManagement = (props: propsType) => {
// 监听小区数据 // 监听小区数据
useEffect(() => { useEffect(() => {
if (CommunityList && flag === false) { if (CommunityList && flag === false) {
readyData.serviceCommunityList = [];
flag = true; flag = true;
setLoading(true); setLoading(true);
TosTosServiceProviderGet(); TosTosServiceProviderGet();
......
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