timeline-item.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view class="tl-item">
  3. <view class="tl-left">
  4. <view class="tl-dot" :class="dotCls"></view>
  5. <view v-if="isLast" class="tl-line tl-line-empty"></view>
  6. <view v-else class="tl-line"></view>
  7. </view>
  8. <view class="tl-body">
  9. <view class="tl-head">
  10. <text class="tl-title">{{ title }}</text>
  11. <StatusTag :status="status" type="promo" :text="statusText" />
  12. </view>
  13. <text v-if="time" class="tl-time">{{ time }}</text>
  14. <text v-if="desc" class="tl-desc">{{ desc }}</text>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import StatusTag from '@/components/status-tag.vue'
  20. /**
  21. * TimeLineItem — 时间线条目(分子级)
  22. * 用法:<TimeLineItem title="晋升 T2" time="2026-08-20" desc="依据:客户评分4.8达标" status="promoted" :is-last="true" />
  23. * 契约:status∈{promoted, evaluated, rejected};statusText 覆盖默认映射
  24. */
  25. export default {
  26. name: 'TimeLineItem',
  27. components: { StatusTag },
  28. props: {
  29. title: { type: String, default: '' },
  30. time: { type: String, default: '' },
  31. desc: { type: String, default: '' },
  32. status: { type: String, default: '' },
  33. statusText: { type: String, default: '' },
  34. isLast: { type: Boolean, default: false }
  35. },
  36. computed: {
  37. dotCls() {
  38. if (this.status === 'promoted') return 'dot-green'
  39. if (this.status === 'rejected') return 'dot-red'
  40. return 'dot-grey'
  41. }
  42. }
  43. }
  44. </script>
  45. <style scoped>
  46. .tl-item {
  47. display: flex;
  48. align-items: stretch;
  49. }
  50. .tl-left {
  51. width: 40rpx;
  52. display: flex;
  53. flex-direction: column;
  54. align-items: center;
  55. margin-right: 20rpx;
  56. }
  57. .tl-dot {
  58. width: 20rpx;
  59. height: 20rpx;
  60. border-radius: 50%;
  61. margin-top: 8rpx;
  62. flex-shrink: 0;
  63. }
  64. .dot-green { background: #0E8A4F; }
  65. .dot-grey { background: #94A3B2; }
  66. .dot-red { background: #C0392B; }
  67. .tl-line {
  68. width: 2rpx;
  69. flex: 1;
  70. background: #E3ECF4;
  71. min-height: 60rpx;
  72. }
  73. .tl-line-empty {
  74. background: transparent;
  75. }
  76. .tl-body {
  77. flex: 1;
  78. background: #FFFFFF;
  79. border: 1rpx solid #E3ECF4;
  80. border-radius: 14rpx;
  81. padding: 20rpx 22rpx;
  82. margin-bottom: 24rpx;
  83. }
  84. .tl-head {
  85. display: flex;
  86. align-items: center;
  87. justify-content: space-between;
  88. }
  89. .tl-title { font-size: 28rpx; font-weight: 700; color: #1F4E79; }
  90. .tl-time { display: block; font-size: 22rpx; color: #3B5A78; margin-top: 8rpx; }
  91. .tl-desc { display: block; font-size: 24rpx; color: #3B5A78; line-height: 1.6; margin-top: 8rpx; }
  92. </style>