Explorar el Código

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager

傅行帆 hace 5 años
padre
commit
f8e9c5f5b1

+ 6
- 6
config/config.js Ver fichero

@@ -189,14 +189,14 @@ export default {
189 189
               component: '../layouts/BlankLayout',
190 190
               routes: [
191 191
                 {
192
-                  path: '/news/NewTypeList',
193
-                  name: '资讯列表',
194
-                  component: './news/NewTypeList',
192
+                  path: '/news/NewsType',
193
+                  name: '资讯类型',
194
+                  component: './news/type/NewsType',
195 195
                 },
196 196
                 {
197
-                  path: '/activity/editActivity',
198
-                  name: '',
199
-                  component: './activity/editActivity',
197
+                  path: '/news/NewsList',
198
+                  name: '咨询列表',
199
+                  component: './news/list/NewsList',
200 200
                 },
201 201
               ],
202 202
             },

+ 43
- 70
src/pages/building/list/index.jsx Ver fichero

@@ -1,6 +1,7 @@
1
-import React from 'react';
1
+import React, { useState, useEffect } from 'react';
2 2
 import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination } from 'antd';
3
-import { connect } from 'dva';
3
+import request from '../../../utils/request';
4
+import apis from '../../../services/apis';
4 5
 import Styles from './style.less';
5 6
 
6 7
 
@@ -8,71 +9,7 @@ const { Option } = Select;
8 9
 // eslint-disable-next-line @typescript-eslint/no-unused-vars
9 10
 const { Meta } = Card;
10 11
 
11
-// 假数据
12
-const tempData = [
13
-  {
14
-    code: 'S101',
15
-    name: '城开花园',
16
-    price: '111',
17
-    address: '顾戴路1801弄',
18
-    status: '1', // 已发布
19
-    createDate: '2019-08-28 17',
20
-  },
21
-  {
22
-    code: 'S102',
23
-    name: '星河天街',
24
-    price: '111',
25
-    address: '长征路1801弄',
26
-    status: '1', // 已发布
27
-    createDate: '2019-08-29 17',
28
-  },
29
-  {
30
-    code: 'S103',
31
-    name: '喜洋洋别墅',
32
-    price: '111',
33
-    address: '阳杨路1801弄',
34
-    status: '1', // 已发布
35
-    createDate: '2019-08-29 17',
36
-  },
37
-  {
38
-    code: 'S104',
39
-    name: '武大郎洋房',
40
-    price: '111',
41
-    address: '太郎路1801弄',
42
-    status: '1', // 已发布
43
-    createDate: '2019-08-29 17',
44
-  },
45
-]
46
-
47
-
48
-// 网路数据请求
49
-connect(({ getList, loading }) => ({
50
-  getList,
51
-  submitting: loading.effects['building/getList'],
52
-}))
53
-
54
-// 提交事件
55
-function handleSubmit(e, props) {
56
-  e.preventDefault();
57
-  props.form.validateFields((err, values) => {
58
-    if (!err) {
59
-      // eslint-disable-next-line no-console
60
-      console.log('提交数据: ', values)
61
-    }
62
-  });
63
-}
64
-
65
-// Change 事件
66
-function handleSelectChange(props) {
67
-  // eslint-disable-next-line no-console
68
-  console.log(props)
69
-}
70
-
71
-// 分页
72
-function onChange(pageNumber) {
73
-  // eslint-disable-next-line no-console
74
-  console.log('Page: ', pageNumber);
75
-}
12
+const tempDate = [{ code: 's101' }]
76 13
 
77 14
 /**
78 15
  *卡片
@@ -143,7 +80,43 @@ function CartBody(props) {
143 80
  */
