home.vue 5.7 KB

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