zxl
2025-07-17 1f233d9f5f5dafb6914fb488cd82065a8deb3e6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
<template>
  <div class="news-management">
    <Card>
      <!-- 搜索表单 -->
      <Form
        ref="searchForm"
        @keydown.enter.native="handleSearch"
        :model="searchForm"
        inline
        :label-width="80"
        class="search-form"
      >
        <FormItem label="标题" prop="title">
          <Input
            type="text"
            v-model="searchForm.title"
            placeholder="请输入标题名称"
            clearable
            @on-clear="handleSearch"
            style="width: 180px"
          />
        </FormItem>
        <FormItem label="是否发布" prop="publish">
          <Select
            v-model="searchForm.publish"
            placeholder="请选择"
            style="width: 180px"
            clearable
            @on-clear="handleSearch"
            @on-change="handleSearch"
          >
            <Option
              v-for="item in typeSelect"
              :value="item.value"
              :key="item.id"
            >
              {{ item.label }}
            </Option>
          </Select>
        </FormItem>
        <Button
          @click="handleSearch"
          type="primary"
          icon="ios-search"
          class="search-btn"
        >搜索</Button>
        <Button
          @click="resetSearch"
          icon="md-refresh"
          style="margin-left: 8px"
        >重置</Button>
      </Form>
 
      <!-- 操作按钮 -->
      <Row class="operation">
        <Button @click="openAdd" type="primary" icon="md-add">新增活动</Button>
        <Button @click="delBatch" type="error" icon="md-trash" :disabled="selectCount === 0">批量删除</Button>
      </Row>
 
      <!-- 活动表格 -->
      <Table
        :loading="loading"
        border
        :columns="columns"
        :data="newsList"
        ref="table"
        @on-selection-change="showSelect"
        class="news-table"
      >
        <!-- 封面展示插槽 -->
        <!-- 操作按钮插槽 -->
        <template slot-scope="{ row }" slot="action">
          <div class="action-btns">
            <Button
              type="primary"
              size="small"
              @click="changeStatus(row, row.publish ? '下架' : '发布')"
              :loading="row.statusLoading"
            >
              {{ row.publish  ? '下架' : '发布' }}
            </Button>
            <Button
              type="info"
              size="small"
              @click="detail(row)"
            >详情</Button>
            <Button
              type="info"
              size="small"
              @click="openEdit(row)"
            >编辑</Button>
            <Button
              type="error"
              size="small"
              @click="delById(row)"
            >删除</Button>
          </div>
        </template>
      </Table>
 
      <!-- 分页 -->
      <Row type="flex" justify="end" class="page-footer">
        <Page
          :current="searchForm.pageNumber"
          :total="total"
          :page-size="searchForm.pageSize"
          @on-change="changePage"
          @on-page-size-change="changePageSize"
          :page-size-opts="[10, 20, 50]"
          size="small"
          show-total
          show-elevator
          show-sizer
        ></Page>
      </Row>
 
      <!-- 新闻编辑/新增模态框 -->
      <Modal
        v-model="modelShow"
        :title="modelTitle"
        @on-cancel="modelClose"
        width="800"
        :mask-closable="false"
      >
        <Form ref="form" :model="newsForm" :label-width="100" :rules="rules">
          <Row :gutter="16">
            <Col span="12">
              <FormItem label="标题" prop="title">
                <Input
                  v-model="newsForm.title"
                  placeholder="请输入标题名称"
                  clearable
                />
              </FormItem>
            </Col>
            <Col span="24">
              <FormItem label="新闻内容:" prop="content">
                <Upload
                  :show-upload-list="false"
                  ref="upload"
                  style="display: none"
                  :before-upload="handleUploadEdit"
                  :format="['jpg','jpeg','png','gif','mp4','mov']"
                  :max-size="20480"
                  action=""
                  accept="image/*,video/*"
                >
                </Upload>
                <!-- 基于elementUi的上传组件 el-upload end-->
                <quill-editor
                  v-model="newsForm.content"
                  ref="QuillEditor"
                  class="editor"
                  :options="editorOption"
                  @blur="onEditorBlur($event)"
                  @focus="onEditorFocus($event)"
                  @ready="onEditorReady($event)"
                >
                </quill-editor>
              </FormItem>
            </Col>
          </Row>
        </Form>
 
        <div slot="footer">
          <Button @click="modelClose">取消</Button>
          <Button type="primary" :loading="submitLoading" @click="saveOrUpdate">提交</Button>
        </div>
      </Modal>
 
 
      <Modal
        v-model="infoModelShow"
        :title="modelTitle"
        @on-cancel="infoModelClose"
        width="800"
        :mask-closable="false"
      >
        <div class="detail-container">
          <Row :gutter="16">
            <Col span="12">
              <div class="detail-item">
                <label>标题:</label>
                <span>{{ newsInfo.title || '-' }}</span>
              </div>
            </Col>
            <Col span="12">
              <div class="detail-item">
                <label>是否发布:</label>
                <span>{{newsInfo.publish  ? '已发布':'未发布'}}</span>
              </div>
            </Col>
 
            <Col span="12">
              <div class="detail-item" v-if="newsInfo.publish">
                <label>发布时间:</label>
                <span>{{ newsInfo.publishDate}}</span>
              </div>
            </Col>
            <Col span="24">
              <div class="detail-item">
                <label>新闻内容:</label>
                <div
                  class="news-content"
                  v-html="newsInfo.content || '无内容'"
                ></div>
              </div>
            </Col>
          </Row>
        </div>
 
        <div slot="footer">
          <Button @click="infoModelClose">关闭</Button>
        </div>
      </Modal>
 
 
      <!-- 图片预览模态框 -->
      <Modal v-model="previewVisible" title="图片预览" footer-hide>
        <img :src="previewImageUrl" style="width: 100%">
      </Modal>
    </Card>
  </div>
