index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div class="volumn-box" :class="isOpen ? 'active' : ''">
  3. <div class="top">
  4. <img
  5. :src="
  6. parseImgUrl('taiguv1/envmonitor', isOpen ? 'active/volumn.png' : 'volumn.svg')
  7. "
  8. alt=""
  9. />
  10. <div class="top-right">
  11. <Switch class="switch-btn" inactive-color="rgba(0, 0, 0, 0.3)" v-model="isOpen" />
  12. </div>
  13. </div>
  14. <div class="bottom">
  15. <div class="air-info">
  16. <div class="left">
  17. <div class="text">音量</div>
  18. <div class="status">已关闭</div>
  19. </div>
  20. <div class="temp" v-if="isOpen">26</div>
  21. </div>
  22. <div class="temp-box" v-if="isOpen">
  23. <div class="bar">
  24. <div class="text text-left active-text">12</div>
  25. <div class="active-bar">
  26. <div class="line"></div>
  27. </div>
  28. <div class="text text-right">100</div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <script lang="ts">
  35. import {
  36. defineComponent,
  37. onMounted,
  38. reactive,
  39. toRefs,
  40. computed,
  41. watch,
  42. onUnmounted,
  43. onBeforeMount,
  44. onBeforeUnmount,
  45. } from "vue";
  46. import { Switch, Dialog, Loading, Toast } from "vant";
  47. import { parseImgUrl } from "@/utils";
  48. import any = jasmine.any;
  49. export default defineComponent({
  50. components: {
  51. Switch,
  52. [Dialog.Component.name]: Dialog.Component,
  53. Loading,
  54. },
  55. setup(props, contx) {
  56. const proxyData = reactive({
  57. parseImgUrl: parseImgUrl,
  58. isOpen: false,
  59. });
  60. onBeforeUnmount(() => {});
  61. onMounted(() => {});
  62. return {
  63. ...toRefs(proxyData),
  64. };
  65. },
  66. });
  67. </script>
  68. <style lang="scss" scoped>
  69. .volumn-box {
  70. box-sizing: border-box;
  71. display: flex;
  72. flex-direction: column;
  73. justify-content: space-between;
  74. padding: 16px;
  75. width: 100%;
  76. height: 100%;
  77. border-radius: 24px 24px 44px 24px;
  78. background-color: rgba(255, 255, 255, 0.2);
  79. backdrop-filter: blur(40px);
  80. box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
  81. .top {
  82. display: flex;
  83. justify-content: space-between;
  84. img {
  85. width: 30px;
  86. }
  87. }
  88. .bottom {
  89. // margin-top: 18vh;
  90. // margin-top: 109px;
  91. .air-info {
  92. display: flex;
  93. justify-content: space-between;
  94. align-items: end;
  95. .temp {
  96. //styleName: En/H2;
  97. font-family: Jost;
  98. font-size: 20px;
  99. font-weight: 300;
  100. line-height: 28px;
  101. color: rgba(0, 20, 40, 1);
  102. sup {
  103. //styleName: En/Body XS;
  104. font-family: Jost;
  105. font-size: 11px;
  106. font-weight: 400;
  107. line-height: 15px;
  108. color: rgba(0, 20, 40, 1);
  109. }
  110. }
  111. }
  112. .text {
  113. //styleName: Chi/Body Large;
  114. font-family: PingFang SC;
  115. font-size: 16px;
  116. font-weight: 300;
  117. line-height: 22px;
  118. letter-spacing: 0.02em;
  119. text-align: left;
  120. text-underline-position: from-font;
  121. text-decoration-skip-ink: none;
  122. color: rgba(255, 255, 255, 1);
  123. padding-bottom: 2px;
  124. }
  125. .status {
  126. //styleName: Chi/Body XS;
  127. font-family: PingFang SC;
  128. font-size: 11px;
  129. font-weight: 400;
  130. line-height: 15px;
  131. letter-spacing: 0.02em;
  132. color: rgba(255, 255, 255, 0.4);
  133. }
  134. .temp-box {
  135. position: relative;
  136. box-sizing: border-box;
  137. width: 100%;
  138. padding: 2px;
  139. margin-top: 8px;
  140. height: 34px;
  141. border-radius: 12px;
  142. background: rgba(255, 255, 255, 0.6);
  143. .text {
  144. position: absolute;
  145. top: 50%;
  146. transform: translateY(-50%);
  147. font-family: Jost;
  148. font-size: 11px;
  149. font-weight: 400;
  150. line-height: 15px;
  151. color: rgba(116, 128, 141, 1);
  152. z-index: 2;
  153. }
  154. .text-left {
  155. left: 8px;
  156. }
  157. .text-right {
  158. right: 8px;
  159. }
  160. .active-text {
  161. color: rgba(255, 255, 255, 0.6);
  162. }
  163. .active-bar {
  164. position: absolute;
  165. background: linear-gradient(95.5deg, #99282b 21.44%, #a95459 84.95%);
  166. left: 2px;
  167. top: 50%;
  168. transform: translateY(-50%);
  169. z-index: 1;
  170. width: 73px;
  171. height: 30px;
  172. border-radius: 10px;
  173. .line {
  174. position: absolute;
  175. top: 50%;
  176. transform: translateY(-50%);
  177. right: 9px;
  178. height: 12px;
  179. width: 2px;
  180. background: rgba(255, 255, 255, 0.8);
  181. }
  182. }
  183. }
  184. }
  185. .switch-btn {
  186. margin-top: 0;
  187. width: 50px !important;
  188. height: 28px !important;
  189. border: none;
  190. }
  191. }
  192. .active {
  193. background: rgba(255, 255, 255, 0.8);
  194. backdrop-filter: blur(40px);
  195. box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
  196. .bottom {
  197. .text {
  198. color: rgba(0, 20, 40, 1);
  199. }
  200. .status {
  201. color: rgba(116, 128, 141, 1);
  202. }
  203. }
  204. }
  205. </style>
  206. <style lang="scss">
  207. .volumn-box {
  208. .van-switch__node {
  209. background: rgba(255, 255, 255, 0.6);
  210. width: 24px;
  211. height: 24px;
  212. left: 2px;
  213. top: 0.33vh;
  214. }
  215. .van-switch--on {
  216. background: linear-gradient(95.5deg, #99282b 21.44%, #a95459 84.95%) !important;
  217. .van-switch__node {
  218. background: #fff !important;
  219. }
  220. }
  221. .van-switch--on.switch-btn {
  222. .van-switch__node {
  223. transform: translate(calc(50px - 28px)) !important;
  224. }
  225. }
  226. .van-loading__spinner {
  227. color: $elActiveColor !important;
  228. }
  229. .van-switch__loading {
  230. top: 0;
  231. left: 0;
  232. width: 100%;
  233. height: 100%;
  234. line-height: 1;
  235. }
  236. .van-switch--disabled {
  237. opacity: 0.5;
  238. }
  239. }
  240. </style>