Przeglądaj źródła

富文本修改

master
suomingxiang 5 miesięcy temu
rodzic
commit
6aee2035c1

+ 1
- 1
src/app.less Wyświetl plik

@@ -5,4 +5,4 @@
5 5
         align-items: center;
6 6
         border-bottom: none;
7 7
     }
8
-}
8
+}

+ 36
- 11
src/pages/JoinZZ/biddingDocument/edit.tsx Wyświetl plik

@@ -4,16 +4,34 @@ import {
4 4
   ProFormText,
5 5
   ProFormDatePicker,
6 6
   ProFormTextArea,
7
+  ProFormDateTimePicker,
7 8
 } from '@ant-design/pro-components';
8 9
 import { Form, Drawer, Space, Button } from 'antd';
9
-import ReactQuill from 'react-quill';
10
+import ReactQuill, { Quill } from 'react-quill';
10 11
 import 'react-quill/dist/quill.snow.css';
12
+// import 'react-quill/dist/quill.bubble.css'
11 13
 import { useIntl } from '@umijs/max';
12 14
 import { upload } from '@/services/JoinZZ/biddingDocument';
13 15
 // import Quill from "quill";
14 16
 // import "quill/dist/quill.snow.css";
15 17
 import moment from 'moment';
18
+const SizeStyle = Quill.import('attributors/style/size')
19
+SizeStyle.whitelist = ['6px','8px','9px','10px','11px','12px','14px', '16px', '18px', '20px','22px','24px','26px','28px', '32px', '36px','48px','72px']
20
+Quill.register(SizeStyle, true)
16 21
 
22
+var Parchment = Quill.import('parchment');
23
+
24
+let config = {
25
+  scope: Parchment.Scope.INLINE,
26
+  // 会有下拉框列表
27
+  whitelist: ['20px', '22px', '24px', '26px', '28px', '30px', '32px', '34px', '36px', '38px', '40px', '42px', '44px']
28
+  //可设置成没有下拉框的,但会导致无法清除样式
29
+  // whitelist: ['1px solid #000000']  
30
+};
31
+
32
+let wordBox = new Parchment.Attributor.Style('wordBox', 'line-height', config);
33
+
34
+Quill.register(wordBox, true);
17 35
 export type BiddingDocumentProps = {
18 36
   onCancel: (flag?: boolean, formVals?: any) => void;
19 37
   onSubmit: (values: any) => Promise<void>;
@@ -28,15 +46,14 @@ let toolbarOptions = [
28 46
   [{ 'script': 'sub' }, { 'script': 'super' }],      // 上标/下标
29 47
   [{ 'indent': '-1' }, { 'indent': '+1' }],          // 减少缩进/缩进
30 48
   [{ 'direction': 'rtl' }],                         // 文本下划线
31
-  [{ 'size': ['small', false, 'large', 'huge'] }],  // 用户自定义下拉
49
+  // [{ 'size': ['small', false, 'large', 'huge'] }],  // /用户自定义下拉
50
+  [{ 'size': ['6px','8px','9px','10px','11px','12px','14px', '16px', '18px', '20px','22px','24px','26px','28px', '32px', '36px','48px','72px']}],
32 51
   [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
33 52
   [{ 'color': [] }, { 'background': [] }],          // 主题默认下拉,使用主题提供的值
34
-  [{ 'font': [] }],
35
-  [{ 'align': [] }],
36
-  // [{ 'wordBox': ['20px', '22px', '24px', '26px', '28px', '28px', '30px'] }],
37 53
   [{ wordBox: ['20px', '22px', '24px', '26px', '28px', '30px', '32px', '34px', '36px', '38px', '40px', '42px', '44px'] }],
38
-  ['clean'],                                         // 清除格式
39
-
54
+  // [{ 'font': [] }],
55
+  [{ 'align': [] }],
56
+  ['clean'], // 清除格式
40 57
 ];
41 58
 const modules = {
42 59
   toolbar: {
@@ -87,12 +104,13 @@ const BiddingDocumentForm: React.FC<BiddingDocumentProps> = (props) => {
87 104
     if(!props.open) return;
88 105
     // const { title, content, surface, surfaceUrl, date } = props;
89 106
     if(!props.currentRow) return;
90
-    const { digest, top,key,content,surface,surfaceUrl,date,title,source} = props.currentRow;
107
+    const { digest, top,key,content,surface,surfaceUrl,date,title,source,createTime} = props.currentRow;
91 108
     if (props.currentRow) {
92 109
       form.setFieldsValue({
93 110
         digest,
94 111
         top,
95
-        key
112
+        key,
113
+        createTime
96 114
       })
97 115
       // if (top) {
98 116
       //   setCheckTop(1)
@@ -155,6 +173,7 @@ const BiddingDocumentForm: React.FC<BiddingDocumentProps> = (props) => {
155 173
     // console.log('htmlStr----', htmlStr)
156 174
     // editor.setContents(content)
157 175
     data.date = moment(data.date).format('YYYY-MM-DD');
176
+    data.createTime = moment(data.createTime).format('YYYY-MM-DD HH:mm:ss');
158 177
     if(checkTop){
159 178
       data.top = 1;
160 179
     }else{
@@ -287,7 +306,13 @@ const BiddingDocumentForm: React.FC<BiddingDocumentProps> = (props) => {
287 306
           ]
288 307
           }
289 308
         />
290
-         
309
+        <ProFormDateTimePicker
310
+          name="createTime"
311
+          label='发稿时间'
312
+          fieldProps={{ format: (value) => value.format('YYYY-MM-DD HH:mm:ss') }}
313
+          labelCol={{ style: { width: 95 } }}
314
+          rules={[{ required: true }]}
315
+        />
291 316
         <ProFormText
292 317
           name="key"
293 318
           label='网页关键字'
@@ -314,7 +339,7 @@ const BiddingDocumentForm: React.FC<BiddingDocumentProps> = (props) => {
314 339
         }}
315 340
         >
316 341
           {/* <div id='editor' style={{ width: '70vw', height: '500px' }} ref={editorRef}></div> */}
317
-          <ReactQuill ref={editorRef} placeholder='请输入...' theme='snow' className="ql-editor" modules={modules} value={editorHtml} onChange={handleChangeQuill} />
342
+          <ReactQuill style={{ width:'70vw' }} ref={editorRef} placeholder='请输入...' theme='snow' className="ql-editor" modules={modules} value={editorHtml} onChange={handleChangeQuill} />
318 343
         </ProForm.Item>
319 344
       </ProForm>
320 345
     </Drawer>

+ 350
- 1
src/pages/JoinZZ/biddingDocument/index.less Wyświetl plik

@@ -1,3 +1,352 @@
1 1
 .ant-pro-table-list-toolbar-title{
2 2
     display:none;
3
-}
3
+}
4
+
5
+
6
+.ql-toolbar {
7
+  &.ql-snow .ql-picker {
8
+    &.ql-size {
9
+      width: 60px;
10
+
11
+      & .ql-picker-label::before,
12
+      .ql-picker-item::before {
13
+        content: '默认';
14
+      }
15
+      & .ql-picker-label[data-value='6px']::before,
16
+      & .ql-picker-item[data-value='6px']::before {
17
+        content: '6px';
18
+      }
19
+      & .ql-picker-label[data-value='8px']::before,
20
+      & .ql-picker-item[data-value='8px']::before {
21
+        content: '8px';
22
+      }
23
+      & .ql-picker-label[data-value='9px']::before,
24
+      & .ql-picker-item[data-value='9px']::before {
25
+        content: '9px';
26
+      }
27
+      & .ql-picker-label[data-value='10px']::before,
28
+      & .ql-picker-item[data-value='10px']::before {
29
+        content: '10px';
30
+      }
31
+      & .ql-picker-label[data-value='11px']::before,
32
+      & .ql-picker-item[data-value='11px']::before {
33
+        content: '11px';
34
+      }
35
+
36
+      & .ql-picker-label[data-value='12px']::before,
37
+      & .ql-picker-item[data-value='12px']::before {
38
+        content: '12px';
39
+      }
40
+
41
+      & .ql-picker-label[data-value='14px']::before,
42
+      & .ql-picker-item[data-value='14px']::before {
43
+        content: '14px';
44
+      }
45
+
46
+      & .ql-picker-label[data-value='16px']::before,
47
+      & .ql-picker-item[data-value='16px']::before {
48
+        content: '16px';
49
+      }
50
+
51
+      & .ql-picker-label[data-value='18px']::before,
52
+      & .ql-picker-item[data-value='18px']::before {
53
+        content: '18px';
54
+      }
55
+      & .ql-picker-label[data-value='20px']::before,
56
+      & .ql-picker-item[data-value='20px']::before {
57
+        content: '20px';
58
+      }
59
+      & .ql-picker-label[data-value='22px']::before,
60
+      & .ql-picker-item[data-value='22px']::before {
61
+        content: '22px';
62
+      }
63
+      & .ql-picker-label[data-value='24px']::before,
64
+      & .ql-picker-item[data-value='24px']::before {
65
+        content: '24px';
66
+      }
67
+      & .ql-picker-label[data-value='26px']::before,
68
+      & .ql-picker-item[data-value='26px']::before {
69
+        content: '26px';
70
+      }
71
+      & .ql-picker-label[data-value='28px']::before,
72
+      & .ql-picker-item[data-value='28px']::before {
73
+        content: '28px';
74
+      }
75
+
76
+      & .ql-picker-label[data-value='32px']::before,
77
+      & .ql-picker-item[data-value='32px']::before {
78
+        content: '32px';
79
+      }
80
+      & .ql-picker-label[data-value='36px']::before,
81
+      & .ql-picker-item[data-value='36px']::before {
82
+        content: '36px';
83
+      }
84
+
85
+      & .ql-picker-label[data-value='48px']::before,
86
+      & .ql-picker-item[data-value='48px']::before {
87
+        content: '48px';
88
+      }
89
+      & .ql-picker-label[data-value='72px']::before,
90
+      & .ql-picker-item[data-value='72px']::before {
91
+        content: '72px';
92
+      }
93
+
94
+      & .ql-picker-item[data-value='6px']::before {
95
+        font-size: 6px;
96
+      }
97
+      & .ql-picker-item[data-value='8px']::before {
98
+        font-size: 8px;
99
+      }
100
+      & .ql-picker-item[data-value='9px']::before {
101
+        font-size: 9px;
102
+      }
103
+      & .ql-picker-item[data-value='10px']::before {
104
+        font-size: 10px;
105
+      }
106
+      & .ql-picker-item[data-value='11px']::before {
107
+        font-size: 11px;
108
+      }
109
+      & .ql-picker-item[data-value='12px']::before {
110
+        font-size: 12px;
111
+      }
112
+      & .ql-picker-item[data-value='14px']::before {
113
+        font-size: 14px;
114
+      }
115
+
116
+      & .ql-picker-item[data-value='16px']::before {
117
+        font-size: 16px;
118
+      }
119
+
120
+      & .ql-picker-item[data-value='18px']::before {
121
+        font-size: 18px;
122
+      }
123
+      & .ql-picker-item[data-value='20px']::before {
124
+        font-size: 20px;
125
+      }      
126
+      & .ql-picker-item[data-value='22px']::before {
127
+        font-size: 22px;
128
+      }
129
+      & .ql-picker-item[data-value='24px']::before {
130
+        font-size: 24px;
131
+      }
132
+      & .ql-picker-item[data-value='26px']::before {
133
+        font-size: 26px;
134
+      }
135
+      & .ql-picker-item[data-value='28px']::before {
136
+        font-size: 28px;
137
+      }
138
+
139
+      & .ql-picker-item[data-value='32px']::before {
140
+        font-size: 32px;
141
+      }
142
+      & .ql-picker-item[data-value='36px']::before {
143
+        font-size: 36px;
144
+      }
145
+      
146
+      & .ql-picker-item[data-value='48px']::before {
147
+        font-size: 48px;
148
+      }
149
+      & .ql-picker-item[data-value='72px']::before {
150
+        font-size: 72px;
151
+      }
152
+    }
153
+
154
+    &.ql-wordBox {
155
+      width: 60px;
156
+
157
+      & .ql-picker-label::before,
158
+      .ql-picker-item::before {
159
+        content: '默认';
160
+      }
161
+
162
+      & .ql-picker-label[data-value='20px']::before,
163
+      & .ql-picker-item[data-value='20px']::before {
164
+        content: '20px';
165
+      }
166
+
167
+      & .ql-picker-label[data-value='22px']::before,
168
+      & .ql-picker-item[data-value='22px']::before {
169
+        content: '22px';
170
+      }
171
+
172
+      & .ql-picker-label[data-value='24px']::before,
173
+      & .ql-picker-item[data-value='24px']::before {
174
+        content: '24px';
175
+      }
176
+
177
+      & .ql-picker-label[data-value='26px']::before,
178
+      & .ql-picker-item[data-value='26px']::before {
179
+        content: '26px';
180
+      }
181
+
182
+      & .ql-picker-label[data-value='28px']::before,
183
+      & .ql-picker-item[data-value='28px']::before {
184
+        content: '28px';
185
+      }
186
+
187
+      & .ql-picker-label[data-value='30px']::before,
188
+      & .ql-picker-item[data-value='30px']::before {
189
+        content: '30px';
190
+      }
191
+
192
+      & .ql-picker-label[data-value='32px']::before,
193
+      & .ql-picker-item[data-value='32px']::before {
194
+        content: '32px';
195
+      }
196
+
197
+      & .ql-picker-label[data-value='34px']::before,
198
+      & .ql-picker-item[data-value='34px']::before {
199
+        content: '34px';
200
+      }
201
+
202
+      & .ql-picker-label[data-value='36px']::before,
203
+      & .ql-picker-item[data-value='36px']::before {
204
+        content: '36px';
205
+      }
206
+
207
+      & .ql-picker-label[data-value='38px']::before,
208
+      & .ql-picker-item[data-value='38px']::before {
209
+        content: '36px';
210
+      }
211
+
212
+      & .ql-picker-label[data-value='40px']::before,
213
+      & .ql-picker-item[data-value='40px']::before {
214
+        content: '40px';
215
+      }
216
+
217
+      & .ql-picker-label[data-value='42px']::before,
218
+      & .ql-picker-item[data-value='42px']::before {
219
+        content: '42px';
220
+      }
221
+
222
+      & .ql-picker-label[data-value='44px']::before,
223
+      & .ql-picker-item[data-value='44px']::before {
224
+        content: '44px';
225
+      }
226
+
227
+      & .ql-picker-item[data-value='20px']::before {
228
+        line-height: 20px;
229
+      }
230
+
231
+      & .ql-picker-item[data-value='22px']::before {
232
+        line-height: 22px;
233
+      }
234
+
235
+      & .ql-picker-item[data-value='24px']::before {
236
+        line-height: 24px;
237
+      }
238
+
239
+      & .ql-picker-item[data-value='26px']::before {
240
+        line-height: 26px;
241
+      }
242
+
243
+      & .ql-picker-item[data-value='28px']::before {
244
+        line-height: 28px;
245
+      }
246
+
247
+      & .ql-picker-item[data-value='30px']::before {
248
+        line-height: 30px;
249
+      }
250
+
251
+      & .ql-picker-item[data-value='32px']::before {
252
+        line-height: 32px;
253
+      }
254
+
255
+      & .ql-picker-item[data-value='34px']::before {
256
+        line-height: 34px;
257
+      }
258
+
259
+      & .ql-picker-item[data-value='36px']::before {
260
+        line-height: 36px;
261
+      }
262
+
263
+      & .ql-picker-item[data-value='38px']::before {
264
+        line-height: 38px;
265
+      }
266
+
267
+      & .ql-picker-item[data-value='40px']::before {
268
+        line-height: 40px;
269
+      }
270
+
271
+      & .ql-picker-item[data-value='44px']::before {
272
+        line-height: 44px;
273
+      }
274
+    }
275
+  }
276
+}
277
+
278
+.ql-container {
279
+    .ql-editor {
280
+    & .ql-size-10px {
281
+        font-size: 10px;
282
+    }
283
+
284
+    & .ql-size-12px {
285
+        font-size: 12px;
286
+    }
287
+
288
+    & .ql-size-14px {
289
+        font-size: 14px;
290
+    }
291
+
292
+    & .ql-size-16px {
293
+        font-size: 16px;
294
+    }
295
+
296
+    & .ql-size-18px {
297
+        font-size: 18px;
298
+    }
299
+
300
+    & .ql-size-24px {
301
+        font-size: 24px;
302
+    }
303
+
304
+    & .ql-size-32px {
305
+        font-size: 32px;
306
+    }
307
+
308
+    & .ql-size-40px {
309
+        font-size: 40px;
310
+    }
311
+    }
312
+}
313
+  
314
+  .ql-size-10px {
315
+    font-size: 10px;
316
+  }
317
+  .ql-size-12px {
318
+    font-size: 12px;
319
+  }
320
+  .ql-size-14px {
321
+    font-size: 14px;
322
+  }
323
+  .ql-size-16px {
324
+    font-size: 16px;
325
+  }
326
+  .ql-size-18px {
327
+    font-size: 18px;
328
+  }
329
+  .ql-size-24px {
330
+    font-size: 24px;
331
+  }
332
+  .ql-size-32px {
333
+    font-size: 32px;
334
+  }
335
+  .ql-size-40px {
336
+    font-size: 40px;
337
+  }
338
+  .ql-lineHeight-1 {
339
+    line-height: 1;
340
+  }
341
+  .ql-lineHeight-1-5 {
342
+    line-height: 1.5;
343
+  }
344
+  .ql-lineHeight-2 {
345
+    line-height: 2;
346
+  }
347
+  .ql-lineHeight-2-5 {
348
+    line-height: 2.5;
349
+  }
350
+  .ql-lineHeight-3 {
351
+    line-height: 3;
352
+  }

+ 14
- 31
src/pages/JoinZZ/biddingDocument/index.tsx Wyświetl plik

@@ -144,26 +144,6 @@ const NoticeTableList: React.FC = () => {
144 144
                                 message.error(res.msg)
145 145
                             }
146 146
                         })
147
-                        pushJoinList().then((res: any) => {
148
-                            if (res.code == 200) {
149
-                                if (actionRef.current) {
150
-                                    actionRef.current.reload();
151
-                                }
152
-                                message.success(res.msg)
153
-                            } else {
154
-                                message.error(res.msg)
155
-                            }
156
-                        })
157
-                        pushJoin().then((res: any) => {
158
-                            if (res.code == 200) {
159
-                                if (actionRef.current) {
160
-                                    actionRef.current.reload();
161
-                                }
162
-                                message.success(res.msg)
163
-                            } else {
164
-                                message.error(res.msg)
165
-                            }
166
-                        })
167 147
                     }}
168 148
                 >
169 149
                     {record.pushStatus == 0 ? '发布' : '已发布'}
@@ -196,19 +176,22 @@ const NoticeTableList: React.FC = () => {
196 176
             ],
197 177
         },