</template>
<script>
import { getNews,editNews,addNews,publish,delById } from '@/api/news.js'
import { uploadFileByLmk, delByKey } from "@/api/common.js"
import { quillEditor } from 'vue-quill-editor'
 
import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css';
import 'quill/dist/quill.bubble.css';
 
import * as Quill from 'quill' //引入编辑器
import VideoBlot from '../activity/video.js';
 
const toolbarOptions = [
  ['bold', 'italic', 'underline', 'strike'],        // 加粗,斜体,下划线,删除线
  ['blockquote', 'code-block'],                     //引用,代码块
  [{ 'header': 1 }, { 'header': 2 }],               // 几级标题
  [{ 'list': 'ordered' }, { 'list': 'bullet' }],    // 有序列表,无序列表
  [{ 'script': 'sub' }, { 'script': 'super' }],     // 下角标,上角标
  [{ 'indent': '-1' }, { 'indent': '+1' }],         // 缩进
  [{ 'direction': 'rtl' }],                         // 文字输入方向
  [{ 'size': ['small', false, 'large', 'huge'] }],  // 字体大小
  [{ 'header': [1, 2, 3, 4, 5, 6, false] }],        // 标题
  [{ 'color': [] }, { 'background': [] }],          // 颜色选择
  // [{ 'font': [] }], // 字体
  [{ 'align': [] }],    // 居中
  ['clean'],            // 清除样式,
  ['link'],
  ['myUploadBtn'],
]
 
