home.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view class="home-container">
  3. <!-- 头部区域 -->
  4. <top-box v-bind:timeStamp="timeStamp"></top-box>
  5. <!-- 滚动条 -->
  6. <view class="notice">
  7. <u-notice-bar :text="myData.msgList[0]" mode="closable" bgColor="#6495ED" color="#FFFFFF"></u-notice-bar>
  8. </view>
  9. <!-- 卡片区域 -->
  10. <view class="card-box">
  11. <!-- 今日打卡 -->
  12. <view class="card-item" style="width: 100%;">
  13. <view class="card-info">
  14. <view class="t-icon t-icon-xueshengdaka"></view>
  15. <text class="info-text">今日打卡情况(今日迟到情况)</text>
  16. </view>
  17. <!-- 内容 -->
  18. <view class="calendar_container">
  19. <zsyCalendar :sundayIndex="6" @change="chooseCalendar" :mode="'close'" />
  20. </view>
  21. </view>
  22. <view class="card-item">
  23. <view class="card-info">
  24. <view class="t-icon t-icon-chengjiguanli"></view>
  25. <text class="info-text">今日评测</text>
  26. </view>
  27. <view class="charts-box">
  28. <qiun-data-charts type="arcbar" :chartData="todayData.evaluationArcbar" :loadingType="4"
  29. :canvas2d='true' canvasId='canvans931' :opts="evaluationOpts" />
  30. </view>
  31. </view>
  32. <view class="card-item">
  33. <view class="card-info">
  34. <view class="t-icon t-icon-xuexiaobaobei"></view>
  35. <text class="info-text">今日作业</text>
  36. </view>
  37. <view class="charts-box">
  38. <qiun-data-charts type="arcbar" :chartData="todayData.homeworkArcbar" :loadingType="4"
  39. :canvas2d='true' canvasId='canvans932' :opts="homeworkOpts" />
  40. </view>
  41. </view>
  42. <!-- 今日课程 -->
  43. <view class="card-item">
  44. <view class="card-info">
  45. <view class="t-icon t-icon-jiaowuxunke"></view>
  46. <text class="info-text">今日课程</text>
  47. </view>
  48. <!-- 内容 -->
  49. <view style="display: flex; align-items: center;">
  50. <view style="color: #3B4144;margin-left: 30rpx;font-size: 30rpx;font-weight: bold;">个人课程数:</view>
  51. <view class="card-content">{{classNum}}</view>
  52. </view>
  53. <view class="u-page__item">
  54. <u-collapse accordion :border="false">
  55. <u-collapse-item title="孩子今日课程:">
  56. <view style="display: flex; flex-wrap: wrap;">
  57. <u-tag v-for="(item,index) in classList" :key="index" :text="item" plain shape="circle"
  58. size="mini"></u-tag>
  59. </view>
  60. </u-collapse-item>
  61. <u-collapse-item title="今日授课老师:">
  62. <view style="display: flex; flex-wrap: wrap;">
  63. <u-tag v-for="(item,index) in teacherList" :key="index" :text="item" plain
  64. shape="circle" size="mini"></u-tag>
  65. </view>
  66. </u-collapse-item>
  67. </u-collapse>
  68. </view>
  69. </view>
  70. <!-- 今日问卷 -->
  71. <view class="card-item">
  72. <view class="card-info">
  73. <view class="t-icon t-icon-qingjiatiaoke"></view>
  74. <text class="info-text">今日活动</text>
  75. </view>
  76. <!-- 内容 -->
  77. <view style="display: flex; align-items: center;">
  78. <view style="color: #3B4144;margin-left: 30rpx;font-size: 30rpx;font-weight: bold;">问卷完成率:</view>
  79. <view class="card-content">{{questionnaire}}%</view>
  80. </view>
  81. <view style="padding: 0rpx 20rpx 10rpx 20rpx;">
  82. <u-line-progress :showText="false" :percentage="questionnaire" activeColor="#6495ed" height="15">
  83. </u-line-progress>
  84. </view>
  85. <!-- 内容 -->
  86. <view style="display: flex; align-items: center;">
  87. <view style="color: #3B4144;margin-left: 30rpx;font-size: 30rpx;font-weight: bold;">投票完成率:</view>
  88. <view class="card-content">{{vote}}%</view>
  89. </view>
  90. <view style="padding: 0rpx 20rpx 10rpx 20rpx;">
  91. <u-line-progress :showText="false" :percentage="vote" activeColor="#fd7193" height="15">
  92. </u-line-progress>
  93. </view>
  94. </view>
  95. <view class="card-item" style="width: 100%;">
  96. <view class="card-info">
  97. <view class="t-icon t-icon-jiaoshidaka"></view>
  98. <text class="info-text">孩子学习记录</text>
  99. </view>
  100. <view style="width: 100%; height: 500rpx; margin-top: -30rpx;">
  101. <qiun-data-charts type="column" :chartData="todayData.studyColumn" :loadingType="4" :canvas2d='true'
  102. canvasId='canvans912' :opts="{dataLabel:false, extra:{column: {barBorderCircle:true}}}" />
  103. </view>
  104. </view>
  105. <view class="card-item">
  106. <view class="card-info">
  107. <view class="t-icon t-icon-jiankangshangbao"></view>
  108. <text class="info-text">运动记录</text>
  109. </view>
  110. <view style="width: 100%; height: 350rpx; margin-top: -10rpx;">
  111. <qiun-data-charts type="pie" :chartData="todayData.exercisePie" :loadingType="4" :canvas2d='true'
  112. canvasId='canvans8121' />
  113. </view>
  114. </view>
  115. <view class="card-item">
  116. <view class="card-info">
  117. <view class="t-icon t-icon-jiankangshangbao"></view>
  118. <text class="info-text">睡眠记录</text>
  119. </view>
  120. <view style="width: 100%; height: 350rpx; margin-top: -10rpx;">
  121. <qiun-data-charts type="ring" :chartData="todayData.sleepRing" :loadingType="4"
  122. :canvas2d='true' canvasId='canvans9122' :tooltipFormat='yAxisDemo1' />
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. </template>
  128. <script>
  129. import {
  130. mapState
  131. } from 'vuex'
  132. //日历组件
  133. import zsyCalendar from '@/components/zsy-calendar/zsy-calendar'
  134. export default {
  135. name: 'Calendar',
  136. computed: {
  137. ...mapState('m_chart', ['todayData']),
  138. ...mapState('m_children', ['childreninfo']),
  139. ...mapState('m_parent', ['myData'])
  140. },
  141. components: {
  142. zsyCalendar
  143. },
  144. data() {
  145. return {
  146. //今日课堂数
  147. classNum: 5,
  148. //今日课程
  149. classList: ['数学', '语文', '英语', '体育', '思品'],
  150. //授课老师
  151. teacherList: ['张老师', '李老师', '王老师', '陈老师', '黄老师'],
  152. //评测进度条属性
  153. evaluationOpts: {},
  154. //作业进度条属性
  155. homeworkOpts: {},
  156. //时间戳
  157. timeStamp: '',
  158. //问卷完成率
  159. questionnaire: 56,
  160. //投票完成率
  161. vote: 100,
  162. }
  163. },
  164. onLoad() {
  165. this.setOpts()
  166. this.getTimeStamp()
  167. },
  168. onPullDownRefresh() {
  169. this.setOpts()
  170. this.getTimeStamp()
  171. console.log('refresh')
  172. setTimeout(function() {
  173. uni.stopPullDownRefresh()
  174. }, 1000);
  175. },
  176. methods: {
  177. //设置更新
  178. setOpts() {
  179. //圆环图标题和副标题动态变化
  180. let evaluation = {
  181. title: {
  182. name: this.todayData.evaluationArcbar.series[0].data * 100 + "%",
  183. color: this.todayData.evaluationArcbar.series[0].color
  184. },
  185. subtitle: {
  186. name: this.todayData.evaluationArcbar.series[0].name
  187. },
  188. extra: {
  189. arcbar: {
  190. type: 'circle'
  191. }
  192. }
  193. }
  194. let homework = {
  195. title: {
  196. name: this.todayData.homeworkArcbar.series[0].data * 100 + "%",
  197. color: this.todayData.homeworkArcbar.series[0].color
  198. },
  199. subtitle: {
  200. name: this.todayData.homeworkArcbar.series[0].name
  201. },
  202. extra: {
  203. arcbar: {
  204. type: 'circle'
  205. }
  206. }
  207. }
  208. this.evaluationOpts = evaluation;
  209. this.homeworkOpts = homework;
  210. },
  211. // 日历选中日期改变事件回调
  212. chooseCalendar(e) {
  213. console.log(e)
  214. },
  215. //更新时间戳
  216. getTimeStamp() {
  217. var date = new Date(),
  218. hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
  219. minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  220. this.timeStamp = (hour + ':' + minute).toString();
  221. }
  222. },
  223. }
  224. </script>
  225. <style lang="scss">
  226. .home-container {
  227. width: 100%;
  228. height: 100%;
  229. overflow-x: hidden; //隐藏多余的页面
  230. .notice {
  231. margin: -50rpx 20rpx 20rpx 20rpx;
  232. }
  233. .card-box {
  234. display: flex;
  235. flex-direction: row;
  236. flex-wrap: wrap;
  237. margin: 0 20rpx 0 20rpx;
  238. justify-content: space-between;
  239. .card-item {
  240. margin: 10rpx 0;
  241. display: flex;
  242. flex-direction: column;
  243. justify-content: space-between;
  244. background-color: #FFFFFF;
  245. box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.05);
  246. border-radius: 16rpx;
  247. width: 347rpx;
  248. height: auto;
  249. .card-info {
  250. display: flex;
  251. align-items: center;
  252. padding: 15rpx;
  253. .info-text {
  254. font-size: 30rpx;
  255. font-weight: bold;
  256. color: #3B4144;
  257. margin-left: 10rpx;
  258. }
  259. }
  260. .card-content {
  261. font-size: 35rpx;
  262. margin: 10rpx 0 10rpx 25rpx;
  263. color: #3B4144;
  264. font-weight: bold;
  265. }
  266. }
  267. }
  268. }
  269. .charts-box {
  270. width: 100%;
  271. height: 300rpx;
  272. padding-bottom: 20rpx;
  273. }
  274. .t-icon {
  275. width: 40rpx;
  276. height: 40rpx;
  277. }
  278. //日历
  279. .calendar_container {
  280. background-color: #FFFFFF;
  281. padding: 10rpx;
  282. margin: 10rpx;
  283. box-sizing: border-box;
  284. }
  285. </style>