deviceItem.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view class="content" @click="goDeviceInfo">
  3. <image
  4. class="device-img"
  5. :src="'https://airsmart-photo1.oss-cn-shanghai.aliyuncs.com/wx/productModel/2X/'+device.ProdModel+'.png'"
  6. mode="aspectFit"
  7. />
  8. <battery :battery="device.Power" class="battery"></battery>
  9. <view class="text-view">
  10. <view class="product">
  11. <text class="product-font">型号 {{device.ProdModel}}</text>
  12. <text class="product-font" :class="{online:device.online}">{{device.online ? '在线':'离线'}}</text>
  13. </view>
  14. <text class="name-font">{{device.devName}}</text>
  15. </view>
  16. <view class="bottom-line"></view>
  17. <view class="right-view">
  18. <image
  19. class="right-img"
  20. src="../../../static/common/right.svg"
  21. mode="aspectFit"
  22. />
  23. <view class="red-point" v-if="false"/>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import battery from "../../battery/battery.vue";
  29. //MW-V(4G)
  30. export default {
  31. components: { battery },
  32. props: {
  33. device:{
  34. type:Object,
  35. default:function(){
  36. return {
  37. devName:'猫王· 旅行者1号',
  38. ProdModel:'MW-X',
  39. Power:50,
  40. }
  41. }
  42. }
  43. },
  44. data: () => ({}),
  45. computed: {},
  46. methods: {
  47. goDeviceInfo() {
  48. this.$emit('onclick')
  49. },
  50. },
  51. watch: {},
  52. // 组件周期函数--监听组件挂载完毕
  53. mounted() {},
  54. // 组件周期函数--监听组件激活(显示)
  55. activated() {},
  56. // 组件周期函数--监听组件停用(隐藏)
  57. deactivated() {},
  58. // 组件周期函数--监听组件销毁之前
  59. beforeDestroy() {},
  60. };
  61. </script>
  62. <style>
  63. .content {
  64. width: 100vw;
  65. height: 236rpx;
  66. display: flex;
  67. flex-direction: row;
  68. justify-content: flex-start;
  69. align-items: center;
  70. position: relative;
  71. }
  72. .device-img {
  73. width: 120rpx;
  74. height: 111rpx;
  75. margin-left: 32rpx;
  76. }
  77. .battery {
  78. margin-left: 6rpx;
  79. margin-bottom: 62rpx;
  80. align-self: flex-end;
  81. }
  82. .text-view {
  83. margin-left: 42rpx;
  84. margin-bottom: 62rpx;
  85. align-self: flex-end;
  86. display: flex;
  87. flex-direction: column-reverse;
  88. }
  89. .product {
  90. width: 40vw;
  91. display: flex;
  92. flex-direction: row;
  93. justify-content: space-between;
  94. }
  95. .product-font {
  96. font-size: 24rpx;
  97. font-weight: 400;
  98. color: #999999;
  99. }
  100. .online{
  101. color: #684BBE;
  102. }
  103. .name-font {
  104. font-size: 30rpx;
  105. font-weight: 600;
  106. color: #353535;
  107. margin-bottom: 6rpx;
  108. }
  109. .bottom-line {
  110. position: absolute;
  111. bottom: 0;
  112. left: 4vw;
  113. width: 92vw;
  114. height: 1px;
  115. opacity: 0.2;
  116. background-image: linear-gradient(to right, #c8c8c8, #484848, #979797);
  117. }
  118. .right-view {
  119. position: absolute;
  120. right: 0;
  121. height: 100%;
  122. display: flex;
  123. flex-direction: row-reverse;
  124. align-items: center;
  125. }
  126. .right-img {
  127. width: 13rpx;
  128. height: 21rpx;
  129. margin-right: 34rpx;
  130. }
  131. .red-point {
  132. width: 12rpx;
  133. height: 12rpx;
  134. background: #fb0202;
  135. border-radius: 8rpx;
  136. margin-right: 30rpx;
  137. }
  138. </style>