deviceCardAir.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <div class="deviceCardAir" :style="{backgroundColor: color}" @click="click">
  3. <div class="deviceCardAir-top">
  4. <span>#{{ item.id }}</span>
  5. <span @click="toggle(item)" class="anticon" style="float: right;border-radius: 15px;cursor: pointer;padding: 6px 8px 7px;margin-right: 15px">
  6. <a-icon type="poweroff" />
  7. </span>
  8. </div>
  9. <div class="deviceCardAir-content">
  10. <div style="font-size: 18px;width: 20px;margin-left: 20px;margin-top: 12px;display: inline-block">
  11. <span v-if="item.online && item.mode=='hot'">制热</span>
  12. <span v-if="item.online && item.mode=='cold'">制冷</span>
  13. <span v-if="!item.online">-</span>
  14. </div>
  15. <div style="display: inline-block;font-size: 25px;vertical-align: top;padding-top: 20px;margin-left: 10%">
  16. <span>{{ item.tm }}ºC</span>
  17. </div>
  18. </div>
  19. <div class="deviceCardAir-bottom">
  20. <span class="anticon" >
  21. <a-icon type="setting" />
  22. </span>
  23. <span style="margin-left: 15px">
  24. 风速:{{ item.wind }}
  25. </span>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. color: '',
  34. }
  35. },
  36. props: {
  37. item: Object,
  38. toggle: Function,
  39. click: Function,
  40. },
  41. watch: {
  42. "item.online": function (val) {
  43. if (this.item.online && this.item.mode=='hot') {
  44. this.color='#f09b68'
  45. } else if (this.item.online && this.item.mode=='cold') {
  46. this.color='#2ea8e5';
  47. } else {
  48. this.color='#bebebe'
  49. }
  50. },
  51. },
  52. mounted() {
  53. if (this.item.online && this.item.mode=='hot') {
  54. this.color='#f09b68'
  55. } else if (this.item.online && this.item.mode=='cold') {
  56. this.color='#2ea8e5';
  57. } else {
  58. this.color='#bebebe'
  59. }
  60. },
  61. methods: {
  62. }
  63. }
  64. </script>
  65. <style lang="less" scoped>
  66. .deviceCardAir {
  67. width: 100%;
  68. height: 10rem;
  69. background-color: #2ea8e5;
  70. border-radius: 4px;
  71. color: white;
  72. .deviceCardAir-top {
  73. padding-top: 14px;
  74. padding-left: 20px;
  75. font-size: 16px;
  76. .anticon:hover {
  77. background-color: rgba(182, 182, 182, 0.7);
  78. }
  79. }
  80. .deviceCardAir-bottom {
  81. margin-top: 12px;
  82. margin-left: 18px;
  83. font-size: 18px;
  84. }
  85. .anticon {
  86. //padding: 6px;
  87. }
  88. }
  89. </style>