deviceCardLight.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div
  3. class="deviceCardAir"
  4. :style="{
  5. backgroundColor: color,
  6. border: activeList.length > 0 && activeList.indexOf(item.id) != -1 ? '1px solid #000' : '1px solid #00000000',
  7. boxShadow:
  8. activeList.length > 0 && activeList.indexOf(item.id) != -1 ? '0 1px 2px ' + color : '0 1px 2px rgba(0, 0, 0, 0.15)'
  9. }"
  10. @click="domClick(item.id)"
  11. >
  12. <div class="deviceCardAir-top">
  13. <span>#{{ item.id }}</span>
  14. <span
  15. @click.stop="toggle(item)"
  16. class="anticon"
  17. style="float: right;border-radius: 15px;cursor: pointer;padding: 6px 8px 7px;margin-right: 15px"
  18. >
  19. <a-icon type="poweroff" />
  20. </span>
  21. </div>
  22. <!--<div class="deviceCardAir-content">-->
  23. <!-- <div style="font-size: 18px;width: 20px;margin-left: 20px;margin-top: 12px;display: inline-block">-->
  24. <!-- <span v-if="item.online && item.mode=='hot'">制热</span>-->
  25. <!-- <span v-if="item.online && item.mode=='cold'">制冷</span>-->
  26. <!-- <span v-if="!item.online">-</span>-->
  27. <!-- </div>-->
  28. <!-- <div style="display: inline-block;font-size: 25px;vertical-align: top;padding-top: 20px;margin-left: 10%">-->
  29. <!-- <span>{{ item.tm }}ºC</span>-->
  30. <!-- </div>-->
  31. <!--</div>-->
  32. <div class="deviceCardAir-bottom">
  33. <span class="anticon" @click.stop="click"> <a-icon type="setting" /> </span>
  34. <span style="margin-left: 15px"> {{ item.name }} </span>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. color: ""
  43. };
  44. },
  45. props: {
  46. item: Object,
  47. activeList: Array,
  48. click: Function,
  49. toggle: Function,
  50. domClick: Function
  51. },
  52. watch: {
  53. "item.online": function(val) {
  54. if (this.item.online) {
  55. this.color = "#2ea8e5";
  56. } else {
  57. this.color = "#bebebe";
  58. }
  59. }
  60. },
  61. mounted() {
  62. if (this.item.online) {
  63. this.color = "#2ea8e5";
  64. } else {
  65. this.color = "#bebebe";
  66. }
  67. },
  68. methods: {}
  69. };
  70. </script>
  71. <style lang="less" scoped>
  72. * {
  73. user-select: none;
  74. -moz-user-select: none;
  75. -webkit-user-select: none;
  76. }
  77. .deviceCardAir {
  78. width: 100%;
  79. height: 10rem;
  80. background-color: #2ea8e5;
  81. border-radius: 4px;
  82. color: white;
  83. background-image: url("@/assets/images/scene/device/bulb-full.png");
  84. background-repeat: no-repeat;
  85. background-position: 85% 70%;
  86. background-size: 25%;
  87. .deviceCardAir-top {
  88. padding-top: 14px;
  89. padding-left: 20px;
  90. font-size: 20px;
  91. .anticon:hover {
  92. background-color: rgba(182, 182, 182, 0.7);
  93. }
  94. }
  95. .deviceCardAir-bottom {
  96. margin-top: 15%;
  97. margin-left: 18px;
  98. font-size: 23px;
  99. }
  100. .anticon {
  101. cursor: pointer;
  102. }
  103. }
  104. </style>