Commit 86851cfb authored by cellee's avatar cellee

更改需求,修复bug

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 16620118
import { LogoutOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons';
import { LogoutOutlined } from '@ant-design/icons';
import { Avatar, Menu, Spin } from 'antd';
import { ClickParam } from 'antd/es/menu';
import { setCookie } from '@/utils/method';
import React from 'react';
import { history, ConnectProps, connect } from 'umi';
import { ConnectState } from '@/models/connect';
......@@ -58,50 +57,27 @@ class AvatarDropdown extends React.Component<GlobalHeaderRightProps> {
render(): React.ReactNode {
const {
currentUser = {
avatar: '',
name: '',
avatar: 'http://120.77.240.215:5205/file/ce90a1cd01cf4c2bb6ab12b295c25c16.png',
name: 'Login Again Please',
},
menu,
} = this.props;
const menuHeaderDropdown = (
<Menu className={styles.menu} selectedKeys={[]} onClick={this.onMenuClick}>
{menu && (
<Menu.Item key="center">
<UserOutlined />
个人中心
</Menu.Item>
)}
{menu && (
<Menu.Item key="settings">
<SettingOutlined />
个人设置
</Menu.Item>
)}
{menu && <Menu.Divider />}
<Menu.Item key="logout">
<LogoutOutlined />
Sign Out
</Menu.Item>
</Menu>
);
return currentUser && currentUser.name ? (
return (
<HeaderDropdown overlay={menuHeaderDropdown}>
<span className={`${styles.action} ${styles.account}`}>
<Avatar size="small" className={styles.avatar} src={currentUser.avatar} alt="avatar" />
<span className={styles.name}>{currentUser.name}</span>
</span>
</HeaderDropdown>
) : (
<span className={`${styles.action} ${styles.account}`}>
<Spin
size="small"
style={{
marginLeft: 8,
marginRight: 8,
}}
/>
</span>
);
}
}
......
......@@ -29,46 +29,12 @@ const GlobalHeaderRight: React.SFC<GlobalHeaderRightProps> = (props) => {
}
return (
<div className={className}>
{/* <HeaderSearch
className={`${styles.action} ${styles.search}`}
placeholder="站内搜索"
defaultValue="umi ui"
options={[
{ label: <a href="https://umijs.org/zh/guide/umi-ui.html">umi ui</a>, value: 'umi ui' },
{
label: <a href="next.ant.design">Ant Design</a>,
value: 'Ant Design',
},
{
label: <a href="https://protable.ant.design/">Pro Table</a>,
value: 'Pro Table',
},
{
label: <a href="https://prolayout.ant.design/">Pro Layout</a>,
value: 'Pro Layout',
},
]}
// onSearch={value => {
// //console.log('input', value);
// }}
/> */}
{/* <Tooltip title="使用文档">
<a
target="_blank"
href="https://pro.ant.design/docs/getting-started"
rel="noopener noreferrer"
className={styles.action}
>
<QuestionCircleOutlined />
</a>
</Tooltip> */}
<Avatar />
{REACT_APP_ENV && (
<span>
<Tag color={ENVTagColor[REACT_APP_ENV]}>{REACT_APP_ENV}</Tag>
</span>
)}
{/* <SelectLang className={styles.action} /> */}
</div>
);
};
......
......@@ -69,6 +69,9 @@ const PictureOptionsRow = (props: any) => {
});
setFileList(result);
onChange && onChange(resultToInside);
} else {
// 更改小区删除附件
setFileList([]);
}
// }
}, [defaultValue]);
......
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Input ,Menu,Table,Space,Pagination,Tooltip, Radio } from 'antd';
import { Input, Menu, Table, Space, Pagination, Tooltip, Radio } from 'antd';
import { Link, useIntl, connect, Dispatch ,getLocale, setLocale} from 'umi';
import { Link, useIntl, connect, Dispatch, getLocale, setLocale } from 'umi';
const locales = ['zh-CN','en-US'];
const locales = ['zh-CN', 'en-US'];
const LanguageSettings = () => {
const languageSelect = (e) => {
setLocale(locales[e.target.value])
const languageSelect = (e: any) => {
setLocale(locales[e.target.value]);
};
const [curLang, setCurLang] = useState(0);
useEffect(() => {
if (getLocale() == "en-US") {
setCurLang(1)
if (getLocale() == 'en-US') {
setCurLang(1);
} else {
setCurLang(0)
setCurLang(0);
}
}, [curLang]);
return (
<div className={styles.base}>
<div className={styles.box}>Language Selection</div>
<Radio.Group onChange={languageSelect} value={curLang} >
<div className={styles.box}><Radio value={0}>Chinese</Radio></div>
<div className={styles.box}><Radio value={1}>English</Radio></div>
<Radio.Group onChange={languageSelect} value={curLang}>
<div className={styles.box}>
<Radio value={0}>Chinese</Radio>
</div>
<div className={styles.box}>
<Radio value={1}>English</Radio>
</div>
</Radio.Group>
</div>
);
};
export default LanguageSettings;
......@@ -52,6 +52,11 @@ const Add = (props: any) => {
// 解除结束时间不可选
settimeT(false);
// 设置结束时间 到开始时间不能选
let difference = moment().diff(moment(DataSave.noticStartTime.time), 'days');
settimeOver(difference);
// 图片名
setImageName(DataSave.noticImageName.split(','));
}
......
......@@ -151,7 +151,7 @@ const CommunityAnnouncement = (props: any) => {
let mlist = { ...value };
mlist.communityNumList =
value.communityNumList != null && value.communityNumList.length > 0
? value.communityNumList
? [value.communityNumList]
: null;
mlist.pageNum = 1;
// 把内容存进去
......@@ -196,7 +196,7 @@ const CommunityAnnouncement = (props: any) => {
<SearchOptionsCommnity
// ubmit={extendName}
opname={opname}
type={1} // 单选还是多选 单选就直接去掉
// type={1} // 单选还是多选 单选就直接去掉
/>
</Form.Item>
<Form.Item name="noticTitlel">
......
......@@ -38,6 +38,7 @@ const Add = (props: any) => {
noticStartTime: day,
noticEndTime: day2,
});
if (DataSave.noticImageName) {
// 发起请求图片
let msg = {
type: 'tosCommunityNoticePreview',
......@@ -45,6 +46,7 @@ const Add = (props: any) => {
};
RA(47, msg, module, dispatch);
}
}
}, [DataSave]);
// 监听图片状态 ImgSrc
......
......@@ -371,6 +371,7 @@ const Bookings = (props: any) => {
limit={curString.categoriesOpenTime} // 禁止时间段
openSelect={endTimes} // 时间类型
type={0}
inhibitTime={result}
/>
</Form.Item>
</Form.Item>
......
......@@ -65,6 +65,8 @@ const Facility = (props: any) => {
const formRef = useRef(null as any);
const [fileList, setFileList] = useState([] as any); // 图片列表组
// 监听是否选择了小区
const [imgOpen, setImgOpen] = useState(true);
const [ctyName, setCtyName] = useState(null);
......@@ -92,6 +94,8 @@ const Facility = (props: any) => {
};
useEffect(() => {
if (sourceData != null) {
console.log(sourceData.categoriesDetailsImageName);
setCtyName(DataSave.communityName);
setSoltTime(sourceData.reservationQuantumTime); // 设置时间
......@@ -126,6 +130,9 @@ const Facility = (props: any) => {
setImgOpen(false);
}
setFileList(sourceData.categoriesDetailsImageName); //设置图片组
delete sourceData.categoriesDetailsImageName;
// 设置表单默认值
formRef.current.setFieldsValue(sourceData);
} else {
......@@ -176,18 +183,22 @@ const Facility = (props: any) => {
} else if (soltTime.length < 2 || !soltTime[0]) {
// 判断时间选择
message.error('Please Fill In The Appointment Period!');
} else if (soltTime[1] <= soltTime[0]) {
// 开始时间与结束时间选择错误
message.error('Wrong selection of start time and end time!');
} else if (
// 提前预订时间大于 取消时间
result.canReservationDay < result.cancelReservationDay ||
result.canReservationDay < result.nomarginCancelReservationDay
) {
message.error('Reservation should be greater than cancellation time!');
// } else if ( // 暂时去掉这个需求判断
// // 不为 0 的时候 No Deposit To Cancel Reservation 必须要小于 Booking
// result.nomarginCancelReservationDay != 0 &&
// result.canReservationDay <= result.nomarginCancelReservationDay
// ) {
// message.error('nomarginCancelReservationDay 要小于 Booking !');
} else {
// 处理 开放时间段
// let reservationQuantumTime: any = [
// moment(soltTime[0], 'HH:mm').format('HH:mm'),
// moment(soltTime[1], 'HH:mm').format('HH:mm'),
// ];
let categoriesName: any = imgs; // 设施图片
result.categoriesName = categoriesName; // 设施内容
result.reservationQuantumTime = soltTime; // 开放时间段
......@@ -197,6 +208,7 @@ const Facility = (props: any) => {
delete result.startTime;
delete result.endTime;
delete result.picList;
if (sourceData != null) {
result.id = DataSave.id;
if (Result == null) {
......@@ -236,19 +248,37 @@ const Facility = (props: any) => {
// 选择小区名字并赋值
const opname = (value: any) => {
if (value) {
console.log(value);
console.log(ctyName);
if (value == '') {
eliminate();
} else {
if (ctyName == null) {
setImgOpen(false); // 允许图片上传
setCtyName(value); // 给小区赋值
form.setFieldsValue({
communityName: value, // 给表单赋值
});
} else {
} else if (value != ctyName) {
eliminate();
}
}
};
// 切换小区清除小区附件列表
const eliminate = () => {
setCtyName(null);
// 设置是否能点击上传
setImgOpen(true);
// 清空设施列表图
let list: any = [];
dispatch({ type: module + '/genxin', list });
}
setFileList(null);
//去掉图片组
form.setFieldsValue({
categoriesDetailsImageName: [],
});
};
// 子组件清除表单的 输入框值
......@@ -297,7 +327,7 @@ const Facility = (props: any) => {
<Form.Item label="Community" name="communityName" rules={NewFaci[0]}>
<SearchOptionsCommnity
// ubmit={extendName}
defaultName={sourceData != null ? DataSave.communityName : null}
defaultName={DataSave != null ? DataSave.communityName : null}
opname={opname}
disabled={facilityDetail}
/>
......@@ -340,7 +370,11 @@ const Facility = (props: any) => {
<hr></hr>
{/* 设施品类上传 */}
<Form.Item label="Facility Classification" className="flex required">
<Form.Item
label="Facility Classification"
className="flex required"
style={{ marginBottom: 0 }}
>
<Facilitys
disabled={imgOpen}
updata={{
......@@ -366,6 +400,7 @@ const Facility = (props: any) => {
extends: ctyName,
}}
limitNums={99}
defaultValue={DataSave != null ? fileList : null}
/>
</Form.Item>
......
......@@ -57,6 +57,8 @@ const FacilityBookings = (props: any) => {
CA();
// 先清空上传图片列表
dispatch({ type: 'FacilityBookings/overAllImgList' });
// 在清空详情信息
SA(null);
} else {
// 清空之前的数据
SA(null);
......@@ -130,8 +132,8 @@ const FacilityBookings = (props: any) => {
),
],
];
setColumns(objectColumns(key));
setColumns2(objectColumns(key2));
setColumns(objectColumns(key) as any);
setColumns2(objectColumns(key2) as any);
if (curString.tab == 1) {
RA(9, {
userToken: token,
......
/*
* @Author: your name
* @Date: 2020-11-19 16:54:53
* @LastEditTime: 2020-11-30 15:00:30
* @LastEditTime: 2020-12-02 16:32:42
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\tip.ts
......@@ -61,8 +61,8 @@ export const NewFaci = [
export const BookingsTip = [
[{ required: true, message: 'Please input Name ' }],
[{ required: true, message: 'Please input Contact Details' }],
[{ required: true, message: 'Required' }],
[{ required: true, message: 'Required' }],
[{ required: true, pattern: new RegExp(/^[1-9]\d*$/, 'g'), message: 'Only numbers!' }],
[{ required: true, pattern: new RegExp(/^[1-9]\d*$/, 'g'), message: 'Only numbers!' }],
[{ required: true, message: 'Required' }],
[{ required: true, message: 'Please Select The Date' }],
];
......
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