zlisen 4 gadus atpakaļ
vecāks
revīzija
fdfc86c20d

+ 3
- 3
config/routes.js Parādīt failu

@@ -129,7 +129,7 @@ export default [
129 129
                   },
130 130
                   {
131 131
                     path: '/student/student/edit',
132
-                    name: '学生管理',
132
+                    name: '学生信息',
133 133
                     menuCode: 'student.student',
134 134
                     hideInMenu: true,
135 135
                     component: './Student/Student/Edit',
@@ -137,13 +137,13 @@ export default [
137 137
                   {
138 138
                     path: '/student/school',
139 139
                     name: '学校管理',
140
-                    menuCode: 'student.student',
140
+                    menuCode: 'student.school',
141 141
                     component: './Student/School/List',
142 142
                   },
143 143
                   {
144 144
                     path: '/student/school/edit',
145 145
                     name: '学校编辑',
146
-                    menuCode: 'student.student',
146
+                    menuCode: 'student.school',
147 147
                     hideInMenu: true,
148 148
                     component: './Student/School/Edit',
149 149
                   },

+ 31
- 99
src/pages/Student/Student/Edit/index.jsx Parādīt failu

@@ -3,25 +3,19 @@ import { connect, history } from 'umi';
3 3
 import { PageContainer } from '@ant-design/pro-layout';
4 4
 import Container from '@/components/Container';
5 5
 import request from '@/utils/request';
6
-
7
-import ProForm, { ProFormText, ProFormSelect } from '@ant-design/pro-form';
8
-import UploadImage from '@/components/UploadImage';
9
-import { notification, Form } from 'antd';
6
+import { notification, Card, Descriptions, Divider, Image, Button } from 'antd';
10 7
 
11 8
 const BannerEdit = (props) => {
12 9
   const { id } = props.location.query;
13 10
   const [loading, setLoading] = useState(false);
14
-  const [form] = Form.useForm();
15
-  //   const [bannerData, setBannerData] = useState({});
11
+  const [data, setData] = useState({});
16 12
 
17 13
   useEffect(() => {
18 14
     if (id) {
19 15
       setLoading(true);
20
-      request(`/banner/${id}`)
16
+      request(`/person/${id}`)
21 17
         .then((res) => {
22
-          form.setFieldsValue(res);
23
-          //   setBannerData(res);
24
-          //   set
18
+          setData(res);
25 19
           setLoading(false);
26 20
         })
27 21
         .catch((e) => {
@@ -29,102 +23,40 @@ const BannerEdit = (props) => {
29 23
           notification.error({ message: e.message });
30 24
         });
31 25
     }
32
-  }, [form, id]);
33
-
34
-  const handleSubmit = (values) => {
35
-    console.log(values, form.getFieldsValue(), 'handleSubmit');
36
-    if (!id) {
37
-      setLoading(true);
38
-      return request('/banner', { method: 'post', data: values })
39
-        .then(() => {
40
-          // props.onChange(res)
41
-          // form.setFieldsValue(res)
42
-          notification.info({ message: '添加成功' });
43
-          setLoading(false);
44
-          history.go('-1');
45
-        })
46
-        .catch((e) => {
47
-          notification.error({ message: e.message });
48
-          setLoading(false);
49
-          return Promise.reject(e.message);
50
-        });
51
-    }
52
-    setLoading(true);
53
-    return request(`/banner/${id}`, { method: 'put', data: { serialNo: id, ...values } })
54
-      .then(() => {
55
-        // props.onChange(res)
56
-        // form.setFieldsValue(res)
57
-        notification.info({ message: '修改成功' });
58
-        setLoading(false);
59
-        history.go('-1');
60
-      })
61
-      .catch((e) => {
62
-        notification.error({ message: e.message });
63
-        setLoading(false);
64
-        return Promise.reject(e.message);
65
-      });
66
-  };
26
+  }, [id]);
67 27
 
68 28
   return (
69 29
     <PageContainer>
70 30
       <Container loading={loading}>
71
-        <ProForm form={form} onFinish={handleSubmit}>
72
-          <Form.Item
73
-            name="image"
74
-            label="图片"
75
-            placeholder="请选择图片"
76
-            extra="支持jpg/png文件,且不超过500kb"
77
-            rules={[{ required: true, message: '请上传图片' }]}
78
-          >
79
-            <UploadImage />
80
-          </Form.Item>
31
+        <div style={{ textAlign: 'right' }}>
32
+          {' '}
33
+          <Button onClick={() => history.go('-1')}>返回</Button>
34
+        </div>
81 35
 
82
-          <ProFormText
83
-            label="标题"
84
-            placeholder="输入标题"
85
-            name="title"
86
-            rules={[{ required: true, message: '请填写标题' }]}
87
-          />
36
+        <Card bordered={false}>
37
+          <div style={{ display: 'flex' }}>
38
+            <div>
39
+              <Image src={data.avatar} width={200}></Image>
40
+            </div>
88 41
 
89
-          <ProFormSelect
90
-            label="板块"
91
-            placeholder="请选择板块"
92
-            initialValue={'post'}
93
-            name="targetType"
94
-            options={[
95
-              {
96
-                value: 'post',
97
-                label: '科普',
98
-              },
99
-            ]}
100
-            rules={[{ required: true, message: '请选择板块' }]}
101
-          />
42
+            <Descriptions title="学生信息" style={{ marginBottom: 32, marginLeft: 40 }}>
43
+              <Descriptions.Item label="姓名">{data.name}</Descriptions.Item>
44
+              <Descriptions.Item label="性别">{data.sex}</Descriptions.Item>
45
+              <Descriptions.Item label="积分">{data.createDate}</Descriptions.Item>
46
+              <Descriptions.Item label="微信昵称">{data.nickName}</Descriptions.Item>
47
+              <Descriptions.Item label="联系方式">{data.phone}</Descriptions.Item>
48
+              <Descriptions.Item label="邮箱">{data.eMail}</Descriptions.Item>
49
+            </Descriptions>
50
+          </div>
102 51
 
103
-          <ProFormSelect
104
-            label="链接文章"
105
-            placeholder="请选择链接文章"
106
-            name="targetId"
107
-            showSearch
108
-            request={async ({ keyWords }) => {
109
-              // console.log()
110
-              // if (keyWords) {
111
-              return request('/post', {
112
-                method: 'get',
113
-                params: { name: keyWords, pageNum: 1, pageSize: 1000 },
114
-              })
115
-                .then((res) => {
116
-                  return res?.records?.map((x) => {
117
-                    return { label: x.name, value: x.postId };
118
-                  });
119
-                })
120
-                .catch((e) => {
121
-                  notification.error({ message: e.message });
122
-                  return Promise.reject(e.message);
123
-                });
124
-              // }
125
-            }}
126
-          />
127
-        </ProForm>
52
+          <Divider style={{ marginBottom: 32 }} />
53
+          <Descriptions title="学校信息" style={{ marginBottom: 32 }}>
54
+            <Descriptions.Item label="学校">{data.schoolName}</Descriptions.Item>
55
+            <Descriptions.Item label="专业">{data.specialtyName}</Descriptions.Item>
56
+            <Descriptions.Item label="学界">{data.schoolBatch}</Descriptions.Item>
57
+            <Descriptions.Item label="学号">{data.studentId}</Descriptions.Item>
58
+          </Descriptions>
59
+        </Card>
128 60
       </Container>
129 61
     </PageContainer>
130 62
   );

+ 10
- 18
src/pages/Student/Student/List/index.jsx Parādīt failu

@@ -1,28 +1,21 @@
1
-import React, { useCallback, useState } from 'react';
1
+import React, { useCallback } from 'react';
2 2
 import { connect, history } from 'umi';
3 3
 import { PageContainer } from '@ant-design/pro-layout';
4 4
 import ProTable from '@ant-design/pro-table';
5
-import { PlusOutlined } from '@ant-design/icons';
6
-import { Button, Popconfirm, Image, Space, notification } from 'antd';
7
-import request, { queryTable } from '@/utils/request';
5
+import { Space } from 'antd';
6
+import { queryTable } from '@/utils/request';
8 7
 
9 8
 const StudentList = () => {
10
-  const [, setLoading] = useState(false);
11 9
   const handleStudentClick = useCallback((id) => {
12
-    history.push(id ? `/student/student/edit?id=${id}` : '/student/student/edit');
10
+    if (id) {
11
+      history.push(`/student/student/edit?id=${id}`);
12
+    }
13 13
   }, []);
14 14
 
15
-  const actions = [
16
-    <Button key="button" icon={<PlusOutlined />} type="primary" onClick={() => handleBannerClick()}>
17
-      新建
18
-    </Button>,
19
-  ];
20
-
21
-
22 15
   const columns = [
23 16
     {
24 17
       title: '编号',
25
-      dataIndex: 'person_id',
18
+      dataIndex: 'personId',
26 19
       align: 'center',
27 20
       hideInSearch: true,
28 21
     },
@@ -58,7 +51,7 @@ const StudentList = () => {
58 51
 
59 52
     {
60 53
       title: '学号',
61
-      dataIndex: 'status',
54
+      dataIndex: 'studentId',
62 55
       align: 'center',
63 56
     },
64 57
     {
@@ -68,7 +61,7 @@ const StudentList = () => {
68 61
       hideInSearch: true,
69 62
       render: (text, record) => (
70 63
         <Space size="middle">
71
-          <a onClick={() => handleStudentClick(record.serialNo)}>用户详情 </a>
64
+          <a onClick={() => handleStudentClick(record.personId)}>用户详情 </a>
72 65
         </Space>
73 66
       ),
74 67
     },
@@ -83,8 +76,7 @@ const StudentList = () => {
83 76
         headerTitle="学校列表"
84 77
         search={{
85 78
           labelWidth: '4em',
86
-        }} 
87
-       
79
+        }}
88 80
       />
89 81
     </PageContainer>
90 82
   );