// toolbar标题
const titleConfig = [
  { Choice: '.ql-insertMetric', title: '跳转配置' },
  { Choice: '.ql-bold', title: '加粗' },
  { Choice: '.ql-italic', title: '斜体' },
  { Choice: '.ql-underline', title: '下划线' },
  { Choice: '.ql-header', title: '段落格式' },
  { Choice: '.ql-strike', title: '删除线' },
  { Choice: '.ql-blockquote', title: '块引用' },
  { Choice: '.ql-code', title: '插入代码' },
  { Choice: '.ql-code-block', title: '插入代码段' },
  { Choice: '.ql-font', title: '字体' },
  { Choice: '.ql-size', title: '字体大小' },
  { Choice: '.ql-list[value="ordered"]', title: '编号列表' },
  { Choice: '.ql-list[value="bullet"]', title: '项目列表' },
  { Choice: '.ql-direction', title: '文本方向' },
  { Choice: '.ql-header[value="1"]', title: 'h1' },
  { Choice: '.ql-header[value="2"]', title: 'h2' },
  { Choice: '.ql-align', title: '对齐方式' },
  { Choice: '.ql-color', title: '字体颜色' },
  { Choice: '.ql-background', title: '背景颜色' },
  { Choice: '.ql-image', title: '图像' },
  { Choice: '.ql-video', title: '视频' },
  { Choice: '.ql-link', title: '添加链接' },
  { Choice: '.ql-formula', title: '插入公式' },
  { Choice: '.ql-clean', title: '清除字体格式' },
  { Choice: '.ql-script[value="sub"]', title: '下标' },
  { Choice: '.ql-script[value="super"]', title: '上标' },
  { Choice: '.ql-indent[value="-1"]', title: '向左缩进' },
  { Choice: '.ql-indent[value="+1"]', title: '向右缩进' },
  { Choice: '.ql-header .ql-picker-label', title: '标题大小' },
  { Choice: '.ql-header .ql-picker-item[data-value="1"]', title: '标题一' },
  { Choice: '.ql-header .ql-picker-item[data-value="2"]', title: '标题二' },
  { Choice: '.ql-header .ql-picker-item[data-value="3"]', title: '标题三' },
  { Choice: '.ql-header .ql-picker-item[data-value="4"]', title: '标题四' },
  { Choice: '.ql-header .ql-picker-item[data-value="5"]', title: '标题五' },
  { Choice: '.ql-header .ql-picker-item[data-value="6"]', title: '标题六' },
  { Choice: '.ql-header .ql-picker-item:last-child', title: '标准' },
  { Choice: '.ql-size .ql-picker-item[data-value="small"]', title: '小号' },
  { Choice: '.ql-size .ql-picker-item[data-value="large"]', title: '大号' },
  { Choice: '.ql-size .ql-picker-item[data-value="huge"]', title: '超大号' },
  { Choice: '.ql-size .ql-picker-item:nth-child(2)', title: '标准' },
  { Choice: '.ql-align .ql-picker-item:first-child', title: '居左对齐' },
  { Choice: '.ql-align .ql-picker-item[data-value="center"]', title: '居中对齐' },
  { Choice: '.ql-align .ql-picker-item[data-value="right"]', title: '居右对齐' },
  { Choice: '.ql-align .ql-picker-item[data-value="justify"]', title: '两端对齐' }
]
 
 
export default {
  name: "newsManagement",
  components: {quillEditor},
  data(){
    return{
      // 图片预览
      previewVisible: false,
      previewImageUrl: '',
 
      modelShow:false,
      modelTitle:'',
      submitLoading:false,
      infoModelShow:false,
      //表头
      columns: [
        {
          type: 'selection',
          width: 60,
          align: 'center'
        },
        {
          title: '标题',
          key: 'title',
          minWidth: 120,
          tooltip: true
        },
        {
          title: '发布',
          key: 'publish',
          width: 100,
          align: 'center',
          render: (h, params) => {
            return h('Tag', {
              props: {
                color: params.row.publish ? 'green' : 'default'
              }
            }, params.row.publish ? '已发布' : '未发布')
          }
        },
        {
          title: '发布时间',
          key: 'publishDate',
          width: 300,
          align: 'center',
          render: (h, { row }) => {
            // 如果 publishDate 为 null 或 undefined,显示 "未发布"
            if (row.publishDate == null) {
              return h('span', { style: { color: '#999' } }, '暂无');
            }
            // 否则正常显示日期
            return h('span', row.publishDate);
          },
        },
        {
          title: '操作',
          slot: 'action',
          width: 280,
          align: 'center',
          fixed: 'right'
        }
      ],
 
      newsList:[],
      total:0,
      newsForm:{
        id:'',
        title:'',
        content:'',
        publish:0,
      },
      newsInfo:{
        title:'',
        publish:false,
        publishDate:'',
        content:''
      },
      rules: {
        title: [
          { required: true, message: '请输入标题', trigger: 'blur' },
          { max: 50, message: '长度不能超过50个字符', trigger: 'blur' }
        ],
        publish: [
          { required: true, message: '请选择是否发布', trigger: 'blur' },
        ],
        content: [
          { required: true, message: '请输入新闻内容', trigger: 'blur' }
        ]
      },
 
      selectList:[],
      selectCount:0,
 
      loading:false,
 
      searchForm: {
        title: '',
        publish: 0,
        pageNumber: 1,
        pageSize: 10
      },
      typeSelect:[
        {
          id:1,
          label:'未发布',
          value:0
        },
        {
          id:2,
          label:'已发布',
          value:1
        }
 
      ],
 
      file: null,
      Quill:'',
      defaultValue: '',
      editorOption: {
        placeholder: '请在这里输入',
        theme: 'snow', //主题 snow/bubble
        modules: {
          history: {
            delay: 1000,
            maxStack: 50,
            userOnly: false
          },
          toolbar: {
            container: toolbarOptions,
            handlers: {
              myUploadBtn: this.myMethod,
            }
          }
        }
      }
    }
  },
  // 在组件创建前注册
  beforeCreate() {
    Quill.register(VideoBlot, true);
  },
  mounted() {
    //初始化
    this.Quill=this.$refs.QuillEditor.quill
    this.getNewsList();
    this.initTitle();
    this.initButton();
  },
  methods:{
    onEditorBlur(editor) {
    },
    // 获得焦点
    onEditorFocus(editor) {
    },
    // 开始
    onEditorReady(editor) {
    },
    myMethod(){
      this.$refs.upload.handleClick();
    },
    initButton(){
      const editorButton = document.querySelector('.ql-myUploadBtn')
      editorButton.innerHTML = '<svg t="1751966766109" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1530" fill="currentColor"  style="width: 1em; height: 1em; vertical-align: middle;"><path d="M1024 693.248q0 25.6-8.704 48.128t-24.576 40.448-36.864 30.208-45.568 16.384l1.024 1.024-17.408 0-4.096 0-4.096 0-675.84 0q-5.12 1.024-16.384 1.024-39.936 0-74.752-15.36t-60.928-41.472-40.96-60.928-14.848-74.752 14.848-74.752 40.96-60.928 60.928-41.472 74.752-15.36l1.024 0q-1.024-8.192-1.024-15.36l0-16.384q0-72.704 27.648-137.216t75.776-112.128 112.128-75.264 136.704-27.648 137.216 27.648 112.64 75.264 75.776 112.128 27.648 137.216q0 37.888-8.192 74.24t-22.528 69.12q5.12-1.024 10.752-1.536t10.752-0.512q27.648 0 52.736 10.752t43.52 29.696 29.184 44.032 10.752 53.76zM665.6 571.392q20.48 0 26.624-4.608t-8.192-22.016q-14.336-18.432-31.744-48.128t-36.352-60.416-38.4-57.344-37.888-38.912q-18.432-13.312-27.136-14.336t-25.088 12.288q-18.432 15.36-35.84 38.912t-35.328 50.176-35.84 52.224-36.352 45.056q-18.432 18.432-13.312 32.768t25.6 14.336l16.384 0q9.216 0 19.968 0.512t20.992 0.512l17.408 0q14.336 1.024 18.432 9.728t4.096 24.064q0 17.408-0.512 30.72t-0.512 25.6-0.512 25.6-0.512 30.72q0 7.168 1.536 15.36t5.632 15.36 12.288 11.776 21.504 4.608l23.552 0q9.216 0 27.648 1.024 24.576 0 28.16-12.288t3.584-38.912q0-23.552 0.512-42.496t0.512-51.712q0-23.552 4.608-36.352t19.968-12.8q11.264 0 32.256-0.512t32.256-0.512z" p-id="1531"></path></svg>'
    },
 
    initTitle() {
      document.getElementsByClassName('ql-editor')[0].dataset.placeholder = ''
      for (let item of titleConfig) {
        let tip = document.querySelector('.quill-editor ' + item.Choice)
        if (!tip) continue
        tip.setAttribute('title', item.title)
      }
    },
    handleUploadEdit(file){
      const fileType = file.type
      const isImage = fileType.includes('image')
      const isVideo = fileType.includes('video')
 
      if (!isImage && !isVideo) {
        this.$Message.error('请上传图片或视频文件')
        return false
      }
 
      if (file.size > 20 * 1024 * 1024) {
        this.$Message.error('文件大小不能超过20MB')
        return false
      }
 
      this.file = file
      this.uploadFile2()
      return false
    },
    uploadFile2() {
 
      if (!this.file) return
 
      this.submitLoading = true
      const formData = new FormData()
      formData.append('file', this.file)
      uploadFileByLmk(formData).then(res => {
        this.submitLoading = false
        if (res.code === 200) {
          let url = res.data.url;
          let fileKey = res.data.fileKey;
          let fileType = this.getFileType(this.file);
 
          const range = this.Quill.getSelection();
          const index = range ? range.index : this.Quill.getLength();
 
          console.log("--------");
          if (fileType === 'video') {
            this.Quill.insertEmbed(index, 'video', {
              url:url,
              controls:'controls',
              width:'100%',
              height:'auto'
            });
          } else if (fileType === 'image') {
            this.Quill.insertEmbed(index, "image", url);
          } else {
            // 如果不是图片或视频,可以处理其他类型或给出提示
            this.$Message.warning('不支持的文件类型');
            return;
          }
          console.log("--------");
          console.log(this.newsForm.content)
          this.Quill.setSelection(index + 1);
          this.$Message.success('上传成功')
        }
      }).catch(() => {
        this.submitLoading = false
      })
    },
    getNewsList(){
      this.loading = true
      getNews(this.searchForm).then(res =>{
        this.loading = false
        if (res.code === 200) {
          // 为每一行添加loading状态
          this.newsList = res.data.map(item => ({
            ...item,
          }))
          this.total = res.total
        }
      }).catch(() => {
        this.loading = false
      })
    },
 
    saveOrUpdate(){
      console.log(this.newsForm)
      // this.$refs.form.validate(valid => {
      //   if (valid) {
      //     this.submitLoading = true
      //     const submitData = {
      //       ...this.newsForm,
      //       publish: this.newsForm.publish !== 0,  // true → 1, false → 0
      //     };
      //     if (this.newsForm.id){
      //       editNews(submitData).then(res => {
      //         this.submitLoading = false
      //         if (res.code === 200) {
      //           this.$Message.success(res.msg)
      //           this.modelClose()
      //           this.getNewsList()
      //         }
      //       }).catch(() => {
      //         this.submitLoading = false
      //       })
      //     }else {
      //       addNews(submitData).then(res => {
      //         this.submitLoading = false
      //         if (res.code === 200) {
      //           this.$Message.success(res.msg)
      //           this.modelClose()
      //           this.getNewsList()
      //         }
      //       }).catch(() => {
      //         this.submitLoading = false
      //       })
      //     }
      //
      //   }
      // })
    },
 
    infoModelClose(){
      this.infoModelShow = false;
    },
 
    modelClose(){
      this.modelShow = false;
    },
 
    changePage(page) {
      this.searchForm.pageNumber = page
      this.getNewsList()
    },
 
    // 改变每页条数
    changePageSize(pageSize) {
      this.searchForm.pageNumber = 1
      this.searchForm.pageSize = pageSize
      this.getNewsList()
    },
 
    delById(row){
      delById(row.id).then(res =>{
        if (res.code === 200){
          this.$Message.success(res.msg);
          this.getNewsList();
        }
 
      })
    },
 
    openEdit(row){
      this.modelTitle = '修改新闻';
      this.modelShow = true;
      this.$refs.form.resetFields();
      this.newsForm.title = row.title;
      this.newsForm.content = row.content;
      this.newsForm.id = row.id;
      this.$refs.editor.setContent(this.newsForm.content)
    },
 
    openAdd(){
      this.modelTitle = '新增新闻';
      this.modelShow = true;
      this.$refs.form.resetFields()
      this.newsForm.id = '';
      this.newsForm.content = '';
      this.newsForm.publish = 0;
 
    },
 
    detail(row){
      this.modelTitle = '活动详情'
      this.infoModelShow = true
      this.newsInfo = row
    },
 
    changeStatus(row,action){
      row.statusLoading = true;
 
      publish(row.id).then(res =>{
        row.statusLoading = false
        if (res.code === 200){
          this.$Message.success(res.msg);
          this.getNewsList();
        }
      }).catch(() => {
        row.statusLoading = false
      })
    },
 
    // 表格选择变化
    showSelect(selection) {
      this.selectList = selection.map(item => item.id)
      this.selectCount = selection.length
    },
 
    delBatch(){
 
    },
    handleSearch(type, value){
      this.searchForm.pageNumber = 1
      this.getNewsList()
    },
 
    resetSearch(){
      this.$refs.searchForm.resetFields()
      this.searchForm.pageNumber = 1
      this.getNewsList()
    },
 
  }
}
</script>
 
