dingxin преди 5 години
родител
ревизия
87e6239106

+ 22
- 0
config/config.js Целия файл

@@ -173,6 +173,23 @@ export default {
173 173
                 },
174 174
               ],
175 175
             },
176
+            {
177
+              path: '/news',
178
+              name: '资讯管理',
179
+              component: '../layouts/BlankLayout',
180
+              routes: [
181
+                {
182
+                  path: '/news/NewTypeList',
183
+                  name: '资讯列表',
184
+                  component: './news/NewTypeList',
185
+                },
186
+                {
187
+                  path: '/activity/editActivity',
188
+                  name: '',
189
+                  component: './activity/editActivity',
190
+                },
191
+              ],
192
+            },
176 193
             {
177 194
               path: '/activity',
178 195
               name: '活动管理',
@@ -183,6 +200,11 @@ export default {
183 200
                   name: '活动列表',
184 201
                   component: './activity/ActivityList',
185 202
                 },
203
+                {
204
+                  path: '/activity/editActivity',
205
+                  name: '',
206
+                  component: './activity/editActivity',
207
+                },
186 208
               ],
187 209
             },
188 210
             {

+ 1
- 0
src/global.less Целия файл

@@ -12,6 +12,7 @@ body,
12 12
 
13 13
 .ant-layout {
14 14
   min-height: 100vh;
15
+  background-color: #f8f8f8;
15 16
 }
16 17
 
17 18
 canvas {

+ 13
- 10
src/layouts/BlankLayout.jsx Целия файл

@@ -1,16 +1,19 @@
1 1
 import React from 'react';
2
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
2 3
 
3 4
 const Layout = ({ children }) => (
4
-  <div
5
-    style={{
6
-      backgroundColor: '#fff',
7
-      padding: '32PX 28px',
8
-      boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)',
9
-      borderRadius: '12px',
10
-    }}
11
-  >
12
-    {children}
13
-  </div>
5
+  <PageHeaderWrapper style={{height:'49px',background:'rgba(240,240,240,1)',paddingTop:'15px'}}>
6
+    <div
7
+      style={{
8
+        backgroundColor: '#fff',
9
+        padding: '32PX 28px',
10
+        boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)',
11
+        borderRadius: '12px',
12
+      }}
13
+    >
14
+      {children}
15
+    </div>
16
+  </PageHeaderWrapper>
14 17
 );
15 18
 
16 19
 export default Layout;

+ 119
- 52
src/pages/activity/ActivityList.jsx Целия файл

@@ -1,36 +1,55 @@
1 1
 import React from 'react';
2
-import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag } from 'antd';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5
-const menu = (
6
-  <Menu onClick={handleMenuClick}>
7
-    <Menu.Item key="1">
8
-      <Icon type="user" />
9
-      1st menu item
10
-    </Menu.Item>
11
-    <Menu.Item key="2">
12
-      <Icon type="user" />
13
-      2nd menu item
14
-    </Menu.Item>
15
-    <Menu.Item key="3">
16
-      <Icon type="user" />
17
-      3rd item
18
-    </Menu.Item>
19
-  </Menu>
20
-);
5
+import router from 'umi/router';
6
+
7
+const { Option } = Select;
8
+// 提交事件
9
+function handleSubmit(e, props) {
10
+  e.preventDefault();
11
+  props.form.validateFields((err, values) => {
12
+    if (!err) {
13
+      console.log('提交数据: ', values)
14
+    }
15
+  });
16
+}
17
+// Change 事件
18
+function handleSelectChange(props) {
19
+  console.log(props)
20
+}
21
+
22
+// 分页
23
+function onChange(pageNumber) {
24
+  console.log('Page: ', pageNumber);
25
+}
26
+// 跳转到编辑商品
27
+function toEditGoods() {
28
+  router.push({
29
+    pathname: '/activity/editActivity',
30
+    query: {
31
+      a: 'b',
32
+    },
33
+  });
34
+}
35
+
36
+/**
37
+ *
38
+ *
39
+ * @param {*} props
40
+ * @returns
41
+ */
42
+
21 43
 const dataSource = [
22 44
   {
23 45
     key: '1',
24 46
     img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
25
-    name: '123',
26
-    age: 32,
27
-    address: '西湖区湖底公园1号',
47
+    name: '华为P30 Pro',
28 48
   },
29 49
   {
30 50
     key: '2',
31 51
     img: '',
32
-    age: 42,
33
-    address: '西湖区湖底公园1号',
52
+    name: '大米',
34 53
   },
35 54
 ];
