|
@@ -0,0 +1,73 @@
|
|
1
|
+import React, { useState, useEffect } from 'react';
|
|
2
|
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert } from 'antd';
|
|
3
|
+import { FormattedMessage } from 'umi-plugin-react/locale';
|
|
4
|
+import channels from '../channel/channelList.less';
|
|
5
|
+import BuildSelect from '../../components/SelectButton/BuildSelect'
|
|
6
|
+import XForm, { FieldTypes } from '../../components/XForm';
|
|
7
|
+import Wangedit from '../../components/Wangedit/Wangedit'
|
|
8
|
+import router from 'umi/router';
|
|
9
|
+import apis from '../../services/apis';
|
|
10
|
+import request from '../../utils/request'
|
|
11
|
+
|
|
12
|
+const { TextArea } = Input;
|
|
13
|
+const { Option } = Select;
|
|
14
|
+
|
|
15
|
+const header = props => {
|
|
16
|
+ const ruleId = props.location.query.ruleId
|
|
17
|
+ const [ ruleData, setRuleData ] = useState({})
|
|
18
|
+ if(ruleId){
|
|
19
|
+ useEffect(() => {
|
|
20
|
+ getRuleData(ruleId);
|
|
21
|
+ },[])
|
|
22
|
+
|
|
23
|
+ // 查询列表
|
|
24
|
+ const getRuleData = (ruleId) => {
|
|
25
|
+ request({ ...apis.integralMall.rulesDetail, urlData: { id: ruleId },}).then((data) => {
|
|
26
|
+ console.log(data)
|
|
27
|
+ setRuleData(data)
|
|
28
|
+ })
|
|
29
|
+ }
|
|
30
|
+ }
|
|
31
|
+
|
|
32
|
+ const fields = [
|
|
33
|
+ {
|
|
34
|
+ label: '获取积分',
|
|
35
|
+ name: 'pointsAmount',
|
|
36
|
+ type: FieldTypes.Text,
|
|
37
|
+ value: ruleData.pointsAmount,
|
|
38
|
+ },
|
|
39
|
+ {
|
|
40
|
+ label: '说明',
|
|
41
|
+ name: 'remark',
|
|
42
|
+ type: FieldTypes.Text,
|
|
43
|
+ value: ruleData.remark,
|
|
44
|
+ }
|
|
45
|
+ ]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+ const handleSubmit = (values) => {
|
|
49
|
+ if(ruleId){
|
|
50
|
+ values.ruleId = ruleId
|
|
51
|
+ request({ ...apis.integralMall.rulesUpdate, data: values,}).then((data) => {
|
|
52
|
+ cancelPage()
|
|
53
|
+ }).catch((err) => {
|
|
54
|
+ message.info(err.msg || err.message)
|
|
55
|
+ })
|
|
56
|
+ }else{
|
|
57
|
+
|
|
58
|
+ }
|
|
59
|
+ }
|
|
60
|
+
|
|
61
|
+ const cancelPage = () => {
|
|
62
|
+ router.push({
|
|
63
|
+ pathname: '/integralMall/achieve',
|
|
64
|
+ });
|
|
65
|
+ }
|
|
66
|
+
|
|
67
|
+ return (
|
|
68
|
+ <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
|
|
69
|
+ )
|
|
70
|
+}
|
|
71
|
+
|
|
72
|
+const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
|
|
73
|
+export default WrappedNormalLoginForm
|