dingxin 5 år sedan
förälder
incheckning
8e7e16a630

+ 18
- 0
config/routes.js Visa fil

@@ -380,6 +380,24 @@ export default [
380 380
               },
381 381
             ],
382 382
           },
383
+          {
384
+            path: '/third',
385
+            name: '第三方管理',
386
+            component: '../layouts/BlankLayout',
387
+            routes: [
388
+              {
389
+                path: '/third/thirdList',
390
+                name: '第三方公司',
391
+                component: './third/thirdList',
392
+              },
393
+              {
394
+                path: '/third/editThirdParty',
395
+                name: '编辑活动',
396
+                hideInMenu: true,
397
+                component: './third/editThirdParty',
398
+              },
399
+            ],
400
+          },
383 401
           {
384 402
             component: './404',
385 403
           },

+ 34
- 34
src/pages/activity/ActivityList.jsx Visa fil

@@ -13,40 +13,40 @@ import AuthButton from '@/components/AuthButton';
13 13
 const { Option } = Select;
14 14
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15 15
 
16
-const header = (props) => {
17
-  const [ data, setData ] = useState({})
16
+const header = props => {
17
+  // eslint-disable-next-line react-hooks/rules-of-hooks
18
+  const [data, setData] = useState({ list: [], total: 0 })
18 19
 //   const [page, changePage] = useState({})
19 20
 
21
+ // 查询列表
22
+ const getList = params => {
23
+  request({ ...apis.activity.list, params: { ...params } }).then(data => {
24
+      console.log(data)
25
+      setData(data)
26
+  })
27
+}
28
+
29
+  // eslint-disable-next-line react-hooks/rules-of-hooks
20 30
   useEffect(() => {
21 31
     getList({ pageNum: 1, pageSize: 10 });
22
-  },[])
23
-
24
-  // 查询列表
25
-  const getList = (params) => {
26
-    request({ ...apis.activity.list, params: { ...params } }).then((data) => {
27
-        console.log(data)
28
-        setData(data)
29
-    })
30
-  }
32
+  }, [])
31 33
 
32
-  
33 34
 // 跳转到编辑商品
