林凡 hace 5 años
padre
commit
444b9823cf

+ 38
- 24
src/pages/carouselFigure/SelectActivity.jsx Ver fichero

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import{ Select, Modal } from 'antd';
2
+import { Form, Select, Modal, Button,Table, Divider, Tag } from 'antd';
3 3
 import { apis, fetch } from '../../utils/request';
4 4
 
5 5
 const getActivities = fetch(apis.activity.listSelected)
@@ -18,7 +18,7 @@ export default (props) => {
18 18
   const setAct = val => setActivity({ dynamicId: val, title: getActTitle(val) })
19 19
 
20 20
   const buildingId = props.buildingId()
21
-  
21
+
22 22
   useEffect(() => {
23 23
     getActivities({
24 24
       params: {
@@ -44,32 +44,46 @@ export default (props) => {
44 44
 
45 45
   const handleChange = val => chooseVal = val
46 46
 
47
+  const setData=val=>{
48
+    setAct(val)
49
+    onChange(val)
50
+    setVisible(false)
51
+  }
52
+
53
+  const columns = [
54
+    {
55
+      title: '标题',
56
+      dataIndex: 'title',
57
+      key: 'dynamicId',
58
+      align:'center',
59
+      ellipsis:true,
60
+      render: text => <a>{text}</a>,
61
+    },
62
+    {
63
+      title: '操作',
64
+      dataIndex: 'name',
65
+      align:'center',
66
+      width:'20%',
67
+      render: (text, record) => (
68
+        <span>
69
+          <a onClick={() => setData(record.dynamicId)} style={{color:'blue'}}>选择</a>
70
+        </span>
71
+      ),
72
+    },
73
+  ];
74
+
47 75
   return (
48
-    <div>
49
-      <div onClick={() => setVisible(true)}>{activity.title}</div>
76
+  <div>
77
+    <div onClick={() => setVisible(true)}>{activity.title}</div>
50 78
       <Modal
51
-        title="请选择活动"
79
+        title="请选择H5"
52 80
         visible={visible}
53
-        onOk={() => {
54
-          setAct(chooseVal)
55
-          onChange(chooseVal)
56
-          setVisible(false)
57
-        }}
58
-        onCancel={() => setVisible(false)}
81
+         onCancel={() => setVisible(false)}
82
+         footer={[]}
59 83
       >
60
-        <Select
61
-        showSearch
62
-        filterOption={(input, option) =>
63
-          option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
64
-        }
65
-        defaultValue={chooseVal} 
66
-        onChange={handleChange} 
67
-        style={{ width: '90%' }}>
68
-          {
69
-            list.map(x => (<Select.Option key={x.dynamicId} value={x.dynamicId}>{x.title}</Select.Option>))
70
-          }
71
-        </Select>
84
+       <Table rowKey={list => list.dynamicId} columns={columns} dataSource={list} />
72 85
       </Modal>
73
-    </div>
86
+  </div>
87
+
74 88
   );
75 89
 }

+ 36
- 24
src/pages/carouselFigure/SelectGroup.jsx Ver fichero

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Select, Modal } from 'antd';
2
+import { Form, Select, Modal, Button,Table, Divider, Tag } from 'antd';
3 3
 import { apis, fetch } from '../../utils/request';
4 4
 
5 5
 const getGroupList = fetch(apis.groupActivity.EffectiveList)
@@ -10,7 +10,7 @@ export default props => {
10 10
     onChange,
11 11
     ...rest
12 12
   } = props;
13
-  
13
+
14 14
   const [list, setList] = useState([]);
15 15
   const [visible, setVisible] = useState(false);
16 16
   const [group, setGroup] = useState({ groupId: undefined, groupName: '请选择拼团' })
@@ -44,32 +44,44 @@ export default props => {
44 44
       onChange(val)
45 45
   }
46 46
 
47
+  const setData=val=>{
48
+    updateGroup(val)
49
+    onChange(val)
50
+    setVisible(false)
51
+  }
52
+
53
+  const columns = [
54
+    {
55
+      title: '标题',
56
+      dataIndex: 'activityName',
57
+      key: 'groupActivityId',
58
+      align:'center',
59
+      ellipsis:true,
60
+      render: text => <a>{text}</a>,
61
+    },
62
+    {
63
+      title: '操作',
64
+      align:'center',
65
+      width:'20%',
66
+      render: (text, record) => (
67
+        <span>
68
+          <a onClick={() => setData(record.groupActivityId)} style={{color:'blue'}}>选择</a>
69
+        </span>
70
+      ),
71
+    },
72
+  ];
73
+
47 74
   return (
48
-    <div>
49
-      <div onClick={() => setVisible(true)}>{group.groupName}</div>
75
+  <div>
76
+    <div onClick={() => setVisible(true)}>{group.groupName}</div>
50 77
       <Modal
51
-        title="请选择拼团"
78
+        title="请选择H5"
52 79
         visible={visible}
53
-        onOk={() => {
54
-          updateGroup(value)
55
-          onChange(value)
56
-          setVisible(false)
57
-        }}
58
-        onCancel={() => setVisible(false)}
80
+         onCancel={() => setVisible(false)}
81
+         footer={[]}
59 82
       >
60
-        <Select
61
-          showSearch
62
-          value={value ? parseInt(value) : undefined}
63
-          onChange={handleChange}
64
-          style={{ width: '90%' }}
65
-          filterOption={(input, option) =>
66
-            option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
67
-          }>
68
-          {
69
-            list.map(x => (<Select.Option key={x.groupActivityId} value={x.groupActivityId}>{x.activityName}</Select.Option>))
70
-          }
71
-        </Select>
83
+       <Table rowKey={list => list.groupActivityId} columns={columns} dataSource={list} />
72 84
       </Modal>
73
-    </div>
85
+  </div>
74 86
   );
75 87
 }

+ 88
- 0
src/pages/carouselFigure/SelectH5.1.jsx Ver fichero

@@ -0,0 +1,88 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Select, Modal, Button } from 'antd';
3
+import { apis, fetch } from '../../utils/request';
4
+
5
+const getH5List = fetch(apis.h5Activity.EffectiveList)
6
+
7
+export default props => {
8
+  const {
9
+    value,
10
+    onChange,
11
+    ...rest
12
+  } = props;
13
+
14
+  const [list, setList] = useState([]);
15
+  const [visible, setVisible] = useState(false);
16
+  const [group, setGroup] = useState({ groupId: undefined, groupName: '请选择H5' })
17
+  const getGroupTitle = val => {
18
+    return (list.filter(x => x.drainageId == val)[0] || {}).name || '请选择H5'
19
+  }
20
+  const updateGroup = val => setGroup({ groupId: val, groupName: getGroupTitle(val) })
21
+
22
+  useEffect(() => {
23
+    getH5List({
24
+      params: {
25
+        pageNum: 1,
26
+        pageSize: 999,
27
+        isMiniapp: 1,
28
+        status: 1,
29
+      },
30
+    }).then(data => {
31
+      setList(data.records || [])
32
+
33
+      updateGroup(value ? undefined : value);
34
+    })
35
+  }, []);
36
+
37
+  if (value !== group.groupId) {
38
+    updateGroup(value);
39
+  }
40
+
41
+  const handleChange = val => {
42
+      onChange(val)
43
+  }
44
+
45
+  const setData=val=>{
46
+    updateGroup('')
47
+    onChange('')
48
+  }
49
+
50
+  return (
51
+    <div>
52
+      <div onClick={() => setVisible(true)}>{group.groupName}</div>
53
+      <Modal
54
+        title="请选择H5"
55
+        visible={visible}
56
+         onCancel={() => setVisible(false)}
57
+         footer={[
58
+            <Button key="back" onClick={() => setVisible(false)}>
59
+              取消
60
+            </Button>,
61
+            <Button key="cancel" onClick={() => setData(value)}>
62
+              清空
63
+            </Button>,
64
+            <Button key="submit" type="primary" onClick={() => {
65
+              updateGroup(value)
66
+              onChange(value)
67
+              setVisible(false)
68
+            }}>
69
+              提交
70
+            </Button>
71
+          ]}
72
+      >
73
+        <Select
74
+          showSearch
75
+          value={value ? parseInt(value) : undefined}
76
+          onChange={handleChange}
77
+          style={{ width: '90%' }}
78
+          filterOption={(input, option) =>
79
+            option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
80
+          }>
81
+          {
82
+            list.map(x => (<Select.Option key={x.drainageId} value={x.drainageId}>{x.name}</Select.Option>))
83
+          }
84
+        </Select>
85
+      </Modal>
86
+    </div>
87
+  );
88
+}

+ 36
- 38
src/pages/carouselFigure/SelectH5.jsx Ver fichero

@@ -1,7 +1,8 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Select, Modal, Button } from 'antd';
2
+import { Form, Select, Modal, Button,Table, Divider, Tag } from 'antd';
3 3
 import { apis, fetch } from '../../utils/request';
4 4
 
5
+const { Column, ColumnGroup } = Table;
5 6
 const getH5List = fetch(apis.h5Activity.EffectiveList)
6 7
 
7 8
 export default props => {
@@ -43,46 +44,43 @@ export default props => {
43 44
   }
44 45
 
45 46
   const setData=val=>{
46
-    updateGroup('')
47
-    onChange('')
47
+    updateGroup(val)
48
+    onChange(val)
49
+    setVisible(false)
48 50
   }
49 51
 
50
-  return (
52
+  const columns = [
53
+    {
54
+      title: '标题',
55
+      dataIndex: 'name',
56
+      key: 'drainageId',
57
+      align:'center',
58
+      ellipsis:true,
59
+      render: text => <a>{text}</a>,
60
+    },
61
+    {
62
+      title: '操作',
63
+      align:'center',
64
+      width:'20%',
65
+      render: (text, record) => (
66
+        <span>
67
+          <a onClick={() => setData(record.drainageId)} style={{color:'blue'}}>选择</a>
68
+        </span>
69
+      ),
70
+    },
71
+  ];
72
+
73
+  return(
51 74
     <div>
52 75
       <div onClick={() => setVisible(true)}>{group.groupName}</div>
53
-      <Modal
54
-        title="请选择H5"
55
-        visible={visible}
56
-         onCancel={() => setVisible(false)}
57
-         footer={[
58
-            <Button key="back" onClick={() => setVisible(false)}>
59
-              取消
60
-            </Button>,
61
-            <Button key="cancel" onClick={() => setData(value)}>
62
-              清空
63
-            </Button>,
64
-            <Button key="submit" type="primary" onClick={() => {
65
-              updateGroup(value)
66
-              onChange(value)
67
-              setVisible(false)
68
-            }}>
69
-              提交
70
-            </Button>
71
-          ]}
72
-      >
73
-        <Select
74
-          showSearch
75
-          value={value ? parseInt(value) : undefined}
76
-          onChange={handleChange}
77
-          style={{ width: '90%' }}
78
-          filterOption={(input, option) =>
79
-            option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
80
-          }>
81
-          {
82
-            list.map(x => (<Select.Option key={x.drainageId} value={x.drainageId}>{x.name}</Select.Option>))
83
-          }
84
-        </Select>
85
-      </Modal>
76
+        <Modal
77
+          title="请选择H5"
78
+          visible={visible}
79
+           onCancel={() => setVisible(false)}
80
+           footer={[]}
81
+        >
82
+         <Table rowKey={list => list.drainageId} columns={columns} dataSource={list} />
83
+        </Modal>
86 84
     </div>
87
-  );
85
+  )
88 86
 }

+ 37
- 25
src/pages/carouselFigure/SelectHelp.jsx Ver fichero

@@ -1,5 +1,6 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Select, Modal } from 'antd';
2
+
3
+import { Form, Select, Modal, Button,Table, Divider, Tag } from 'antd';
3 4
 import { apis, fetch } from '../../utils/request';
4 5
 
5 6
 const getHelpList = fetch(apis.helpActivity.effectiveList)
@@ -45,33 +46,44 @@ export default props => {
45 46
     onChange(val)
46 47
   }
47 48
 
49
+  const setData=val=>{
50
+    updateHelp(val)
51
+    onChange(val)
52
+    setVisible(false)
53
+  }
54
+
55
+  const columns = [
56
+    {
57
+      title: '标题',
58
+      dataIndex: 'title',
59
+      key: 'helpActivityId',
60
+      align:'center',
61
+      ellipsis:true,
62
+      render: text => <a>{text}</a>,
63
+    },
64
+    {
65
+      title: '操作',
66
+      align:'center',
67
+      width:'20%',
68
+      render: (text, record) => (
69
+        <span>
70
+          <a onClick={() => setData(record.helpActivityId)} style={{color:'blue'}}>选择</a>
71
+        </span>
72
+      ),
73
+    },
74
+  ];
75
+
48 76
   return (
49 77
     <div>
50 78
       <div onClick={() => setVisible(true)}>{help.helpName}</div>
51
-      <Modal
52
-        title="请选择助力"
53
-        visible={visible}
54
-        onOk={() => {
55
-          updateHelp(value)
56
-          onChange(value)
57
-          setVisible(false)
58
-        }}
59
-        onCancel={() => setVisible(false)}
60
-      >
61
-        <Select
62
-          placeholder="请选择助力"
63
-          showSearch
64
-          value={value ? parseInt(value) : undefined}
65
-          onChange={handleChange}
66
-          style={{ width: '90%' }}
67
-          filterOption={(input, option) =>
68
-            option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
69
-          }>
70
-          {
71
-            list.map(x => (<Select.Option key={x.helpActivityId} value={x.helpActivityId}>{x.title}</Select.Option>))
72
-          }
73
-        </Select>
74
-      </Modal>
79
+        <Modal
80
+          title="请选择H5"
81
+          visible={visible}
82
+           onCancel={() => setVisible(false)}
83
+           footer={[]}
84
+        >
85
+         <Table rowKey={list => list.helpActivityId} columns={columns} dataSource={list} />
86
+        </Modal>
75 87
     </div>
76 88
   );
77 89
 }

