todaydata-box.vue 4.8 KB

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