basicCard4.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <div class="basicCard4">
  3. <div :class="activeIndex == index ? 'card4-box1' : 'card4-box'" v-for="(item, index) in card4List" :key="index"
  4. @click="toggleDustCard(index, item)">
  5. <div class="card4-title">{{ item.title }}</div>
  6. <div class="card4-content">
  7. <div class="content-item" v-for="(items, ind) in item.list" :key="ind">
  8. <span>{{ items.label }}</span>
  9. <span>{{ items.value }}</span>
  10. </div>
  11. </div>
  12. <div class="card4-level">
  13. <div class="level-text">{{ warningLevel }}</div>
  14. </div>
  15. </div>
  16. </div>
  17. </template>
  18. <script lang="ts" setup>
  19. import { ref, reactive, defineProps, watch,defineEmits } from 'vue'
  20. let props = defineProps({
  21. cardData4: {
  22. type: Array,
  23. default: () => {
  24. return []
  25. }
  26. },
  27. warningLevel:{
  28. type:String,
  29. default:''
  30. }
  31. })
  32. let emit=defineEmits(['toggleDustCards'])
  33. let activeIndex = ref(0)
  34. let card4List = ref<any[]>([])
  35. function toggleDustCard(index, item) {
  36. activeIndex.value = index
  37. emit('toggleDustCards',item.sensorCode)
  38. }
  39. watch(() => props.cardData4, (newC, oldC) => {
  40. console.log(newC, 'newC------')
  41. if (newC.length != 0) {
  42. card4List.value = newC
  43. }
  44. }, {
  45. immediate: true,
  46. deep: true
  47. })
  48. </script>
  49. <style lang="less" scoped>
  50. .basicCard4 {
  51. display: flex;
  52. position: relative;
  53. box-sizing: border-box;
  54. align-items: flex-end;
  55. justify-content: flex-start;
  56. width: 100%;
  57. height: 100%;
  58. padding-bottom: 10px;
  59. overflow-x: auto;
  60. transform: scaleY(-1);
  61. background-color: rgb(41 49 53 / 80%);
  62. .card4-box {
  63. position: relative;
  64. flex-shrink: 0;
  65. width: 338px;
  66. height: 147px;
  67. margin: 0 10px;
  68. transform: scaleY(-1);
  69. background: url('../../../assets/images/workPlaceWarn/composite.png') no-repeat center;
  70. background-size: 100% 100%;
  71. .card4-title {
  72. position: absolute;
  73. top: 8px;
  74. left: 0;
  75. width: 100%;
  76. color: #fff;
  77. font-size: 14px;
  78. text-align: center;
  79. }
  80. .card4-content {
  81. display: flex;
  82. position: absolute;
  83. top: 26px;
  84. left: 0;
  85. flex-wrap: wrap;
  86. align-items: flex-start;
  87. justify-content: flex-start;
  88. width: 100%;
  89. height: 120px;
  90. .content-item {
  91. display: flex;
  92. align-items: center;
  93. justify-content: space-around;
  94. width: 50%;
  95. height: 50%;
  96. background: url('../../../assets/images/dust/dusthome/content-item.png') no-repeat center;
  97. background-size: 95% 50%;
  98. span {
  99. &:first-child {
  100. color: #fff;
  101. font-size: 14px;
  102. }
  103. &:last-child {
  104. color: #01fefc;
  105. font-family: douyuFont;
  106. }
  107. }
  108. }
  109. }
  110. .card4-level{
  111. position: absolute;
  112. bottom: 0;
  113. left: 0;
  114. width: 75px;
  115. height: 75px;
  116. .level-text{
  117. position: absolute;
  118. top: 65%;
  119. left: 10%;
  120. transform: rotate(45deg);
  121. color: #fff;
  122. font-size: 12px;
  123. }
  124. }
  125. }
  126. .card4-box1 {
  127. position: relative;
  128. flex-shrink: 0;
  129. width: 338px;
  130. height: 170px;
  131. margin: 0 10px;
  132. transform: scaleY(-1);
  133. background: url('../../../assets/images/workPlaceWarn/composite1.png') no-repeat center;
  134. background-size: 100% 100%;
  135. .card4-title {
  136. position: absolute;
  137. top: 8px;
  138. left: 0;
  139. width: 100%;
  140. color: #fff;
  141. font-size: 16px;
  142. text-align: center;
  143. }
  144. .card4-content {
  145. display: flex;
  146. position: absolute;
  147. top: 26px;
  148. left: 0;
  149. flex-wrap: wrap;
  150. align-items: flex-start;
  151. justify-content: flex-start;
  152. width: 100%;
  153. height: 120px;
  154. .content-item {
  155. display: flex;
  156. align-items: center;
  157. justify-content: space-around;
  158. width: 50%;
  159. height: 50%;
  160. background: url('../../../assets/images/dust/dusthome/content-item.png') no-repeat center;
  161. background-size: 95% 50%;
  162. span {
  163. &:first-child {
  164. color: #fff;
  165. font-size: 12px;
  166. }
  167. &:last-child {
  168. color: #01fefc;
  169. font-family: douyuFont;
  170. font-size: 14px;
  171. }
  172. }
  173. }
  174. }
  175. .card4-level{
  176. position: absolute;
  177. bottom: 0;
  178. left: 0;
  179. width: 75px;
  180. height: 75px;
  181. .level-text{
  182. position: absolute;
  183. top: 36%;
  184. left: 10%;
  185. transform: rotate(45deg);
  186. color: #fff;
  187. font-size: 12px;
  188. }
  189. }
  190. }
  191. }
  192. </style>