+ 35
- 25
src/pages/carouselFigure/SelectNews.jsx Ver fichero

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Select, Modal } from 'antd';
2
+import { Form, Select, Modal, Button,Table, Divider, Tag } from 'antd';
3 3
 import { apis, fetch } from '../../utils/request';
4 4
 
5 5
 const getNewsList = fetch(apis.news.getList)
@@ -42,34 +42,44 @@ export default props => {
42 42
     onChange(val)
43 43
   }
44 44
 
45
-  console.log(value, typeof value)
45
+  const setData=val=>{
46
+    updateNews(val)
47
+    onChange(val)
48
+    setVisible(false)
49
+  }
50
+
51
+  const columns = [
52
+    {
53
+      title: '标题',
54
+      dataIndex: 'newsName',
55
+      key: 'newsId',
56
+      align:'center',
57
+      ellipsis:true,
58
+      render: text => <a>{text}</a>,
59
+    },
60
+    {
61
+      title: '操作',
62
+      align:'center',
63
+      width:'20%',
64
+      render: (text, record) => (
65
+        <span>
66
+          <a onClick={() => setData(record.newsId)} style={{color:'blue'}}>选择</a>
67
+        </span>
68
+      ),
69
+    },
70
+  ];
71
+
46 72
   return (
47 73
     <div>
48 74
       <div onClick={() => setVisible(true)}>{news.newsName}</div>
49
-      <Modal
50
-        title="请选择资讯"
51
-        visible={visible}
52
-        onOk={() => {
53
-          updateNews(value)
54
-          onChange(value)
55
-          setVisible(false)
56
-        }}
57
-        onCancel={() => setVisible(false)}
58
-      >
59
-        <Select
60
-          showSearch
61
-          value={value ? parseInt(value) : undefined}
62
-          onChange={handleChange}
63
-          style={{ width: '90%' }}
64
-          filterOption={(input, option) =>
65
-            option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
66
-          }
75
+        <Modal
76
+          title="请选择H5"
77
+          visible={visible}
78
+           onCancel={() => setVisible(false)}
79
+           footer={[]}
67 80
         >
68
-          {
69
-            list.map(x => (<Select.Option key={x.newsId} value={x.newsId}>{x.newsName}</Select.Option>))
70
-          }
71
-        </Select>
72
-      </Modal>
81
+         <Table rowKey={list => list.newsId} columns={columns} dataSource={list} />
82
+        </Modal>
73 83
     </div>
74 84
   );
75 85
 }