aircondition.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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" @click="reduce">
  19. <uni-icons type="icon-jian" custom-prefix="iconfont" color="#8c8c8c"></uni-icons>
  20. </view>
  21. <view class="aircondition-label">
  22. <view class="value">{{showValue(temp)}}</view>
  23. <view class="unit">°C</view>
  24. </view>
  25. <view class="aircondition-add aircondition-icon">
  26. <uni-icons type="plusempty" color="#8c8c8c" @click="add"></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. reduce() {
  128. if (this.temp <= 16) return;
  129. this.temp -= 0.5
  130. },
  131. add() {
  132. if (this.temp >= 30) return;
  133. this.temp += 0.5
  134. },
  135. showValue(num) {
  136. return num.toFixed(1);
  137. },
  138. openPopup(type) {
  139. this.type = type;
  140. this.$refs.popup.open('bottom');
  141. },
  142. closePopup() {
  143. this.$refs.popup.close();
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="scss">
  149. .aircondition-box {
  150. padding: 30rpx;
  151. .popup-content {
  152. border-radius: 16rpx 16rpx 0 0;
  153. background: #fff;
  154. .popup-operation {
  155. padding: 30rpx 0;
  156. }
  157. .model-popup {
  158. display: flex;
  159. .model-popup-item {
  160. flex: 1;
  161. text-align: center;
  162. &.active {
  163. color: $uni-primary;
  164. }
  165. }
  166. .model-popup-label {
  167. font-size: 24rpx;
  168. margin-top: 10rpx;
  169. font-weight: 300;
  170. }
  171. }
  172. .wind-popup {
  173. padding: 0 30rpx;
  174. box-sizing: border-box;
  175. .wind-title {
  176. display: flex;
  177. align-items: center;
  178. }
  179. .big-title {
  180. font-size: 32rpx
  181. }
  182. .line {
  183. width: 2rpx;
  184. height: 26rpx;
  185. background: $uni-background-color;
  186. margin: 0 16rpx;
  187. }
  188. .wind-auto {
  189. padding: 20rpx 30rpx;
  190. border-radius: 26rpx;
  191. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  192. display: flex;
  193. align-items: center;
  194. margin: 30rpx 0;
  195. .big-title {
  196. flex: 1;
  197. margin-left: 20rpx;
  198. }
  199. }
  200. .wind-hand {
  201. padding-top: 20rpx;
  202. }
  203. .hand-text {
  204. position: relative;
  205. color: $uni-secondary-color;
  206. font-size: 24rpx;
  207. height: 34rpx;
  208. margin-top: 20rpx;
  209. .number20 {
  210. position: absolute;
  211. left: 20%;
  212. margin-left: -26rpx;
  213. }
  214. .number40 {
  215. position: absolute;
  216. left: 40%;
  217. margin-left: -26rpx;
  218. }
  219. .number60 {
  220. position: absolute;
  221. left: 60%;
  222. margin-left: -26rpx;
  223. }
  224. .number80 {
  225. position: absolute;
  226. left: 80%;
  227. margin-left: -26rpx;
  228. }
  229. .number100 {
  230. position: absolute;
  231. left: 100%;
  232. margin-left: -52rpx;
  233. }
  234. }
  235. }
  236. .popup-close {
  237. border-top: 20rpx solid $uni-background-color;
  238. height: 88rpx;
  239. line-height: 88rpx;
  240. text-align: center;
  241. color: $uni-secondary-color;
  242. }
  243. }
  244. .aircondition-control {
  245. padding: 30rpx;
  246. background: #fff;
  247. border-radius: 16rpx;
  248. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  249. }
  250. .aircondition-toogle {
  251. display: flex;
  252. justify-content: space-between;
  253. margin-bottom: 40rpx;
  254. }
  255. .toogle-icon-text {
  256. display: flex;
  257. align-items: center;
  258. .text {
  259. font-size: 36rpx;
  260. margin-left: 20rpx;
  261. }
  262. }
  263. .toogle-icon {
  264. width: 80rpx;
  265. height: 80rpx;
  266. background: $uni-primary;
  267. text-align: center;
  268. line-height: 80rpx;
  269. border-radius: 8px;
  270. }
  271. .aircondition-show {
  272. display: flex;
  273. align-items: center;
  274. justify-content: center;
  275. padding: 0 40rpx 30rpx 40rpx;
  276. }
  277. .aircondition-icon {
  278. width: 60rpx;
  279. height: 60rpx;
  280. background-color: $uni-background-color;
  281. text-align: center;
  282. line-height: 60rpx;
  283. border-radius: 50%;
  284. }
  285. .aircondition-label {
  286. flex: 1;
  287. width: 0;
  288. display: flex;
  289. align-items: flex-end;
  290. justify-content: center;
  291. color: $uni-base-color;
  292. .value {
  293. font-size: 80rpx;
  294. height: 100rpx;
  295. }
  296. .unit {
  297. font-size: 40rpx;
  298. }
  299. }
  300. .aircondition-model {
  301. display: flex;
  302. margin-top: 30rpx;
  303. .box {
  304. flex: 1;
  305. background: #fff;
  306. border-radius: 16rpx;
  307. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  308. height: 160rpx;
  309. display: flex;
  310. align-items: center;
  311. justify-content: space-between;
  312. padding: 0 60rpx 0 30rpx;
  313. box-sizing: border-box;
  314. .content {
  315. .title {
  316. font-size: 32rpx;
  317. font-weight: 300;
  318. }
  319. .sub-title {
  320. font-size: 24rpx;
  321. color: $uni-secondary-color;
  322. font-weight: 200;
  323. margin-top: 10rpx;
  324. }
  325. }
  326. }
  327. .bg {
  328. width: 30rpx;
  329. }
  330. }
  331. }
  332. </style>