|
@@ -1,5 +1,5 @@
|
|
|
import {Button, Card, Form, Input, message} from 'antd';
|
|
|
-import React, {useState} from 'react';
|
|
|
+import React, {useEffect, useState} from 'react';
|
|
|
import {PageHeaderWrapper} from '@ant-design/pro-layout';
|
|
|
import service from './service';
|
|
|
|
|
@@ -8,6 +8,11 @@ interface PasswordChange {
|
|
|
oldPassword: string;
|
|
|
}
|
|
|
|
|
|
+interface PushChange {
|
|
|
+ userId: number;
|
|
|
+ noteUrl: string;
|
|
|
+}
|
|
|
+
|
|
|
enum InputState {
|
|
|
default = '',
|
|
|
success = 'success',
|
|
@@ -47,6 +52,7 @@ const TableList: React.FC<{}> = () => {
|
|
|
const [success, setSuccess] = useState<InputState>(InputState.default);
|
|
|
|
|
|
const [form2] = Form.useForm();
|
|
|
+ const [noteForm] = Form.useForm();
|
|
|
|
|
|
const nameExist = async () => {
|
|
|
const userName = form2.getFieldValue("userName");
|
|
@@ -72,6 +78,17 @@ const TableList: React.FC<{}> = () => {
|
|
|
const onFinish = (values: any) => {
|
|
|
handleUpdate(values);
|
|
|
};
|
|
|
+
|
|
|
+ const updatePushUrl = (values: PushChange) => {
|
|
|
+ values["noteUrl"] = encodeURI(values["noteUrl"]);
|
|
|
+ service.updatePushUrl(values).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ message.success("更新成功");
|
|
|
+ } else {
|
|
|
+ message.error('获取url失败!');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
/**
|
|
|
* 用户名更新
|
|
|
* @param value
|
|
@@ -86,6 +103,16 @@ const TableList: React.FC<{}> = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ service.queryPushUrl({}).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ noteForm.setFieldsValue({"noteUrl": decodeURI(res.data)});
|
|
|
+ } else {
|
|
|
+ message.error('获取url失败!');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }, [])
|
|
|
+
|
|
|
// const onFinishFailed = errorInfo => {
|
|
|
// console.log('Failed:', errorInfo);
|
|
|
// };
|
|
@@ -155,13 +182,36 @@ const TableList: React.FC<{}> = () => {
|
|
|
</Form.Item>
|
|
|
</Form>
|
|
|
</Card>
|
|
|
+ <Card title="消息提醒地址" style={{width: '100%'}}>
|
|
|
+ <Form
|
|
|
+ {...layout}
|
|
|
+ name="basic"
|
|
|
+ initialValues={{}}
|
|
|
+ onFinish={updatePushUrl}
|
|
|
+ form={noteForm}
|
|
|
+ // onFinishFailed={onFinishFailed}
|
|
|
+ >
|
|
|
+ <Form.Item
|
|
|
+ label="提醒地址"
|
|
|
+ name="noteUrl"
|
|
|
+ >
|
|
|
+ <Input/>
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ <Form.Item {...tailLayout}>
|
|
|
+ <Button type="primary" htmlType="submit">
|
|
|
+ 提交
|
|
|
+ </Button>
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ </Card>
|
|
|
<Card title="刷新页面" style={{width: '100%'}}>
|
|
|
<Form
|
|
|
{...layout}
|
|
|
name="basic"
|
|
|
>
|
|
|
<Form.Item {...tailLayout}>
|
|
|
- <Button type="primary" htmlType="button" onClick={()=>{
|
|
|
+ <Button type="primary" htmlType="button" onClick={() => {
|
|
|
window.location.reload();
|
|
|
}}>
|
|
|
刷新页面
|