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