Kaynağa Gözat

新闻增加字段

master
suomingxiang 2 ay önce
ebeveyn
işleme
74c56451f9

+ 0
- 1
src/components/DictTag/index.tsx Dosyayı Görüntüle

@@ -81,7 +81,6 @@ const DictTag: React.FC<DictTagProps> = (props) => {
81 81
           return 'default';
82 82
         }
83 83
         if (props.enums && props.enums.length > 0) {
84
-          console.log(props.enums);
85 84
           const item = props.enums[value];
86 85
           return item.listClass || 'default';
87 86
         }

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

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

Loading…
İptal
Kaydet