rotationflow.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <view class="rotationflow">
  3. <custom-card>
  4. <block slot="backText">自动控制</block>
  5. </custom-card>
  6. <view class="rotationflow-top">
  7. <view class="rotationflow-top-list">
  8. <image :src="autoBtn" class="rotate-autoBtn" />
  9. <image :src="rotate" class="rotate-rotate" />
  10. <image :src="water" class="rotate-water" />
  11. <view class="rotationflow-time">
  12. <view class="rotationflow-time-title">2号灌区</view>
  13. <view class="rotationflow-time-content"> {{ time }}</view>
  14. <view class="rotationflow-time-label">灌溉时长</view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="rotationflow-middle">
  19. <view
  20. class="rotationflow-middle-item"
  21. v-for="item in list"
  22. :key="item.label"
  23. >
  24. <view class="rotationflow-middle-item-value">{{ item.value }}</view>
  25. <view class="rotationflow-middle-item-title">{{ item.label }}</view>
  26. </view>
  27. </view>
  28. <view class="rotationflow-content">
  29. <view class="rotationflow-content-top">
  30. <view class="rotationflow-content-top-title">灌溉</view>
  31. <view class="rotationflow-content-top-desc">已选灌区</view>
  32. </view>
  33. <view class="rotationflow-content-list">
  34. <view class="rotationflow-content-list-wrapper">
  35. <view class="rotationflow-content-num">
  36. <view class="rotationflow-content-num-title">轮灌次数:1</view>
  37. <view class="rotationflow-content-num-title"
  38. >轮灌间隔:10分钟</view
  39. > </view
  40. ><view class="rotationflow-content-num">
  41. <view class="rotationflow-content-num-title">轮灌次数:1</view>
  42. <view class="rotationflow-content-num-title"
  43. >轮灌间隔:10分钟</view
  44. > </view
  45. ><view class="rotationflow-content-num">
  46. <view class="rotationflow-content-num-title">轮灌次数:1</view>
  47. <view class="rotationflow-content-num-title">轮灌间隔:10分钟</view>
  48. </view>
  49. </view>
  50. <view
  51. class="rotationflow-content-list-item"
  52. v-for="(item, index) in 30"
  53. :class="index === 0 ? 'haveYet' : index === 1 ? 'currentYet' : ''"
  54. :key="index"
  55. >
  56. <view class="rotationflow-content-list-item-title">1号灌区</view>
  57. <view class="rotationflow-content-list-item-desc">已灌溉</view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="rotationflow-footer">
  62. <view class="rotationflow-footer-item">结束灌溉</view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. import rotate from './assets/rotate.png';
  68. import water from './assets/water.png';
  69. import autoBtn from './assets/autoBtn.png';
  70. export default {
  71. name: 'rotationflow',
  72. data() {
  73. return {
  74. rotate,
  75. water,
  76. autoBtn,
  77. time: '',
  78. list: [
  79. {
  80. value: '0.00',
  81. label: 'PH值',
  82. },
  83. {
  84. value: '987 us',
  85. label: 'EC值',
  86. },
  87. {
  88. value: '20℃',
  89. label: '水温',
  90. },
  91. {
  92. value: '20 Pa',
  93. label: '管道压力',
  94. },
  95. ],
  96. timer: null,
  97. devBid: '',
  98. };
  99. },
  100. components: {},
  101. methods: {
  102. setTime() {
  103. let hours = 6 * 60 * 60 * 1000;
  104. this.time = '06:00:00';
  105. this.timer = setInterval(() => {
  106. if (hours <= 0) {
  107. clearInterval(this.timer);
  108. return;
  109. }
  110. hours -= 1000;
  111. let h = Math.floor(hours / (60 * 60 * 1000));
  112. let m = Math.floor((hours % (60 * 60 * 1000)) / (60 * 1000));
  113. let s = Math.floor(((hours % (60 * 60 * 1000)) % (60 * 1000)) / 1000);
  114. this.time = `${h < 10 ? '0' + h : h}:${m < 10 ? '0' + m : m}:${
  115. s < 10 ? '0' + s : s
  116. }`;
  117. }, 1000);
  118. },
  119. async getRunStatus() {
  120. const res = await this.$myRequest({
  121. url: '/api/v2/iot/mobile/device/sf/zsrf/task/run/status/',
  122. method: 'post',
  123. data: {
  124. devBid: this.devBid,
  125. },
  126. });
  127. console.log(res, 'resresresres');
  128. },
  129. },
  130. mounted() {
  131. this.setTime();
  132. },
  133. onLoad(options) {
  134. const { devBid } = options;
  135. this.devBid = devBid;
  136. this.getRunStatus();
  137. },
  138. onUnload() {
  139. clearInterval(this.timer);
  140. },
  141. beforeDestroy() {
  142. if (this.timer) {
  143. clearInterval(this.timer);
  144. }
  145. },
  146. };
  147. </script>
  148. <style scoped lang="scss">
  149. uni-page-body,
  150. uni-page-wrapper {
  151. position: relative;
  152. height: 100%;
  153. }
  154. @keyframes rotate {
  155. 0% {
  156. transform: rotate(0deg);
  157. }
  158. 100% {
  159. transform: rotate(360deg);
  160. }
  161. }
  162. .rotationflow {
  163. background: linear-gradient(
  164. 180deg,
  165. #f5f6fa00 0%,
  166. #f5f6fa 23.64%,
  167. #f5f6fa 100%
  168. ),
  169. linear-gradient(102deg, #bfeadd 6.77%, #b8f1e7 40.15%, #b9eef5 84.02%);
  170. width: 100%;
  171. height: calc(100% - 140rpx);
  172. overflow: hidden;
  173. overflow-y: scroll;
  174. margin-bottom: 140rpx;
  175. .rotationflow-top {
  176. height: 500rpx;
  177. width: 100%;
  178. display: flex;
  179. justify-content: center;
  180. align-items: center;
  181. .rotationflow-top-list {
  182. display: flex;
  183. position: relative;
  184. align-items: center;
  185. justify-content: center;
  186. width: 100%;
  187. height: 100%;
  188. .rotate-autoBtn {
  189. position: absolute;
  190. width: 360rpx;
  191. height: 360rpx;
  192. z-index: 1;
  193. }
  194. .rotate-rotate {
  195. position: absolute;
  196. width: 320rpx;
  197. height: 320rpx;
  198. left: 215rpx;
  199. top: 92rpx;
  200. z-index: 2;
  201. // 循环滚动
  202. animation: rotate 20s linear infinite;
  203. }
  204. .rotate-water {
  205. position: absolute;
  206. width: 550rpx;
  207. height: 600rpx;
  208. margin-left: 220rpx;
  209. margin-top: 100rpx;
  210. }
  211. .rotationflow-time {
  212. display: flex;
  213. flex-direction: column;
  214. align-items: center;
  215. justify-content: center;
  216. position: relative;
  217. z-index: 3;
  218. top: -5rpx;
  219. .rotationflow-time-title {
  220. width: 200rpx;
  221. color: #042118;
  222. text-align: center;
  223. font-family: 'Source Han Sans CN VF';
  224. font-size: 32rpx;
  225. font-weight: 500;
  226. }
  227. .rotationflow-time-content {
  228. width: 200rpx;
  229. color: #042118;
  230. font-family: 'Source Han Sans CN VF';
  231. font-size: 40rpx;
  232. font-weight: 700;
  233. margin: 8rpx 0;
  234. text-align: center;
  235. }
  236. .rotationflow-time-label {
  237. width: 200rpx;
  238. color: #687a74;
  239. text-align: center;
  240. font-family: 'Source Han Sans CN VF';
  241. font-size: 24rpx;
  242. font-weight: 400;
  243. }
  244. }
  245. }
  246. }
  247. .rotationflow-middle {
  248. display: flex;
  249. padding: 0 32rpx;
  250. margin: 32rpx 0;
  251. .rotationflow-middle-item {
  252. width: 25%;
  253. text-align: center;
  254. .rotationflow-middle-item-value {
  255. color: #042118;
  256. font-family: 'Source Han Sans CN VF';
  257. font-size: 32rpx;
  258. font-weight: 500;
  259. }
  260. .rotationflow-middle-item-title {
  261. color: #687a74;
  262. font-family: 'Source Han Sans CN VF';
  263. font-size: 28rpx;
  264. font-style: normal;
  265. font-weight: 400;
  266. line-height: normal;
  267. // 超出隐藏
  268. white-space: nowrap;
  269. text-overflow: ellipsis;
  270. overflow: hidden;
  271. }
  272. }
  273. }
  274. .rotationflow-content {
  275. border-bottom: none;
  276. position: relative;
  277. overflow: hidden;
  278. background-color: #fff;
  279. border-radius: 16rpx;
  280. padding: 32rpx;
  281. width: calc(100% - 64rpx);
  282. margin-left: 32rpx;
  283. margin-bottom: 140rpx;
  284. &::before {
  285. position: absolute;
  286. content: '';
  287. top: 0;
  288. left: 0;
  289. right: 0;
  290. bottom: 0;
  291. background-size: cover;
  292. }
  293. .rotationflow-content-top {
  294. display: flex;
  295. .rotationflow-content-top-title {
  296. border-radius: 8rpx;
  297. background: #1890ff1a;
  298. color: #1890ff;
  299. font-family: 'Source Han Sans CN VF';
  300. font-size: 28rpx;
  301. font-style: normal;
  302. font-weight: 400;
  303. line-height: normal;
  304. padding: 4rpx 16rpx;
  305. }
  306. .rotationflow-content-top-desc {
  307. color: #333333;
  308. font-family: 'Source Han Sans CN VF';
  309. font-size: 28rpx;
  310. font-weight: 700;
  311. margin-left: 16rpx;
  312. }
  313. }
  314. .rotationflow-content-list {
  315. width: 100%;
  316. .rotationflow-content-list-wrapper {
  317. width: 100%;
  318. border-radius: 8rpx;
  319. background: #f5f6fa;
  320. padding: 8rpx 0;
  321. margin-top: 16rpx;
  322. }
  323. .rotationflow-content-num {
  324. display: flex;
  325. padding: 8rpx 16rpx;
  326. .rotationflow-content-num-title {
  327. width: 50%;
  328. color: #687a74;
  329. font-family: 'Source Han Sans CN VF';
  330. font-size: 28rpx;
  331. font-style: normal;
  332. font-weight: 400;
  333. margin: 0 8rpx;
  334. }
  335. }
  336. .rotationflow-content-list-item {
  337. display: flex;
  338. justify-content: space-between;
  339. margin-top: 8rpx;
  340. color: #042118;
  341. text-align: right;
  342. font-family: 'Source Han Sans CN VF';
  343. font-size: 28rpx;
  344. font-weight: 400;
  345. .rotationflow-content-list-item-desc {
  346. margin-right: 32rpx;
  347. }
  348. }
  349. .haveYet {
  350. color: #9ba6a3;
  351. text-align: right;
  352. font-family: 'Source Han Sans CN VF';
  353. font-size: 28rpx;
  354. font-weight: 400;
  355. }
  356. .currentYet {
  357. color: #14a478;
  358. text-align: right;
  359. font-family: 'Source Han Sans CN VF';
  360. font-size: 28rpx;
  361. font-weight: 400;
  362. }
  363. }
  364. }
  365. .rotationflow-footer {
  366. position: fixed;
  367. width: 100%;
  368. bottom: 0;
  369. left: 0;
  370. display: flex;
  371. height: 128rpx;
  372. align-items: center;
  373. background: #fff;
  374. box-shadow: 0 -4rpx 8rpx 0 #00000026;
  375. .rotationflow-footer-item {
  376. width: calc(100% - 64rpx);
  377. margin: 0 32rpx;
  378. text-align: center;
  379. font-size: 32rpx;
  380. height: 80rpx;
  381. line-height: 80rpx;
  382. color: #ffffff;
  383. font-family: 'PingFang SC';
  384. font-size: 32rpx;
  385. font-weight: 500;
  386. border-radius: 16rpx;
  387. background: #14a478;
  388. }
  389. }
  390. }
  391. </style>