Blame view

ant-design-vue-jeecg/src/components/tools/ShowAnnouncement.vue 3.53 KB
肖超群 authored
1
2
3
4
5
<template>
  <j-modal
    :title="title"
    :width="modelStyle.width"
    :visible="visible"
肖超群 authored
6
    :bodyStyle="bodyStyle"
肖超群 authored
7
8
    :switchFullscreen="switchFullscreen"
    @cancel="handleCancel"
肖超群 authored
9
  >
肖超群 authored
10
    <template slot="footer">
谭毅彬 authored
11
      <a-button key="back" @click="handleCancel">{{$t('button.close')}}</a-button>
曾湘平 authored
12
      <a-button v-if="record.openType === 'url'" type="primary" @click="toHandle">{{ $t('system.goToDealWith') }}</a-button>
肖超群 authored
13
14
    </template>
    <a-card class="daily-article" :loading="loading">
曾湘平 authored
15
16
      <a-card-meta :title="record.titile"
                   :description="$t('system.publishingTime') + ' : ' + record.sendTime + ','+ $t('system.publisher') +' : '+ record.sender"/>
17
      <!-- <a-divider/> -->
肖超群 authored
18
19
20
21
22
23
      <span v-html="record.msgContent" class="article-content"></span>
    </a-card>
  </j-modal>
</template>

<script>
24
import { getUserList } from '@/api/api'
肖超群 authored
25
肖超群 authored
26
export default {
27
  name: 'SysAnnouncementModal',
肖超群 authored
28
29
30
  components: {},
  data() {
    return {
曾湘平 authored
31
      title: this.$t('system.notificationMessage'),
肖超群 authored
32
33
      record: {},
      labelCol: {
34
35
        xs: { span: 24 },
        sm: { span: 5 }
肖超群 authored
36
      },
肖超群 authored
37
      wrapperCol: {
38
39
        xs: { span: 24 },
        sm: { span: 16 }
肖超群 authored
40
      },
肖超群 authored
41
42
43
44
      visible: false,
      switchFullscreen: true,
      loading: false,
      bodyStyle: {
45
46
47
        padding: '5',
        height: window.innerHeight * 0.6 + 'px',
        'overflow-y': 'auto'
肖超群 authored
48
      },
肖超群 authored
49
50
      modelStyle: {
        width: '60%',
51
        style: { top: '20px' },
肖超群 authored
52
53
        fullScreen: false
      }
肖超群 authored
54
    }
肖超群 authored
55
  },
56
  created() {},
肖超群 authored
57
58
59
60
  methods: {
    detail(record) {
      //update-begin---author:wangshuai ---date:20220107  for:将其它页面传递过来的用户名改成用户真实姓名
      if (record.sender) {
61
        getUserList({ username: record.sender }).then(res => {
肖超群 authored
62
63
64
65
66
67
          if (res.success && res.result.records.length > 0) {
            record.sender = res.result.records[0].realname
          }
        })
      }
      //update-end---author:wangshuai ---date:20220107  for:将其它页面传递过来的用户名改成用户真实姓名
68
69
      this.visible = true
      this.record = record
肖超群 authored
70
71
    },
    handleCancel() {
72
      this.visible = false
肖超群 authored
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
    },
    /** 切换全屏显示 */
    handleClickToggleFullScreen() {
      let mode = !this.modelStyle.fullScreen
      if (mode) {
        this.modelStyle.width = '100%'
        this.modelStyle.style.top = '20px'
      } else {
        this.modelStyle.width = '60%'
        this.modelStyle.style.top = '50px'
      }
      this.modelStyle.fullScreen = mode
    },
    toHandle() {
      if (this.record.openType === 'url') {
88
        this.visible = false
肖超群 authored
89
        //链接跳转
90
        this.$router.push({ path: this.record.openPage })
肖超群 authored
91
      }
92
    }
肖超群 authored
93
  }
肖超群 authored
94
}
肖超群 authored
95
96
97
</script>

<style lang="less">
肖超群 authored
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
.announcementCustomModal {
  .ant-modal-header {
    border: none;
    display: inline-block;
    position: absolute;
    z-index: 1;
    right: 56px;
    padding: 0;

    .ant-modal-title {
      .custom-btn {
        width: 56px;
        height: 56px;
        border: none;
        box-shadow: none;
肖超群 authored
113
114
115
      }
    }
  }
肖超群 authored
116
117
118
119
120

  .daily-article {
    border-bottom: 0;
  }
}
肖超群 authored
121
122
</style>
<style scoped lang="less">
肖超群 authored
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
.daily-article {
  .article-button {
    font-size: 1.2rem !important;
  }

  .ant-card-body {
    padding: 18px !important;
  }

  .ant-card-head {
    padding: 0 1rem;
  }

  .ant-card-meta {
    margin-bottom: 1rem;
  }

  .article-content {
    p {
      word-wrap: break-word;
      word-break: break-all;
      text-overflow: initial;
      white-space: normal;
146
147
      font-size: 0.9rem !important;
      margin-bottom: 0.8rem;
肖超群 authored
148
149
    }
  }
肖超群 authored
150
}
肖超群 authored
151
</style>