Blame view

ant-design-vue-jeecg/src/components/tools/ShowAnnouncement.vue 3.44 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
11
12
13
14
15
16
17
18
    <template slot="footer">
      <a-button key="back" @click="handleCancel">关闭</a-button>
      <a-button v-if="record.openType==='url'" type="primary" @click="toHandle">去处理</a-button>
    </template>
    <a-card class="daily-article" :loading="loading">
      <a-card-meta
        :title="record.titile"
        :description="'发布人:'+record.sender + ' 发布时间: ' + record.sendTime">
      </a-card-meta>
肖超群 authored
19
      <a-divider/>
肖超群 authored
20
21
22
23
24
25
      <span v-html="record.msgContent" class="article-content"></span>
    </a-card>
  </j-modal>
</template>

<script>
肖超群 authored
26
import {getUserList} from '@/api/api'
肖超群 authored
27
肖超群 authored
28
29
30
31
32
33
34
35
36
37
export default {
  name: "SysAnnouncementModal",
  components: {},
  data() {
    return {
      title: "通知消息",
      record: {},
      labelCol: {
        xs: {span: 24},
        sm: {span: 5},
肖超群 authored
38
      },
肖超群 authored
39
40
41
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 16},
肖超群 authored
42
      },
肖超群 authored
43
44
45
46
47
48
49
50
      visible: false,
      switchFullscreen: true,
      loading: false,
      bodyStyle: {
        padding: "0",
        height: (window.innerHeight * 0.8) + "px",
        "overflow-y": "auto",
肖超群 authored
51
      },
肖超群 authored
52
53
54
55
56
      modelStyle: {
        width: '60%',
        style: {top: '20px'},
        fullScreen: false
      }
肖超群 authored
57
    }
肖超群 authored
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
  },
  created() {
  },
  methods: {
    detail(record) {
      //update-begin---author:wangshuai ---date:20220107  for:将其它页面传递过来的用户名改成用户真实姓名
      if (record.sender) {
        getUserList({"username": record.sender}).then((res) => {
          if (res.success && res.result.records.length > 0) {
            record.sender = res.result.records[0].realname
          }
        })
      }
      //update-end---author:wangshuai ---date:20220107  for:将其它页面传递过来的用户名改成用户真实姓名
      this.visible = true;
      this.record = record;
    },
    handleCancel() {
      this.visible = false;
    },
    /** 切换全屏显示 */
    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') {
        this.visible = false;
        //链接跳转
        this.$router.push({path: this.record.openPage})
      }
    },
肖超群 authored
97
  }
肖超群 authored
98
}
肖超群 authored
99
100
101
</script>

<style lang="less">
肖超群 authored
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
.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
117
118
119
      }
    }
  }
肖超群 authored
120
121
122
123
124

  .daily-article {
    border-bottom: 0;
  }
}
肖超群 authored
125
126
</style>
<style scoped lang="less">
肖超群 authored
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
.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;
      font-size: .9rem !important;
      margin-bottom: .8rem;
肖超群 authored
152
153
    }
  }
肖超群 authored
154
}
肖超群 authored
155
</style>