36 55
 
@@ -40,7 +59,6 @@ const columns = [
40 59
     dataIndex: 'img',
41 60
     key: 'img',
42 61
     align: 'center',
43
-
44 62
     render: (text, record) => <img src={record.img} className={styles.touxiang} />,
45 63
   },
46 64
   {
@@ -48,7 +66,7 @@ const columns = [
48 66
     dataIndex: 'name',
49 67
     key: 'name',
50 68
     align: 'center',
51
-    render: text => <a>{text}</a>,
69
+
52 70
   },
53 71
   {
54 72
     title: '所属积分',
@@ -85,36 +103,85 @@ const columns = [
85 103
     dataIndex: 'handle',
86 104
     key: 'handle',
87 105
     align: 'center',
88
-    render: () => <a>Delete</a>,
106
+    render: () => <><span style={{ color: '#1990FF', marginRight: '20px' }} onClick={confirm}>下架<Icon type="shopping-cart" className={styles.shoppingCart} /></span><span style={{ color: '#FF925C' }}>编辑<Icon type="form" className={styles.edit} /></span></>,
89 107
   },
90 108
 ];
109
+const confirm = () => {
110
+  Modal.confirm({
111
+    title: '确认下架该商品?',
112
+    okText: '确认',
113
+    cancelText: '取消',
114
+    onOk() {
115
+      console.log('OK');
116
+    },
117
+    onCancel() {
118
+      console.log('Cancel');
119
+    },
120
+  });
91 121
 
92
-export default () => (
93
-  <>
94
-    <div className={styles.searchBox}>
95
-      <Input placeholder="商品名称" className={styles.searchItem} />
96
-      <Dropdown overlay={menu} className={styles.searchItem}>
97
-        <Button>
98
-          Button <Icon type="down" />
99
-        </Button>
100
-      </Dropdown>
101
-      <Dropdown overlay={menu} className={styles.searchItem}>
102
-        <Button>
103
-          Button <Icon type="down" />
104
-        </Button>
105
-      </Dropdown>
106
-      <Input placeholder="商品名称" className={styles.searchItem} />
107
-      <Input placeholder="商品名称" className={styles.searchItem} />
108
-      <Button type="primary" size="small">
109
-        查询
110
-      </Button>
111
-    </div>
112
-    <Button className={styles.addBtn}>新增</Button>
113
-    <Table dataSource={dataSource} columns={columns} />
114
-  </>
115
-);
122
+}
123
+
124
+const header = (props) => {
125
+  const { getFieldDecorator } = props.form
126
+  return (
116 127
 
117
-function handleMenuClick(e) {
118
-  message.info('Click on menu item.');
119
-  console.log('click', e);
128
+    <>
129
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
130
+        <Form.Item>
131
+          {getFieldDecorator('name')(
132
+            <Input
133
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
134
+              placeholder="商品名称"
135
+            />,
136
+          )}
137
+        </Form.Item>
138
+        <Form.Item>
139
+          {getFieldDecorator('goodState')(
140
+            <Select style={{ width: '180px' }} placeholder="状态" onChange={handleSelectChange}>
141
+              <Option value="1">上架</Option>
142
+              <Option value="0">下架</Option>
143
+            </Select>,
144
+          )}
145
+        </Form.Item>
146
+        <Form.Item>
147
+          {getFieldDecorator('isMain')(
148
+            <Select style={{ width: '180px' }} placeholder="所属项目" onChange={handleSelectChange}>
149
+              <Option value="1">首页推荐</Option>
150
+              <Option value="0">首页未推荐</Option>
151
+            </Select>,
152
+          )}
153
+        </Form.Item>
154
+        <Form.Item>
155
+          {getFieldDecorator('min')(
156
+            <Input
157
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
158
+              placeholder="最小积分"
159
+            />,
160
+          )}
161
+        </Form.Item>
162
+        <Form.Item>
163
+          {getFieldDecorator('max')(
164
+            <Input
165
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
166
+              placeholder="最大积分"
167
+            />,
168
+          )}
169
+        </Form.Item>
170
+        <Form.Item>
171
+          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
172
+            搜索
173
+          </Button>
174
+        </Form.Item>
175
+      </Form>
176
+      <Button type="primary" className={styles.addBtn} onClick={toEditGoods}>新增</Button>
177
+      <Table dataSource={dataSource} columns={columns} />
178
+      {/* 分页 */
179
+      /* <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
180
+        <Pagination showQuickJumper defaultCurrent={1} total={500} onChange={onChange} />
181
+      </div> */}
182
+    </>
183
+  )
120 184
 }
185
+const WrappedHeader = Form.create({ name: 'header' })(header);
186
+
187
+export default WrappedHeader

+ 52
- 0
src/pages/activity/editActivity.jsx Целия файл

@@ -0,0 +1,52 @@
1
+import React, { useState } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+
6
+
7
+
8
+/**
9
+ *
10
+ *
11
+ * @param {*} props
12
+ * @returns
13
+ */
14
+
15
+
16
+ const Basic = (props) => {
17
+   return <div>Basic</div>
18
+ }
19
+ 
20
+ const Poster = (props) => {
21
+  return <div>Poster</div>
22
+}
23
+
24
+const Share = (props) => {
25
+  return <div>Share</div>
26
+}
27
+
28
+ const Edit = (props) => {
29
+   const [ tab, changeTab ] = useState('a');
30
+
31
+
32
+  return (
33
+    <div>
34
+      <div>
35
+        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
36
+          <Radio.Button value="a">基本信息</Radio.Button>
37
+          <Radio.Button value="b">海报图片</Radio.Button>
38
+          <Radio.Button value="c">分享设置</Radio.Button>
39
+        </Radio.Group>
40
+      </div>
41
+      <div>
42
+        { tab === 'a' && <Basic /> }
43
+        { tab === 'b' && <Poster /> }
44
+        { tab === 'c' && <Share /> }
45
+      </div>
46
+    </div>
47
+  );
48
+ }
49
+
50
+
51
+
52
+export default Edit

+ 2
- 2
src/pages/integralMall/GoodsList.jsx Целия файл

@@ -1,5 +1,5 @@
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 4
 import styles from '../style/GoodsList.less';
5 5
 import router from 'umi/router';
@@ -103,7 +103,7 @@ const columns = [
103 103
     dataIndex: 'handle',
104 104
     key: 'handle',
105 105
     align: 'center',
106
-    render: () => <><span style={{ color: '#1990FF', marginRight: '20px' }} onClick={confirm}>下架<Icon type="shopping-cart" className={styles.shoppingCart} /></span><span style={{ color: '#FF925C' }}>编辑<Icon type="form" className={styles.edit} /></span></>,
106
+    render: () => <><span style={{ color: '#1990FF', marginRight: '20px' }} onClick={confirm}>下架<Icon type="shopping-cart" className={styles.shoppingCart} /></span><span style={{ color: '#FF925C' }} onClick={toEditGoods}>编辑<Icon type="form" className={styles.edit} /></span></>,
107 107
   },
108 108
 ];
109 109
 function confirm() {

+ 119
- 0
src/pages/news/NewTypeList.jsx Целия файл

@@ -0,0 +1,119 @@
1
+import React from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import router from 'umi/router';
6
+
7
+const { Option } = Select;
8
+// 提交事件
9
+function handleSubmit(e, props) {
10
+  e.preventDefault();
11
+  props.form.validateFields((err, values) => {
12
+    if (!err) {
13
+      console.log('提交数据: ', values)
14
+    }
15
+  });
16
+}
17
+// Change 事件
18
+function handleSelectChange(props) {
19
+  console.log(props)
20
+}
21
+
22
+// 分页
23
+function onChange(pageNumber) {
24
+  console.log('Page: ', pageNumber);
25
+}
26
+// 跳转到编辑商品
27
+function toEditGoods() {
28
+  router.push({
29
+    pathname: '/activity/editActivity',
30
+    query: {
31
+      a: 'b',
32
+    },
33
+  });
34
+}
35
+
36
+/**
37
+ *
38
+ *
39
+ * @param {*} props
40
+ * @returns
41
+ */
42
+
43
+const dataSource = [
44
+  {
45
+    key: '1',
46
+    img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
47
+    name: '华为P30 Pro',
48
+  },
49
+  {
50
+    key: '2',
51
+    img: '',
52
+    name: '大米',
53
+  },
54
+];
55
+
56
+const columns = [
57
+  {
58
+    title: '类型图',
59
+    dataIndex: 'img',
60
+    key: 'img',
61
+    align: 'center',
62
+    render: (text, record) => <img src={record.img} className={styles.touxiang} />,
63
+  },
64
+  {
65
+    title: '名称',
66
+    dataIndex: 'name',
67
+    key: 'name',
68
+    align: 'center',
69
+
70
+  },
71
+
72
+  {
73
+    title: '操作',
74
+    dataIndex: 'handle',
75
+    key: 'handle',
76
+    align: 'center',
77
+    render: () => <>
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></>,
80
+  },
81
+];
82
+const confirm = () => {
83
+  Modal.confirm({
84
+    title: '确认删除该商品?',
85
+    okText: '确认',
86
+    cancelText: '取消',
87
+    onOk() {
88
+      console.log('OK');
89
+    },
90
+    onCancel() {
91
+      console.log('Cancel');
92
+    },
93
+  });
94
+
95
+}
96
+
97
+const header = (props) => {
98
+  const { getFieldDecorator } = props.form
99
+  return (
100
+
101
+    <>
102
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
103
+        <Form.Item>
104
+          {getFieldDecorator('goodState')(
105
+            <Select style={{ width: '180px' }} placeholder="请选择" onChange={handleSelectChange}>
106
+              <Option value="1">上架</Option>
107
+              <Option value="0">下架</Option>
108
+            </Select>,
109
+          )}
110
+        </Form.Item>
111
+      </Form>
112
+      <Button type="primary" className={styles.addBtn} onClick={toEditGoods}>新增</Button>
113
+      <Table dataSource={dataSource} columns={columns} />
114
+    </>
115
+  )
116
+}
117
+const WrappedHeader = Form.create({ name: 'header' })(header);
118
+
119
+export default WrappedHeader

+ 56
- 0
src/pages/style/News.less Целия файл

@@ -0,0 +1,56 @@
1
+.searchBox {
2
+    font-size: 30px;
3
+    color: red;
4
+    display: flex;
5
+    display: flex;
6
+    justify-items: center;
7
+    align-items: center;
8
+    justify-content: space-between;
9
+    .searchItem {
10
+      min-width: 200px;
11
+      margin-right: 20px;
12
+      text-align: left;
13
+      .anticon-down {
14
+        float: right !important;
15
+      }
16
+    }
17
+  }
18
+  .addBtn {
19
+    padding: 0 30px;
20
+    height: 36px;
21
+    background-color: #50be00;
22
+    color: #fff;
23
+    margin: 30px 0;
24
+    border-color: #50be00;
25
+  }
26
+  .addBtn:focus {
27
+    color: #fff;
28
+    background-color: #50be00;
29
+    border-color: #50be00;
30
+  }
31
+  .searchBtn{
32
+   background-color: #3A91D5;
33
+   border-color: #3A91D5;
34
+  }
35
+  .searchBtn:focus {
36
+    color: #fff;
37
+    background-color: #3A91D5;
38
+    border-color: #3A91D5;
39
+  }
40
+  .touxiang {
41
+    width: 93px;
42
+    height: 93px;
43
+  }
44
+  .ant-table-column-title {
45
+    font-weight: 600;
46
+  }
47
+  .shoppingCart{
48
+    color: #dcdcdc;
49
+    margin-left: 6px;
50
+    font-size: 16px;
51
+  }
52
+  .edit{
53
+    color: #dcdcdc;
54
+    margin-left: 6px;
55
+    font-size: 15px;
56
+  }