recordItem.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="list-item">
  3. <view class="time">
  4. <text class="date">
  5. {{ formatTime(item.createTime, 'MM-DD') }}
  6. </text>
  7. <text class="now">
  8. {{ formatTime(item.createTime, 'HH:mm') }}
  9. </text>
  10. </view>
  11. <view class="icon-box">
  12. <text class="icon" />
  13. </view>
  14. <view class="content">
  15. <view class="title">
  16. {{ item.content }}
  17. </view>
  18. <view class="option">
  19. <text class="option-text">
  20. {{ item.realname }}
  21. </text>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. /**
  28. * 操作记录
  29. */
  30. import moment from 'moment'
  31. export default {
  32. name: 'RecordItem',
  33. props: {
  34. item: {
  35. type: Object,
  36. required: true
  37. }
  38. },
  39. methods: {
  40. formatTime(date, formatStr) {
  41. return moment(date).format(formatStr)
  42. }
  43. }
  44. }
  45. </script>
  46. <style scoped lang="scss">
  47. .list-item {
  48. display: flex;
  49. justify-content: space-around;
  50. .time {
  51. flex-direction: column;
  52. @include left;
  53. .date {
  54. font-size: 26rpx;
  55. color: $dark;
  56. }
  57. .now {
  58. font-size: 24rpx;
  59. color: $gray;
  60. }
  61. }
  62. .icon-box {
  63. position: relative;
  64. display: flex;
  65. .icon {
  66. z-index: 2;
  67. width: 17rpx;
  68. height: 17rpx;
  69. border-radius: 50%;
  70. background-color: #17cfbd;
  71. margin: 14rpx 24rpx 0;
  72. }
  73. &::before {
  74. position: absolute;
  75. z-index: 1;
  76. top: 14rpx;
  77. left: 50%;
  78. transform: translateX(-50%);
  79. content: "";
  80. width: 1rpx;
  81. height: 100%;
  82. background-color: $border-color;
  83. display: block;
  84. }
  85. }
  86. .content {
  87. flex: 1;
  88. padding-bottom: 36rpx;
  89. overflow: hidden;
  90. .title {
  91. font-size: 30rpx;
  92. color: $dark;
  93. white-space: pre-wrap;
  94. word-wrap: break-word;
  95. margin-bottom: 20rpx;
  96. }
  97. .option {
  98. font-size: 26rpx;
  99. color: $gray;
  100. display: flex;
  101. flex-wrap: wrap;
  102. .option-text {
  103. flex: 1;
  104. }
  105. }
  106. }
  107. &:first-child {
  108. .icon {
  109. background-color: #ffbc01;
  110. }
  111. }
  112. &:last-child {
  113. .icon-box {
  114. &::before {
  115. display: none;
  116. }
  117. }
  118. }
  119. }
  120. </style>