|
@@ -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
|