todaydata-box.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <!-- 今日记录模块 -->
  3. <view class="module-container">
  4. <u-tabs :list="list" :current="current" @change="change"
  5. :activeStyle="{color: '#303133',fontWeight: 'bold',transform: 'scale(1.05)',}"
  6. :inactiveStyle="{color: '#6c6e73'}"></u-tabs>
  7. <view class="module-box" v-if="current == 0">
  8. <view class="module-item">
  9. <view class="module-item-box">
  10. <text class="module-item-text">自主学习记录</text>
  11. <view class="num-box">
  12. <text class="module-item-num">5.5</text>
  13. <text class="unit">小时</text>
  14. </view>
  15. <view class="t-icon t-icon-shizhong-copy2-copy"></view>
  16. </view>
  17. </view>
  18. <view class="module-item" style="background-color: #00cca3;">
  19. <view class="module-item-box">
  20. <text class="module-item-text">娱乐放松记录</text>
  21. <view class="num-box">
  22. <text class="module-item-num">5</text>
  23. <text class="unit">小时</text>
  24. </view>
  25. <view class="t-icon t-icon-shizhong-copy3-copy"></view>
  26. </view>
  27. </view>
  28. <view class="module-item" style="background-color: #ff9db2;">
  29. <view class="module-item-box">
  30. <text class="module-item-text">运动锻炼记录</text>
  31. <view class="num-box">
  32. <text class="module-item-num">5</text>
  33. <text class="unit">分钟</text>
  34. </view>
  35. <view class="t-icon t-icon-shizhong-copy4-copy"></view>
  36. </view>
  37. </view>
  38. <view class="module-item" style="background-color: #f9c752;">
  39. <view class="module-item-box">
  40. <text class="module-item-text">睡眠记录</text>
  41. <view class="num-box">
  42. <text class="module-item-num">8</text>
  43. <text class="unit">小时</text>
  44. </view>
  45. <view class="t-icon t-icon-shizhong-copy1-copy"></view>
  46. </view>
  47. </view>
  48. </view>
  49. <!-- 记录表 -->
  50. <view class="module-box" v-if="current == 1">
  51. <view class="card-item" style="width: 710rpx;">
  52. <view class="card-info">
  53. <view class="t-icon t-icon-jiaoshidaka"></view>
  54. <text class="info-text">孩子学习记录</text>
  55. </view>
  56. <view style="width: 100%; height: 500rpx; margin-top: -30rpx;">
  57. <qiun-data-charts type="column" :chartData="todayData.studyColumn" :loadingType="4" :canvas2d='true'
  58. canvasId='canvans912' :opts="{dataLabel:false, extra:{column: {barBorderCircle:true}}}" />
  59. </view>
  60. </view>
  61. <view class="card-item">
  62. <view class="card-info">
  63. <view class="t-icon t-icon-jiankangshangbao"></view>
  64. <text class="info-text">运动记录</text>
  65. </view>
  66. <view style="width: 100%; height: 350rpx; margin-top: -10rpx;">
  67. <qiun-data-charts type="pie" :chartData="todayData.exercisePie" :loadingType="4" :canvas2d='true'
  68. canvasId='canvans8121' />
  69. </view>
  70. </view>
  71. <view class="card-item">
  72. <view class="card-info">
  73. <view class="t-icon t-icon-jiankangshangbao"></view>
  74. <text class="info-text">睡眠记录</text>
  75. </view>
  76. <view style="width: 100%; height: 350rpx; margin-top: -10rpx;">
  77. <qiun-data-charts type="ring" :chartData="todayData.sleepRing" :loadingType="4" :canvas2d='true'
  78. canvasId='canvans9122' :tooltipFormat='yAxisDemo1' />
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </template>
  84. <script>
  85. import {
  86. mapState
  87. } from 'vuex'
  88. export default {
  89. name: "todaydata-box",
  90. computed:{
  91. ...mapState('m_chart', ['todayData']),
  92. },
  93. data() {
  94. return {
  95. list: [{
  96. name: '今日数据记录'
  97. }, {
  98. name: '历史数据图表'
  99. }],
  100. current: 0,
  101. };
  102. },
  103. methods: {
  104. change(index) {
  105. console.log(index)
  106. this.current = index.index
  107. }
  108. }
  109. }
  110. </script>
  111. <style lang="scss">
  112. .module-container {
  113. display: flex;
  114. flex-direction: column;
  115. }
  116. .module-box {
  117. display: flex;
  118. flex-direction: row;
  119. flex-wrap: wrap;
  120. justify-content: space-between;
  121. .module-item {
  122. margin: 10rpx 0;
  123. display: flex;
  124. flex-direction: column;
  125. justify-content: space-between;
  126. background-color: #FFFFFF;
  127. box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.05);
  128. border-radius: 16rpx;
  129. width: 347rpx;
  130. height: 230rpx;
  131. background-color: #5b7cff;
  132. overflow: hidden;
  133. .module-item-box {
  134. padding: 30rpx;
  135. width: 100%;
  136. display: flex;
  137. flex-direction: column;
  138. .t-icon {
  139. width: 250rpx;
  140. height: 250rpx;
  141. margin: -250rpx 0 0 150rpx;
  142. }
  143. }
  144. }
  145. }
  146. .card-item {
  147. margin: 10rpx 0;
  148. display: flex;
  149. flex-direction: column;
  150. justify-content: space-between;
  151. background-color: #FFFFFF;
  152. box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.05);
  153. border-radius: 16rpx;
  154. width: 347rpx;
  155. height: auto;
  156. .card-info {
  157. display: flex;
  158. align-items: center;
  159. padding: 15rpx;
  160. .info-text {
  161. font-size: 30rpx;
  162. font-weight: bold;
  163. color: #3B4144;
  164. margin-left: 10rpx;
  165. }
  166. .t-icon {
  167. width: 40rpx;
  168. height: 40rpx;
  169. }
  170. }
  171. .card-content {
  172. font-size: 35rpx;
  173. margin: 10rpx 0 10rpx 25rpx;
  174. color: #3B4144;
  175. font-weight: bold;
  176. }
  177. }
  178. .module-item-text {
  179. color: #FFFFFF;
  180. font-size: 35rpx;
  181. font-weight: bold;
  182. z-index: 1;
  183. }
  184. .num-box {
  185. margin: 30rpx 0 0 20rpx;
  186. display: flex;
  187. align-items: flex-end;
  188. .module-item-num {
  189. color: #FFFFFF;
  190. font-size: 70rpx;
  191. font-weight: bold;
  192. z-index: 1;
  193. }
  194. .unit {
  195. margin-bottom: 15rpx;
  196. margin-left: 20rpx;
  197. color: #FFFFFF;
  198. font-size: 35rpx;
  199. font-weight: bold;
  200. z-index: 1;
  201. }
  202. }
  203. </style>