198 178
     ];
199
-/**
179
+    /**
200 180
      * 一键发布
201 181
      */
202
-const publishing = async () => {
203
-    try {
204
-        const resp = pushBiddingDocumentDetailAll();
205
-        if (resp.code === 200) {
206
-            message.success('发布成功');
207
-        } else {
208
-            message.error(resp.msg);
209
-        }
210
-    } catch (error) { }
211
-}
182
+    const publishing = async () => {
183
+        try {
184
+            const resp = await pushJoinList();
185
+            if (resp.code === 200) {
186
+                message.success('发布成功');
187
+                if(actionRef){
188
+                    actionRef.current.reload();
189
+                }
190
+            } else {
191
+                message.error(resp.msg);
192
+            }
193
+        } catch (error) { }
194
+    }
212 195
     return (
213 196
         <KeepAlive name={'招标文件'} path="/JoinZZ/biddingDocument">
214 197
             <PageContainer>

+ 23
- 16
src/pages/JoinZZ/vacancy/edit.tsx Wyświetl plik

@@ -10,10 +10,25 @@ import { upload } from '@/services/JoinZZ/vacancy';
10 10
 import { getDataEnumList } from '@/services/system/Enum';
11 11
 // import Quill from "quill";
12 12
 // import "quill/dist/quill.snow.css";
13
-import ReactQuill from 'react-quill';
13
+import ReactQuill, { Quill } from 'react-quill';
14 14
 import 'react-quill/dist/quill.snow.css';
15 15
 import moment from 'moment';
16
+const SizeStyle = Quill.import('attributors/style/size')
17
+SizeStyle.whitelist = ['6px','8px','9px','10px','11px','12px','14px', '16px', '18px', '20px','22px','24px','26px','28px', '32px', '36px','48px','72px']
18
+Quill.register(SizeStyle, true)
19
+var Parchment = Quill.import('parchment');
16 20
 
21
+let config = {
22
+  scope: Parchment.Scope.INLINE,
23
+  // 会有下拉框列表
24
+  whitelist: ['20px', '22px', '24px', '26px', '28px', '30px', '32px', '34px', '36px', '38px', '40px', '42px', '44px']
25
+  //可设置成没有下拉框的,但会导致无法清除样式
26
+  // whitelist: ['1px solid #000000']  
27
+};
28
+
29
+let wordBox = new Parchment.Attributor.Style('wordBox', 'line-height', config);
30
+
31
+Quill.register(wordBox, true);
17 32
 export type VacancyProps = {
18 33
   onCancel: (flag?: boolean, formVals?: any) => void;
19 34
   onSubmit: (values: any) => Promise<void>;
@@ -25,26 +40,18 @@ let toolbarOptions = [
25 40
   ['bold', 'italic', 'underline', 'strike'],        // 切换按钮
26 41
   ['blockquote', 'code-block'],
27 42
   ['link', 'image'],
28
-
29
-
30
-  [{ 'header': 1 }, { 'header': 2 }],               // 用户自定义按钮值
31 43
   [{ 'list': 'ordered' }, { 'list': 'bullet' }],
32 44
   [{ 'script': 'sub' }, { 'script': 'super' }],      // 上标/下标
33 45
   [{ 'indent': '-1' }, { 'indent': '+1' }],          // 减少缩进/缩进
34 46
   [{ 'direction': 'rtl' }],                         // 文本下划线
35
-
36
-
37
-  [{ 'size': ['small', false, 'large', 'huge'] }],  // 用户自定义下拉
47
+  // [{ 'size': ['small', false, 'large', 'huge'] }],  // 用户自定义下拉
48
+  [{ 'size': ['6px','8px','9px','10px','11px','12px','14px', '16px', '18px', '20px','22px','24px','26px','28px', '32px', '36px','48px','72px']}],
38 49
   [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
39
-
40
-
41 50
   [{ 'color': [] }, { 'background': [] }],          // 主题默认下拉,使用主题提供的值
42
-  [{ 'font': [] }],
43
-  [{ 'align': [] }],
44
-  // [{ 'wordBox': ['20px', '22px', '24px', '26px', '28px', '28px', '30px'] }],
45 51
   [{ wordBox: ['20px', '22px', '24px', '26px', '28px', '30px', '32px', '34px', '36px', '38px', '40px', '42px', '44px'] }],
46
-  ['clean'],                                         // 清除格式
47
-
52
+  // [{ 'font': [] }],
53
+  [{ 'align': [] }],
54
+  ['clean'], // 清除格式
48 55
 ];
49 56
 const modules = {
50 57
   toolbar: {
@@ -188,11 +195,11 @@ const VacancyForm: React.FC<VacancyProps> = (props) => {
188 195
     const range = quill.getSelection()
189 196
     if (range) {
190 197
       if (range.length == 0 && range.index !== 0) {
191
-        console.log('User cursor is at index', range.index)
198
+        // console.log('User cursor is at index', range.index)
192 199
         setUserIndex(range.index)
193 200
       } else {
194 201
         const text = quill.getText(range.index, range.length)
195
-        console.log('User has highlighted: ', text)
202
+        // console.log('User has highlighted: ', text)
196 203
       }
197 204
     } else {
198 205
       console.log('User cursor is not in editor')

+ 333
- 1
src/pages/JoinZZ/vacancy/index.less Wyświetl plik

@@ -1,3 +1,335 @@
1 1
 .ant-pro-table-list-toolbar-title{
2 2
     display:none;
3
-}
3
+}
4
+.ql-toolbar {
5
+  &.ql-snow .ql-picker {
6
+    &.ql-size {
7
+      width: 60px;
8
+
9
+      & .ql-picker-label::before,
10
+      .ql-picker-item::before {
11
+        content: '默认';
12
+      }
13
+      & .ql-picker-label[data-value='6px']::before,
14
+      & .ql-picker-item[data-value='6px']::before {
15
+        content: '6px';
16
+      }
17
+      & .ql-picker-label[data-value='8px']::before,
18
+      & .ql-picker-item[data-value='8px']::before {
19
+        content: '8px';
20
+      }
21
+      & .ql-picker-label[data-value='9px']::before,
22
+      & .ql-picker-item[data-value='9px']::before {
23
+        content: '9px';
24
+      }
25
+      & .ql-picker-label[data-value='10px']::before,
26
+      & .ql-picker-item[data-value='10px']::before {
27
+        content: '10px';
28
+      }
29
+      & .ql-picker-label[data-value='11px']::before,
30
+      & .ql-picker-item[data-value='11px']::before {
31
+        content: '11px';
32
+      }
33
+
34
+      & .ql-picker-label[data-value='12px']::before,
35
+      & .ql-picker-item[data-value='12px']::before {
36
+        content: '12px';
37
+      }
38
+
39
+      & .ql-picker-label[data-value='14px']::before,
40
+      & .ql-picker-item[data-value='14px']::before {
41
+        content: '14px';
42
+      }
43
+
44
+      & .ql-picker-label[data-value='16px']::before,
45
+      & .ql-picker-item[data-value='16px']::before {
46
+        content: '16px';
47
+      }
48
+
49
+      & .ql-picker-label[data-value='18px']::before,
50
+      & .ql-picker-item[data-value='18px']::before {
51
+        content: '18px';
52
+      }
53
+      & .ql-picker-label[data-value='20px']::before,
54
+      & .ql-picker-item[data-value='20px']::before {
55
+        content: '20px';
56
+      }
57
+      & .ql-picker-label[data-value='22px']::before,
58
+      & .ql-picker-item[data-value='22px']::before {
59
+        content: '22px';
60
+      }
61
+      & .ql-picker-label[data-value='24px']::before,
62
+      & .ql-picker-item[data-value='24px']::before {
63
+        content: '24px';
64
+      }
65
+      & .ql-picker-label[data-value='26px']::before,
66
+      & .ql-picker-item[data-value='26px']::before {
67
+        content: '26px';
68
+      }
69
+      & .ql-picker-label[data-value='28px']::before,
70
+      & .ql-picker-item[data-value='28px']::before {
71
+        content: '28px';
72
+      }
73
+
74
+      & .ql-picker-label[data-value='32px']::before,
75
+      & .ql-picker-item[data-value='32px']::before {
76
+        content: '32px';
77
+      }
78
+      & .ql-picker-label[data-value='36px']::before,
79
+      & .ql-picker-item[data-value='36px']::before {
80
+        content: '36px';
81
+      }
82
+
83
+      & .ql-picker-label[data-value='48px']::before,
84
+      & .ql-picker-item[data-value='48px']::before {
85
+        content: '48px';
86
+      }
87
+      & .ql-picker-label[data-value='72px']::before,
88
+      & .ql-picker-item[data-value='72px']::before {
89
+        content: '72px';
90
+      }
91
+
92
+      & .ql-picker-item[data-value='6px']::before {
93
+        font-size: 6px;
94
+      }
95
+      & .ql-picker-item[data-value='8px']::before {
96
+        font-size: 8px;
97
+      }
98
+      & .ql-picker-item[data-value='9px']::before {
99
+        font-size: 9px;
100
+      }
101
+      & .ql-picker-item[data-value='10px']::before {
102
+        font-size: 10px;
103
+      }
104
+      & .ql-picker-item[data-value='11px']::before {
105
+        font-size: 11px;
106
+      }
107
+      & .ql-picker-item[data-value='12px']::before {
108
+        font-size: 12px;
109
+      }
110
+      & .ql-picker-item[data-value='14px']::before {
111
+        font-size: 14px;
112
+      }
113
+
114
+      & .ql-picker-item[data-value='16px']::before {
115
+        font-size: 16px;
116
+      }
117
+
118
+      & .ql-picker-item[data-value='18px']::before {
119
+        font-size: 18px;
120
+      }
121
+      & .ql-picker-item[data-value='20px']::before {
122
+        font-size: 20px;
123
+      }      
124
+      & .ql-picker-item[data-value='22px']::before {
125
+        font-size: 22px;
126
+      }
127
+      & .ql-picker-item[data-value='24px']::before {
128
+        font-size: 24px;
129
+      }
130
+      & .ql-picker-item[data-value='26px']::before {
131
+        font-size: 26px;
132
+      }
133
+      & .ql-picker-item[data-value='28px']::before {
134
+        font-size: 28px;
135
+      }
136
+
137
+      & .ql-picker-item[data-value='32px']::before {
138
+        font-size: 32px;
139
+      }
140
+      & .ql-picker-item[data-value='36px']::before {
141
+        font-size: 36px;
142
+      }
143
+      
144
+      & .ql-picker-item[data-value='48px']::before {
145
+        font-size: 48px;
146
+      }
147
+      & .ql-picker-item[data-value='72px']::before {
148
+        font-size: 72px;
149
+      }
150
+    }
151
+
152
+    &.ql-wordBox {
153
+      width: 60px;
154
+
155
+      & .ql-picker-label::before,
156
+      .ql-picker-item::before {
157
+        content: '默认';
158
+      }
159
+
160
+      & .ql-picker-label[data-value='20px']::before,
161
+      & .ql-picker-item[data-value='20px']::before {
162
+        content: '20px';
163
+      }
164
+
165
+      & .ql-picker-label[data-value='22px']::before,
166
+      & .ql-picker-item[data-value='22px']::before {
167
+        content: '22px';
168
+      }
169
+
170
+      & .ql-picker-label[data-value='24px']::before,
171
+      & .ql-picker-item[data-value='24px']::before {
172
+        content: '24px';
173
+      }
174
+
175
+      & .ql-picker-label[data-value='26px']::before,
176
+      & .ql-picker-item[data-value='26px']::before {
177
+        content: '26px';
178
+      }
179
+
180
+      & .ql-picker-label[data-value='28px']::before,
181
+      & .ql-picker-item[data-value='28px']::before {
182
+        content: '28px';
183
+      }
184
+
185
+      & .ql-picker-label[data-value='30px']::before,
186
+      & .ql-picker-item[data-value='30px']::before {
187
+        content: '30px';
188
+      }
189
+
190
+      & .ql-picker-label[data-value='32px']::before,
191
+      & .ql-picker-item[data-value='32px']::before {
192
+        content: '32px';
193
+      }
194
+
195
+      & .ql-picker-label[data-value='34px']::before,
196
+      & .ql-picker-item[data-value='34px']::before {
197
+        content: '34px';
198
+      }
199
+
200
+      & .ql-picker-label[data-value='36px']::before,
201
+      & .ql-picker-item[data-value='36px']::before {
202
+        content: '36px';
203
+      }
204
+
205
+      & .ql-picker-label[data-value='38px']::before,
206
+      & .ql-picker-item[data-value='38px']::before {
207
+        content: '36px';
208
+      }
209
+
210
+      & .ql-picker-label[data-value='40px']::before,
211
+      & .ql-picker-item[data-value='40px']::before {
212
+        content: '40px';
213
+      }
214
+
215
+      & .ql-picker-label[data-value='42px']::before,
216
+      & .ql-picker-item[data-value='42px']::before {
217
+        content: '42px';
218
+      }
219
+
220
+      & .ql-picker-label[data-value='44px']::before,
221
+      & .ql-picker-item[data-value='44px']::before {
222
+        content: '44px';
223
+      }
224
+
225
+      & .ql-picker-item[data-value='20px']::before {
226
+        line-height: 20px;
227
+      }
228
+
229
+      & .ql-picker-item[data-value='22px']::before {
230
+        line-height: 22px;
231
+      }
232
+
233
+      & .ql-picker-item[data-value='24px']::before {
234
+        line-height: 24px;
235
+      }
236
+
237
+      & .ql-picker-item[data-value='26px']::before {
238
+        line-height: 26px;
239
+      }
240
+
241
+      & .ql-picker-item[data-value='28px']::before {
242
+        line-height: 28px;
243
+      }
244
+
245
+      & .ql-picker-item[data-value='30px']::before {
246
+        line-height: 30px;
247
+      }
248
+
249
+      & .ql-picker-item[data-value='32px']::before {
250
+        line-height: 32px;
251
+      }
252
+
253
+      & .ql-picker-item[data-value='34px']::before {
254
+        line-height: 34px;
255
+      }
256
+
257
+      & .ql-picker-item[data-value='36px']::before {
258
+        line-height: 36px;
259
+      }
260
+
261
+      & .ql-picker-item[data-value='38px']::before {
262
+        line-height: 38px;
263
+      }
264
+
265
+      & .ql-picker-item[data-value='40px']::before {
266
+        line-height: 40px;
267
+      }
268
+
269
+      & .ql-picker-item[data-value='44px']::before {
270
+        line-height: 44px;
271
+      }
272
+    }
273
+  }
274
+}
275
+
276
+.ql-container {
277
+    .ql-editor {
278
+    & .ql-size-10px {
279
+        font-size: 10px;
280
+    }
281
+
282
+    & .ql-size-12px {
283
+        font-size: 12px;
284
+    }
285
+
286
+    & .ql-size-14px {
287
+        font-size: 14px;
288
+    }
289
+
290
+    & .ql-size-16px {
291
+        font-size: 16px;
292
+    }
293
+
294
+    & .ql-size-18px {
295
+        font-size: 18px;
296
+    }
297
+
298
+    & .ql-size-24px {
299
+        font-size: 24px;
300
+    }
301
+
302
+    & .ql-size-32px {
303
+        font-size: 32px;
304
+    }
305
+
306
+    & .ql-size-40px {
307
+        font-size: 40px;
308
+    }
309
+    }
310
+}
311
+  
312
+  .ql-size-10px {
313
+    font-size: 10px;
314
+  }
315
+  .ql-size-12px {
316
+    font-size: 12px;
317
+  }
318
+  .ql-size-14px {
319
+    font-size: 14px;
320
+  }
321
+  .ql-size-16px {
322
+    font-size: 16px;
323
+  }
324
+  .ql-size-18px {
325
+    font-size: 18px;
326
+  }
327
+  .ql-size-24px {
328
+    font-size: 24px;
329
+  }
330
+  .ql-size-32px {
331
+    font-size: 32px;
332
+  }
333
+  .ql-size-40px {
334
+    font-size: 40px;
335
+  }

+ 22
- 1
src/pages/JoinZZ/vacancy/index.tsx Wyświetl plik

@@ -57,6 +57,20 @@ const NoticeTableList: React.FC = () => {
57 57
         getEnum()
58 58
     }, [])
59 59
 
60
+    /**
61
+     * 一键发布
62
+     */
63
+    const publishing = async () => {
64
+        try {
65
+            const resp = await pushVacancyDetail();
66
+            console.log(resp)
67
+            if (resp.code === 200) {
68
+                message.success('发布成功');
69
+            } else {
70
+                message.error(resp.msg);
71
+            }
72
+        } catch (error) { }
73
+    }
60 74
     const getEnum = ()=>{
61 75
         getDataEnumList({ enumUuid: '2024511920818108' }).then((res) => {
62 76
             console.log(res.rows)
@@ -168,7 +182,14 @@ const NoticeTableList: React.FC = () => {
168 182
                                 }}
169 183
                             >
170 184
                                 <PlusOutlined /> <FormattedMessage id="public.add" defaultMessage="新建" />
171
-                            </Button>
185
+                            </Button>,
186
+                             <Button
187
+                                type="primary"
188
+                                key="fabu"
189
+                                onClick={publishing}
190
+                            >
191
+                                 一键发布
192
+                             </Button>,
172 193
                         ]}
173 194
                         request={(params) => {
174 195
                             return getVacancyList({ ...params } as API.System.NoticeListParams).then((res) => {

+ 31
- 12
src/pages/News/NewsList/edit.tsx Wyświetl plik

@@ -10,12 +10,30 @@ import {
10 10
 } from '@ant-design/pro-components';
11 11
 import { Form, Drawer, Upload, Space, Button } from 'antd';
12 12
 import { useIntl } from '@umijs/max';
13
-import ReactQuill from 'react-quill';
13
+import ReactQuill, { Quill } from 'react-quill';
14 14
 import 'react-quill/dist/quill.snow.css';
15 15
 import { upload } from '@/services/news/news';
16 16
 import { getDataEnumList } from '@/services/system/Enum';
17 17
 
18 18
 import moment from 'moment';
19
+const SizeStyle = Quill.import('attributors/style/size')
20
+SizeStyle.whitelist = ['6px','8px','9px','10px','11px','12px','14px', '16px', '18px', '20px','22px','24px','26px','28px', '32px', '36px','48px','72px']
21
+Quill.register(SizeStyle, true)
22
+
23
+var Parchment = Quill.import('parchment');
24
+
25
+let config = {
26
+  scope: Parchment.Scope.INLINE,
27
+  // 会有下拉框列表
28
+  whitelist: ['20px', '22px', '24px', '26px', '28px', '30px', '32px', '34px', '36px', '38px', '40px', '42px', '44px']
29
+  //可设置成没有下拉框的,但会导致无法清除样式
30
+  // whitelist: ['1px solid #000000']  
31
+};
32
+
33
+let wordBox = new Parchment.Attributor.Style('wordBox', 'line-height', config);
34
+
35
+Quill.register(wordBox, true);
36
+
19 37
 export type NewsProps = {
20 38
   onCancel: (flag?: boolean, formVals?: any) => void;
21 39
   onSubmit: (values: any) => Promise<void>;
@@ -23,20 +41,21 @@ export type NewsProps = {
23 41
   currentRow: any;
24 42
 };
25 43
 let toolbarOptions = [
26
-  ['bold', 'italic', 'underline', 'strike'],
44
+  ['bold', 'italic', 'underline', 'strike'],        // 切换按钮
27 45
   ['blockquote', 'code-block'],
28 46
   ['link', 'image'],
29 47
   [{ 'list': 'ordered' }, { 'list': 'bullet' }],
30
-  [{ 'script': 'sub' }, { 'script': 'super' }],
31
-  [{ 'indent': '-1' }, { 'indent': '+1' }],
32
-  [{ 'direction': 'rtl' }],
33
-  [{ 'size': ['small', false, 'large', 'huge'] }],
48
+  [{ 'script': 'sub' }, { 'script': 'super' }],      // 上标/下标
49
+  [{ 'indent': '-1' }, { 'indent': '+1' }],          // 减少缩进/缩进
50
+  [{ 'direction': 'rtl' }],                         // 文本下划线
51
+  // [{ 'size': ['small', false, 'large', 'huge'] }],  // 用户自定义下拉
52
+  [{ 'size': ['6px','8px','9px','10px','11px','12px','14px', '16px', '18px', '20px','22px','24px','26px','28px', '32px', '36px','48px','72px']}],
34 53
   [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
35
-  [{ 'color': [] }, { 'background': [] }],
36
-  [{ 'font': [] }],
37
-  [{ 'align': [] }],
54
+  [{ 'color': [] }, { 'background': [] }],          // 主题默认下拉,使用主题提供的值
38 55
   [{ wordBox: ['20px', '22px', '24px', '26px', '28px', '30px', '32px', '34px', '36px', '38px', '40px', '42px', '44px'] }],
39
-  ['clean'],
56
+  // [{ 'font': [] }],
57
+  [{ 'align': [] }],
58
+  ['clean'], // 清除格式
40 59
 ];
41 60
 const modules = {
42 61
   toolbar: {
@@ -145,11 +164,11 @@ const NewsForm: React.FC<NewsProps> = (props) => {
145 164
     const range = quill.getSelection()
146 165
     if (range) {
147 166
       if (range.length == 0 && range.index !== 0) {
148
-        console.log('User cursor is at index', range.index)
167
+        // console.log('User cursor is at index', range.index)
149 168
         setUserIndex(range.index)
150 169
       } else {
151 170
         const text = quill.getText(range.index, range.length)
152
-        console.log('User has highlighted: ', text)
171
+        // console.log('User has highlighted: ', text)
153 172
       }
154 173
     } else {
155 174
       console.log('User cursor is not in editor')

src/pages/News/NewsList/edit copy.tsx → src/pages/News/NewsList/editcopy.tsx Wyświetl plik


+ 343
- 2
src/pages/News/NewsList/index.less Wyświetl plik

@@ -1,3 +1,344 @@
1
-.ant-pro-table-list-toolbar-title{
2
-    display:none;
1
+.ant-pro-table-list-toolbar-title {
2
+  display: none;
3
+}
4
+
5
+
6
+.ql-toolbar {
7
+  &.ql-snow .ql-picker {
8
+    &.ql-size {
9
+      width: 60px;
10
+
11
+      & .ql-picker-label::before,
12
+      .ql-picker-item::before {
13
+        content: '默认';
14
+      }
15
+      & .ql-picker-label[data-value='6px']::before,
16
+      & .ql-picker-item[data-value='6px']::before {
17
+        content: '6px';
18
+      }
19
+      & .ql-picker-label[data-value='8px']::before,
20
+      & .ql-picker-item[data-value='8px']::before {
21
+        content: '8px';
22
+      }
23
+      & .ql-picker-label[data-value='9px']::before,
24
+      & .ql-picker-item[data-value='9px']::before {
25
+        content: '9px';
26
+      }
27
+      & .ql-picker-label[data-value='10px']::before,
28
+      & .ql-picker-item[data-value='10px']::before {
29
+        content: '10px';
30
+      }
31
+      & .ql-picker-label[data-value='11px']::before,
32
+      & .ql-picker-item[data-value='11px']::before {
33
+        content: '11px';
34
+      }
35
+
36
+      & .ql-picker-label[data-value='12px']::before,
37
+      & .ql-picker-item[data-value='12px']::before {
38
+        content: '12px';
39
+      }
40
+
41
+      & .ql-picker-label[data-value='14px']::before,
42
+      & .ql-picker-item[data-value='14px']::before {
43
+        content: '14px';
44
+      }
45
+
46
+      & .ql-picker-label[data-value='16px']::before,
47
+      & .ql-picker-item[data-value='16px']::before {
48
+        content: '16px';
49
+      }
50
+
51
+      & .ql-picker-label[data-value='18px']::before,
52
+      & .ql-picker-item[data-value='18px']::before {
53
+        content: '18px';
54
+      }
55
+      & .ql-picker-label[data-value='20px']::before,
56
+      & .ql-picker-item[data-value='20px']::before {
57
+        content: '20px';
58
+      }
59
+      & .ql-picker-label[data-value='22px']::before,
60
+      & .ql-picker-item[data-value='22px']::before {
61
+        content: '22px';
62
+      }
63
+      & .ql-picker-label[data-value='24px']::before,
64
+      & .ql-picker-item[data-value='24px']::before {
65
+        content: '24px';
66
+      }
67
+      & .ql-picker-label[data-value='26px']::before,
68
+      & .ql-picker-item[data-value='26px']::before {
69
+        content: '26px';
70
+      }
71
+      & .ql-picker-label[data-value='28px']::before,
72
+      & .ql-picker-item[data-value='28px']::before {
73
+        content: '28px';
74
+      }
75
+
76
+      & .ql-picker-label[data-value='32px']::before,
77
+      & .ql-picker-item[data-value='32px']::before {
78
+        content: '32px';
79
+      }
80
+      & .ql-picker-label[data-value='36px']::before,
81
+      & .ql-picker-item[data-value='36px']::before {
82
+        content: '36px';
83
+      }
84
+
85
+      & .ql-picker-label[data-value='48px']::before,
86
+      & .ql-picker-item[data-value='48px']::before {
87
+        content: '48px';
88
+      }
89
+      & .ql-picker-label[data-value='72px']::before,
90
+      & .ql-picker-item[data-value='72px']::before {
91
+        content: '72px';
92
+      }
93
+
94
+      & .ql-picker-item[data-value='6px']::before {
95
+        font-size: 6px;
96
+      }
97
+      & .ql-picker-item[data-value='8px']::before {
98
+        font-size: 8px;
99
+      }
100
+      & .ql-picker-item[data-value='9px']::before {
101
+        font-size: 9px;
102
+      }
103
+      & .ql-picker-item[data-value='10px']::before {
104
+        font-size: 10px;
105
+      }
106
+      & .ql-picker-item[data-value='11px']::before {
107
+        font-size: 11px;
108
+      }
109
+      & .ql-picker-item[data-value='12px']::before {
110
+        font-size: 12px;
111
+      }
112
+      & .ql-picker-item[data-value='14px']::before {
113
+        font-size: 14px;
114
+      }
115
+
116
+      & .ql-picker-item[data-value='16px']::before {
117
+        font-size: 16px;
118
+      }
119
+
120
+      & .ql-picker-item[data-value='18px']::before {
121
+        font-size: 18px;
122
+      }
123
+      & .ql-picker-item[data-value='20px']::before {
124
+        font-size: 20px;
125
+      }      
126
+      & .ql-picker-item[data-value='22px']::before {
127
+        font-size: 22px;
128
+      }
129
+      & .ql-picker-item[data-value='24px']::before {
130
+        font-size: 24px;
131
+      }
132
+      & .ql-picker-item[data-value='26px']::before {
133
+        font-size: 26px;
134
+      }
135
+      & .ql-picker-item[data-value='28px']::before {
136
+        font-size: 28px;
137
+      }
138
+
139
+      & .ql-picker-item[data-value='32px']::before {
140
+        font-size: 32px;
141
+      }
142
+      & .ql-picker-item[data-value='36px']::before {
143
+        font-size: 36px;
144
+      }
145
+      
146
+      & .ql-picker-item[data-value='48px']::before {
147
+        font-size: 48px;
148
+      }
149
+      & .ql-picker-item[data-value='72px']::before {
150
+        font-size: 72px;
151
+      }
152
+    }
153
+
154
+    &.ql-wordBox {
155
+      width: 60px;
156
+
157
+      & .ql-picker-label::before,
158
+      .ql-picker-item::before {
159
+        content: '默认';
160
+      }
161
+
162
+      & .ql-picker-label[data-value='20px']::before,
163
+      & .ql-picker-item[data-value='20px']::before {
164
+        content: '20px';
165
+      }
166
+
167
+      & .ql-picker-label[data-value='22px']::before,
168
+      & .ql-picker-item[data-value='22px']::before {
169
+        content: '22px';
170
+      }
171
+
172
+      & .ql-picker-label[data-value='24px']::before,
173
+      & .ql-picker-item[data-value='24px']::before {
174
+        content: '24px';
175
+      }
176
+
177
+      & .ql-picker-label[data-value='26px']::before,
178
+      & .ql-picker-item[data-value='26px']::before {
179
+        content: '26px';
180
+      }
181
+
182
+      & .ql-picker-label[data-value='28px']::before,
183
+      & .ql-picker-item[data-value='28px']::before {
184
+        content: '28px';
185
+      }
186
+
187
+      & .ql-picker-label[data-value='30px']::before,
188
+      & .ql-picker-item[data-value='30px']::before {
189
+        content: '30px';
190
+      }
191
+
192
+      & .ql-picker-label[data-value='32px']::before,
193
+      & .ql-picker-item[data-value='32px']::before {
194
+        content: '32px';
195
+      }
196
+
197
+      & .ql-picker-label[data-value='34px']::before,
198
+      & .ql-picker-item[data-value='34px']::before {
199
+        content: '34px';
200
+      }
201
+
202
+      & .ql-picker-label[data-value='36px']::before,
203
+      & .ql-picker-item[data-value='36px']::before {
204
+        content: '36px';
205
+      }
206
+
207
+      & .ql-picker-label[data-value='38px']::before,
208
+      & .ql-picker-item[data-value='38px']::before {
209
+        content: '36px';
210
+      }
211
+
212
+      & .ql-picker-label[data-value='40px']::before,
213
+      & .ql-picker-item[data-value='40px']::before {
214
+        content: '40px';
215
+      }
216
+
217
+      & .ql-picker-label[data-value='42px']::before,
218
+      & .ql-picker-item[data-value='42px']::before {
219
+        content: '42px';
220
+      }
221
+
222
+      & .ql-picker-label[data-value='44px']::before,
223
+      & .ql-picker-item[data-value='44px']::before {
224
+        content: '44px';
225
+      }
226
+
227
+      & .ql-picker-item[data-value='20px']::before {
228
+        line-height: 20px;
229
+      }
230
+
231
+      & .ql-picker-item[data-value='22px']::before {
232
+        line-height: 22px;
233
+      }
234
+
235
+      & .ql-picker-item[data-value='24px']::before {
236
+        line-height: 24px;
237
+      }
238
+
239
+      & .ql-picker-item[data-value='26px']::before {
240
+        line-height: 26px;
241
+      }
242
+
243
+      & .ql-picker-item[data-value='28px']::before {
244
+        line-height: 28px;
245
+      }
246
+
247
+      & .ql-picker-item[data-value='30px']::before {
248
+        line-height: 30px;
249
+      }
250
+
251
+      & .ql-picker-item[data-value='32px']::before {
252
+        line-height: 32px;
253
+      }
254
+
255
+      & .ql-picker-item[data-value='34px']::before {
256
+        line-height: 34px;
257
+      }
258
+
259
+      & .ql-picker-item[data-value='36px']::before {
260
+        line-height: 36px;
261
+      }
262
+
263
+      & .ql-picker-item[data-value='38px']::before {
264
+        line-height: 38px;
265
+      }
266
+
267
+      & .ql-picker-item[data-value='40px']::before {
268
+        line-height: 40px;
269
+      }
270
+
271
+      & .ql-picker-item[data-value='44px']::before {
272
+        line-height: 44px;
273
+      }
274
+    }
275
+  }
276
+}
277
+
278
+.ql-container {
279
+  .ql-editor {
280
+    & .ql-size-10px {
281
+      font-size: 10px;
282
+    }
283
+
284
+    & .ql-size-12px {
285
+      font-size: 12px;
286
+    }
287
+
288
+    & .ql-size-14px {
289
+      font-size: 14px;
290
+    }
291
+
292
+    & .ql-size-16px {
293
+      font-size: 16px;
294
+    }
295
+
296
+    & .ql-size-18px {
297
+      font-size: 18px;
298
+    }
299
+
300
+    & .ql-size-24px {
301
+      font-size: 24px;
302
+    }
303
+
304
+    & .ql-size-32px {
305
+      font-size: 32px;
306
+    }
307
+
308
+    & .ql-size-40px {
309
+      font-size: 40px;
310
+    }
311
+  }
312
+}
313
+
314
+.ql-size-10px {
315
+  font-size: 10px;
316
+}
317
+
318
+.ql-size-12px {
319
+  font-size: 12px;
320
+}
321
+
322
+.ql-size-14px {
323
+  font-size: 14px;
324
+}
325
+
326
+.ql-size-16px {
327
+  font-size: 16px;
328
+}
329
+
330
+.ql-size-18px {
331
+  font-size: 18px;
332
+}
333
+
334
+.ql-size-24px {
335
+  font-size: 24px;
336
+}
337
+
338
+.ql-size-32px {
339
+  font-size: 32px;
340
+}
341
+
342
+.ql-size-40px {
343
+  font-size: 40px;
3 344
 }

+ 331
- 306
src/pages/PartyWork/partyWork/edit.tsx Wyświetl plik

@@ -1,9 +1,10 @@
1 1
 import React, { useEffect, useState, useRef } from 'react';
2 2
 import {
3
-  ProForm,
4
-  ProFormText,
5
-  ProFormSelect,
6
-  ProFormDatePicker,
3
+    ProForm,
4
+    ProFormText,
5
+    ProFormSelect,
6
+    ProFormDatePicker,
7
+    ProFormDateTimePicker,
7 8
 } from '@ant-design/pro-components';
8 9
 import { Form, Drawer, Upload, Space, Button } from 'antd';
9 10
 
@@ -12,38 +13,54 @@ import { upload } from '@/services/partyWork/partyWork';
12 13
 import { getDataEnumList } from '@/services/system/Enum';
13 14
 // import Quill from "quill";
14 15
 // import "quill/dist/quill.snow.css";
15
-import ReactQuill from 'react-quill';
16
+import ReactQuill, { Quill } from 'react-quill';
16 17
 import 'react-quill/dist/quill.snow.css';
17 18
 import moment from 'moment';
19
+const SizeStyle = Quill.import('attributors/style/size')
20
+SizeStyle.whitelist = ['6px','8px','9px','10px','11px','12px','14px', '16px', '18px', '20px','22px','24px','26px','28px', '32px', '36px','48px','72px']
21
+Quill.register(SizeStyle, true)
22
+var Parchment = Quill.import('parchment');
23
+
24
+let config = {
25
+  scope: Parchment.Scope.INLINE,
26
+  // 会有下拉框列表
27
+  whitelist: ['20px', '22px', '24px', '26px', '28px', '30px', '32px', '34px', '36px', '38px', '40px', '42px', '44px']
28
+  //可设置成没有下拉框的,但会导致无法清除样式
29
+  // whitelist: ['1px solid #000000']  
30
+};
31
+
32
+let wordBox = new Parchment.Attributor.Style('wordBox', 'line-height', config);
33
+
34
+Quill.register(wordBox, true);
18 35
 export type PartyWorkProps = {
19
-  onCancel: (flag?: boolean, formVals?: any) => void;
20
-  onSubmit: (values: any) => Promise<void>;
21
-  open: boolean;
22
-  currentRow: any;
36
+    onCancel: (flag?: boolean, formVals?: any) => void;
37
+    onSubmit: (values: any) => Promise<void>;
38
+    open: boolean;
39
+    currentRow: any;
23 40
 };
24 41
 
25 42
 let toolbarOptions = [
26
-  ['bold', 'italic', 'underline', 'strike'],        // 切换按钮
27
-  ['blockquote', 'code-block'],
28
-  ['link', 'image'],
29
-  [{ 'list': 'ordered' }, { 'list': 'bullet' }],
30
-  [{ 'script': 'sub' }, { 'script': 'super' }],      // 上标/下标
31
-  [{ 'indent': '-1' }, { 'indent': '+1' }],          // 减少缩进/缩进
32
-  [{ 'direction': 'rtl' }],                         // 文本下划线
33
-  [{ 'size': ['small', false, 'large', 'huge'] }],  // 用户自定义下拉
34
-  [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
35
-  [{ 'color': [] }, { 'background': [] }],          // 主题默认下拉,使用主题提供的值
36
-  [{ 'font': [] }],
37
-  [{ 'align': [] }],
38
-  // [{ 'wordBox': ['20px', '22px', '24px', '26px', '28px', '28px', '30px'] }],
39
-  [{ wordBox: ['20px', '22px', '24px', '26px', '28px', '30px', '32px', '34px', '36px', '38px', '40px', '42px', '44px'] }],
40
-  ['clean'],                                         // 清除格式
43
+    ['bold', 'italic', 'underline', 'strike'],        // 切换按钮
44
+    ['blockquote', 'code-block'],
45
+    ['link', 'image'],
46
+    [{ 'list': 'ordered' }, { 'list': 'bullet' }],
47
+    [{ 'script': 'sub' }, { 'script': 'super' }],      // 上标/下标
48
+    [{ 'indent': '-1' }, { 'indent': '+1' }],          // 减少缩进/缩进
49
+    [{ 'direction': 'rtl' }],                         // 文本下划线
50
+    // [{ 'size': ['small', false, 'large', 'huge'] }],  // 用户自定义下拉
51
+    [{ 'size': ['6px','8px','9px','10px','11px','12px','14px', '16px', '18px', '20px','22px','24px','26px','28px', '32px', '36px','48px','72px']}],
52
+    [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
53
+    [{ 'color': [] }, { 'background': [] }],          // 主题默认下拉,使用主题提供的值
54
+    [{ wordBox: ['20px', '22px', '24px', '26px', '28px', '30px', '32px', '34px', '36px', '38px', '40px', '42px', '44px'] }],
55
+    // [{ 'font': [] }],
56
+    [{ 'align': [] }],
57
+    ['clean'], // 清除格式
41 58
 
42 59
 ];
43 60
 const modules = {
44
-  toolbar: {
45
-    container: toolbarOptions, // 使用自定义工具栏选项
46
-  },
61
+    toolbar: {
62
+        container: toolbarOptions, // 使用自定义工具栏选项
63
+    },
47 64
 };
48 65
 // function image(){
49 66
 //   var _this3 = this;
@@ -77,307 +94,315 @@ const modules = {
77 94
 // }
78 95
 const PartyWorkForm: React.FC<PartyWorkProps> = (props) => {
79 96
 
80
-  const [form] = Form.useForm();
81
-  const intl = useIntl();
82
-  let editorRef = useRef<HTMLDivElement>(null)
83
-  const [editWho, setEditWho] = useState('')
84
-  const [userIndex, setUserIndex] = useState(0)
85
-  const [editorHtml, setEditorHtml] = useState('');
86
-  useEffect(() => {
87
-    form.resetFields();
88
-    if(!props.open) return;
89
-    // const { title, content, surface, surfaceUrl, date } = props;
90
-    if(!props.currentRow) return;
91
-    const { digest, top,key,content,surface,surfaceUrl,date,title,source,column} = props.currentRow;
92
-    if (props.currentRow) {
93
-      form.setFieldsValue({
94
-        digest,
95
-        top,
96
-        key,
97
-        column,
98
-        source
99
-      })
100
-      // if (top) {
101
-      //   setCheckTop(1)
102
-      // } else {
103
-      //   setCheckTop(0)
104
-      // }
105
-    }
97
+    const [form] = Form.useForm();
98
+    const intl = useIntl();
99
+    let editorRef = useRef<HTMLDivElement>(null)
100
+    const [editWho, setEditWho] = useState('')
101
+    const [userIndex, setUserIndex] = useState(0)
102
+    const [editorHtml, setEditorHtml] = useState('');
103
+    useEffect(() => {
104
+        form.resetFields();
105
+        if (!props.open) return;
106
+        // const { title, content, surface, surfaceUrl, date } = props;
107
+        if (!props.currentRow) return;
108
+        const { digest, top, key, content, surface, surfaceUrl, date, title, source, column,createTime } = props.currentRow;
109
+        if (props.currentRow) {
110
+            form.setFieldsValue({
111
+                digest,
112
+                top,
113
+                key,
114
+                column,
115
+                source,
116
+                createTime
117
+            })
118
+            // if (top) {
119
+            //   setCheckTop(1)
120
+            // } else {
121
+            //   setCheckTop(0)
122
+            // }
123
+        }
106 124
 
107
-    setSurface(surface)
108
-    form.setFieldsValue({
109
-      title: title,
110
-      date: date,
111
-    })
112
-    if (surfaceUrl && surface) {
113
-      setFileList([
114
-        {
115
-          uid: surface,
116
-          thumbUrl: surfaceUrl
125
+        setSurface(surface)
126
+        form.setFieldsValue({
127
+            title: title,
128
+            date: date,
129
+        })
130
+        if (surfaceUrl && surface) {
131
+            setFileList([
132
+                {
133
+                    uid: surface,
134
+                    thumbUrl: surfaceUrl
135
+                }
136
+            ])
117 137
         }
118
-      ])
119
-    }
120
-    // if (editorRef && editorRef.current && editorRef.current.children[0]) {
121
-    //   editorRef.current.children[0].innerHTML = content
122
-    // }
123
-    setEditorHtml(content || '')
124
-  }, [props.open,props.currentRow]);
125
-  const base64ToFile = (base64, fileName = `${Math.random()}`) => {
126
-    let arr = base64.split(',')
127
-    console.log(arr[0])
128
-    let mime = arr[0].match(/:(.*?);/)[1]
129
-    let bstr = atob(arr[1])
130
-    let n = bstr.length
131
-    let u8arr = new Uint8Array(n)
132
-    while (n--) {
133
-      u8arr[n] = bstr.charCodeAt(n)
134
-    }
135
-    return new File([u8arr], `${fileName}.${mime.split('/')[1]}`, {
136
-      type: mime,
137
-    })
138
-  }
139
-  useEffect(() => {
140
-    if(editorRef?.current){
141
-      const quill = editorRef.current.getEditor()
142
-      if (editWho === 'api' && userIndex !== 0) {
143
-        quill.setSelection(userIndex + 2)
144
-      }
138
+        // if (editorRef && editorRef.current && editorRef.current.children[0]) {
139
+        //   editorRef.current.children[0].innerHTML = content
140
+        // }
141
+        setEditorHtml(content || '')
142
+    }, [props.open, props.currentRow]);
143
+    const base64ToFile = (base64, fileName = `${Math.random()}`) => {
144
+        let arr = base64.split(',')
145
+        console.log(arr[0])
146
+        let mime = arr[0].match(/:(.*?);/)[1]
147
+        let bstr = atob(arr[1])
148
+        let n = bstr.length
149
+        let u8arr = new Uint8Array(n)
150
+        while (n--) {
151
+            u8arr[n] = bstr.charCodeAt(n)
152
+        }
153
+        return new File([u8arr], `${fileName}.${mime.split('/')[1]}`, {
154
+            type: mime,
155
+        })
145 156
     }
146
-  }, [editorHtml,userIndex])
157
+    useEffect(() => {
158
+        if (editorRef?.current) {
159
+            const quill = editorRef.current.getEditor()
160
+            if (editWho === 'api' && userIndex !== 0) {
161
+                quill.setSelection(userIndex + 2)
162
+            }
163
+        }
164
+    }, [editorHtml, userIndex])
147 165
 
148
-  const [fileList, setFileList] = useState<any>([]);
149
-  const [surface, setSurface] = useState<any>('');
166
+    const [fileList, setFileList] = useState<any>([]);
167
+    const [surface, setSurface] = useState<any>('');
150 168
 
151
-  const [checkTop, setCheckTop] = useState<any>('')
152
-  const handleOk = async () => {
153
-    let data = form.getFieldsValue()
154
-    let val = await form.validateFields()
155
-    
156
-    const htmlStr = editorHtml.replaceAll('"', "'")
169
+    const [checkTop, setCheckTop] = useState<any>('')
170
+    const handleOk = async () => {
171
+        let data = form.getFieldsValue()
172
+        let val = await form.validateFields()
157 173
 
158
-    // let content = editor.getContents()
159
-    // console.log('htmlStr----', htmlStr)
160
-    // editor.setContents(content)
161
-    data.date = moment(data.date).format('YYYY-MM-DD');
162
-    if(checkTop){
163
-      data.top = 1;
164
-    }else{
165
-      data.top = 0;
166
-    } 
167
-    // data.top = checkTop;
168
-    let formData = {
169
-      ...data,
170
-      surface,
171
-      content: htmlStr
172
-    }
173
-    form.setFieldsValue({
174
-      title: '',
175
-      digest: ""
176
-    })
177
-    setFileList([]);
178
-    setCheckTop(false)
179
-    // editor.clipboard.dangerouslyPasteHTML(0, '')
180
-    // editor.setContents([])
181
-    setEditorHtml('');
182
-    props.onSubmit(formData);
183
-  };
184
-  const handleCancel = () => {
185
-    form.setFieldsValue({
186
-      title: '',
187
-      digest: "",
188
-      top: ""
189
-    })
190
-    setFileList([]);
191
-    setCheckTop(false)
192
-    // editor.clipboard.dangerouslyPasteHTML(0, '')
193
-    // editor.setContents([])
194
-    setEditorHtml('');
195
-    props.onCancel();
174
+        const htmlStr = editorHtml.replaceAll('"', "'")
196 175
 
197
-  };
176
+        // let content = editor.getContents()
177
+        // console.log('htmlStr----', htmlStr)
178
+        // editor.setContents(content)
179
+        data.date = moment(data.date).format('YYYY-MM-DD');
180
+        data.createTime = moment(data.createTime).format('YYYY-MM-DD HH:mm:ss');
181
+        if (checkTop) {
182
+            data.top = 1;
183
+        } else {
184
+            data.top = 0;
185
+        }
186
+        // data.top = checkTop;
187
+        let formData = {
188
+            ...data,
189
+            surface,
190
+            content: htmlStr
191
+        }
192
+        form.setFieldsValue({
193
+            title: '',
194
+            digest: ""
195
+        })
196
+        setFileList([]);
197
+        setCheckTop(false)
198
+        // editor.clipboard.dangerouslyPasteHTML(0, '')
199
+        // editor.setContents([])
200
+        setEditorHtml('');
201
+        props.onSubmit(formData);
202
+    };
203
+    const handleCancel = () => {
204
+        form.setFieldsValue({
205
+            title: '',
206
+            digest: "",
207
+            top: ""
208
+        })
209
+        setFileList([]);
210
+        setCheckTop(false)
211
+        // editor.clipboard.dangerouslyPasteHTML(0, '')
212
+        // editor.setContents([])
213
+        setEditorHtml('');
214
+        props.onCancel();
198 215
 
199
-  const handleChange = async (res) => {
200
-    const { fileList } = res;
201
-    setFileList(fileList);
202
-  };
216
+    };
203 217
 
204
-  const handleBeforeUpload = async (file: RcFile) => {
205
-    const formData = new FormData();
206
-    formData.append('file', file, file.name);
207
-    const res = await upload(formData);
208
-    if (res?.data?.uuid) {
209
-      setSurface(res.data.uuid)
210
-    }
211
-    return false;
212
-  };
218
+    const handleChange = async (res) => {
219
+        const { fileList } = res;
220
+        setFileList(fileList);
221
+    };
213 222
 
214
-  const handleChangeQuill = (content, delta, source, editor) => {
215
-    let quill = editorRef.current.getEditor()
216
-    quill.focus()
217
-    let delta_ops = delta.ops
218
-    let quilContent = editor.getContents()
219
-    setEditorHtml(content)
220
-    const range = quill.getSelection()
221
-    if (range) {
222
-      if (range.length == 0 && range.index !== 0) {
223
-        console.log('User cursor is at index', range.index)
224
-        setUserIndex(range.index)
225
-      } else {
226
-        const text = quill.getText(range.index, range.length)
227
-        console.log('User has highlighted: ', text)
228
-      }
229
-    } else {
230
-      console.log('User cursor is not in editor')
231
-    }
232
-    setEditWho(source)
233
-    if (delta_ops && delta_ops.length > 0) {
234
-      quilContent.ops.map((item) => {
235
-        if (item.insert) {
236
-          let imgStr = item.insert.image
237
-          if (imgStr && imgStr?.includes('data:image/')) {
238
-            let file = base64ToFile(imgStr)
239
-            let formData = new FormData()
240
-            formData.append('file', file)
241
-            upload(formData).then((res) => {
242
-              item.insert.image = res.data.url
243
-              quill.setContents(quilContent)
223
+    const handleBeforeUpload = async (file: RcFile) => {
224
+        const formData = new FormData();
225
+        formData.append('file', file, file.name);
226
+        const res = await upload(formData);
227
+        if (res?.data?.uuid) {
228
+            setSurface(res.data.uuid)
229
+        }
230
+        return false;
231
+    };
232
+
233
+    const handleChangeQuill = (content, delta, source, editor) => {
234
+        let quill = editorRef.current.getEditor()
235
+        quill.focus()
236
+        let delta_ops = delta.ops
237
+        let quilContent = editor.getContents()
238
+        setEditorHtml(content)
239
+        const range = quill.getSelection()
240
+        if (range) {
241
+            if (range.length == 0 && range.index !== 0) {
242
+                // console.log('User cursor is at index', range.index)
243
+                setUserIndex(range.index)
244
+            } else {
245
+                const text = quill.getText(range.index, range.length)
246
+                // console.log('User has highlighted: ', text)
247
+            }
248
+        } else {
249
+            console.log('User cursor is not in editor')
250
+        }
251
+        setEditWho(source)
252
+        if (delta_ops && delta_ops.length > 0) {
253
+            quilContent.ops.map((item) => {
254
+                if (item.insert) {
255
+                    let imgStr = item.insert.image
256
+                    if (imgStr && imgStr?.includes('data:image/')) {
257
+                        let file = base64ToFile(imgStr)
258
+                        let formData = new FormData()
259
+                        formData.append('file', file)
260
+                        upload(formData).then((res) => {
261
+                            item.insert.image = res.data.url
262
+                            quill.setContents(quilContent)
263
+                        })
264
+                    }
265
+                }
244 266
             })
245
-          }
246 267
         }
247
-      })
248 268
     }
249
-  }
250 269
 
251 270
 
252
-  return (
253
-    <Drawer
254
-      width={'80%'}
255
-      title={props.currentRow ? '文章编辑' : '新建文章'}
256
-      open={props.open}
257
-      destroyOnClose
258
-      onClose={handleCancel}
259
-      extra={
260
-        <Space>
261
-          <Button onClick={handleCancel}>取消</Button>
262
-          <Button type="primary" onClick={handleOk}>确认</Button>
263
-        </Space>
264
-      }
265
-    >
266
-      <ProForm
267
-        form={form}
268
-        grid={true}
269
-        submitter={false}
270
-        layout="horizontal"
271
-      >
272
-        <ProFormText
273
-          name="title"
274
-          label='标题'
275
-          labelCol={{
276
-            style: { width: 95 }
277
-          }}
278
-          placeholder='请输入标题'
279
-          rules={[
280
-            {
281
-              required: true,
282
-              message: '请输入标题!',
283
-            },
284
-          ]}
285
-        />
286
-        <ProForm.Item
287
-          label={'封面图'}
288
-          extra={'图片尺寸1218*915'}
289
-          labelCol={{
290
-            style: { width: 95 }
291
-          }}
292
-          rules={[
293
-            {
294
-              required: true
271
+    return (
272
+        <Drawer
273
+            width={'80%'}
274
+            title={props.currentRow ? '文章编辑' : '新建文章'}
275
+            open={props.open}
276
+            destroyOnClose
277
+            onClose={handleCancel}
278
+            extra={
279
+                <Space>
280
+                    <Button onClick={handleCancel}>取消</Button>
281
+                    <Button type="primary" onClick={handleOk}>确认</Button>
282
+                </Space>
295 283
             }
296
-          ]
297
-          }
298 284
         >
299
-          <Upload
300
-            listType="picture-card" // 设置为图片卡片模式
301
-            fileList={fileList}
302
-            maxCount={1}
303
-            onChange={handleChange}
304
-            beforeUpload={handleBeforeUpload}
305
-          >
306
-            {fileList?.length < 1 && '+' + intl.formatMessage({ id: 'public.uploadImg' })}
307
-          </Upload>
308
-        </ProForm.Item>
309
-        <ProFormDatePicker
310
-          name="date"
311
-          label='展示日期'
312
-          fieldProps={{
313
-            format: (value) => value.format('YYYY-MM-DD'),
314
-          }}
315
-          labelCol={{
316
-            style: { width: 95 }
317
-          }}
318
-          rules={[
319
-            {
320
-              required: true
321
-            }
322
-          ]
323
-          }
324
-        />
285
+            <ProForm
286
+                form={form}
287
+                grid={true}
288
+                submitter={false}
289
+                layout="horizontal"
290
+            >
291
+                <ProFormText
292
+                    name="title"
293
+                    label='标题'
294
+                    labelCol={{
295
+                        style: { width: 95 }
296
+                    }}
297
+                    placeholder='请输入标题'
298
+                    rules={[
299
+                        {
300
+                            required: true,
301
+                            message: '请输入标题!',
302
+                        },
303
+                    ]}
304
+                />
305
+                <ProForm.Item
306
+                    label={'封面图'}
307
+                    extra={'图片尺寸1218*915'}
308
+                    labelCol={{
309
+                        style: { width: 95 }
310
+                    }}
311
+                    rules={[
312
+                        {
313
+                            required: true
314
+                        }
315
+                    ]
316
+                    }
317
+                >
318
+                    <Upload
319
+                        listType="picture-card" // 设置为图片卡片模式
320
+                        fileList={fileList}
321
+                        maxCount={1}
322
+                        onChange={handleChange}
323
+                        beforeUpload={handleBeforeUpload}
324
+                    >
325
+                        {fileList?.length < 1 && '+' + intl.formatMessage({ id: 'public.uploadImg' })}
326
+                    </Upload>
327
+                </ProForm.Item>
328
+                <ProFormDatePicker
329
+                    name="date"
330
+                    label='展示日期'
331
+                    fieldProps={{
332
+                        format: (value) => value.format('YYYY-MM-DD'),
333
+                    }}
334
+                    labelCol={{
335
+                        style: { width: 95 }
336
+                    }}
337
+                    rules={[
338
+                        {
339
+                            required: true
340
+                        }
341
+                    ]
342
+                    }
343
+                />
344
+                <ProFormDateTimePicker
345
+                    name="createTime"
346
+                    label='发稿时间'
347
+                    fieldProps={{ format: (value) => value.format('YYYY-MM-DD HH:mm:ss') }}
348
+                    labelCol={{ style: { width: 95 } }}
349
+                    rules={[{ required: true }]}
350
+                />
351
+                <ProFormSelect
352
+                    name="column"
353
+                    key="column"
354
+                    label='党建分类'
355
+                    request={() =>
356
+                        getDataEnumList({ enumUuid: '2024510243805101' }).then((res) => {
357
+                            let tList = []
358
+                            res.rows.forEach(item => {
359
+                                tList.push({
360
+                                    label: item.dataName,
361
+                                    value: item.uuid,
362
+                                })
363
+                            })
364
+                            return tList;
365
+                        })
325 366
 
326
-        <ProFormSelect
327
-          name="column"
328
-          key="column"
329
-          label='党建分类'
330
-          request={() =>
331
-            getDataEnumList({enumUuid: '2024510243805101'}).then((res) => {
332
-              let tList = []
333
-              res.rows.forEach(item => {
334
-                tList.push({
335
-                  label: item.dataName,
336
-                  value: item.uuid,
337
-                })
338
-              })
339
-              return tList;
340
-            })
367
+                    }
368
+                    labelCol={{
369
+                        style: { width: 95 }
370
+                    }}
371
+                    placeholder={'请选择新闻分类'}
341 372
 
342
-          }
343
-          labelCol={{
344
-            style: { width: 95 }
345
-          }}
346
-          placeholder={'请选择新闻分类'}
373
+                />
347 374
 
348
-        />
349
-         
350
-        <ProFormText
351
-          name="key"
352
-          label='网页关键字'
353
-          labelCol={{
354
-            style: { width: 95 }
355
-          }}
356
-          placeholder={'请输入页面关键字'}
357
-        />
375
+                <ProFormText
376
+                    name="key"
377
+                    label='网页关键字'
378
+                    labelCol={{
379
+                        style: { width: 95 }
380
+                    }}
381
+                    placeholder={'请输入页面关键字'}
382
+                />
358 383
 
359
-        <ProFormText
360
-          name="source"
361
-          label='来源'
362
-          labelCol={{
363
-            style: { width: 95 }
364
-          }}
365
-          placeholder={'中泽集团'}
366
-          initialValue={'中泽集团'}
367
-        />
384
+                <ProFormText
385
+                    name="source"
386
+                    label='来源'
387
+                    labelCol={{
388
+                        style: { width: 95 }
389
+                    }}
390
+                    placeholder={'中泽集团'}
391
+                    initialValue={'中泽集团'}
392
+                />
368 393
 
369
-        <ProForm.Item 
370
-        label={'党建文章内容'} 
371
-        labelCol={{
372
-          style: { width: 95 }
373
-        }}
374
-        >
375
-          {/* <div id='editor' style={{ width: '70vw', height: '500px' }} ref={editorRef}></div> */}
376
-          <ReactQuill ref={editorRef} placeholder='请输入...' theme='snow' className="ql-editor" modules={modules} value={editorHtml} onChange={handleChangeQuill} />
377
-        </ProForm.Item>
378
-      </ProForm>
379
-    </Drawer>
380
-  );
394
+                <ProForm.Item
395
+                    label={'党建文章内容'}
396
+                    labelCol={{
397
+                        style: { width: 95 }
398
+                    }}
399
+                >
400
+                    {/* <div id='editor' style={{ width: '70vw', height: '500px' }} ref={editorRef}></div> */}
401
+                    <ReactQuill ref={editorRef} placeholder='请输入...' theme='snow' className="ql-editor" modules={modules} value={editorHtml} onChange={handleChangeQuill} />
402
+                </ProForm.Item>
403
+            </ProForm>
404
+        </Drawer>
405
+    );
381 406
 };
382 407
 
383 408
 export default PartyWorkForm;

+ 333
- 1
src/pages/PartyWork/partyWork/index.less Wyświetl plik

@@ -1,3 +1,335 @@
1 1
 .ant-pro-table-list-toolbar-title{
2 2
     display:none;
3
-}
3
+}
4
+.ql-toolbar {
5
+  &.ql-snow .ql-picker {
6
+    &.ql-size {
7
+      width: 60px;
8
+
9
+      & .ql-picker-label::before,
10
+      .ql-picker-item::before {
11
+        content: '默认';
12
+      }
13
+      & .ql-picker-label[data-value='6px']::before,
14
+      & .ql-picker-item[data-value='6px']::before {
15
+        content: '6px';
16
+      }
17
+      & .ql-picker-label[data-value='8px']::before,
18
+      & .ql-picker-item[data-value='8px']::before {
19
+        content: '8px';
20
+      }
21
+      & .ql-picker-label[data-value='9px']::before,
22
+      & .ql-picker-item[data-value='9px']::before {
23
+        content: '9px';
24
+      }
25
+      & .ql-picker-label[data-value='10px']::before,
26
+      & .ql-picker-item[data-value='10px']::before {
27
+        content: '10px';
28
+      }
29
+      & .ql-picker-label[data-value='11px']::before,
30
+      & .ql-picker-item[data-value='11px']::before {
31
+        content: '11px';
32
+      }
33
+
34
+      & .ql-picker-label[data-value='12px']::before,
35
+      & .ql-picker-item[data-value='12px']::before {
36
+        content: '12px';
37
+      }
38
+
39
+      & .ql-picker-label[data-value='14px']::before,
40
+      & .ql-picker-item[data-value='14px']::before {
41
+        content: '14px';
42
+      }
43
+
44
+      & .ql-picker-label[data-value='16px']::before,
45
+      & .ql-picker-item[data-value='16px']::before {
46
+        content: '16px';
47
+      }
48
+
49
+      & .ql-picker-label[data-value='18px']::before,
50
+      & .ql-picker-item[data-value='18px']::before {
51
+        content: '18px';
52
+      }
53
+      & .ql-picker-label[data-value='20px']::before,
54
+      & .ql-picker-item[data-value='20px']::before {
55
+        content: '20px';
56
+      }
57
+      & .ql-picker-label[data-value='22px']::before,
58
+      & .ql-picker-item[data-value='22px']::before {
59
+        content: '22px';
60
+      }
61
+      & .ql-picker-label[data-value='24px']::before,
62
+      & .ql-picker-item[data-value='24px']::before {
63
+        content: '24px';
64
+      }
65
+      & .ql-picker-label[data-value='26px']::before,
66
+      & .ql-picker-item[data-value='26px']::before {
67
+        content: '26px';
68
+      }
69
+      & .ql-picker-label[data-value='28px']::before,
70
+      & .ql-picker-item[data-value='28px']::before {
71
+        content: '28px';
72
+      }
73
+
74
+      & .ql-picker-label[data-value='32px']::before,
75
+      & .ql-picker-item[data-value='32px']::before {
76
+        content: '32px';
77
+      }
78
+      & .ql-picker-label[data-value='36px']::before,
79
+      & .ql-picker-item[data-value='36px']::before {
80
+        content: '36px';
81
+      }
82
+
83
+      & .ql-picker-label[data-value='48px']::before,
84
+      & .ql-picker-item[data-value='48px']::before {
85
+        content: '48px';
86
+      }
87
+      & .ql-picker-label[data-value='72px']::before,
88
+      & .ql-picker-item[data-value='72px']::before {
89
+        content: '72px';
90
+      }
91
+
92
+      & .ql-picker-item[data-value='6px']::before {
93
+        font-size: 6px;
94
+      }
95
+      & .ql-picker-item[data-value='8px']::before {
96
+        font-size: 8px;
97
+      }
98
+      & .ql-picker-item[data-value='9px']::before {
99
+        font-size: 9px;
100
+      }
101
+      & .ql-picker-item[data-value='10px']::before {
102
+        font-size: 10px;
103
+      }
104
+      & .ql-picker-item[data-value='11px']::before {
105
+        font-size: 11px;
106
+      }
107
+      & .ql-picker-item[data-value='12px']::before {
108
+        font-size: 12px;
109
+      }
110
+      & .ql-picker-item[data-value='14px']::before {
111
+        font-size: 14px;
112
+      }
113
+
114
+      & .ql-picker-item[data-value='16px']::before {
115
+        font-size: 16px;
116
+      }
117
+
118
+      & .ql-picker-item[data-value='18px']::before {
119
+        font-size: 18px;
120
+      }
121
+      & .ql-picker-item[data-value='20px']::before {
122
+        font-size: 20px;
123
+      }      
124
+      & .ql-picker-item[data-value='22px']::before {
125
+        font-size: 22px;
126
+      }
127
+      & .ql-picker-item[data-value='24px']::before {
128
+        font-size: 24px;
129
+      }
130
+      & .ql-picker-item[data-value='26px']::before {
131
+        font-size: 26px;
132
+      }
133
+      & .ql-picker-item[data-value='28px']::before {
134
+        font-size: 28px;
135
+      }
136
+
137
+      & .ql-picker-item[data-value='32px']::before {
138
+        font-size: 32px;
139
+      }
140
+      & .ql-picker-item[data-value='36px']::before {
141
+        font-size: 36px;
142
+      }
143
+      
144
+      & .ql-picker-item[data-value='48px']::before {
145
+        font-size: 48px;
146
+      }
147
+      & .ql-picker-item[data-value='72px']::before {
148
+        font-size: 72px;
149
+      }
150
+    }
151
+
152
+    &.ql-wordBox {
153
+      width: 60px;
154
+
155
+      & .ql-picker-label::before,
156
+      .ql-picker-item::before {
157
+        content: '默认';
158
+      }
159
+
160
+      & .ql-picker-label[data-value='20px']::before,
161
+      & .ql-picker-item[data-value='20px']::before {
162
+        content: '20px';
163
+      }
164
+
165
+      & .ql-picker-label[data-value='22px']::before,
166
+      & .ql-picker-item[data-value='22px']::before {
167
+        content: '22px';
168
+      }
169
+
170
+      & .ql-picker-label[data-value='24px']::before,
171
+      & .ql-picker-item[data-value='24px']::before {
172
+        content: '24px';
173
+      }
174
+
175
+      & .ql-picker-label[data-value='26px']::before,
176
+      & .ql-picker-item[data-value='26px']::before {
177
+        content: '26px';
178
+      }
179
+
180
+      & .ql-picker-label[data-value='28px']::before,
181
+      & .ql-picker-item[data-value='28px']::before {
182
+        content: '28px';
183
+      }
184
+
185
+      & .ql-picker-label[data-value='30px']::before,
186
+      & .ql-picker-item[data-value='30px']::before {
187
+        content: '30px';
188
+      }
189
+
190
+      & .ql-picker-label[data-value='32px']::before,
191
+      & .ql-picker-item[data-value='32px']::before {
192
+        content: '32px';
193
+      }
194
+
195
+      & .ql-picker-label[data-value='34px']::before,
196
+      & .ql-picker-item[data-value='34px']::before {
197
+        content: '34px';
198
+      }
199
+
200
+      & .ql-picker-label[data-value='36px']::before,
201
+      & .ql-picker-item[data-value='36px']::before {
202
+        content: '36px';
203
+      }
204
+
205
+      & .ql-picker-label[data-value='38px']::before,
206
+      & .ql-picker-item[data-value='38px']::before {
207
+        content: '36px';
208
+      }
209
+
210
+      & .ql-picker-label[data-value='40px']::before,
211
+      & .ql-picker-item[data-value='40px']::before {
212
+        content: '40px';
213
+      }
214
+
215
+      & .ql-picker-label[data-value='42px']::before,
216
+      & .ql-picker-item[data-value='42px']::before {
217
+        content: '42px';
218
+      }
219
+
220
+      & .ql-picker-label[data-value='44px']::before,
221
+      & .ql-picker-item[data-value='44px']::before {
222
+        content: '44px';
223
+      }
224
+
225
+      & .ql-picker-item[data-value='20px']::before {
226
+        line-height: 20px;
227
+      }
228
+
229
+      & .ql-picker-item[data-value='22px']::before {
230
+        line-height: 22px;
231
+      }
232
+
233
+      & .ql-picker-item[data-value='24px']::before {
234
+        line-height: 24px;
235
+      }
236
+
237
+      & .ql-picker-item[data-value='26px']::before {
238
+        line-height: 26px;
239
+      }
240
+
241
+      & .ql-picker-item[data-value='28px']::before {
242
+        line-height: 28px;
243
+      }
244
+
245
+      & .ql-picker-item[data-value='30px']::before {
246
+        line-height: 30px;
247
+      }
248
+
249
+      & .ql-picker-item[data-value='32px']::before {
250
+        line-height: 32px;
251
+      }
252
+
253
+      & .ql-picker-item[data-value='34px']::before {
254
+        line-height: 34px;
255
+      }
256
+
257
+      & .ql-picker-item[data-value='36px']::before {
258
+        line-height: 36px;
259
+      }
260
+
261
+      & .ql-picker-item[data-value='38px']::before {
262
+        line-height: 38px;
263
+      }
264
+
265
+      & .ql-picker-item[data-value='40px']::before {
266
+        line-height: 40px;
267
+      }
268
+
269
+      & .ql-picker-item[data-value='44px']::before {
270
+        line-height: 44px;
271
+      }
272
+    }
273
+  }
274
+}
275
+
276
+.ql-container {
277
+    .ql-editor {
278
+    & .ql-size-10px {
279
+        font-size: 10px;
280
+    }
281
+
282
+    & .ql-size-12px {
283
+        font-size: 12px;
284
+    }
285
+
286
+    & .ql-size-14px {
287
+        font-size: 14px;
288
+    }
289
+
290
+    & .ql-size-16px {
291
+        font-size: 16px;
292
+    }
293
+
294
+    & .ql-size-18px {
295
+        font-size: 18px;
296
+    }
297
+
298
+    & .ql-size-24px {
299
+        font-size: 24px;
300
+    }
301
+
302
+    & .ql-size-32px {
303
+        font-size: 32px;
304
+    }
305
+
306
+    & .ql-size-40px {
307
+        font-size: 40px;
308
+    }
309
+    }
310
+}
311
+  
312
+  .ql-size-10px {
313
+    font-size: 10px;
314
+  }
315
+  .ql-size-12px {
316
+    font-size: 12px;
317
+  }
318
+  .ql-size-14px {
319
+    font-size: 14px;
320
+  }
321
+  .ql-size-16px {
322
+    font-size: 16px;
323
+  }
324
+  .ql-size-18px {
325
+    font-size: 18px;
326
+  }
327
+  .ql-size-24px {
328
+    font-size: 24px;
329
+  }
330
+  .ql-size-32px {
331
+    font-size: 32px;
332
+  }
333
+  .ql-size-40px {
334
+    font-size: 40px;
335
+  }

+ 282
- 257
src/pages/SocialRespon/socialRespon/edit.tsx Wyświetl plik

@@ -1,295 +1,320 @@
1 1
 import React, { useEffect, useState, useRef } from 'react';
2 2
 import {
3
-  ProForm,
4
-  ProFormText,
5
-  ProFormTextArea,
6
-  ProFormDatePicker,
3
+    ProForm,
4
+    ProFormText,
5
+    ProFormTextArea,
6
+    ProFormDatePicker,
7
+    ProFormDateTimePicker,
7 8
 } from '@ant-design/pro-components';
8 9
 import { Form, Drawer, Space, Button } from 'antd';
9
-import ReactQuill from 'react-quill';
10
+import ReactQuill, { Quill } from 'react-quill';
10 11
 import 'react-quill/dist/quill.snow.css';
11 12
 import { useIntl } from '@umijs/max';
12 13
 import { upload } from '@/services/socialRespon/socialRespon';
13 14
 import moment from 'moment';
15
+const SizeStyle = Quill.import('attributors/style/size')
16
+SizeStyle.whitelist = ['6px','8px','9px','10px','11px','12px','14px', '16px', '18px', '20px','22px','24px','26px','28px', '32px', '36px','48px','72px']
17
+Quill.register(SizeStyle, true)
18
+
19
+var Parchment = Quill.import('parchment');
20
+
21
+let config = {
22
+  scope: Parchment.Scope.INLINE,
23
+  // 会有下拉框列表
24
+  whitelist: ['20px', '22px', '24px', '26px', '28px', '30px', '32px', '34px', '36px', '38px', '40px', '42px', '44px']
25
+  //可设置成没有下拉框的,但会导致无法清除样式
26
+  // whitelist: ['1px solid #000000']  
27
+};
28
+
29
+let wordBox = new Parchment.Attributor.Style('wordBox', 'line-height', config);
30
+
31
+Quill.register(wordBox, true);
14 32
 export type SocialResponProps = {
15
-  onCancel: (flag?: boolean, formVals?: any) => void;
16
-  onSubmit: (values: any) => Promise<void>;
17
-  open: boolean;
18
-  currentRow: any;
19
-  date: any;
20
-  title: string;
21
-  content: string;
22
-  surface: string;
23
-  surfaceUrl: string;
33
+    onCancel: (flag?: boolean, formVals?: any) => void;
34
+    onSubmit: (values: any) => Promise<void>;
35
+    open: boolean;
36
+    currentRow: any;
37
+    date: any;
38
+    title: string;
39
+    content: string;
40
+    surface: string;
41
+    surfaceUrl: string;
24 42
 };
25 43
 
26 44
 let toolbarOptions = [
27
-  ['bold', 'italic', 'underline', 'strike'],        // 切换按钮
28
-  ['blockquote', 'code-block'],
29
-  ['link', 'image'],
30
-  [{ 'list': 'ordered' }, { 'list': 'bullet' }],
31
-  [{ 'script': 'sub' }, { 'script': 'super' }],      // 上标/下标
32
-  [{ 'indent': '-1' }, { 'indent': '+1' }],          // 减少缩进/缩进
33
-  [{ 'direction': 'rtl' }],                         // 文本下划线
34
-  [{ 'size': ['small', false, 'large', 'huge'] }],  // 用户自定义下拉
35
-  [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
36
-  [{ 'color': [] }, { 'background': [] }],          // 主题默认下拉,使用主题提供的值
37
-  [{ 'font': [] }],
38
-  [{ 'align': [] }],
39
-  // [{ 'wordBox': ['20px', '22px', '24px', '26px', '28px', '28px', '30px'] }],
40
-  [{ wordBox: ['20px', '22px', '24px', '26px', '28px', '30px', '32px', '34px', '36px', '38px', '40px', '42px', '44px'] }],
41
-  ['clean'],                                         // 清除格式
42
-
43
-];
45
+    ['bold', 'italic', 'underline', 'strike'],        // 切换按钮
46
+    ['blockquote', 'code-block'],
47
+    ['link', 'image'],
48
+    [{ 'list': 'ordered' }, { 'list': 'bullet' }],
49
+    [{ 'script': 'sub' }, { 'script': 'super' }],      // 上标/下标
50
+    [{ 'indent': '-1' }, { 'indent': '+1' }],          // 减少缩进/缩进
51
+    [{ 'direction': 'rtl' }],                         // 文本下划线
52
+    // [{ 'size': ['small', false, 'large', 'huge'] }],  // 用户自定义下拉
53
+    [{ 'size': ['6px','8px','9px','10px','11px','12px','14px', '16px', '18px', '20px','22px','24px','26px','28px', '32px', '36px','48px','72px']}],
54
+    [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
55
+    [{ 'color': [] }, { 'background': [] }],          // 主题默认下拉,使用主题提供的值
56
+    [{ wordBox: ['20px', '22px', '24px', '26px', '28px', '30px', '32px', '34px', '36px', '38px', '40px', '42px', '44px'] }],
57
+    // [{ 'font': [] }],
58
+    [{ 'align': [] }],
59
+    ['clean'], // 清除格式
60
+  ];
44 61
 
45 62
 const SocialResponForm: React.FC<SocialResponProps> = (props) => {
46 63
 
47
-  const [form] = Form.useForm();
48
-  const intl = useIntl();
49
-  let editorRef = useRef<HTMLDivElement>(null)
50
-  const [editorHtml, setEditorHtml] = useState('');
64
+    const [form] = Form.useForm();
65
+    const intl = useIntl();
66
+    let editorRef = useRef<HTMLDivElement>(null)
67
+    const [editorHtml, setEditorHtml] = useState('');
51 68
 
52
-  const modules = {
53
-    toolbar: {
54
-      container: toolbarOptions, // 使用自定义工具栏选项
55
-    },
56
-  };
57
-  useEffect(() => {
58
-    form.resetFields();
59
-    if (!props.open) return;
60
-    // const { title, content, surface, surfaceUrl, date } = props;
61
-    if (!props.currentRow) return;
62
-    const { digest, top, key, content, surface, surfaceUrl, date, title, source, column } = props.currentRow;
63
-    if (props.currentRow) {
64
-      form.setFieldsValue({
65
-        digest,
66
-        top,
67
-        key,
68
-        column,
69
-        source
70
-      })
71
-      // if (top) {
72
-      //   setCheckTop(1)
73
-      // } else {
74
-      //   setCheckTop(0)
75
-      // }
76
-    }
69
+    const modules = {
70
+        toolbar: {
71
+            container: toolbarOptions, // 使用自定义工具栏选项
72
+        },
73
+    };
74
+    useEffect(() => {
75
+        form.resetFields();
76
+        if (!props.open) return;
77
+        // const { title, content, surface, surfaceUrl, date } = props;
78
+        if (!props.currentRow) return;
79
+        const { digest, top, key, content, surface, surfaceUrl, date, title, source, column,createTime } = props.currentRow;
80
+        if (props.currentRow) {
81
+            form.setFieldsValue({
82
+                digest,
83
+                top,
84
+                key,
85
+                column,
86
+                source,
87
+                createTime
88
+            })
89
+            // if (top) {
90
+            //   setCheckTop(1)
91
+            // } else {
92
+            //   setCheckTop(0)
93
+            // }
94
+        }
77 95
 
78
-    setSurface(surface)
79
-    form.setFieldsValue({
80
-      title: title,
81
-      date: date,
82
-    })
83
-    if (surfaceUrl && surface) {
84
-      setFileList([
85
-        {
86
-          uid: surface,
87
-          thumbUrl: surfaceUrl
96
+        setSurface(surface)
97
+        form.setFieldsValue({
98
+            title: title,
99
+            date: date,
100
+        })
101
+        if (surfaceUrl && surface) {
102
+            setFileList([
103
+                {
104
+                    uid: surface,
105
+                    thumbUrl: surfaceUrl
106
+                }
107
+            ])
88 108
         }
89
-      ])
90
-    }
91
-    setEditorHtml(content || '')
109
+        setEditorHtml(content || '')
92 110
 
93
-  }, [props.open]);
111
+    }, [props.open]);
94 112
 
95
-  const [fileList, setFileList] = useState<any>([]);
96
-  const [surface, setSurface] = useState<any>('');
113
+    const [fileList, setFileList] = useState<any>([]);
114
+    const [surface, setSurface] = useState<any>('');
97 115
 
98
-  const [editWho, setEditWho] = useState('')
99
-  const [userIndex, setUserIndex] = useState(0)
100
-  const [checkTop, setCheckTop] = useState<any>('')
101
-  const handleOk = async () => {
102
-    let data = form.getFieldsValue()
103
-    let val = await form.validateFields()
116
+    const [editWho, setEditWho] = useState('')
117
+    const [userIndex, setUserIndex] = useState(0)
118
+    const [checkTop, setCheckTop] = useState<any>('')
119
+    const handleOk = async () => {
120
+        let data = form.getFieldsValue()
121
+        let val = await form.validateFields()
104 122
 
105
-    let htmlStr = editorHtml?.replaceAll('"', "'")
123
+        let htmlStr = editorHtml?.replaceAll('"', "'")
106 124
 
107
-    // let content = editor.getContents()
108
-    // console.log('htmlStr----', htmlStr)
109
-    // editor.setContents(content)
110
-    data.date = moment(data.date).format('YYYY-MM-DD');
111
-    if (checkTop) {
112
-      data.top = 1;
113
-    } else {
114
-      data.top = 0;
115
-    }
116
-    // data.top = checkTop;
117
-    let formData = {
118
-      ...data,
119
-      surface,
120
-      content: htmlStr
121
-    }
122
-    form.setFieldsValue({
123
-      title: '',
124
-      digest: ""
125
-    })
126
-    setFileList([]);
127
-    setCheckTop(false)
128
-    setEditorHtml('');
129
-    props.onSubmit(formData);
130
-  };
131
-  const handleCancel = () => {
132
-    form.setFieldsValue({
133
-      title: '',
134
-      digest: "",
135
-      top: ""
136
-    })
137
-    setFileList([]);
138
-    setCheckTop(false)
139
-    setEditorHtml('');
140
-    props.onCancel();
125
+        // let content = editor.getContents()
126
+        // console.log('htmlStr----', htmlStr)
127
+        // editor.setContents(content)
128
+        data.date = moment(data.date).format('YYYY-MM-DD');
129
+        data.createTime = moment(data.createTime).format('YYYY-MM-DD HH:mm:ss');
130
+        if (checkTop) {
131
+            data.top = 1;
132
+        } else {
133
+            data.top = 0;
134
+        }
135
+        // data.top = checkTop;
136
+        let formData = {
137
+            ...data,
138
+            surface,
139
+            content: htmlStr
140
+        }
141
+        form.setFieldsValue({
142
+            title: '',
143
+            digest: ""
144
+        })
145
+        setFileList([]);
146
+        setCheckTop(false)
147
+        setEditorHtml('');
148
+        props.onSubmit(formData);
149
+    };
150
+    const handleCancel = () => {
151
+        form.setFieldsValue({
152
+            title: '',
153
+            digest: "",
154
+            top: ""
155
+        })
156
+        setFileList([]);
157
+        setCheckTop(false)
158
+        setEditorHtml('');
159
+        props.onCancel();
141 160
 
142
-  };
143
-  useEffect(() => {
144
-    const quill = editorRef.current.getEditor()
145
-    if (editWho === 'api' && userIndex !== 0) {
146
-      quill.setSelection(userIndex + 2)
147
-    }
148
-  }, [editorHtml])
161
+    };
162
+    useEffect(() => {
163
+        const quill = editorRef.current.getEditor()
164
+        if (editWho === 'api' && userIndex !== 0) {
165
+            quill.setSelection(userIndex + 2)
166
+        }
167
+    }, [editorHtml])
149 168
 
150
-  const base64ToFile = (base64, fileName = `${Math.random()}`) => {
151
-    let arr = base64.split(',')
152
-    console.log(arr[0])
153
-    let mime = arr[0].match(/:(.*?);/)[1]
154
-    let bstr = atob(arr[1])
155
-    let n = bstr.length
156
-    let u8arr = new Uint8Array(n)
157
-    while (n--) {
158
-      u8arr[n] = bstr.charCodeAt(n)
159
-    }
160
-    return new File([u8arr], `${fileName}.${mime.split('/')[1]}`, {
161
-      type: mime,
162
-    })
163
-  }
164
-  const handleChangeQuill = (content, delta, source, editor) => {
165
-    let quill = editorRef.current.getEditor()
166
-    quill.focus()
167
-    let delta_ops = delta.ops
168
-    let quilContent = editor.getContents()
169
-    setEditorHtml(content)
170
-    const range = quill.getSelection()
171
-    if (range) {
172
-      if (range.length == 0 && range.index !== 0) {
173
-        console.log('User cursor is at index', range.index)
174
-        setUserIndex(range.index)
175
-      } else {
176
-        const text = quill.getText(range.index, range.length)
177
-        console.log('User has highlighted: ', text)
178
-      }
179
-    } else {
180
-      console.log('User cursor is not in editor')
169
+    const base64ToFile = (base64, fileName = `${Math.random()}`) => {
170
+        let arr = base64.split(',')
171
+        console.log(arr[0])
172
+        let mime = arr[0].match(/:(.*?);/)[1]
173
+        let bstr = atob(arr[1])
174
+        let n = bstr.length
175
+        let u8arr = new Uint8Array(n)
176
+        while (n--) {
177
+            u8arr[n] = bstr.charCodeAt(n)
178
+        }
179
+        return new File([u8arr], `${fileName}.${mime.split('/')[1]}`, {
180
+            type: mime,
181
+        })
181 182
     }
182
-    setEditWho(source)
183
-    if (delta_ops && delta_ops.length > 0) {
184
-      quilContent.ops.map((item) => {
185
-        if (item.insert) {
186
-          let imgStr = item.insert.image
187
-          if (imgStr && imgStr?.includes('data:image/')) {
188
-            let file = base64ToFile(imgStr)
189
-            let formData = new FormData()
190
-            formData.append('file', file)
191
-            upload(formData).then((res) => {
192
-              item.insert.image = res.data.url
193
-              quill.setContents(quilContent)
183
+    const handleChangeQuill = (content, delta, source, editor) => {
184
+        let quill = editorRef.current.getEditor()
185
+        quill.focus()
186
+        let delta_ops = delta.ops
187
+        let quilContent = editor.getContents()
188
+        setEditorHtml(content)
189
+        const range = quill.getSelection()
190
+        if (range) {
191
+            if (range.length == 0 && range.index !== 0) {
192
+                // console.log('User cursor is at index', range.index)
193
+                setUserIndex(range.index)
194
+            } else {
195
+                const text = quill.getText(range.index, range.length)
196
+                // console.log('User has highlighted: ', text)
197
+            }
198
+        } else {
199
+            console.log('User cursor is not in editor')
200
+        }
201
+        setEditWho(source)
202
+        if (delta_ops && delta_ops.length > 0) {
203
+            quilContent.ops.map((item) => {
204
+                if (item.insert) {
205
+                    let imgStr = item.insert.image
206
+                    if (imgStr && imgStr?.includes('data:image/')) {
207
+                        let file = base64ToFile(imgStr)
208
+                        let formData = new FormData()
209
+                        formData.append('file', file)
210
+                        upload(formData).then((res) => {
211
+                            item.insert.image = res.data.url
212
+                            quill.setContents(quilContent)
213
+                        })
214
+                    }
215
+                }
194 216
             })
195
-          }
196 217
         }
197
-      })
198 218
     }
199
-  }
200 219
 
201 220
 
202 221
 
203
-  return (
204
-    <Drawer
205
-      width={'80%'}
206
-      title={props.currentRow ? '文章编辑' : '新建文章'}
207
-      forceRender
208
-      open={props.open}
209
-      destroyOnClose
210
-      onClose={handleCancel}
211
-      extra={
212
-        <Space>
213
-          <Button onClick={handleCancel}>取消</Button>
214
-          <Button type="primary" onClick={handleOk}>确认</Button>
215
-        </Space>
216
-      }
217
-    >
218
-      <ProForm
219
-        form={form}
220
-        grid={true}
221
-        submitter={false}
222
-        layout="horizontal"
223
-      >
224
-        <ProFormText
225
-          name="title"
226
-          label='标题'
227
-          labelCol={{
228
-            style: { width: 95 }
229
-          }}
230
-          placeholder='请输入标题'
231
-          rules={[
232
-            {
233
-              required: true,
234
-              message: '请输入标题!',
235
-            },
236
-          ]}
237
-        />
238
-        <ProFormTextArea
239
-          name="digest"
240
-          label='摘要'
241
-          labelCol={{
242
-            style: { width: 95 }
243
-          }}
244
-          placeholder={'请输入摘要'}
245
-        />
246
-        <ProFormDatePicker
247
-          name="date"
248
-          label='展示日期'
249
-          fieldProps={{
250
-            format: (value) => value.format('YYYY-MM-DD'),
251
-          }}
252
-          labelCol={{
253
-            style: { width: 95 }
254
-          }}
255
-          rules={[
256
-            {
257
-              required: true
222
+    return (
223
+        <Drawer
224
+            width={'80%'}
225
+            title={props.currentRow ? '文章编辑' : '新建文章'}
226
+            forceRender
227
+            open={props.open}
228
+            destroyOnClose
229
+            onClose={handleCancel}
230
+            extra={
231
+                <Space>
232
+                    <Button onClick={handleCancel}>取消</Button>
233
+                    <Button type="primary" onClick={handleOk}>确认</Button>
234
+                </Space>
258 235
             }
259
-          ]
260
-          }
261
-        />
262
-
263
-        <ProFormText
264
-          name="key"
265
-          label='网页关键字'
266
-          labelCol={{
267
-            style: { width: 95 }
268
-          }}
269
-          placeholder={'请输入页面关键字'}
270
-        />
236
+        >
237
+            <ProForm
238
+                form={form}
239
+                grid={true}
240
+                submitter={false}
241
+                layout="horizontal"
242
+            >
243
+                <ProFormText
244
+                    name="title"
245
+                    label='标题'
246
+                    labelCol={{
247
+                        style: { width: 95 }
248
+                    }}
249
+                    placeholder='请输入标题'
250
+                    rules={[
251
+                        {
252
+                            required: true,
253
+                            message: '请输入标题!',
254
+                        },
255
+                    ]}
256
+                />
257
+                <ProFormTextArea
258
+                    name="digest"
259
+                    label='摘要'
260
+                    labelCol={{
261
+                        style: { width: 95 }
262
+                    }}
263
+                    placeholder={'请输入摘要'}
264
+                />
265
+                <ProFormDatePicker
266
+                    name="date"
267
+                    label='展示日期'
268
+                    fieldProps={{
269
+                        format: (value) => value.format('YYYY-MM-DD'),
270
+                    }}
271
+                    labelCol={{
272
+                        style: { width: 95 }
273
+                    }}
274
+                    rules={[
275
+                        {
276
+                            required: true
277
+                        }
278
+                    ]
279
+                    }
280
+                />
281
+                <ProFormDateTimePicker
282
+                    name="createTime"
283
+                    label='发稿时间'
284
+                    fieldProps={{ format: (value) => value.format('YYYY-MM-DD HH:mm:ss') }}
285
+                    labelCol={{ style: { width: 95 } }}
286
+                    rules={[{ required: true }]}
287
+                />
288
+                <ProFormText
289
+                    name="key"
290
+                    label='网页关键字'
291
+                    labelCol={{
292
+                        style: { width: 95 }
293
+                    }}
294
+                    placeholder={'请输入页面关键字'}
295
+                />
271 296
 
272
-        <ProFormText
273
-          name="source"
274
-          label='来源'
275
-          labelCol={{
276
-            style: { width: 95 }
277
-          }}
278
-          placeholder={'中泽集团'}
279
-          initialValue={'中泽集团'}
280
-        />
297
+                <ProFormText
298
+                    name="source"
299
+                    label='来源'
300
+                    labelCol={{
301
+                        style: { width: 95 }
302
+                    }}
303
+                    placeholder={'中泽集团'}
304
+                    initialValue={'中泽集团'}
305
+                />
281 306
 
282
-        <ProForm.Item
283
-          label={'文章内容'}
284
-          labelCol={{
285
-            style: { width: 95 }
286
-          }}
287
-        >
288
-          <ReactQuill ref={editorRef} placeholder='请输入...' theme='snow' className="ql-editor" modules={modules} value={editorHtml} onChange={handleChangeQuill} />
289
-        </ProForm.Item>
290
-      </ProForm>
291
-    </Drawer>
292
-  );
307
+                <ProForm.Item
308
+                    label={'文章内容'}
309
+                    labelCol={{
310
+                        style: { width: 95 }
311
+                    }}
312
+                >
313
+                    <ReactQuill ref={editorRef} placeholder='请输入...' theme='snow' className="ql-editor" modules={modules} value={editorHtml} onChange={handleChangeQuill} />
314
+                </ProForm.Item>
315
+            </ProForm>
316
+        </Drawer>
317
+    );
293 318
 };
294 319
 
295 320
 export default SocialResponForm;

+ 334
- 1
src/pages/SocialRespon/socialRespon/index.less Wyświetl plik

@@ -1,3 +1,336 @@
1 1
 .ant-pro-table-list-toolbar-title{
2 2
     display:none;
3
-}
3
+}
4
+
5
+.ql-toolbar {
6
+  &.ql-snow .ql-picker {
7
+    &.ql-size {
8
+      width: 60px;
9
+
10
+      & .ql-picker-label::before,
11
+      .ql-picker-item::before {
12
+        content: '默认';
13
+      }
14
+      & .ql-picker-label[data-value='6px']::before,
15
+      & .ql-picker-item[data-value='6px']::before {
16
+        content: '6px';
17
+      }
18
+      & .ql-picker-label[data-value='8px']::before,
19
+      & .ql-picker-item[data-value='8px']::before {
20
+        content: '8px';
21
+      }
22
+      & .ql-picker-label[data-value='9px']::before,
23
+      & .ql-picker-item[data-value='9px']::before {
24
+        content: '9px';
25
+      }
26
+      & .ql-picker-label[data-value='10px']::before,
27
+      & .ql-picker-item[data-value='10px']::before {
28
+        content: '10px';
29
+      }
30
+      & .ql-picker-label[data-value='11px']::before,
31
+      & .ql-picker-item[data-value='11px']::before {
32
+        content: '11px';
33
+      }
34
+
35
+      & .ql-picker-label[data-value='12px']::before,
36
+      & .ql-picker-item[data-value='12px']::before {
37
+        content: '12px';
38
+      }
39
+
40
+      & .ql-picker-label[data-value='14px']::before,
41
+      & .ql-picker-item[data-value='14px']::before {
42
+        content: '14px';
43
+      }
44
+
45
+      & .ql-picker-label[data-value='16px']::before,
46
+      & .ql-picker-item[data-value='16px']::before {
47
+        content: '16px';
48
+      }
49
+
50
+      & .ql-picker-label[data-value='18px']::before,
51
+      & .ql-picker-item[data-value='18px']::before {
52
+        content: '18px';
53
+      }
54
+      & .ql-picker-label[data-value='20px']::before,
55
+      & .ql-picker-item[data-value='20px']::before {
56
+        content: '20px';
57
+      }
58
+      & .ql-picker-label[data-value='22px']::before,
59
+      & .ql-picker-item[data-value='22px']::before {
60
+        content: '22px';
61
+      }
62
+      & .ql-picker-label[data-value='24px']::before,
63
+      & .ql-picker-item[data-value='24px']::before {
64
+        content: '24px';
65
+      }
66
+      & .ql-picker-label[data-value='26px']::before,
67
+      & .ql-picker-item[data-value='26px']::before {
68
+        content: '26px';
69
+      }
70
+      & .ql-picker-label[data-value='28px']::before,
71
+      & .ql-picker-item[data-value='28px']::before {
72
+        content: '28px';
73
+      }
74
+
75
+      & .ql-picker-label[data-value='32px']::before,
76
+      & .ql-picker-item[data-value='32px']::before {
77
+        content: '32px';
78
+      }
79
+      & .ql-picker-label[data-value='36px']::before,
80
+      & .ql-picker-item[data-value='36px']::before {
81
+        content: '36px';
82
+      }
83
+
84
+      & .ql-picker-label[data-value='48px']::before,
85
+      & .ql-picker-item[data-value='48px']::before {
86
+        content: '48px';
87
+      }
88
+      & .ql-picker-label[data-value='72px']::before,
89
+      & .ql-picker-item[data-value='72px']::before {
90
+        content: '72px';
91
+      }
92
+
93
+      & .ql-picker-item[data-value='6px']::before {
94
+        font-size: 6px;
95
+      }
96
+      & .ql-picker-item[data-value='8px']::before {
97
+        font-size: 8px;
98
+      }
99
+      & .ql-picker-item[data-value='9px']::before {
100
+        font-size: 9px;
101
+      }
102
+      & .ql-picker-item[data-value='10px']::before {
103
+        font-size: 10px;
104
+      }
105
+      & .ql-picker-item[data-value='11px']::before {
106
+        font-size: 11px;
107
+      }
108
+      & .ql-picker-item[data-value='12px']::before {
109
+        font-size: 12px;
110
+      }
111
+      & .ql-picker-item[data-value='14px']::before {
112
+        font-size: 14px;
113
+      }
114
+
115
+      & .ql-picker-item[data-value='16px']::before {
116
+        font-size: 16px;
117
+      }
118
+
119
+      & .ql-picker-item[data-value='18px']::before {
120
+        font-size: 18px;
121
+      }
122
+      & .ql-picker-item[data-value='20px']::before {
123
+        font-size: 20px;
124
+      }      
125
+      & .ql-picker-item[data-value='22px']::before {
126
+        font-size: 22px;
127
+      }
128
+      & .ql-picker-item[data-value='24px']::before {
129
+        font-size: 24px;
130
+      }
131
+      & .ql-picker-item[data-value='26px']::before {
132
+        font-size: 26px;
133
+      }
134
+      & .ql-picker-item[data-value='28px']::before {
135
+        font-size: 28px;
136
+      }
137
+
138
+      & .ql-picker-item[data-value='32px']::before {
139
+        font-size: 32px;
140
+      }
141
+      & .ql-picker-item[data-value='36px']::before {
142
+        font-size: 36px;
143
+      }
144
+      
145
+      & .ql-picker-item[data-value='48px']::before {
146
+        font-size: 48px;
147
+      }
148
+      & .ql-picker-item[data-value='72px']::before {
149
+        font-size: 72px;
150
+      }
151
+    }
152
+
153
+    &.ql-wordBox {
154
+      width: 60px;
155
+
156
+      & .ql-picker-label::before,
157
+      .ql-picker-item::before {
158
+        content: '默认';
159
+      }
160
+
161
+      & .ql-picker-label[data-value='20px']::before,
162
+      & .ql-picker-item[data-value='20px']::before {
163
+        content: '20px';
164
+      }
165
+
166
+      & .ql-picker-label[data-value='22px']::before,
167
+      & .ql-picker-item[data-value='22px']::before {
168
+        content: '22px';
169
+      }
170
+
171
+      & .ql-picker-label[data-value='24px']::before,
172
+      & .ql-picker-item[data-value='24px']::before {
173
+        content: '24px';
174
+      }
175
+
176
+      & .ql-picker-label[data-value='26px']::before,
177
+      & .ql-picker-item[data-value='26px']::before {
178
+        content: '26px';
179
+      }
180
+
181
+      & .ql-picker-label[data-value='28px']::before,
182
+      & .ql-picker-item[data-value='28px']::before {
183
+        content: '28px';
184
+      }
185
+
186
+      & .ql-picker-label[data-value='30px']::before,
187
+      & .ql-picker-item[data-value='30px']::before {
188
+        content: '30px';
189
+      }
190
+
191
+      & .ql-picker-label[data-value='32px']::before,
192
+      & .ql-picker-item[data-value='32px']::before {
193
+        content: '32px';
194
+      }
195
+
196
+      & .ql-picker-label[data-value='34px']::before,
197
+      & .ql-picker-item[data-value='34px']::before {
198
+        content: '34px';
199
+      }
200
+
201
+      & .ql-picker-label[data-value='36px']::before,
202
+      & .ql-picker-item[data-value='36px']::before {
203
+        content: '36px';
204
+      }
205
+
206
+      & .ql-picker-label[data-value='38px']::before,
207
+      & .ql-picker-item[data-value='38px']::before {
208
+        content: '36px';
209
+      }
210
+
211
+      & .ql-picker-label[data-value='40px']::before,
212
+      & .ql-picker-item[data-value='40px']::before {
213
+        content: '40px';
214
+      }
215
+
216
+      & .ql-picker-label[data-value='42px']::before,
217
+      & .ql-picker-item[data-value='42px']::before {
218
+        content: '42px';
219
+      }
220
+
221
+      & .ql-picker-label[data-value='44px']::before,
222
+      & .ql-picker-item[data-value='44px']::before {
223
+        content: '44px';
224
+      }
225
+
226
+      & .ql-picker-item[data-value='20px']::before {
227
+        line-height: 20px;
228
+      }
229
+
230
+      & .ql-picker-item[data-value='22px']::before {
231
+        line-height: 22px;
232
+      }
233
+
234
+      & .ql-picker-item[data-value='24px']::before {
235
+        line-height: 24px;
236
+      }
237
+
238
+      & .ql-picker-item[data-value='26px']::before {
239
+        line-height: 26px;
240
+      }
241
+
242
+      & .ql-picker-item[data-value='28px']::before {
243
+        line-height: 28px;
244
+      }
245
+
246
+      & .ql-picker-item[data-value='30px']::before {
247
+        line-height: 30px;
248
+      }
249
+
250
+      & .ql-picker-item[data-value='32px']::before {
251
+        line-height: 32px;
252
+      }
253
+
254
+      & .ql-picker-item[data-value='34px']::before {
255
+        line-height: 34px;
256
+      }
257
+
258
+      & .ql-picker-item[data-value='36px']::before {
259
+        line-height: 36px;
260
+      }
261
+
262
+      & .ql-picker-item[data-value='38px']::before {
263
+        line-height: 38px;
264
+      }
265
+
266
+      & .ql-picker-item[data-value='40px']::before {
267
+        line-height: 40px;
268
+      }
269
+
270
+      & .ql-picker-item[data-value='44px']::before {
271
+        line-height: 44px;
272
+      }
273
+    }
274
+  }
275
+}
276
+
277
+.ql-container {
278
+    .ql-editor {
279
+    & .ql-size-10px {
280
+        font-size: 10px;
281
+    }
282
+
283
+    & .ql-size-12px {
284
+        font-size: 12px;
285
+    }
286
+
287
+    & .ql-size-14px {
288
+        font-size: 14px;
289
+    }
290
+
291
+    & .ql-size-16px {
292
+        font-size: 16px;
293
+    }
294
+
295
+    & .ql-size-18px {
296
+        font-size: 18px;
297
+    }
298
+
299
+    & .ql-size-24px {
300
+        font-size: 24px;
301
+    }
302
+
303
+    & .ql-size-32px {
304
+        font-size: 32px;
305
+    }
306
+
307
+    & .ql-size-40px {
308
+        font-size: 40px;
309
+    }
310
+    }
311
+}
312
+  
313
+  .ql-size-10px {
314
+    font-size: 10px;
315
+  }
316
+  .ql-size-12px {
317
+    font-size: 12px;
318
+  }
319
+  .ql-size-14px {
320
+    font-size: 14px;
321
+  }
322
+  .ql-size-16px {
323
+    font-size: 16px;
324
+  }
325
+  .ql-size-18px {
326
+    font-size: 18px;
327
+  }
328
+  .ql-size-24px {
329
+    font-size: 24px;
330
+  }
331
+  .ql-size-32px {
332
+    font-size: 32px;
333
+  }
334
+  .ql-size-40px {
335
+    font-size: 40px;
336
+  }

+ 1
- 1
src/services/JoinZZ/biddingDocument.ts Wyświetl plik

@@ -52,7 +52,7 @@ export async function pushBiddingDocumentDetail(params: any) {
52 52
 
53 53
 //发布全部
54 54
 export async function pushBiddingDocumentDetailAll(params: any) {
55
-  return request('/api/staticize/static/articleDetail?type=biddingDocument&uuid='+params.uuid, {
55
+  return request('/api/staticize/static/articleDetail?type=biddingDocument', {
56 56
     method: 'GET',
57 57
     headers: {
58 58
       'Content-Type': 'application/json;charset=UTF-8',

Ładowanie…
Anuluj
Zapisz