NoticeList.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div>
  3. <ep-list class="list">
  4. <template v-for="(item, i) in data">
  5. <ep-list-item :key="i" class="item">
  6. <ep-list-item-meta slot="meta" class="meta">
  7. <avatar slot="avatar" class="avatar" :src="item.avatar"></avatar>
  8. <div slot="title" class="title">
  9. {{item.title}}
  10. </div>
  11. <div slot="description">
  12. <el-button type="text" style="white-space: inherit;" v-if="item.type==='通知'" @click=" $refs.notifyForm.init('read', item.id)">
  13. <div class="description" style="height:30px" v-html="item.description"></div>
  14. </el-button>
  15. <el-button type="text" style="white-space: inherit;" v-if="item.type==='站内信'" @click="$refs.receivedMailDetail.init(item.id)">
  16. <div class="description" style="height:30px" v-html="item.description"></div>
  17. </el-button>
  18. <div class="datetime">{{item.datetime}}</div>
  19. </div>
  20. </ep-list-item-meta>
  21. </ep-list-item>
  22. </template>
  23. <ep-list-item class="item">
  24. <ep-list-item-meta>
  25. <div slot="description">
  26. <router-link :to="url">
  27. <div class="description" style="text-align:center">查看更多</div>
  28. </router-link>
  29. </div>
  30. </ep-list-item-meta>
  31. </ep-list-item>
  32. </ep-list>
  33. <ReceivedMailDetail ref="receivedMailDetail"></ReceivedMailDetail>
  34. <NotifyForm ref="notifyForm"></NotifyForm>
  35. </div>
  36. </template>
  37. <script>
  38. import EpList from '@/components/List/index.vue'
  39. import EpListItem from '@/components/List/ListItem.vue'
  40. import EpListItemMeta from '@/components/List/ListItemMeta.vue'
  41. import Avatar from '@/components/avatar/index.vue'
  42. import ReceivedMailDetail from '@/views/modules/mailbox/ReceivedMailDetail'
  43. import NotifyForm from '@/views/modules/notify/NotifyForm'
  44. export default {
  45. props: {
  46. data: {
  47. type: Array,
  48. default () {
  49. return []
  50. }
  51. },
  52. url: {
  53. type: String,
  54. default () {
  55. return ''
  56. }
  57. }
  58. },
  59. components: {
  60. EpList,
  61. EpListItem,
  62. EpListItemMeta,
  63. ReceivedMailDetail,
  64. NotifyForm,
  65. Avatar
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. @import '@/assets/scss/theme.scss';
  71. .list {
  72. max-height: 400px;
  73. overflow: auto;
  74. .item {
  75. transition: all 0.3s;
  76. overflow: hidden;
  77. cursor: pointer;
  78. padding-left: 24px;
  79. padding-right: 24px;
  80. &:last-child {
  81. border-bottom: 0;
  82. }
  83. &:hover {
  84. background: $primary-1;
  85. }
  86. .meta {
  87. width: 100%;
  88. }
  89. .avatar {
  90. background: #fff;
  91. margin-top: 4px;
  92. }
  93. .title {
  94. font-weight: normal;
  95. margin-bottom: 8px;
  96. }
  97. .description {
  98. font-size: 12px;
  99. line-height: $line-height-base;
  100. display: -webkit-box;/*作为弹性伸缩盒子模型显示*/
  101. -webkit-line-clamp: 1; /*显示的行数;如果要设置2行加...则设置为2*/
  102. overflow: hidden; /*超出的文本隐藏*/
  103. text-overflow: ellipsis; /* 溢出用省略号*/
  104. -webkit-box-orient: vertical;/*伸缩盒子的子元素排列:从上到下*/
  105. }
  106. .datetime {
  107. font-size: 12px;
  108. margin-top: 4px;
  109. line-height: $line-height-base;
  110. }
  111. }
  112. }
  113. </style>