傅行帆 преди 5 години
родител
ревизия
5e3215e75e
променени са 4 файла, в които са добавени 252 реда и са изтрити 0 реда
  1. 18
    0
      config/routes.js
  2. 109
    0
      src/pages/third/editThirdParty.jsx
  3. 103
    0
      src/pages/third/thirdList.jsx
  4. 22
    0
      src/services/apis.js

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

@@ -363,6 +363,24 @@ export default [
363 363
               },
364 364
             ],
365 365
           },
366
+          {
367
+            path: '/third',
368
+            name: '第三方管理',
369
+            component: '../layouts/BlankLayout',
370
+            routes: [
371
+              {
372
+                path: '/third/thirdList',
373
+                name: '第三方公司',
374
+                component: './third/thirdList',
375
+              },
376
+              {
377
+                path: '/third/editThirdParty',
378
+                name: '编辑活动',
379
+                hideInMenu: true,
380
+                component: './third/editThirdParty',
381
+              },
382
+            ],
383
+          },
366 384
           {
367 385
             component: './404',
368 386
           },

+ 109
- 0
src/pages/third/editThirdParty.jsx Целия файл

@@ -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 Целия файл

@@ -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 Целия файл

@@ -678,4 +678,26 @@ export default {
678 678
     action: 'admin.updateAuthMenu.post',
679 679
   },
680 680
  },
681
+ third: {
682
+  thirdPartyMiniapp: {
683
+    url: `${prefix}/thirdPartyMiniapp`,
684
+    method: 'GET',
685
+    action: 'admin.thirdPartyMiniapp.get',
686
+  },
687
+  update: {
688
+    url: `${prefix}/thirdPartyMiniapp/update`,
689
+    method: 'PUT',
690
+    action: 'admin.thirdPartyMiniapp.update.put',
691
+  },
692
+  add: {
693
+    url: `${prefix}/thirdPartyMiniapp/add`,
694
+    method: 'POST',
695
+    action: 'admin.thirdPartyMiniapp.add.post',
696
+  },
697
+  details: {
698
+    url: `${prefix}/thirdPartyMiniapp/:id`,
699
+    method: 'GET',
700
+    action: 'admin.thirdPartyMiniapp.id.get',
701
+  }
702
+ }
681 703
 }