DeviceCard.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="device-card__body">
  3. <view class="device-card">
  4. <view class="online-status">在线</view>
  5. <view class="device-card__title">设备ID</view>
  6. <view class="device-card__content">
  7. <text class="device-id-text">{{ deviceId }}</text>
  8. <text class="copy-icon" @tap="copyDeviceId">&#xe628;</text>
  9. </view>
  10. </view>
  11. <view class="device-card">
  12. <view class="device-card__title">上报时间</view>
  13. <view class="device-card__content">2026-02-22 14:20:00</view>
  14. </view>
  15. <view class="device-card">
  16. <view class="device-card__title">设备位置</view>
  17. <view class="device-card__content address">位置信息此处展示16个字超出省略省略省略…</view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. props: {
  24. deviceId: {
  25. type: String,
  26. default: '2255666666666125'
  27. }
  28. },
  29. data() {
  30. return {
  31. title: ''
  32. }
  33. },
  34. methods: {
  35. copyDeviceId() {
  36. uni.setClipboardData({
  37. data: this.deviceId,
  38. success: () => {
  39. uni.showToast({
  40. title: '复制成功',
  41. icon: 'success'
  42. })
  43. }
  44. })
  45. }
  46. }
  47. }
  48. </script>
  49. <style scoped lang="scss">
  50. .device-card__body {
  51. display: flex;
  52. padding: 16px 12px;
  53. flex-direction: column;
  54. align-items: flex-start;
  55. gap: 8px;
  56. border-radius: 8px;
  57. background: linear-gradient(180deg, #EFF 0%, #FFF 23.56%);
  58. margin-top: 34rpx;
  59. position: relative;
  60. .device-card {
  61. display: flex;
  62. gap: 16px;
  63. .device-card__title {
  64. width: 136rpx;
  65. color: #4E5969;
  66. font-size: 14px;
  67. font-style: normal;
  68. font-weight: 400;
  69. text-align: right;
  70. display: flex;
  71. align-items: center;
  72. justify-content: flex-end;
  73. }
  74. .online-status {
  75. width: 136rpx;
  76. height: 56rpx;
  77. line-height: 56rpx;
  78. position: absolute;
  79. text-align: center;
  80. top: 0;
  81. right: 0;
  82. background: url('../assets/online.png') no-repeat center center;
  83. background-size: 100% 100%;
  84. color: #0bbc58;
  85. font-family: "Source Han Sans CN VF";
  86. font-size: 28rpx;
  87. }
  88. .offline-status{
  89. width: 136rpx;
  90. height: 56rpx;
  91. line-height: 56rpx;
  92. position: absolute;
  93. text-align: center;
  94. top: 0;
  95. right: 0;
  96. background: url('../assets/offline.png') no-repeat center center;
  97. background-size: 100% 100%;
  98. color: #ff3546;
  99. font-family: "Source Han Sans CN VF";
  100. font-size: 28rpx;
  101. }
  102. .device-card__content {
  103. color: #4E5969;
  104. font-size: 14px;
  105. font-style: normal;
  106. font-weight: 400;
  107. display: flex;
  108. align-items: center;
  109. gap: 8rpx;
  110. .device-id-text {
  111. flex: 1;
  112. }
  113. .copy-icon {
  114. font-family: 'iconfont';
  115. font-size: 32rpx;
  116. color: #86909C;
  117. cursor: pointer;
  118. &:active {
  119. opacity: 0.6;
  120. }
  121. }
  122. }
  123. .address {
  124. overflow: hidden;
  125. text-overflow: ellipsis;
  126. white-space: nowrap;
  127. }
  128. }
  129. }
  130. </style>