questionMsgDia.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <el-popover
  3. placement="bottom"
  4. width="404"
  5. trigger="hover"
  6. popper-class="question-msg-pop"
  7. @show="handleShow"
  8. @hide="handleShow"
  9. >
  10. <div class="question-msg-pop-content">
  11. <div style="font-size:16px">待处理消息({{list.length}})</div>
  12. <div class="list-box">
  13. <div class="item" v-for="item in list" :key="item.CommentId" @click="goDetail(item)">
  14. <img class="avatar" :src="item.HeadImgUrl?item.HeadImgUrl:'~@/assets/img/icons/msg-inner.png'" alt="">
  15. <div style="overflow:hidden">
  16. <div class="title">{{item.Content}}</div>
  17. <div class="time">{{item.CreateTime}}</div>
  18. </div>
  19. </div>
  20. </div>
  21. </div>
  22. <div slot="reference" style="position:relative;cursor: pointer;marginRight:26px" >
  23. <div v-if="isshow">
  24. <img src="~@/assets/img/icons/msg.png" alt="" style="height:32px;marginTop:6px;">
  25. <span style="width:8px;height:8px;borderRadius:50%;background:#f00;display:block;position:absolute;right:-4px;top:3px;" v-show="list.length>0"></span>
  26. </div>
  27. </div>
  28. </el-popover>
  29. </template>
  30. <script>
  31. import { interactiveInterface } from '@/api/api.js'
  32. export default {
  33. data() {
  34. return {
  35. list:[],
  36. isshow:false,
  37. }
  38. },
  39. created(){
  40. this.getList()
  41. },
  42. methods: {
  43. handleShow(){
  44. this.getList()
  45. },
  46. async getList(){
  47. const res=await interactiveInterface.getAllNoticeList()
  48. if(res.Ret===200){
  49. const arr=res.Data.List||[]
  50. this.isshow=res.Data.IsShow
  51. this.list=arr
  52. }
  53. },
  54. goDetail(item){
  55. // if(this.$route.path=='/messageboard'){
  56. // this.$router.push({
  57. // query:{
  58. // from:'notice',
  59. // reportid:item.ReportId||0
  60. // }
  61. // })
  62. // setTimeout(() => {
  63. // this.$router.go(0)
  64. // }, 300);
  65. // }else{
  66. // this.$router.push({
  67. // path:'/messageboard',
  68. // query:{
  69. // from:'notice',
  70. // reportid:item.ReportId||0
  71. // }
  72. // })
  73. // }
  74. // 去到留言管理页面
  75. if(this.$route.path=='/ybComment'){
  76. this.$router.go(0)
  77. }else{
  78. this.$router.push('/ybComment')
  79. }
  80. }
  81. },
  82. }
  83. </script>
  84. <style lang="scss">
  85. .question-msg-pop{
  86. padding: 20px;
  87. }
  88. </style>
  89. <style lang="scss" scoped>
  90. .question-msg-pop-content{
  91. min-width: 404px !important;
  92. .list-box{
  93. margin-top: 20px;
  94. border-top: 1px solid #DCDFE6;
  95. min-height: 400px;
  96. max-height: 600px;
  97. overflow-y: auto;
  98. .item{
  99. display: flex;
  100. margin: 17px 0;
  101. cursor: pointer;
  102. align-items: center;
  103. // &::before{
  104. // content: '';
  105. // display: block;
  106. // width: 40px;
  107. // height: 40px;
  108. // background-image: url('~@/assets/img/icons/msg-inner.png');
  109. // background-size: cover;
  110. // flex-shrink: 0;
  111. // margin-right: 15px;
  112. // }
  113. .avatar{
  114. width: 40px;
  115. height: 40px;
  116. object-fit: cover;
  117. margin-right: 15px;
  118. }
  119. .title{
  120. font-size: 16px;
  121. color: #666;
  122. overflow: hidden;
  123. text-overflow: ellipsis;
  124. white-space: nowrap;
  125. }
  126. .time{
  127. color: #999;
  128. font-size: 12px;
  129. }
  130. }
  131. }
  132. }
  133. </style>