water.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view class="meter-index">
  3. <view class="meter-box">
  4. <view class="title">{{title}}</view>
  5. <view class="sub-title">{{space}}</view>
  6. <view class="meter-box-content">
  7. <view class="meter-box-list">
  8. <view class="content-item">
  9. <view class="content-item-title">
  10. <view class="content-item-icon">
  11. <uni-icons type="icon-yongshuiliang1" custom-prefix="iconfont" size="20"
  12. color="#577ff5">
  13. </uni-icons>
  14. </view>
  15. <view class="label">今日用水量</view>
  16. </view>
  17. <view class="content-item-article">
  18. <text class="number">6.86</text>
  19. <text class="unit">t</text>
  20. </view>
  21. </view>
  22. <view class="content-item">
  23. <view class="content-item-title">
  24. <view class="content-item-icon">
  25. <uni-icons type="icon-yongshuiliang" custom-prefix="iconfont" size="22" color="#577ff5">
  26. </uni-icons>
  27. </view>
  28. <view class="label">当月用水量</view>
  29. </view>
  30. <view class="content-item-article">
  31. <text class="number">122.23</text>
  32. <text class="unit">t</text>
  33. </view>
  34. </view>
  35. <view class="content-item">
  36. <view class="content-item-title">
  37. <view class="content-item-icon">
  38. <uni-icons type="icon-dianchidianliang" custom-prefix="iconfont" size="18"
  39. color="#577ff5">
  40. </uni-icons>
  41. </view>
  42. <view class="label">电池电量</view>
  43. </view>
  44. <view class="content-item-article">
  45. <text class="number">10</text>
  46. <text class="unit">%</text>
  47. </view>
  48. </view>
  49. </view>
  50. <image class="meter-image"
  51. src="https://file-node.oss-cn-shanghai.aliyuncs.com/youji/f64e4608c64049dbae07d9eec7d835ac">
  52. </image>
  53. </view>
  54. </view>
  55. <view class="meter-charts">
  56. <view class="meter-chart-title">历史用水量</view>
  57. <view class="meter-chart-box">
  58. <u-echart ref="echart"></u-echart>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import uEchart from './uEchart.vue'
  65. export default {
  66. props: ['title', 'space'],
  67. data() {
  68. return {
  69. }
  70. },
  71. mounted() {
  72. setTimeout(() => {
  73. this.$refs.echart.initCharts({
  74. type: 'line',
  75. categories: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月'],
  76. series: [{
  77. name: '用水量',
  78. data: [36, 42, 23, 38, 41, 28, 35, 42, 30, 40]
  79. }],
  80. animation: true,
  81. background: "#FFFFFF",
  82. color: ["#1890FF"],
  83. padding: [10, 0, 0, 0],
  84. enableScroll: false,
  85. legend: {
  86. show: false
  87. },
  88. xAxis: {
  89. disableGrid: true
  90. },
  91. yAxis: {
  92. gridType: "dash",
  93. dashLength: 2
  94. },
  95. extra: {
  96. line: {
  97. type: "straight",
  98. width: 2,
  99. activeType: "hollow"
  100. }
  101. }
  102. })
  103. }, 500)
  104. },
  105. components: {
  106. uEchart
  107. },
  108. }
  109. </script>
  110. <style lang="scss">
  111. .meter-index {
  112. padding: 30rpx;
  113. .meter-box {
  114. background: #fff;
  115. padding: 30rpx;
  116. border-radius: 16rpx;
  117. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  118. .title {
  119. font-size: 40rpx;
  120. font-weight: 500;
  121. }
  122. .sub-title {
  123. font-size: 24rpx;
  124. color: $uni-secondary-color;
  125. font-weight: 200;
  126. }
  127. .meter-box-content {
  128. display: flex;
  129. align-items: center;
  130. padding: 80rpx 0 40rpx 0;
  131. }
  132. .meter-box-list {
  133. flex: 1;
  134. width: 0;
  135. overflow: hidden;
  136. }
  137. .content-item {
  138. margin-bottom: 20rpx;
  139. }
  140. .content-item-title {
  141. display: flex;
  142. align-items: center;
  143. .content-item-icon {
  144. width: 60rpx;
  145. height: 60rpx;
  146. text-align: center;
  147. line-height: 60rpx;
  148. }
  149. .label {
  150. font-size: 24rpx;
  151. font-weight: 300;
  152. margin-left: 10rpx;
  153. }
  154. }
  155. .content-item-article {
  156. display: flex;
  157. align-items: flex-end;
  158. padding-left: 70rpx;
  159. padding-top: 10rpx;
  160. .number {
  161. font-size: 40rpx;
  162. line-height: 40rpx;
  163. }
  164. .unit {
  165. color: $uni-secondary-color;
  166. margin-left: 8rpx;
  167. font-size: 24rpx;
  168. }
  169. }
  170. .meter-image {
  171. width: 200rpx;
  172. height: 200rpx;
  173. margin-right: 40rpx;
  174. }
  175. }
  176. .meter-charts {
  177. margin-top: 30rpx;
  178. background: #fff;
  179. padding: 30rpx;
  180. border-radius: 16rpx;
  181. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  182. .meter-chart-title {
  183. padding-bottom: 30rpx;
  184. font-size: 32rpx;
  185. font-weight: 500;
  186. }
  187. .meter-chart-box {
  188. width: 100%;
  189. height: 300rpx;
  190. }
  191. }
  192. }
  193. </style>