Commit 139b07d7 authored by cellee's avatar cellee

useReducer的 使用

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent a9e0b23a
......@@ -5,7 +5,7 @@ import { stringify } from 'querystring';
import { ConnectState } from '@/models/connect';
import { CurrentUser } from '@/models/user';
import { getCookie } from '@/utils/method';
import { Result, Button } from 'antd';
import { message } from 'antd';
interface SecurityLayoutProps extends ConnectProps {
loading?: boolean;
......@@ -105,6 +105,13 @@ class SecurityLayout extends React.Component<SecurityLayoutProps, SecurityLayout
const permission = JSON.parse(localStorage.getItem('permission') || '[]');
// 用户重新打开需要重新登录
const tokenLogin = JSON.parse(sessionStorage.getItem('token') || '[]');
if (tokenLogin.length == 0) {
message.warning('Login Expired !');
return <Redirect to={`/user/login`} />;
}
let perObj = perList.filter((obj) => {
return obj.path === location.pathname;
});
......
......@@ -97,6 +97,9 @@ const Model: LoginModelType = {
localStorage.setItem('userInfo', JSON.stringify(userMessage));
localStorage.setItem('permission', JSON.stringify(userMessage.permission));
console.log('获取到Token:' + getCookie('token'));
// 设置 session 登录 token
sessionStorage.setItem('token', JSON.stringify(userMessage.token));
yield put({
type: 'saveToken',
token: userMessage.token,
......
......@@ -152,7 +152,7 @@ const BookingDetail = (props: any) => {
{DataSave.communityName}
</Descriptions.Item>
<Descriptions.Item label="Booking Facilities">
{DataSave.facilityTitle}
{DataSave.categoriesName}
</Descriptions.Item>
<Descriptions.Item label="Booking Time">
{DataSave.subscribeDate} {ExtractTime}
......
......@@ -124,11 +124,6 @@ const Contract = (props: any) => {
RA(19, obj);
};
// 刷新
const onReset2 = () => {
RA(19, term);
};
// 表单提交
const onFinishContract = (value: any) => {
if (!value.communityName && !value.contractNumber && !value.contractTitle) {
......@@ -213,7 +208,7 @@ const Contract = (props: any) => {
density: false,
fullScreen: false,
reload: () => {
onReset2();
onReset();
},
setting: false,
}}
......
This diff is collapsed.
......@@ -5,7 +5,8 @@ import { LeftOutlined } from '@ant-design/icons';
import { connect, history } from 'umi';
import LINE from '../../components/Line/Line';
import TextArea from 'antd/lib/input/TextArea';
const { TextArea } = Input;
import PDF from 'react-pdf-js';
import moment from 'moment';
......@@ -119,30 +120,6 @@ const ContractContent = (props: any) => {
history.go(-1);
};
// 提交
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: '.docx,.jpg,.png,.pdf',
......@@ -163,30 +140,6 @@ const ContractContent = (props: any) => {
},
};
// // 设置提示倒计时
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]);
}
console.log(dateStrings);
};
// 选择小区名字并赋值
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) => {
......@@ -251,8 +204,6 @@ const ContractContent = (props: any) => {
form={form}
name="basic"
initialValues={DataSaveDetail}
onFinish={onFinish}
// initialValues={defForm}
>
<div className="contract_box">
<div className="list2">
......@@ -296,8 +247,6 @@ const ContractContent = (props: any) => {
>
<SearchOptionsCommnity
defaultName={DataSaveDetail ? DataSaveDetail.communityName : null}
// ubmit={extendName}
opname={opname}
disabled={true}
/>
</Form.Item>
......@@ -327,7 +276,6 @@ const ContractContent = (props: any) => {
defaultValue={DataSaveDetail ? DataSaveDetail.time : null}
disabledDate={disabledDate}
placeholder={['Effective Date', 'Expiration Date']}
onChange={changeTime}
disabled
/>
</Form.Item>
......
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