34
-const toEditGoods = (dynamicId) => () => {
35
+const toEditGoods = dynamicId => () => {
35 36
     router.push({
36 37
       pathname: '/activity/editActivity',
37 38
       query: {
38
-        dynamicId
39
+        dynamicId,
39 40
       },
40 41
     });
41 42
   }
42
-  
43
+
43 44
   /**
44 45
    *
45 46
    *
46 47
    * @param {*} props
47 48
    * @returns
48 49
    */
49
-  
50 50
   const columns = [
51 51
     {
52 52
       title: '活动标题',
@@ -90,14 +90,14 @@ const toEditGoods = (dynamicId) => () => {
90 90
       dataIndex: 'isEnlist',
91 91
       key: 'isEnlist',
92 92
       align: 'center',
93
-      render: (isEnlist)=> <><span>{isEnlist == 0 ?"未开始" : isEnlist==1 ? "进行中" : "已结束"}</span></>
93
+      render: isEnlist => <><span>{isEnlist == 0 ? "未开始" : isEnlist == 1 ? '进行中' : '已结束'}</span></>,
94 94
     },
95 95
     {
96 96
       title: '操作',
97 97
       dataIndex: 'handle',
98 98
       key: 'handle',
99 99
       align: 'center',
100
-      render: (x,row) => (
100
+      render: (x, row) => (
101 101
         <>
102 102
           <AuthButton name="admin.SignList.get" noRight={null}>
103 103
             <span style={{ color: '#1990FF', cursor: 'pointer'}} onClick={getSignList.bind(this, row.dynamicId)}>{row.isEnlist == '1' || row.isEnlist == '2' ? "报名记录" : ""}<Icon type="snippets" className={styles.shoppingCart} /></span>
@@ -116,48 +116,48 @@ const toEditGoods = (dynamicId) => () => {
116 116
       )
117 117
     },
118 118
   ];
119
-  
120
-  const getSignList = (dynamicId) => {
119
+
120
+  const getSignList = dynamicId => {
121 121
       router.push({
122 122
           pathname: '/activity/SignList',
123 123
           query: {
124
-              dynamicId
124
+              dynamicId,
125 125
           },
126 126
         });
127 127
   }
128
-  
129
-  const finishDynamic = (row) => {
128
+
129
+  const finishDynamic = row => {
130 130
       Modal.confirm({
131 131
           title: '结束以后将无法编辑, 是否继续?',
132 132
           okText: '确定',
133 133
           cancelText: '取消',
134 134
           onOk() {
135
-              request({ ...apis.activity.finish, data: {dynamicId: row.dynamicId, top: ""} }).then((data) => {
135
+              request({ ...apis.activity.finish, data: {dynamicId: row.dynamicId, top: "" } }).then(data => {
136 136
                   console.log(data)
137 137
                   message.info('操作成功!')
138 138
                   getList({ pageNum: 1, pageSize: 10 })
139
-              }).catch((err) => {
139
+              }).catch(err => {
140 140
                   console.log(err)
141 141
                   message.info(err.msg || err.message)
142 142
               })
143 143
           },
144 144
         });
145 145
   }
146
-  
146
+
147 147
 //   置顶
148
-  const topDynamic = (row) => () => {
148
+  const topDynamic = row => () => {
149 149
       const weight = Math.abs(row.weight - 1)
150
-      request({ ...apis.activity.weight, params: {dynamicId: row.dynamicId, weight} }).then((data) => {
150
+      request({ ...apis.activity.weight, params: {dynamicId: row.dynamicId, weight} }).then(data => {
151 151
           console.log(data)
152 152
           message.info('操作成功!')
153 153
           getList({ pageNum: 1, pageSize: 10 })
154
-      }).catch((err) => {
154
+      }).catch(err => {
155 155
           console.log(err)
156 156
           message.info(err.msg || err.message)
157 157
       })
158 158
   }
159 159
   
160
-  const sendOrPublicDynamic = (row) => {
160
+  const sendOrPublicDynamic = row => {
161 161
       if (row.status === 1) {
162 162
           cancelDynamic(row)
163 163
       } else {
@@ -166,7 +166,7 @@ const toEditGoods = (dynamicId) => () => {
166 166
   }
167 167
   
168 168
   // 取消活动
169
-  const cancelDynamic = (row) => {
169
+  const cancelDynamic = row => {
170 170
       request({ ...apis.activity.cancel, urlData: {id: row.dynamicId}}).then((data) => {
171 171
           message.info('操作成功!')
172 172
           getList({ pageNum: 1, pageSize: 10 })
@@ -177,7 +177,7 @@ const toEditGoods = (dynamicId) => () => {
177 177
   }
178 178
   
179 179
   //发布活动
180
-  const sendDynamic = (row) => {
180
+  const sendDynamic = row => {
181 181
       request({ ...apis.activity.send, urlData: {id: row.dynamicId}}).then((data) => {
182 182
           message.info('操作成功!')
183 183
           getList({ pageNum: 1, pageSize: 10 });
@@ -187,7 +187,7 @@ const toEditGoods = (dynamicId) => () => {
187 187
       })
188 188
   }
189 189
   
190
-  const changePageNum = (pageNumber) => {
190
+  const changePageNum = pageNumber => {
191 191
       getList({ pageNum: pageNumber, pageSize: 10 })
192 192
   }
193 193
 
@@ -258,7 +258,7 @@ const handleSubmit = (e, props) => {
258 258
       </AuthButton>
259 259
       <Table dataSource={data.list} columns={columns} pagination={false} rowKey="activityList"/>
260 260
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
261
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
261
+       <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={(e) => changePageNum(e)} />
262 262
       </div>
263 263
     </>
264 264
   )

+ 10
- 4
src/pages/activity/editActivity.jsx Visa fil

@@ -29,7 +29,7 @@ const { TextArea } = Input;
29 29
 const Edit = (props) => {
30 30
   const [tab, changeTab] = useState('basic')
31 31
   const dynamicId = props.location.query.dynamicId
32
-  const [dynamicData, setDynamicData] = useState({})
32
+  const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
33 33
   if (dynamicId) {
34 34
     useEffect(() => {
35 35
       getDynamicData(dynamicId);
@@ -50,6 +50,11 @@ const Edit = (props) => {
50 50
     });
51 51
   }
52 52
 
53
+  const radioOnChange = e => {
54
+    console.log(e.target.value)
55
+    setDynamicData({ ...dynamicData, isEnlist: e.target.value })
56
+  }
57
+
53 58
   const Basic = (props) => {
54 59
     const fields = [
55 60
       {
@@ -123,7 +128,7 @@ const Edit = (props) => {
123 128
       {
124 129
         label: '是否需要报名',
125 130
         name: 'isEnlist',
126
-        render: <Radio.Group name="radiogroup">
131
+        render: <Radio.Group name="radiogroup" onChange={(e) => radioOnChange(e)}>
127 132
           <Radio value={1}>是</Radio>
128 133
           <Radio value={0}>否</Radio>
129 134
         </Radio.Group>,
@@ -132,9 +137,10 @@ const Edit = (props) => {
132 137
       {
133 138
         label: '报名时间',
134 139
         name: 'signupTime',
135
-        type: FieldTypes.RangePicker,
140
+        // type: FieldTypes.RangePicker,
141
+        render: dynamicData.isEnlist === 1 ? (<RangePicker format={ 'YYYY/MM/DD HH:mm' } style={{ width: '100%' }} />) : '',
136 142
         value: dynamicData.enlistStart != null ? [moment(dynamicData.enlistStart, 'YYYY-MM-DD HH:mm'), moment(dynamicData.enlistEnd, 'YYYY-MM-DD HH:mm')] : null,
137
-        props: {showTime:{ format: 'HH:mm' }},
143
+        // props: {showTime:{ format: 'HH:mm' }},
138 144
         rules: [
139 145
           { required: true, message: '请选择报名时间' },
140 146
         ]

+ 1
- 1
src/pages/building/list/add/components/base.jsx Visa fil

@@ -90,7 +90,7 @@ function AddBuilding(props) {
90 90
     const api = data.buildingId === undefined ? apis.building.addBuilding : apis.building.updateBuilding
91 91
     request({ ...api, data: { ...data } }).then(() => {
92 92
       openNotificationWithIcon('success', '操作成功')
93
-      router.go(-1)
93
+      // router.go(-1)
94 94
     }).catch(err => {
95 95
       openNotificationWithIcon('error', err.message)
96 96
     })

+ 14
- 5
src/pages/building/list/add/components/buildingProjectType.jsx Visa fil

@@ -1,5 +1,5 @@
1 1
 import React, { useEffect, useState } from 'react'
2
-import { Button, Radio, Icon, Form, Input, Row, Col, Modal, notification, Checkbox } from 'antd';
2
+import { Button, Radio, Icon, Form, Input, Row, Col, Modal, notification, Checkbox, InputNumber } from 'antd';
3 3
 import { render } from 'react-dom';
4 4
 import request from '../../../../../utils/request';
5 5
 import apis from '../../../../../services/apis';
@@ -32,7 +32,13 @@ class TypeForm extends React.Component {
32 32
     this.props.form.validateFieldsAndScroll((err, values) => {
33 33
       if (!err) {
34 34
         // console.log('Received values of form: ', values);
35
-        values[name] = e.target.value
35
+        const currentValue = e.target.value
36
+        if (currentValue === '') {
37
+          values[name] = null
38
+        } else {
39
+          values[name] = currentValue
40
+        }
41
+        
36 42
         values.buildingTypeName = this.props.type.buildingTypeName
37 43
         console.log('values: ', values)
38 44
         this.props.onSuccess(values)
@@ -48,7 +54,7 @@ class TypeForm extends React.Component {
48 54
     const { getFieldDecorator } = this.props.form;
49 55
 
50 56
     // this.props.form.setFieldsValue(this.props.type)
51
-
57
+    console.log(this.props.type)
52 58
     return (
53 59
       <>
54 60
         <Col span={11} style={{
@@ -130,7 +136,7 @@ class ProjectTypeBody extends React.Component {
130 136
     const { projectType } = this.state
131 137
     const buildingType = projectType.filter(item => checked.includes(`${item.buildingTypeId}`))
132 138
 
133
-    const tempDate = buildingType.map(item => ({ buildingTypeId: item.buildingTypeId, buildingTypeName: item.buildingTypeName, price: '', decoration: '', rightsYear: '', status: '1' }))
139
+    const tempDate = buildingType.map(item => ({ buildingTypeId: item.buildingTypeId, buildingTypeName: item.buildingTypeName, price: null, decoration: null, rightsYear: null, status: '1' }))
134 140
     const updateProjectDate = this.updateProjectType(tempDate)
135 141
     console.log('updateProjectDate: ', updateProjectDate)
136 142
     this.setState({ data: updateProjectDate })
@@ -138,7 +144,10 @@ class ProjectTypeBody extends React.Component {
138 144
 
139 145
   onClose = e => {
140 146
     const { data } = this.state
147
+    console.log('onClose——data: ', data)
148
+    console.log('onClose: ', e.buildingTypeId)
141 149
     const buildingType = data.filter(item => e.buildingTypeId !== item.buildingTypeId)
150
+    console.log('onClose——data: ', buildingType)
142 151
     this.setState({ data: buildingType })
143 152
     this.setState({ defaultCheckboxValue: buildingType.map(item => item.buildingTypeId) })
144 153
   }
@@ -234,7 +243,7 @@ class ProjectTypeBody extends React.Component {
234 243
         </Modal>
235 244
         <Row type="flex" justify="space-between">
236 245
           {
237
-            this.state.data.map(item => <WrappedTypeForm type={item} key={item.id} onSuccess={(e) => this.onSuccess(e, item)} onClose={(e) => this.onClose(e)} />)
246
+            this.state.data.map(item => <WrappedTypeForm type={item} key={item.buildingTypeId} onSuccess={(e) => this.onSuccess(e, item)} onClose={(e) => this.onClose(e)} />)
238 247
           }
239 248
         </Row>
240 249
       </>

+ 109
- 0
src/pages/third/editThirdParty.jsx Visa fil

@@ -0,0 +1,109 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import apis from '../../services/apis';
6
+import moment from 'moment';
7
+import router from 'umi/router';
8
+import BuildSelect from '../../components/SelectButton/BuildSelect'
9
+import XForm, { FieldTypes } from '../../components/XForm';
10
+import Wangedit from '../../components/Wangedit/Wangedit'
11
+import request from '../../utils/request'
12
+import yinhao from '../../assets/yinhao.png'
13
+import ImageUploader from '../../components/XForm/ImageUpload';
14
+import logo from '../../assets/logo.png';
15
+import touxiang from '../../assets/touxiang.jpg';
16
+import poster1 from '../../assets/poster1.png';
17
+import poster2 from '../../assets/poster2.png';
18
+import xiaochengxu from '../../assets/xiaochengxu.png'
19
+
20
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
21
+const { TextArea } = Input;
22
+
23
+/**
24
+ *
25
+ *
26
+ * @param {*} props
27
+ * @returns
28
+ */
29
+const third = (props) => {
30
+  const configId = props.location.query.configId
31
+  const [thirdData, setThirdData] = useState({})
32
+  if (configId) {
33
+    useEffect(() => {
34
+      getThirdData(configId);
35
+    }, [])
36
+
37
+    // 查询列表
38
+    const getThirdData = (configId) => {
39
+      request({ ...apis.third.details, urlData: { id: configId } }).then((data) => {
40
+        console.log(data)
41
+        setThirdData(data)
42
+      })
43
+    }
44
+  }
45
+
46
+  const cancelPage = () => {
47
+    router.push({
48
+      pathname: '/third/thirdList',
49
+    });
50
+  }
51
+ 
52
+  const fields = [
53
+    {
54
+      label: 'appid',
55
+      name: 'appid',
56
+      type: FieldTypes.Text,
57
+      value: thirdData.appid,
58
+      rules: [
59
+        { required: true, message: '请输入appid' },
60
+      ]
61
+    },
62
+    {
63
+      label: 'appSecret',
64
+      name: 'appSecret',
65
+      type: FieldTypes.Text,
66
+      value: thirdData.appSecret,
67
+      rules: [
68
+        { required: true, message: '请输入appSecret' },
69
+      ]
70
+    },
71
+    {
72
+      label: '过期时间',
73
+      name: 'expirationDate',
74
+      type: FieldTypes.DatePicker,
75
+      value: thirdData.expirationDate != null ? moment(thirdData.expirationDate, 'YYYY-MM-DD HH:mm') : null,
76
+      rules: [
77
+        { required: true, message: '请选择时间' },
78
+      ]
79
+    },
80
+  ]
81
+
82
+  const handleSubmit = val => {
83
+    console.log('submit data --->', val)
84
+    if (configId) {
85
+      val.configId = configId
86
+      request({ ...apis.third.update, data: val }).then((data) => {
87
+        message.info("保存成功")
88
+        cancelPage()
89
+      }).catch((err) => {
90
+        message.info(err.msg || err.message)
91
+      })
92
+    } else {
93
+      request({ ...apis.third.add, data: val }).then((data) => {
94
+        message.info("保存成功")
95
+        cancelPage()
96
+      }).catch((err) => {
97
+        message.info(err.msg || err.message)
98
+      })
99
+    }
100
+  }
101
+
102
+  return (
103
+    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
104
+  );
105
+}
106
+
107
+
108
+
109
+export default third

+ 103
- 0
src/pages/third/thirdList.jsx Visa fil

@@ -0,0 +1,103 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import router from 'umi/router';
6
+import moment from 'moment';
7
+import SelectCity from '../../components/SelectButton/CitySelect'
8
+import BuildSelect from '../../components/SelectButton/BuildSelect'
9
+import apis from '../../services/apis';
10
+import request from '../../utils/request';
11
+import AuthButton from '@/components/AuthButton';
12
+
13
+const { Option } = Select;
14
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15
+
16
+const header = (props) => {
17
+  const [ data, setData ] = useState({})
18
+//   const [page, changePage] = useState({})
19
+
20
+  useEffect(() => {
21
+    getList({ pageNum: 1, pageSize: 10 });
22
+  },[])
23
+
24
+  // 查询列表
25
+  const getList = (params) => {
26
+    request({ ...apis.third.thirdPartyMiniapp, params: { ...params },}).then((data) => {
27
+        console.log(data)
28
+        setData(data)
29
+    })
30
+  }
31
+
32
+  //重置搜索
33
+  const handleReset = () => {
34
+    props.form.resetFields();
35
+  }
36
+
37
+  const toEditThirdParty =  (configId) => () => {
38
+    router.push({
39
+      pathname: '/third/editThirdParty',
40
+      query: {
41
+        configId
42
+      },
43
+    });
44
+  }
45
+
46
+  const columns = [
47
+    {
48
+      title: 'appid',
49
+      dataIndex: 'appid',
50
+      key: 'appid',
51
+      align: 'center',
52
+    },
53
+    {
54
+      title: 'appSecret',
55
+      dataIndex: 'appSecret',
56
+      key: 'appSecret',
57
+      align: 'center',
58
+    },
59
+    {
60
+      title: '过期时间',
61
+      dataIndex: 'expirationDate',
62
+      key: 'expirationDate',
63
+      align: 'center',
64
+      render: (x, row) => <><span>{moment(row.expirationDate).format('YYYY-MM-DD')}</span></>
65
+    },
66
+    {
67
+      title: '操作',
68
+      dataIndex: 'handle',
69
+      key: 'handle',
70
+      align: 'center',
71
+      render: (x,row) => (
72
+        <>
73
+          <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
74
+            <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditThirdParty(row.configId)}>编辑<Icon type="form" className={styles.edit} /></span>
75
+          </AuthButton>
76
+        </>
77
+      )
78
+    },
79
+  ];
80
+   
81
+  
82
+  const changePageNum = (pageNumber) => {
83
+      getList({ pageNum: pageNumber, pageSize: 10 })
84
+  }
85
+ 
86
+
87
+  const { getFieldDecorator } = props.form
88
+  return (
89
+
90
+    <>
91
+      <AuthButton name="admin.buildingDynamic.add.post" noRight={null}>
92
+        <Button type="danger" className={styles.addBtn} onClick={toEditThirdParty()}>新增</Button>
93
+      </AuthButton>
94
+      <Table rowKey="messageList" dataSource={data.records} columns={columns} pagination={false}/>
95
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
96
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
97
+      </div>
98
+    </>
99
+  )
100
+}
101
+const WrappedHeader = Form.create({ name: 'header' })(header);
102
+
103
+export default WrappedHeader

+ 22
- 0
src/services/apis.js Visa fil

@@ -685,4 +685,26 @@ export default {
685 685
     action: 'admin.taRole.get',
686 686
   },
687 687
  },
688
+ third: {
689
+  thirdPartyMiniapp: {
690
+    url: `${prefix}/thirdPartyMiniapp`,
691
+    method: 'GET',
692
+    action: 'admin.thirdPartyMiniapp.get',
693
+  },
694
+  update: {
695
+    url: `${prefix}/thirdPartyMiniapp/update`,
696
+    method: 'PUT',
697
+    action: 'admin.thirdPartyMiniapp.update.put',
698
+  },
699
+  add: {
700
+    url: `${prefix}/thirdPartyMiniapp/add`,
701
+    method: 'POST',
702
+    action: 'admin.thirdPartyMiniapp.add.post',
703
+  },
704
+  details: {
705
+    url: `${prefix}/thirdPartyMiniapp/:id`,
706
+    method: 'GET',
707
+    action: 'admin.thirdPartyMiniapp.id.get',
708
+  },
709
+ },
688 710
 }