Browse Source

新闻增加字段

master
suomingxiang 2 months ago
parent
commit
74c56451f9
2 changed files with 11 additions and 7 deletions
  1. 0
    1
      src/components/DictTag/index.tsx
  2. 11
    6
      src/pages/News/NewsList/edit.tsx

+ 0
- 1
src/components/DictTag/index.tsx View File

81
           return 'default';
81
           return 'default';
82
         }
82
         }
83
         if (props.enums && props.enums.length > 0) {
83
         if (props.enums && props.enums.length > 0) {
84
-          console.log(props.enums);
85
           const item = props.enums[value];
84
           const item = props.enums[value];
86
           return item.listClass || 'default';
85
           return item.listClass || 'default';
87
         }
86
         }

+ 11
- 6
src/pages/News/NewsList/edit.tsx View File

6
   ProFormUploadButton,
6
   ProFormUploadButton,
7
   ProFormSelect,
7
   ProFormSelect,
8
   ProFormDatePicker,
8
   ProFormDatePicker,
9
-  ProFormRadio
9
+  ProFormRadio,
10
+  ProFormSwitch
10
 } from '@ant-design/pro-components';
11
 } from '@ant-design/pro-components';
11
 import { Form, Modal, Drawer, message, Upload, Space, Button, Switch,Input,Tooltip } from 'antd';
12
 import { Form, Modal, Drawer, message, Upload, Space, Button, Switch,Input,Tooltip } from 'antd';
12
 import {InfoCircleOutlined} from '@ant-design/icons';
13
 import {InfoCircleOutlined} from '@ant-design/icons';
101
     if(!props.open) return;
102
     if(!props.open) return;
102
     // const { title, content, surface, surfaceUrl, date } = props;
103
     // const { title, content, surface, surfaceUrl, date } = props;
103
     if(!props.currentRow) return;
104
     if(!props.currentRow) return;
104
-    const { digest, top,key,content,surface,surfaceUrl,date,title,source,column} = props.currentRow;
105
+    const { digest, top,key,content,surface,surfaceUrl,date,title,source,column,newsTop} = props.currentRow;
105
     if (props.currentRow) {
106
     if (props.currentRow) {
106
       form.setFieldsValue({
107
       form.setFieldsValue({
107
         digest,
108
         digest,
108
         top,
109
         top,
109
         key,
110
         key,
110
         column,
111
         column,
111
-        source
112
+        source,
113
+        newsTop:newsTop?true:false,
112
       })
114
       })
113
       // if (top) {
115
       // if (top) {
114
       //   setCheckTop(1)
116
       //   setCheckTop(1)
212
     // console.log('htmlStr----', htmlStr)
214
     // console.log('htmlStr----', htmlStr)
213
     editor.setContents(content)
215
     editor.setContents(content)
214
     data.date = moment(data.date).format('YYYY-MM-DD');
216
     data.date = moment(data.date).format('YYYY-MM-DD');
215
-    if(checkTop){
216
-      data.top = 1;
217
+    if(data.newsTop){
218
+      data.newsTop = 1;
217
     }else{
219
     }else{
218
-      data.top = 0;
220
+      data.newsTop = 0;
219
     } 
221
     } 
220
     // data.top = checkTop;
222
     // data.top = checkTop;
221
     let formData = {
223
     let formData = {
321
             {fileList?.length < 1 && '+' + intl.formatMessage({ id: 'public.uploadImg' })}
323
             {fileList?.length < 1 && '+' + intl.formatMessage({ id: 'public.uploadImg' })}
322
           </Upload>
324
           </Upload>
323
         </ProForm.Item>
325
         </ProForm.Item>
326
+        <ProFormSwitch labelCol={{
327
+            style: { width: 95 }
328
+          }} name="newsTop" label="置顶" />
324
         <ProFormDatePicker
329
         <ProFormDatePicker
325
           name="date"
330
           name="date"
326
           label='日期'
331
           label='日期'

Loading…
Cancel
Save