Kaynağa Gözat

新闻增加字段

master
suomingxiang 2 ay önce
ebeveyn
işleme
0a3136a561
1 değiştirilmiş dosya ile 21 ekleme ve 3 silme
  1. 21
    3
      src/pages/News/NewsList/edit.tsx

+ 21
- 3
src/pages/News/NewsList/edit.tsx Dosyayı Görüntüle

@@ -7,7 +7,8 @@ import {
7 7
   ProFormSelect,
8 8
   ProFormDatePicker,
9 9
   ProFormRadio,
10
-  ProFormSwitch
10
+  ProFormSwitch,
11
+  ProFormDateTimePicker
11 12
 } from '@ant-design/pro-components';
12 13
 import { Form, Modal, Drawer, message, Upload, Space, Button, Switch,Input,Tooltip } from 'antd';
13 14
 import {InfoCircleOutlined} from '@ant-design/icons';
@@ -102,7 +103,7 @@ const NewsForm: React.FC<NewsProps> = (props) => {
102 103
     if(!props.open) return;
103 104
     // const { title, content, surface, surfaceUrl, date } = props;
104 105
     if(!props.currentRow) return;
105
-    const { digest, top,key,content,surface,surfaceUrl,date,title,source,column,newsTop} = props.currentRow;
106
+    const { digest, top,key,content,surface,surfaceUrl,date,title,source,column,newsTop,createTime} = props.currentRow;
106 107
     if (props.currentRow) {
107 108
       form.setFieldsValue({
108 109
         digest,
@@ -110,6 +111,7 @@ const NewsForm: React.FC<NewsProps> = (props) => {
110 111
         key,
111 112
         column,
112 113
         source,
114
+        createTime,
113 115
         newsTop:newsTop?true:false,
114 116
       })
115 117
       // if (top) {
@@ -214,6 +216,7 @@ const NewsForm: React.FC<NewsProps> = (props) => {
214 216
     // console.log('htmlStr----', htmlStr)
215 217
     editor.setContents(content)
216 218
     data.date = moment(data.date).format('YYYY-MM-DD');
219
+    data.createTime = moment(data.createTime).format('YYYY-MM-DD HH:mm:ss');
217 220
     if(data.newsTop){
218 221
       data.newsTop = 1;
219 222
     }else{
@@ -342,7 +345,22 @@ const NewsForm: React.FC<NewsProps> = (props) => {
342 345
           ]
343 346
           }
344 347
         />
345
-
348
+        <ProFormDateTimePicker
349
+          name="createTime"
350
+          label='发稿时间'
351
+          fieldProps={{
352
+            format: (value) => value.format('YYYY-MM-DD HH:mm:ss'),
353
+          }}
354
+          labelCol={{
355
+            style: { width: 95 }
356
+          }}
357
+          rules={[
358
+            {
359
+              required: true
360
+            }
361
+          ]
362
+          }
363
+        />
346 364
         <ProFormSelect
347 365
           name="column"
348 366
           key="column"

Loading…
İptal
Kaydet