msg-list.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <!-- <view class="flex align-center p-2 border-bottom border-light-secondary animated fast fadeIn" hover-class="bg-light" @click="open"> -->
  3. <view class="msgLIst" hover-class="bg-light" @click="open">
  4. <image :src="item.avatar" mode="" style="height: 60rpx;width: 60rpx;" class="msgImg "></image>
  5. <view class="msgView">
  6. <view class="betWeen">
  7. <text class="font-md">
  8. {{item.username}}
  9. </text>
  10. <text class="text-secondary font-sm">
  11. {{item.updata_time | formateTime}}
  12. </text>
  13. </view>
  14. <view class="betWeen">
  15. <text class="text-secondary text-ellipsis" style="max-width: 500rpx;">
  16. {{item.data}}
  17. </text>
  18. <uni-badge :text="item.noread" type="error "></uni-badge>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. // 引入时间库
  25. import $T from '@/components/common/time.js';
  26. import uniBadge from '@/components/uni-badge/uni-badge.vue'
  27. export default {
  28. props: {
  29. item: Object,
  30. index: Number
  31. },
  32. components: {
  33. uniBadge
  34. },
  35. filters: {
  36. formateTime(value) {
  37. return $T.gettime(value)
  38. }
  39. },
  40. methods: {
  41. open() {
  42. uni.navigateTo({
  43. url: '../../pages/user-chat/user-chat'
  44. });
  45. }
  46. }
  47. }
  48. </script>
  49. <style lang="scss">
  50. .msgLIst {
  51. display: flex;
  52. align-items: center;
  53. padding: 20rpx;
  54. background: #FFFFFF;
  55. border-bottom: 1rpx solid #dee2e6;
  56. &:first-of-type {
  57. margin-top: 20rpx;
  58. }
  59. .msgImg {
  60. margin-right: 20rpx;
  61. border-radius: 100rpx;
  62. }
  63. .msgView {
  64. display: flex;
  65. flex-direction: column;
  66. flex: 1;
  67. }
  68. }
  69. .betWeen {
  70. display: flex;
  71. align-items: center;
  72. justify-content: space-between;
  73. .font-md {
  74. font-size: 30rpx;
  75. }
  76. .text-secondary {
  77. color: #6c757d;
  78. font-size: 24rpx;
  79. }
  80. .font-sm {
  81. font-size: 20rpx;
  82. }
  83. /* 文字换行溢出处理 */
  84. .text-ellipsis {
  85. /* #ifndef APP-PLUS-NVUE */
  86. overflow: hidden;
  87. text-overflow: ellipsis;
  88. white-space: nowrap;
  89. /* #endif */
  90. /* #ifdef APP-PLUS-NVUE */
  91. lines: 1;
  92. /* #endif */
  93. }
  94. }
  95. </style>