home.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="home-container">
  3. <!-- 头部区域 -->
  4. <view class="home-topinfo">
  5. <image class="children-avatar" src="../../static/boy.png"></image>
  6. <view class="children-name">
  7. <text class="name">张小伟</text>
  8. <text class="detail">学习近况</text>
  9. </view>
  10. </view>
  11. <mainline-chart></mainline-chart>
  12. <!-- 步骤条区域 -->
  13. <!-- <view class="steps-box">
  14. <uni-steps :options="stepsValue" direction="column" :active="active"></uni-steps>
  15. </view> -->
  16. <!-- 滚动条 -->
  17. <view class="notice">
  18. <u-notice-bar :text="notification" mode="closable" bgColor="#6495ED" color="#FFFFFF"></u-notice-bar>
  19. </view>
  20. <!-- 成绩表单 -->
  21. <view class="table-card">
  22. <view class="table-name">
  23. <text class="table-name-text">成绩概览</text>
  24. </view>
  25. <z-table class="table" :tableData="tableData" :columns="columns" stickSide="true" showBottomSum="true"></z-table>
  26. </view>
  27. <!-- 卡片区域 -->
  28. <view class="home-card">
  29. <view class="card-edit">
  30. <text class="card-title">学期计划</text>
  31. <button class="card-button" @click="submitInputValue">修改计划</button>
  32. </view>
  33. <text class="card-content">{{inputvalue}}</text>
  34. <u--textarea class="card-input" autoHeight v-model="inputvalue"></u--textarea>
  35. </view>
  36. <!-- 目标图表 -->
  37. <view class="chart-card">
  38. <bar-chart class="home-bar-chart"></bar-chart>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data() {
  46. return {
  47. active: 0,
  48. notification: '这里是滚动条的内容,显示重要通知等等消息',
  49. inputvalue: '孩子学期计划',
  50. stepsValue: [{
  51. title: '开学时间',
  52. desc: '2011-11-11'
  53. }, {
  54. title: '开学考试',
  55. desc: '2018-11-12'
  56. }, {
  57. title: '期中考试',
  58. desc: '2028-11-13'
  59. }, {
  60. title: '期末考试',
  61. desc: '2023-11-14'
  62. }],
  63. tableData: [
  64. {
  65. 'name':'数学',
  66. 'open':83,
  67. 'mid':95,
  68. 'final':96
  69. },
  70. {
  71. 'name':'语文',
  72. 'open':93,
  73. 'mid':90,
  74. 'final':96
  75. },
  76. {
  77. 'name':'英语',
  78. 'open':99,
  79. 'mid':82,
  80. 'final':96
  81. },
  82. {
  83. 'name':'体育',
  84. 'open':99,
  85. 'mid':97,
  86. 'final':96
  87. },
  88. {
  89. 'name':'科学',
  90. 'open':99,
  91. 'mid':92,
  92. 'final':96
  93. },
  94. {
  95. 'name':'思品',
  96. 'open':99,
  97. 'mid':94,
  98. 'final':96
  99. }
  100. ],
  101. columns: [
  102. {
  103. 'title':'科目',
  104. 'key':'name',
  105. 'width':'120',
  106. },
  107. {
  108. 'title':'开学',
  109. 'key':'open',
  110. 'width':'140',
  111. },
  112. {
  113. 'title':'期中',
  114. 'key':'mid',
  115. 'width':'140',
  116. },
  117. {
  118. 'title':'期末',
  119. 'key':'final',
  120. 'width':'140',
  121. }
  122. ]
  123. }
  124. },
  125. onLoad() {
  126. this.updateSteps();
  127. },
  128. methods: {
  129. //更新时间表
  130. updateSteps() {
  131. let aData = new Date();
  132. let Today = aData.getFullYear() + "-" + (aData.getMonth() + 1) + "-" + aData.getDate();
  133. for (let i = 0; i < this.stepsValue.length; i++) {
  134. let timeNow = new Date(Today).getTime();
  135. let time = new Date(this.stepsValue[this.active].desc).getTime();
  136. let time2 = new Date(this.stepsValue[this.active + 1].desc).getTime();
  137. if (timeNow > time && timeNow > time2) {
  138. this.active += 1;
  139. }
  140. }
  141. },
  142. //提交计划
  143. submitInputValue(e){
  144. }
  145. },
  146. }
  147. </script>
  148. <style lang="scss">
  149. .home-container {
  150. height: 100%;
  151. .home-topinfo {
  152. height: 400rpx;
  153. background: linear-gradient(#0080ff, #f1f3f5);
  154. display: flex;
  155. justify-content: flex-start;
  156. align-items: center;
  157. .children-avatar {
  158. margin-top: 10px;
  159. margin-left: 20px;
  160. width: 48px;
  161. height: 48px;
  162. border-radius: 25px;
  163. border: 2px solid #FFFFFF;
  164. box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
  165. }
  166. .children-name {
  167. margin-top: 12px;
  168. margin-left: 10px;
  169. display: flex;
  170. flex-direction: column;
  171. .name {
  172. color: #808599;
  173. font-size: 13px;
  174. margin: 2px 0px 0px 5px;
  175. font-weight: bold;
  176. }
  177. .detail {
  178. color: #3B4144;
  179. font-weight: bold;
  180. margin: 5px 0px 0px 5px;
  181. }
  182. }
  183. }
  184. .steps-box {
  185. margin: -55px 17px 10px 17px;
  186. }
  187. .notice{
  188. margin: -5px 17px 10px 17px;
  189. }
  190. .home-card {
  191. margin: 10px 17px 17px 17px;
  192. background-color: #FFFFFF;
  193. flex: 1 1 auto;
  194. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  195. display: flex;
  196. flex-direction: column;
  197. border-radius: 10px;
  198. padding: 3px;
  199. .card-edit{
  200. width: 100%;
  201. display: flex;
  202. justify-content: space-between;
  203. .card-title {
  204. font-size: 15px;
  205. margin: 12px;
  206. font-weight: bold;
  207. color: #3B4144;
  208. }
  209. .card-button{
  210. margin: 10px;
  211. width: 80px;
  212. height: 30px;
  213. font-size: 13px;
  214. background-color: #6495ED;
  215. color: #FFFFFF;
  216. }
  217. }
  218. .card-content {
  219. table-layout: fixed;
  220. font-size: 13px;
  221. margin: 0px 12px 12px 12px;
  222. word-wrap: break-word;
  223. word-break: normal;
  224. overflow: hidden;
  225. color: #3B4144;
  226. }
  227. }
  228. .chart-card {
  229. margin: 0 7px 7px 7px;
  230. .home-bar-chart {
  231. margin-top: 45px
  232. }
  233. }
  234. .table-card{
  235. margin: 20px 17px;
  236. border-radius: 8px;
  237. display: flex;
  238. align-items: center;
  239. justify-content: center;
  240. flex-direction: column;
  241. background-color: #FFFFFF;
  242. box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  243. .table-name{
  244. width: 100%;
  245. text-align: left;
  246. margin: 10px 0 0 33px;
  247. font-weight: bold;
  248. color: #3B4144;
  249. .table-name-text {
  250. font-size: 13px;
  251. }
  252. }
  253. .table{
  254. margin: 10px;
  255. }
  256. }
  257. }
  258. </style>