144 81
 function body(props) {
145 82
   const { getFieldDecorator } = props.form
146
-  connect()
83
+
84
+  // eslint-disable-next-line react-hooks/rules-of-hooks
85
+  const { dataSource, setDataSource } = useState(tempDate || [])
86
+  console.log(dataSource)
87
+
88
+  // eslint-disable-next-line react-hooks/rules-of-hooks
89
+  useEffect(() => {
90
+    // 网路请求
91
+    request({ ...apis.building }).then(res => {
92
+      setDataSource(res)
93
+    })
94
+  })
95
+
96
+
97
+  // 提交事件
98
+  function handleSubmit(e) {
99
+    e.preventDefault();
100
+    props.form.validateFields((err, values) => {
101
+      if (!err) {
102
+        // eslint-disable-next-line no-console
103
+        console.log('提交数据: ', values)
104
+      }
105
+    });
106
+  }
107
+
108
+  // Change 事件
109
+  function handleSelectChange(e) {
110
+    // eslint-disable-next-line no-console
111
+    console.log(e)
112
+  }
113
+
114
+  // 分页
115
+  function onChange(pageNumber) {
116
+    // eslint-disable-next-line no-console
117
+    console.log('Page: ', pageNumber);
118
+  }
119
+
147 120
   return (
148 121
     <>
149 122
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
@@ -214,9 +187,9 @@ function body(props) {
214 187
       {/* 卡片内容,显示楼盘项目  */}
215 188
       <Row style={{ padding: ' 0 10px' }}>
216 189
         {
217
-          tempData.map((item, index) => (
190
+          dataSource.map((item, index) => (
218 191
               <Col span={8}>
219
-                <CartBody data={item} />
192
+                <CartBody data={item} key={item.code}/>
220 193
               </Col>
221 194
             ))
222 195
         }

+ 0
- 0
src/pages/news/list/NewsList.jsx Ver fichero


src/pages/news/NewTypeList.jsx → src/pages/news/type/NewsType.jsx Ver fichero

@@ -1,7 +1,7 @@
1 1
 import React from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal } from 'antd';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal,Breadcrumb } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../style/GoodsList.less';
4
+import styles from './style.less';
5 5
 import router from 'umi/router';
6 6
 
7 7
 const { Option } = Select;
@@ -23,10 +23,11 @@ function handleSelectChange(props) {
23 23
 function onChange(pageNumber) {
24 24
   console.log('Page: ', pageNumber);
25 25
 }
26
+
26 27
 // 跳转到编辑商品
27 28
 function toEditGoods() {
28 29
   router.push({
29
-    pathname: '/activity/editActivity',
30
+    pathname: '/integralMall/editGoods',
30 31
     query: {
31 32
       a: 'b',
32 33
     },
@@ -55,7 +56,7 @@ const dataSource = [
55 56
 
56 57
 const columns = [
57 58
   {
58
-    title: '类型图',
59
+    title: '类型图',
59 60
     dataIndex: 'img',
60 61
     key: 'img',
61 62
     align: 'center',
@@ -68,7 +69,6 @@ const columns = [
68 69
     align: 'center',
69 70
 
70 71
   },
71
-
72 72
   {
73 73
     title: '操作',
74 74
     dataIndex: 'handle',
@@ -76,12 +76,12 @@ const columns = [
76 76
     align: 'center',
77 77
     render: () => <>
78 78
     <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={confirm}>删除<Icon type="shopping-cart" className={styles.shoppingCart} /></span>
79
-    <span style={{ color: '#FF925C' }}>编辑<Icon type="form" className={styles.edit} /></span></>,
79
+    <span style={{ color: '#FF925C' }} onClick={toEditGoods}>编辑<Icon type="form" className={styles.edit} /></span></>,
80 80
   },
81 81
 ];
82
-const confirm = () => {
82
+function confirm() {
83 83
   Modal.confirm({
84
-    title: '确认删除该商品?',
84
+    title: '确认删除该类型?',
85 85
     okText: '确认',
86 86
     cancelText: '取消',
87 87
     onOk() {
@@ -93,8 +93,7 @@ const confirm = () => {
93 93
   });
94 94
 
95 95
 }
96
-
97
-const header = (props) => {
96
+function header(props) {
98 97
   const { getFieldDecorator } = props.form
99 98
   return (
100 99
 

src/pages/style/News.less → src/pages/news/type/style.less Ver fichero


+ 8
- 2
src/services/apis.js Ver fichero

@@ -10,5 +10,11 @@ export default {
10 10
       method: 'POST',
11 11
       url: `${prefix}/taUser/signin`,
12 12
     },
13
-  }
14
-}
13
+  },
14
+  building: {
15
+    getList: {
16
+      methods: 'GET',
17
+      url: `${prefix}/buildinglist`,
18
+    },
19
+  },
20
+}