equip-item.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <view class="item">
  3. <template v-if="$attrs.item.device_status==1">
  4. <view class="tag tag-on" ></view>
  5. </template>
  6. <template v-else>
  7. <view class="tag tag-off" ></view>
  8. </template>
  9. <view class="info">
  10. <text class="">设备ID:{{$attrs.item.device_id}}</text>
  11. <text v-if="$attrs.item.device_status==1" class="state on">在线</text>
  12. <text v-else class="state off">离线</text>
  13. </view>
  14. <view class="date">
  15. 最新上报时间:{{$attrs.item.status_time|timeFormat}}
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. tagOn:'../../static/image/tab-on.png',
  24. tagOff:'../../static/image/tab-off.png',
  25. }
  26. },
  27. methods: {
  28. }
  29. }
  30. </script>
  31. <style lang="scss">
  32. .item {
  33. background: #fff;
  34. margin-top: 20rpx;
  35. padding: 10rpx 30rpx;
  36. padding-left:80rpx;
  37. border-radius: 4rpx;
  38. box-shadow: 0 0 4px 2px rgba(0, 0, 10, 0.05);
  39. line-height: 60rpx;
  40. position: relative;
  41. .tag {
  42. position: absolute;
  43. width: 30rpx;
  44. height: 60rpx;
  45. top: 0;
  46. left: 20rpx;
  47. background-repeat: no-repeat;
  48. background-size:100% auto;
  49. background-position: top left;
  50. }
  51. .tag-on {
  52. background-image:url('~@/static/image/on.png');
  53. }
  54. .tag-off {
  55. background-image:url('~@/static/image/off.png');
  56. }
  57. .info {
  58. border-bottom: 1px solid #F5F5F5;
  59. color: #333;
  60. font-size: 28rpx;
  61. display: flex;
  62. justify-content: space-between;
  63. .on {
  64. color: $uni-color-success;
  65. }
  66. .off{
  67. color:$uni-color-error;
  68. }
  69. }
  70. .date {
  71. color: #999;
  72. font-size: 24rpx;
  73. }
  74. }
  75. </style>