|
@@ -1,7 +1,10 @@
|
|
|
import {Button, Card, Form, Input, message} from 'antd';
|
|
|
-import React, {useEffect, useState} from 'react';
|
|
|
+import React, { useEffect, useState} from 'react';
|
|
|
import {PageHeaderWrapper} from '@ant-design/pro-layout';
|
|
|
import service from './service';
|
|
|
+import {connect} from "umi";
|
|
|
+import {ConnectState} from "@/models/connect";
|
|
|
+import { Dispatch, AnyAction } from 'redux';
|
|
|
|
|
|
interface PasswordChange {
|
|
|
newPassword: string;
|
|
@@ -27,6 +30,9 @@ const tailLayout = {
|
|
|
wrapperCol: {offset: 4, span: 18},
|
|
|
};
|
|
|
|
|
|
+interface Props {
|
|
|
+ dispatch: Dispatch<AnyAction>;
|
|
|
+}
|
|
|
|
|
|
/**
|
|
|
* 更新节点
|
|
@@ -48,12 +54,24 @@ const handleUpdate = async (fields: PasswordChange) => {
|
|
|
};
|
|
|
|
|
|
|
|
|
-const TableList: React.FC<{}> = () => {
|
|
|
+
|
|
|
+const TableList: React.FC<Props> = (props) => {
|
|
|
const [success, setSuccess] = useState<InputState>(InputState.default);
|
|
|
|
|
|
const [form2] = Form.useForm();
|
|
|
const [noteForm] = Form.useForm();
|
|
|
|
|
|
+ const logOutHandle=()=>{
|
|
|
+ const { dispatch } = props;
|
|
|
+
|
|
|
+ if (dispatch) {
|
|
|
+ dispatch({
|
|
|
+ type: 'login/logout',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
const nameExist = async () => {
|
|
|
const userName = form2.getFieldValue("userName");
|
|
|
if (userName == null || userName.length <= 6) {
|
|
@@ -219,8 +237,23 @@ const TableList: React.FC<{}> = () => {
|
|
|
</Form.Item>
|
|
|
</Form>
|
|
|
</Card>
|
|
|
+ <Card title="退出登录" style={{width: '100%'}}>
|
|
|
+ <Form
|
|
|
+ {...layout}
|
|
|
+ name="basic"
|
|
|
+ >
|
|
|
+ <Form.Item {...tailLayout}>
|
|
|
+ <Button type="primary" htmlType="button" onClick={() => {
|
|
|
+ logOutHandle();
|
|
|
+ }}>
|
|
|
+ 退出登录
|
|
|
+ </Button>
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ </Card>
|
|
|
</PageHeaderWrapper>
|
|
|
);
|
|
|
};
|
|
|
|
|
|
-export default TableList;
|
|
|
+export default connect(({ }: ConnectState) => ({
|
|
|
+}))(TableList);
|