dashboard.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="dashboard-page zx-page-linear">
  3. <view class="dashboard">
  4. <view class="shadow" :style="{ '--progress': progress + '%' }"></view>
  5. <view class="spe-wrap">
  6. <view class="spe-num">
  7. {{ speed }}
  8. </view>
  9. <view class="unit">km/h</view>
  10. </view>
  11. <view class="power-wrap">
  12. <u-count-to :startVal="0" bold :endVal="progress" fontSize="48rpx" />
  13. </view>
  14. </view>
  15. <view class="battery_life_progress">
  16. <view class="is_progress">
  17. <text>续航</text>
  18. <text>46.5km</text>
  19. </view>
  20. </view>
  21. <view class="info-container">
  22. <view class="info-wrap" v-for="(item, index) in infoList" :key="index">
  23. <view class="label">{{ item.label }}</view>
  24. <view class="value">{{ 10 + index }} <text class="unit">{{ item.unit }}</text></view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. speed: 50,
  34. infoList: []
  35. }
  36. },
  37. computed: {
  38. progress() {
  39. const MAX_SPEED = 120;
  40. return this.speed / MAX_SPEED * 100
  41. }
  42. },
  43. created() {
  44. this._initInfoList()
  45. },
  46. methods: {
  47. _initInfoList() {
  48. this.infoList = [
  49. { label: '骑行里程', prop: 'km', unit: 'km' },
  50. { label: '骑行时长', prop: 'km', unit: 'h' },
  51. { label: '最大速度', prop: 'km', unit: 'km/h' },
  52. { label: '平均速度', prop: 'km', unit: 'km/h' },
  53. ]
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. @import "@/libs/css/layout.scss";
  60. .dashboard-page {
  61. padding: 24rpx 32rpx 0;
  62. min-height: calc(100vh - 100rpx);
  63. .dashboard {
  64. width: 554rpx;
  65. height: 554rpx;
  66. margin: 0 auto 58rpx;
  67. background: url('https://qiniu.bms16.com/Ftwa7u9tJYw3XSLaXYvrDyGNRuD5');
  68. background-size: 100%;
  69. position: relative;
  70. .shadow {
  71. box-shadow: inset 0rpx 2rpx 6rpx 0rpx #fff;
  72. width: 490rpx;
  73. height: 502rpx;
  74. position: relative;
  75. top: 20rpx;
  76. left: 50%;
  77. transform: translateX(-50%);
  78. border-radius: 50%;
  79. background: conic-gradient(from -122deg, #0A59F7 0%, #20FFCA var(--progress), #F3F8FF 0% 245deg, transparent 245deg 360deg);
  80. mask: radial-gradient(transparent 200rpx, #000 200rpx);
  81. -webkit-mask: radial-gradient(transparent 210rpx, #000 213rpx);
  82. }
  83. .spe-wrap {
  84. width: 218rpx;
  85. height: 218rpx;
  86. background: #0A59F7;
  87. border-radius: 50%;
  88. position: absolute;
  89. left: 50%;
  90. top: 50%;
  91. transform: translate(-50%, -50%);
  92. display: flex;
  93. align-items: center;
  94. justify-content: center;
  95. flex-direction: column;
  96. color: #fff;
  97. .spe-num {
  98. font-family: Futura, Futura;
  99. font-weight: bold;
  100. font-size: 80rpx;
  101. color: #FFFFFF;
  102. line-height: 64rpx;
  103. text-align: center;
  104. font-style: normal;
  105. margin-bottom: 16rpx;
  106. }
  107. .unit {
  108. line-height: 28rpx;
  109. font-style: italic;
  110. }
  111. }
  112. .power-wrap {
  113. width: 230rpx;
  114. height: 104rpx;
  115. background: #D6E7FF;
  116. border-radius: 64rpx;
  117. position: absolute;
  118. bottom: 22rpx;
  119. left: 50%;
  120. transform: translateX(-50%);
  121. display: flex;
  122. align-items: center;
  123. justify-content: center;
  124. font-family: Futura, Futura;
  125. font-weight: bold;
  126. font-size: 48rpx;
  127. color: #060809;
  128. }
  129. }
  130. .battery_life_progress {
  131. width: 100%;
  132. margin-bottom: 40rpx;
  133. background: #FFFFFF;
  134. border-radius: 40rpx;
  135. padding: 6rpx;
  136. overflow: hidden;
  137. .is_progress {
  138. width: 50%;
  139. height: 100%;
  140. padding: 16rpx 32rpx;
  141. background: #0A59F7;
  142. border-radius: 36rpx;
  143. display: flex;
  144. align-items: center;
  145. justify-content: space-between;
  146. color: #fff;
  147. font-size: 36rpx;
  148. }
  149. }
  150. .info-container {
  151. display: flex;
  152. flex-wrap: wrap;
  153. justify-content: space-between;
  154. .info-wrap {
  155. width: 336rpx;
  156. margin-bottom: 14rpx;
  157. background: #FFFFFF;
  158. border-radius: 40rpx;
  159. padding: 32rpx 24rpx;
  160. .label {
  161. font-size: 28rpx;
  162. color: #060809;
  163. margin-bottom: 24rpx;
  164. }
  165. .value {
  166. font-size: 48rpx;
  167. .unit {
  168. margin-left: 8rpx;
  169. font-size: 28rpx;
  170. }
  171. }
  172. }
  173. }
  174. }
  175. </style>