equip-item.vue 1.5 KB

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