aircondition.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view class="aircondition-box">
  3. <view class="aircondition-control">
  4. <view class="aircondition-toogle">
  5. <view class="toogle-icon-text">
  6. <view class="toogle-icon">
  7. <uni-icons type="icon-fentikongtiaokongtiaojieneng" custom-prefix="iconfont" color="#fff"
  8. size="26">
  9. </uni-icons>
  10. </view>
  11. <text class="text">{{title}}</text>
  12. </view>
  13. <uni-icons type="icon-caozuo-kaiguan" custom-prefix="iconfont" size="40"
  14. :color="!isOpen?'#c3c3c3':'#08979c'" @click="isOpen = !isOpen">
  15. </uni-icons>
  16. </view>
  17. <view class="aircondition-show">
  18. <view class="aircondition-reduce aircondition-icon">
  19. <uni-icons type="icon-jian" custom-prefix="iconfont" color="#8c8c8c"></uni-icons>
  20. </view>
  21. <view class="aircondition-label">
  22. <view class="value">{{temp}}</view>
  23. <view class="unit">°C</view>
  24. </view>
  25. <view class="aircondition-add aircondition-icon">
  26. <uni-icons type="plusempty" color="#8c8c8c"></uni-icons>
  27. </view>
  28. </view>
  29. <l-slider v-model="temp" :min="16" :max="30" :step="0.5"></l-slider>
  30. </view>
  31. <view class="aircondition-model">
  32. <view class="box" @click="openPopup('model')">
  33. <view class="content">
  34. <view class="title">模式</view>
  35. <view class="sub-title">制热</view>
  36. </view>
  37. <uni-icons type="icon-zhongtumoshi" custom-prefix="iconfont" color="#bcbcbc" size="26">
  38. </uni-icons>
  39. </view>
  40. <view class="bg"></view>
  41. <view class="box" @click="openPopup('windSpeed')">
  42. <view class="content">
  43. <view class="title">风速</view>
  44. <view class="sub-title">自动</view>
  45. </view>
  46. <uni-icons type="icon-fengsu" custom-prefix="iconfont" color="#bcbcbc" size="26">
  47. </uni-icons>
  48. </view>
  49. </view>
  50. <uni-popup ref="popup">
  51. <view class="popup-content">
  52. <view class="popup-operation">
  53. <view class="model-popup" v-if="type == 'model'">
  54. <view class="model-popup-item active">
  55. <uni-icons type="icon-zidong" custom-prefix="iconfont" color="#08979c" size="26">
  56. </uni-icons>
  57. <view class="model-popup-label">自动</view>
  58. </view>
  59. <view class="model-popup-item">
  60. <uni-icons type="icon-zhileng" custom-prefix="iconfont" color="#8c8c8c" size="26">
  61. </uni-icons>
  62. <view class="model-popup-label">制冷</view>
  63. </view>
  64. <view class="model-popup-item">
  65. <uni-icons type="icon-zhire" custom-prefix="iconfont" color="#8c8c8c" size="26">
  66. </uni-icons>
  67. <view class="model-popup-label">制热</view>
  68. </view>
  69. <view class="model-popup-item">
  70. <uni-icons type="icon-chushi" custom-prefix="iconfont" color="#8c8c8c" size="26">
  71. </uni-icons>
  72. <view class="model-popup-label">抽湿</view>
  73. </view>
  74. <view class="model-popup-item">
  75. <uni-icons type="icon-songfeng" custom-prefix="iconfont" color="#8c8c8c" size="26">
  76. </uni-icons>
  77. <view class="model-popup-label">送风</view>
  78. </view>
  79. </view>
  80. <view class="wind-popup" v-if="type == 'windSpeed'">
  81. <view class="wind-title">
  82. <view class="big-title">风速</view>
  83. <view class="line"></view>
  84. <view class="label">
  85. <text v-if="autoWind">自动风</text>
  86. <text v-else>{{windSpeed}}%</text>
  87. </view>
  88. </view>
  89. <view class="wind-auto">
  90. <uni-icons type="icon-zidong" custom-prefix="iconfont" color="#1f1f1f" size="26">
  91. </uni-icons>
  92. <view class="big-title">自动风</view>
  93. <uv-switch v-model="autoWind" size="40rpx"></uv-switch>
  94. </view>
  95. <view class="wind-hand">
  96. <l-slider v-model="windSpeed" :min="1" :max="100" :step="1"></l-slider>
  97. </view>
  98. <view class="hand-text">
  99. <text class="number1">1%</text>
  100. <text class="number20">20%</text>
  101. <text class="number40">40%</text>
  102. <text class="number60">60%</text>
  103. <text class="number80">80%</text>
  104. <text class="number100">100%</text>
  105. </view>
  106. </view>
  107. </view>
  108. <view class="popup-close" @click="closePopup">关闭</view>
  109. </view>
  110. </uni-popup>
  111. </view>
  112. </template>
  113. <script>
  114. export default {
  115. props: ['title'],
  116. data() {
  117. return {
  118. isOpen: true,
  119. temp: 26,
  120. type: '',
  121. autoWind: true,
  122. windSpeed: 20
  123. }
  124. },
  125. mounted() {},
  126. methods: {
  127. openPopup(type) {
  128. this.type = type;
  129. this.$refs.popup.open('bottom');
  130. },
  131. closePopup() {
  132. this.$refs.popup.close();
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss">
  138. .aircondition-box {
  139. padding: 30rpx;
  140. .popup-content {
  141. border-radius: 16rpx 16rpx 0 0;
  142. background: #fff;
  143. .popup-operation {
  144. padding: 30rpx 0;
  145. }
  146. .model-popup {
  147. display: flex;
  148. .model-popup-item {
  149. flex: 1;
  150. text-align: center;
  151. &.active {
  152. color: $uni-primary;
  153. }
  154. }
  155. .model-popup-label {
  156. font-size: 24rpx;
  157. margin-top: 10rpx;
  158. font-weight: 300;
  159. }
  160. }
  161. .wind-popup {
  162. padding: 0 30rpx;
  163. box-sizing: border-box;
  164. .wind-title {
  165. display: flex;
  166. align-items: center;
  167. }
  168. .big-title {
  169. font-size: 32rpx
  170. }
  171. .line {
  172. width: 2rpx;
  173. height: 26rpx;
  174. background: $uni-background-color;
  175. margin: 0 16rpx;
  176. }
  177. .wind-auto {
  178. padding: 20rpx 30rpx;
  179. border-radius: 26rpx;
  180. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  181. display: flex;
  182. align-items: center;
  183. margin: 30rpx 0;
  184. .big-title {
  185. flex: 1;
  186. margin-left: 20rpx;
  187. }
  188. }
  189. .wind-hand {
  190. padding-top: 20rpx;
  191. }
  192. .hand-text {
  193. position: relative;
  194. color: $uni-secondary-color;
  195. font-size: 24rpx;
  196. height: 34rpx;
  197. margin-top: 20rpx;
  198. .number20 {
  199. position: absolute;
  200. left: 20%;
  201. margin-left: -26rpx;
  202. }
  203. .number40 {
  204. position: absolute;
  205. left: 40%;
  206. margin-left: -26rpx;
  207. }
  208. .number60 {
  209. position: absolute;
  210. left: 60%;
  211. margin-left: -26rpx;
  212. }
  213. .number80 {
  214. position: absolute;
  215. left: 80%;
  216. margin-left: -26rpx;
  217. }
  218. .number100 {
  219. position: absolute;
  220. left: 100%;
  221. margin-left: -52rpx;
  222. }
  223. }
  224. }
  225. .popup-close {
  226. border-top: 20rpx solid $uni-background-color;
  227. padding: 24rpx 0;
  228. text-align: center;
  229. color: $uni-secondary-color;
  230. }
  231. }
  232. .aircondition-control {
  233. padding: 30rpx;
  234. background: #fff;
  235. border-radius: 16rpx;
  236. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  237. }
  238. .aircondition-toogle {
  239. display: flex;
  240. justify-content: space-between;
  241. margin-bottom: 40rpx;
  242. }
  243. .toogle-icon-text {
  244. display: flex;
  245. align-items: center;
  246. .text {
  247. font-size: 36rpx;
  248. margin-left: 20rpx;
  249. }
  250. }
  251. .toogle-icon {
  252. width: 80rpx;
  253. height: 80rpx;
  254. background: $uni-primary;
  255. text-align: center;
  256. line-height: 80rpx;
  257. border-radius: 8px;
  258. }
  259. .aircondition-show {
  260. display: flex;
  261. align-items: center;
  262. justify-content: center;
  263. padding: 0 40rpx 30rpx 40rpx;
  264. }
  265. .aircondition-icon {
  266. width: 60rpx;
  267. height: 60rpx;
  268. background-color: $uni-background-color;
  269. text-align: center;
  270. line-height: 60rpx;
  271. border-radius: 50%;
  272. }
  273. .aircondition-label {
  274. flex: 1;
  275. width: 0;
  276. display: flex;
  277. align-items: flex-end;
  278. justify-content: center;
  279. color: $uni-base-color;
  280. .value {
  281. font-size: 80rpx;
  282. height: 100rpx;
  283. }
  284. .unit {
  285. font-size: 40rpx;
  286. }
  287. }
  288. .aircondition-model {
  289. display: flex;
  290. margin-top: 30rpx;
  291. .box {
  292. flex: 1;
  293. background: #fff;
  294. border-radius: 16rpx;
  295. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  296. height: 160rpx;
  297. display: flex;
  298. align-items: center;
  299. justify-content: space-between;
  300. padding: 0 60rpx 0 30rpx;
  301. box-sizing: border-box;
  302. .content {
  303. .title {
  304. font-size: 32rpx;
  305. font-weight: 300;
  306. }
  307. .sub-title {
  308. font-size: 24rpx;
  309. color: $uni-secondary-color;
  310. font-weight: 200;
  311. margin-top: 10rpx;
  312. }
  313. }
  314. }
  315. .bg {
  316. width: 30rpx;
  317. }
  318. }
  319. }
  320. </style>