todaydata-box.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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="{color: '#b0b0b1',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-shizhong-copy2-copy"></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-shizhong-copy3-copy"></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-shizhong-copy4-copy"></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-shizhong-copy1-copy"></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. .module-container {
  119. display: flex;
  120. flex-direction: column;
  121. }
  122. .module-box {
  123. display: flex;
  124. flex-direction: row;
  125. flex-wrap: wrap;
  126. justify-content: space-between;
  127. .module-item {
  128. margin: 10rpx 0;
  129. display: flex;
  130. flex-direction: column;
  131. justify-content: space-between;
  132. background-color: #FFFFFF;
  133. box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.05);
  134. border-radius: 16rpx;
  135. width: 347rpx;
  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. .card-item {
  153. margin: 10rpx 0;
  154. display: flex;
  155. flex-direction: column;
  156. justify-content: space-between;
  157. background-color: #FFFFFF;
  158. box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.05);
  159. border-radius: 16rpx;
  160. width: 347rpx;
  161. height: auto;
  162. .card-info {
  163. display: flex;
  164. align-items: center;
  165. padding: 15rpx;
  166. .info-text {
  167. font-size: 30rpx;
  168. font-weight: bold;
  169. color: #3B4144;
  170. margin-left: 10rpx;
  171. }
  172. .t-icon {
  173. width: 40rpx;
  174. height: 40rpx;
  175. }
  176. }
  177. .card-content {
  178. font-size: 35rpx;
  179. margin: 10rpx 0 10rpx 25rpx;
  180. color: #3B4144;
  181. font-weight: bold;
  182. }
  183. }
  184. .module-item-text {
  185. color: #FFFFFF;
  186. font-size: 35rpx;
  187. font-weight: bold;
  188. z-index: 1;
  189. }
  190. .num-box {
  191. margin: 30rpx 0 0 20rpx;
  192. display: flex;
  193. align-items: flex-end;
  194. .module-item-num {
  195. color: #FFFFFF;
  196. font-size: 70rpx;
  197. font-weight: bold;
  198. z-index: 1;
  199. }
  200. .unit {
  201. margin-bottom: 15rpx;
  202. margin-left: 20rpx;
  203. color: #f5f5f5;
  204. font-size: 35rpx;
  205. font-weight: bold;
  206. z-index: 1;
  207. }
  208. }
  209. </style>