Blame view

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

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

<style lang="less">
肖超群 authored
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
.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
112
113
114
      }
    }
  }
肖超群 authored
115
116
117
118
119

  .daily-article {
    border-bottom: 0;
  }
}
肖超群 authored
120
121
</style>
<style scoped lang="less">
肖超群 authored
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
.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;
谭毅彬 authored
145
146
      font-size: 0.9rem !important;
      margin-bottom: 0.8rem;
肖超群 authored
147
148
    }
  }
肖超群 authored
149
}
肖超群 authored
150
</style>