<style scoped lang="scss">
.ql-editor .ql-video {
  width: 50%;
  height: auto; /* 根据你的需求调整高度 */
  max-width: 100%;
}
 
.news-management {
  .search-form {
    padding: 16px;
    background: #f8f8f9;
    border-radius: 4px;
    margin-bottom: 16px;
 
 
    .ivu-form-item {
      margin-bottom: 16px;
      margin-right: 16px;
    }
 
    .search-btn {
      margin-left: 8px;
    }
  }
}
.operation {
  margin-bottom: 16px;
 
  .ivu-btn {
    margin-right: 8px;
  }
}
.detail-container {
  padding: 16px;
}
 
.detail-item {
  margin-bottom: 18px;
  line-height: 1.5;
 
  label {
    display: inline-block;
    width: 100px;
    color: #666;
    font-weight: bold;
    vertical-align: top;
  }
 
  span {
    display: inline-block;
    width: calc(100% - 110px);
  }
}
 
.news-content {
  border: 1px solid #dcdee2;
  border-radius: 4px;
  padding: 12px;
  min-height: 100px;
  margin-top: 8px;
}
.news-table {
  .media-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
 
    .thumbnail {
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
      cursor: pointer;
      transition: all 0.3s;
 
      &:hover {
        transform: scale(1.05);
        box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
      }
    }
  }
 
  .action-btns {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
 
    .ivu-btn {
      margin: 4px;
      font-size: 12px;
      padding: 2px 6px;
      min-width: 60px;
    }
  }
}
/*
  文字大小
*/
.ql-snow .ql-picker.ql-size{
  width: 70px;  // 菜单栏占比宽度
}
/*
  字体
*/
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=SimHei]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=SimHei]::before {
  content: "黑体";
  font-family: "SimHei";
}
 
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Microsoft-YaHei]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Microsoft-YaHei]::before {
  content: "微软雅黑";
  font-family: "Microsoft YaHei";
}
 
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=KaiTi]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=KaiTi]::before {
  content: "楷体";
  font-family: "KaiTi";
}
 
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=FangSong]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=FangSong]::before {
  content: "仿宋";
  font-family: "FangSong";
}
 
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Arial]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Arial]::before {
  content: "Arial";
  font-family: "Arial";
}
 
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=Times-New-Roman]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=Times-New-Roman]::before {
  content: "Times New Roman";
  font-family: "Times New Roman";
}
 
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=sans-serif]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=sans-serif]::before {
  content: "sans-serif";
  font-family: "sans-serif";
}
 
.ql-font-SimSun {
  font-family: "SimSun";
}
 
.ql-font-SimHei {
  font-family: "SimHei";
}
 
.ql-font-Microsoft-YaHei {
  font-family: "Microsoft YaHei";
}
 
.ql-font-KaiTi {
  font-family: "KaiTi";
}
 
.ql-font-FangSong {
  font-family: "FangSong";
}
 
.ql-font-Arial {
  font-family: "Arial";
}
 
.ql-font-Times-New-Roman {
  font-family: "Times New Roman";
}
 
.ql-font-sans-serif {
  font-family: "sans-serif";
}
</style>