傅行帆 5 jaren geleden
bovenliggende
commit
69257ef32c
2 gewijzigde bestanden met toevoegingen van 101 en 64 verwijderingen
  1. 96
    64
      src/pages/promote/detail.jsx
  2. 5
    0
      src/services/apis.js

+ 96
- 64
src/pages/promote/detail.jsx Bestand weergeven

@@ -10,19 +10,19 @@ import moment from 'moment';
10 10
 
11 11
 
12 12
 const header = props => {
13
-    const newsId = props.location.query.id
13
+    const serialNo = props.location.query.id
14 14
   
15
-    const [ data, setData ] = useState({})
16
-    if(newsId){
15
+    const [ currentData, setData ] = useState({})
16
+    if(serialNo){
17 17
       useEffect(() => {
18
-        getNewData(newsId);
18
+        getData(serialNo);
19 19
       },[])
20 20
   
21 21
     // 查询列表
22
-    const getNewData = (newsId) => {
22
+    const getData = (serialNo) => {
23 23
       request({
24
-          ...apis.officenews.get,
25
-          urlData: { id: newsId }
24
+          ...apis.promote.get,
25
+          urlData: { id: serialNo }
26 26
       }).then((data) => {
27 27
         setData(data)
28 28
       }).catch((err) => {
@@ -31,65 +31,97 @@ const header = props => {
31 31
     }
32 32
     }
33 33
   
34
-    const fields = [
35
-      {
36
-        label: '资讯封面',
37
-        name: 'thumb',
38
-        type: FieldTypes.ImageUploader,
39
-        value: data.thumb,
40
-        rules: [
41
-            { required: true, message: '请选择资讯封面' },
42
-        ],
43
-        help: '建议尺寸:500px*400px,比例5:4,格式:jpg,用于:橙蕉官网新闻资讯列表',
44
-      },    
45
-      {
46
-        label: '资讯标题',
47
-        name: 'title',
48
-        type: FieldTypes.Text,
49
-        value: data.title
50
-      },
51
-      {
52
-        label: '资讯详情',
53
-        name: 'content',
54
-        value: data.content,
55
-        render: <Wangedit />
56
-      },
57
-      {
58
-        label: '状态',
59
-        name: 'status',
60
-        value: data.status,
61
-        render: <Select style={{ width: '180px' }} placeholder="发布状态">
62
-                    <Option value={0}>已发布</Option>
63
-                    <Option value={1}>未发布</Option>
64
-                </Select>,
65
-      },
66
-    ]
67
-  
68
-     
69
-    const handleSubmit = (values) => {
70
-      if(newsId){
71
-          request({ ...apis.officenews.update, urlData: { id: newsId }, data: { ...values }}).then((data) => {
72
-            cancelPage();
73
-          }).catch((err) => {
74
-            message.error(err.msg || err.message)
75
-          })
76
-        }else{
77
-          request({ ...apis.officenews.save, data: { ...values }}).then((data) => {
78
-            cancelPage();
79
-          }).catch((err) => {
80
-            message.error(err.msg || err.message)
81
-          })
82
-        }
83
-    }
84
-  
85
-    const cancelPage = () => {
86
-      router.push({
87
-        pathname: '/officenews/index',
88
-      });
89
-    }
90 34
   
35
+    const formItemLayout = {
36
+      labelCol: { span: 6 },
37
+      wrapperCol: { span: 14 },
38
+    };
39
+
40
+    const { getFieldDecorator } = props.form
41
+
91 42
     return (
92
-      <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
43
+      <div>
44
+      <Form {...formItemLayout} >
45
+                    <Form.Item label="公司名称">
46
+                        {getFieldDecorator('company',{
47
+                            initialValue: currentData.company,
48
+                        })(
49
+                            <Input
50
+                                disabled
51
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
52
+                                placeholder="公司名称"
53
+                            />,
54
+                        )}
55
+                    </Form.Item>
56
+                   <Form.Item label="联系人">
57
+                        {getFieldDecorator('name',{
58
+                            initialValue: currentData.name
59
+                        })(
60
+                            <Input
61
+                                disabled
62
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
63
+                                placeholder="联系人"
64
+                            />,
65
+                        )}
66
+                    </Form.Item>
67
+                    <Form.Item label="手机号">
68
+                        {getFieldDecorator('phone',{
69
+                            initialValue: currentData.phone
70
+                        })(
71
+                            <Input
72
+                                disabled
73
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
74
+                                placeholder="手机号"
75
+                            />,
76
+                        )}
77
+                    </Form.Item>
78
+                    <Form.Item label="需求备注">
79
+                        {getFieldDecorator('demand',{
80
+                            initialValue: currentData.demand
81
+                        })(
82
+                            <Input
83
+                                disabled
84
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
85
+                                placeholder="需求备注"
86
+                            />,
87
+                        )}
88
+                    </Form.Item>
89
+                   <Form.Item label="跟进状态">
90
+                        {getFieldDecorator('status',{
91
+                            initialValue: currentData.status === 1 ? '有效' : currentData.status === 2 ? "待跟进" : '无效'
92
+                        })(
93
+                          <Input
94
+                          disabled
95
+                          prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
96
+                          placeholder="需求备注"
97
+                      />,
98
+                        )}
99
+                    </Form.Item>
100
+                {/* <Form.Item label="跟进备注">
101
+                        {getFieldDecorator('follow',{
102
+                            initialValue: currentData.follow
103
+                        })(
104
+                            <Input
105
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
106
+                                placeholder="跟进备注"
107
+                            />,
108
+                        )}
109
+                    </Form.Item> */}
110
+                <Form.Item label="备注信息">
111
+                        {getFieldDecorator('remark',{
112
+                            initialValue: currentData.remark
113
+                        })(
114
+                            <Input
115
+                                disabled
116
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
117
+                                placeholder="备注信息"
118
+                            />,
119
+                        )}
120
+                    </Form.Item>
121
+                </Form>
122
+
123
+                <Button type="danger" style={{marginLeft: "50em"}} onClick={() => router.go(-1)}>关闭</Button>
124
+      </div>
93 125
     )
94 126
   }
95 127
   

+ 5
- 0
src/services/apis.js Bestand weergeven

@@ -449,6 +449,11 @@ const apis = {
449 449
       method: 'PUT',
450 450
       action: 'channel',
451 451
     },
452
+    get: {
453
+      url: `${prefix}/taOfficeContact/:id`,
454
+      method: 'GET',
455
+      action: 'channel',
456
+    },
452 457
   },
453 458
 }
454 459