track-record.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <view class="record-card">
  3. <view class="title">
  4. <view class="line"></view>
  5. <text>任务跟踪记录</text>
  6. </view>
  7. <view v-for="(item, idx) in records" :key="idx" class="record-item">
  8. <view class="item-header">
  9. <text class="user">{{ item.user || '-' }}</text>
  10. <text class="time">{{ item.time || '-' }}</text>
  11. </view>
  12. <view class="item-body">
  13. <text class="content">{{ item.statusText || item.content || '-' }}</text>
  14. </view>
  15. <view v-if="getImgs(item).length" class="item-images">
  16. <u-image
  17. v-for="(img, i) in getImgs(item)"
  18. :key="i"
  19. :src="img"
  20. width="160rpx"
  21. height="160rpx"
  22. radius="8"
  23. mode="aspectFill"
  24. @click="preview(getImgs(item), i)"
  25. ></u-image>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script setup>
  31. const props = defineProps({
  32. records: {
  33. type: Array,
  34. default: () => []
  35. }
  36. })
  37. const getImgs = (item) => {
  38. const arr = item?.images || item?.files || item?.fileList || item?.pictures || item?.pics || []
  39. if (!arr) return []
  40. return Array.isArray(arr)
  41. ? arr.map(v => typeof v === 'string' ? v : (v?.url || '')).filter(Boolean)
  42. : []
  43. }
  44. const preview = (urls, index) => {
  45. uni.previewImage({ urls, current: index })
  46. }
  47. </script>
  48. <style lang="scss" scoped>
  49. .record-card {
  50. background: #ffffff;
  51. border-radius: 12rpx;
  52. padding: 20rpx;
  53. }
  54. .title {
  55. display: flex;
  56. align-items: center;
  57. gap: 12rpx;
  58. margin-bottom: 16rpx;
  59. }
  60. .line {
  61. width: 8rpx;
  62. height: 32rpx;
  63. background: #22ac38;
  64. border-radius: 4rpx;
  65. }
  66. .record-item {
  67. padding: 20rpx 0;
  68. border-top: 1rpx solid #f0f0f0;
  69. }
  70. .item-header {
  71. display: flex;
  72. align-items: center;
  73. justify-content: space-between;
  74. margin-bottom: 8rpx;
  75. }
  76. .user {
  77. font-size: 28rpx;
  78. color: #666666;
  79. }
  80. .time {
  81. font-size: 26rpx;
  82. color: #969696;
  83. }
  84. .item-body {
  85. margin-top: 6rpx;
  86. }
  87. .content {
  88. font-size: 28rpx;
  89. color: #333333;
  90. }
  91. .item-images {
  92. margin-top: 12rpx;
  93. display: flex;
  94. flex-wrap: wrap;
  95. gap: 12rpx;
  96. }
  97. </style>