AirSwitchVer.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div class="airSwitch">
  3. <div class="air-title">
  4. <span>空调实时开关</span>
  5. <span class="status">{{status ? "空调已开启" : "空调已关闭"}}</span>
  6. </div>
  7. <div class="air-cont">
  8. <div class="air-left">
  9. <div class="bar-box">
  10. <div class="bar"></div>
  11. </div>
  12. <div class="air-rate">
  13. <span>空调开启率</span>
  14. <span class="air-rate-value">{{value}}%</span>
  15. </div>
  16. </div>
  17. <div class="air-bg">
  18. <img :src="[status ? img.openImg : img.closeImg]" />
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import air_close from '@/assets/horImg/air_close.png';
  25. import air_open from '@/assets/horImg/air_open.png';
  26. export default {
  27. name: "AirSwitch",
  28. props: {
  29. status: {
  30. type: Boolean,
  31. default: () => { return false } // 默认开
  32. },
  33. value: {
  34. type: Number,
  35. default: () => { return 75 } // 默认开
  36. },
  37. },
  38. data() {
  39. return {
  40. img: {
  41. openImg: air_open,
  42. closeImg: air_close,
  43. }
  44. }
  45. },
  46. }
  47. </script>
  48. <style lang="less" scoped>
  49. .airSwitch {
  50. padding: 24px 32px;
  51. height: 250px;
  52. width: 1000px;
  53. margin: 0 auto;
  54. box-sizing: border-box;
  55. border-radius: 20px;
  56. border: 2px solid #ffffff;
  57. background: #ffffff;
  58. .air-title {
  59. font-size: 20px;
  60. font-weight: 600;
  61. color: #3b3558;
  62. .status {
  63. margin-top: 8px;
  64. margin-left: 12px;
  65. display: inline-block;
  66. height: 24px;
  67. line-height: 24px;
  68. width: 86px;
  69. border-radius: 4px;
  70. background: rgba(126, 216, 116, 1);
  71. box-sizing: border-box;
  72. color: #ffffff;
  73. font-weight: 600;
  74. text-align: center;
  75. font-size: 14px;
  76. &.close {
  77. background: rgba(155, 152, 173, 1);
  78. }
  79. }
  80. }
  81. .air-cont {
  82. display: flex;
  83. flex-direction: row;
  84. .air-left {
  85. flex: 3;
  86. display: flex;
  87. justify-content: center;
  88. flex-direction: column;
  89. .bar-box {
  90. width: 88%;
  91. height: 10px;
  92. background: rgba(62, 140, 255, 0.2);
  93. border-radius: 6px;
  94. .bar {
  95. width: 80%;
  96. height: 10px;
  97. background: linear-gradient(
  98. 90deg,
  99. #76deff 0%,
  100. #3e91f8 100%
  101. );
  102. border-radius: 6px;
  103. }
  104. }
  105. .air-rate {
  106. font-size: 20px;
  107. display: flex;
  108. height: 40px;
  109. align-items: center;
  110. margin-top:14px;
  111. .air-rate-value {
  112. font-size: 32px;
  113. padding-left:8px;
  114. }
  115. }
  116. }
  117. .air-bg {
  118. flex: 1;
  119. img {
  120. width: 240px;
  121. }
  122. }
  123. }
  124. }
  125. </style>