index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <div
  3. class="volumn-box"
  4. :class="isOpen ? 'active' : ''"
  5. @click="searchMore"
  6. >
  7. <div class="top">
  8. <img
  9. :src="
  10. parseImgUrl('taiguv1/envmonitor', isOpen ? 'active/curtain.svg' : 'curtain.svg')
  11. "
  12. alt=""
  13. />
  14. <div class="top-right">
  15. <Switch
  16. class="switch-btn"
  17. inactive-color="rgba(0, 0, 0, 0.3)"
  18. v-model="isOpen"
  19. @click.stop=""
  20. />
  21. </div>
  22. </div>
  23. <div class="bottom">
  24. <div class="text">窗帘</div>
  25. <div class="status">{{ isOpen ? "已开启" : "已关闭" }}</div>
  26. <div class="control-box">
  27. <div class="control-item">上</div>
  28. <div class="control-item">停</div>
  29. <div class="control-item">下</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. searchMore() {
  60. contx.emit("showMore",'curtain',true);
  61. },
  62. });
  63. onBeforeUnmount(() => {});
  64. onMounted(() => {});
  65. return {
  66. ...toRefs(proxyData),
  67. };
  68. },
  69. });
  70. </script>
  71. <style lang="scss" scoped>
  72. .volumn-box {
  73. box-sizing: border-box;
  74. display: flex;
  75. flex-direction: column;
  76. justify-content: space-between;
  77. padding: 16px;
  78. width: 100%;
  79. height: 100%;
  80. border-radius: 24px 24px 44px 24px;
  81. background: rgba(255, 255, 255, 0.2);
  82. backdrop-filter: blur(40px);
  83. box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
  84. .top {
  85. display: flex;
  86. justify-content: space-between;
  87. img {
  88. width: 30px;
  89. }
  90. }
  91. .bottom {
  92. // margin-top: 18vh;
  93. // margin-top: 109px;
  94. .text {
  95. //styleName: Chi/Body Large;
  96. font-family: PingFang SC;
  97. font-size: 16px;
  98. font-weight: 300;
  99. line-height: 22px;
  100. letter-spacing: 0.02em;
  101. text-align: left;
  102. text-underline-position: from-font;
  103. text-decoration-skip-ink: none;
  104. color: rgba(255, 255, 255, 1);
  105. padding-bottom: 2px;
  106. }
  107. .status {
  108. //styleName: Chi/Body XS;
  109. font-family: PingFang SC;
  110. font-size: 11px;
  111. font-weight: 400;
  112. line-height: 15px;
  113. letter-spacing: 0.02em;
  114. color: rgba(255, 255, 255, 0.4);
  115. }
  116. .control-box {
  117. width: 100%;
  118. display: flex;
  119. justify-content: space-between;
  120. .control-item {
  121. display: flex;
  122. align-items: center;
  123. justify-content: center;
  124. width: 36px;
  125. height: 36px;
  126. border-radius: 60px;
  127. opacity: 0.6;
  128. background: var(--White-White-40, rgba(255, 255, 255, 0.40));
  129. backdrop-filter: blur(30px);
  130. font-family: Jost;
  131. font-size: 16px;
  132. font-style: normal;
  133. font-weight: 300;
  134. line-height: normal;
  135. }
  136. }
  137. }
  138. .switch-btn {
  139. width: 50px !important;
  140. height: 28px !important;
  141. border: none;
  142. }
  143. }
  144. .active {
  145. background: rgba(255, 255, 255, 0.8);
  146. backdrop-filter: blur(40px);
  147. box-shadow: 0px 10px 20px 0px rgba(0, 20, 40, 0.1);
  148. .bottom {
  149. .text {
  150. color: rgba(0, 20, 40, 1);
  151. }
  152. .status {
  153. color: rgba(116, 128, 141, 1);
  154. }
  155. }
  156. }
  157. </style>
  158. <style lang="scss">
  159. .volumn-box {
  160. .van-switch__node {
  161. background: rgba(255, 255, 255, 0.6);
  162. width: 24px;
  163. height: 24px;
  164. top: 0.33vh;
  165. }
  166. .van-switch--on.switch-btn {
  167. .van-switch__node {
  168. transform: translate(calc(50px - 28px)) !important;
  169. }
  170. }
  171. .van-switch--on {
  172. background: linear-gradient(
  173. 95.5deg,
  174. #99282b 21.44%,
  175. #a95459 84.95%
  176. ) !important;
  177. .van-switch__node {
  178. background: #fff !important;
  179. }
  180. }
  181. .van-loading__spinner {
  182. color: $elActiveColor !important;
  183. }
  184. .van-switch__loading {
  185. top: 0;
  186. left: 0;
  187. width: 100%;
  188. height: 100%;
  189. line-height: 1;
  190. }
  191. .van-switch--disabled {
  192. opacity: 0.5;
  193. }
  194. }
  195. </style>