messageshow.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view class="m-item" :id="'message'+cid">
  3. <view class="m-left">
  4. <image class="head_icon" src="https://img-cdn-qiniu.dcloud.net.cn/uniapp/app/homeHL.png" v-if="message.user=='home'"></image>
  5. </view>
  6. <view class="m-content">
  7. <view class="m-content-head" :class="{'m-content-head-right':message.user=='customer'}">
  8. <view :class="'m-content-head-'+message.user">{{message.content}} </view>
  9. </view>
  10. </view>
  11. <view class="m-right">
  12. <image class="head_icon" src="https://img-cdn-qiniu.dcloud.net.cn/uniapp/app/customerHL.png" v-if="message.user=='customer'"></image>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. props: {
  19. message: {
  20. type: Object,
  21. default() {
  22. return {};
  23. }
  24. },
  25. cid: {
  26. type: [Number, String],
  27. default: ''
  28. }
  29. }
  30. }
  31. </script>
  32. <style>
  33. .m-item {
  34. display: flex;
  35. flex-direction: row;
  36. padding-top: 40upx;
  37. }
  38. .m-left {
  39. display: flex;
  40. width: 120upx;
  41. justify-content: center;
  42. align-items: flex-start;
  43. }
  44. .m-content {
  45. display: flex;
  46. flex: 1;
  47. flex-direction: column;
  48. justify-content: center;
  49. word-break: break-all;
  50. }
  51. .m-right {
  52. display: flex;
  53. width: 120upx;
  54. justify-content: center;
  55. align-items: flex-start;
  56. }
  57. .head_icon {
  58. width: 80upx;
  59. height: 80upx;
  60. }
  61. .m-content-head {
  62. position: relative;
  63. }
  64. .m-content-head-right {
  65. display: flex;
  66. justify-content: flex-end;
  67. }
  68. .m-content-head-home {
  69. text-align: left;
  70. background: #1482d1;
  71. border: 1px #1482d1 solid;
  72. border-radius: 20upx;
  73. padding: 20upx;
  74. color: white;
  75. }
  76. .m-content-head-home:before {
  77. border: 15upx solid transparent;
  78. border-right: 15upx solid #1482d1;
  79. left: -26upx;
  80. width: 0;
  81. height: 0;
  82. position: absolute;
  83. content: ' '
  84. }
  85. .m-content-head-customer {
  86. border: 1upx white solid;
  87. background: white;
  88. border-radius: 20upx;
  89. padding: 20upx;
  90. }
  91. .m-content-head-customer:after {
  92. border: 15upx solid transparent;
  93. border-left: 15upx solid white;
  94. top: 20upx;
  95. right: -26upx;
  96. width: 0;
  97. height: 0;
  98. position: absolute;
  99. content: ' '
  100. }
  101. </style>