msgitem.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view v-if="isshow">
  3. <image :src="image_cache(item.avatar)" class="leftImg" />
  4. </view>
  5. </template>
  6. <script>
  7. import config from "../config.js"
  8. export default {
  9. props: {
  10. msg: {
  11. required: true,
  12. },
  13. },
  14. data() {
  15. return {
  16. item:[],
  17. isshow:false,
  18. };
  19. },
  20. mounted() {
  21. var msg=this.msg.msg;
  22. if(msg.avatar.indexOf('http')<=-1) msg.avatar=config.imgUri+msg.avatar;
  23. this.item=msg;
  24. this.isshow=true;
  25. }
  26. }
  27. </script>
  28. <style lang="scss">
  29. .item {
  30. height: 100upx;
  31. border-bottom: 1px solid #F0F0F0;
  32. overflow: hidden;
  33. padding: $uni-spacing-col-lg 30upx;
  34. display: flex;
  35. flex-direction: row;
  36. justify-content: flex-start;
  37. align-items: center;
  38. }
  39. .item:hover{
  40. background-color: #eee;
  41. }
  42. .leftImg {
  43. width: 100upx;
  44. height: 100upx;
  45. margin-right: $uni-spacing-row-base;
  46. border-radius: $uni-border-radius-base;
  47. display: flex;
  48. flex-flow: wrap;
  49. justify-content: center;
  50. background-color: #eee;
  51. align-items: center;
  52. &:not(image) {
  53. padding: 1upx;
  54. }
  55. view,
  56. image {
  57. width: (76upx-2upx*4)/3;
  58. height: (76upx-2upx*4)/3;
  59. margin: 1upx;
  60. }
  61. }
  62. .rightContent {
  63. flex: 1;
  64. }
  65. .rightContent,
  66. .topCont {
  67. overflow: hidden;
  68. line-height:50upx;
  69. }
  70. .topCont {
  71. display: flex;
  72. flex-direction: row;
  73. justify-content: space-between;
  74. align-items: center;
  75. vertical-align: top;
  76. }
  77. .userName {
  78. color: $uni-text-color;
  79. font-size: 32upx;
  80. }
  81. .time {
  82. color: #999999;
  83. font-size: 30upx;
  84. }
  85. .bottomCont {
  86. width: 100%;
  87. font-size: 24upx;
  88. color: #999999;
  89. display: flex;
  90. align-items: center;
  91. justify-content: space-between;
  92. }
  93. .content {
  94. font-size: 28upx;
  95. white-space: nowrap;
  96. text-overflow: ellipsis;
  97. overflow: hidden;
  98. word-break: break-all;
  99. }
  100. .badge {
  101. background-color: red;
  102. color: #fff;
  103. border-radius: 40upx;
  104. line-height: 40upx;
  105. width: 40upx;
  106. height: 40upx;
  107. font-size: 24upx;
  108. text-align: center;
  109. flex-shrink: 0;
  110. }
  111. </style>