ShowAnnouncement.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <j-modal
  3. :title="title"
  4. :width="modelStyle.width"
  5. :visible="visible"
  6. :bodyStyle ="bodyStyle"
  7. :switchFullscreen="switchFullscreen"
  8. @cancel="handleCancel"
  9. >
  10. <template slot="footer">
  11. <a-button key="back" @click="handleCancel">关闭</a-button>
  12. <a-button v-if="record.openType==='url'" type="primary" @click="toHandle">去处理</a-button>
  13. </template>
  14. <a-card class="daily-article" :loading="loading">
  15. <a-card-meta
  16. :title="record.titile"
  17. :description="'发布人:'+record.sender + ' 发布时间: ' + record.sendTime">
  18. </a-card-meta>
  19. <a-divider />
  20. <span v-html="record.msgContent" class="article-content"></span>
  21. </a-card>
  22. </j-modal>
  23. </template>
  24. <script>
  25. import {getUserList} from '@/api/api'
  26. export default {
  27. name: "SysAnnouncementModal",
  28. components: {
  29. },
  30. data () {
  31. return {
  32. title:"通知消息",
  33. record: {},
  34. labelCol: {
  35. xs: { span: 24 },
  36. sm: { span: 5 },
  37. },
  38. wrapperCol: {
  39. xs: { span: 24 },
  40. sm: { span: 16 },
  41. },
  42. visible: false,
  43. switchFullscreen: true,
  44. loading: false,
  45. bodyStyle:{
  46. padding: "0",
  47. height:(window.innerHeight*0.8)+"px",
  48. "overflow-y":"auto",
  49. },
  50. modelStyle:{
  51. width: '60%',
  52. style: { top: '20px' },
  53. fullScreen: false
  54. }
  55. }
  56. },
  57. created () {
  58. },
  59. methods: {
  60. detail (record) {
  61. //update-begin---author:wangshuai ---date:20220107 for:将其它页面传递过来的用户名改成用户真实姓名
  62. if(record.sender){
  63. getUserList({"username":record.sender}).then((res) =>{
  64. if(res.success && res.result.records.length>0){
  65. record.sender = res.result.records[0].realname
  66. }
  67. })
  68. }
  69. //update-end---author:wangshuai ---date:20220107 for:将其它页面传递过来的用户名改成用户真实姓名
  70. this.visible = true;
  71. this.record = record;
  72. },
  73. handleCancel () {
  74. this.visible = false;
  75. },
  76. /** 切换全屏显示 */
  77. handleClickToggleFullScreen() {
  78. let mode = !this.modelStyle.fullScreen
  79. if (mode) {
  80. this.modelStyle.width = '100%'
  81. this.modelStyle.style.top = '20px'
  82. } else {
  83. this.modelStyle.width = '60%'
  84. this.modelStyle.style.top = '50px'
  85. }
  86. this.modelStyle.fullScreen = mode
  87. },
  88. toHandle(){
  89. if(this.record.openType==='url'){
  90. this.visible = false;
  91. //链接跳转
  92. this.$router.push({path: this.record.openPage})
  93. }
  94. },
  95. }
  96. }
  97. </script>
  98. <style lang="less">
  99. .announcementCustomModal{
  100. .ant-modal-header {
  101. border: none;
  102. display: inline-block;
  103. position: absolute;
  104. z-index: 1;
  105. right: 56px;
  106. padding: 0;
  107. .ant-modal-title{
  108. .custom-btn{
  109. width: 56px;
  110. height: 56px;
  111. border: none;
  112. box-shadow: none;
  113. }
  114. }
  115. }
  116. .daily-article{
  117. border-bottom: 0;
  118. }
  119. }
  120. </style>
  121. <style scoped lang="less">
  122. .daily-article {
  123. .article-button {
  124. font-size: 1.2rem !important;
  125. }
  126. .ant-card-body {
  127. padding: 18px !important;
  128. }
  129. .ant-card-head {
  130. padding: 0 1rem;
  131. }
  132. .ant-card-meta {
  133. margin-bottom: 1rem;
  134. }
  135. .article-content {
  136. p {
  137. word-wrap: break-word;
  138. word-break: break-all;
  139. text-overflow: initial;
  140. white-space: normal;
  141. font-size: .9rem !important;
  142. margin-bottom: .8rem;
  143. }
  144. }
  145. }
  146. </style>