home.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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="home-card">
  17. <text class="card-title">文本卡片</text>
  18. <text class="card-content">这里是卡片的内容,显示重要通知等等消息</text>
  19. </view>
  20. <!-- 数据展示 -->
  21. <view class="chart-card">
  22. <line-chart class="home-line-chart"></line-chart>
  23. </view>
  24. <view class="chart-card">
  25. <wyb-table ref="table" :headers="headers" :contents="contents" height="600rpx" :urlCol="urlCol"></wyb-table>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. const theUrl = '/pages/demos/noticeBar-demo/more' // 本地的某个页面
  34. const httpUrl = 'https://ext.dcloud.net.cn/plugin?id=2667' // 某个网址
  35. return {
  36. active: 0,
  37. stepsValue: [{
  38. title: '开学时间',
  39. desc: '2011-11-11'
  40. }, {
  41. title: '开学考试',
  42. desc: '2018-11-12'
  43. }, {
  44. title: '期中考试',
  45. desc: '2028-11-13'
  46. }, {
  47. title: '期末考试',
  48. desc: '2023-11-14'
  49. }],
  50. headers: [{
  51. label: '姓名',
  52. key: 'name'
  53. }, {
  54. label: '年龄',
  55. key: 'age'
  56. }, {
  57. label: '学院',
  58. key: 'collage'
  59. }, {
  60. label: '成绩',
  61. key: 'score'
  62. }, {
  63. label: '路由',
  64. key: 'url'
  65. }, {
  66. label: '网址',
  67. key: 'link'
  68. }],
  69. contents: [{
  70. name: '刘一',
  71. age: '',
  72. collage: '信息学院',
  73. score: '99',
  74. url: ['查看更多', theUrl],
  75. link: ''
  76. }, {
  77. name: '陈二',
  78. age: '18',
  79. collage: '商学院',
  80. score: '98',
  81. url: ['我带参数', theUrl, {
  82. name: '陈二'
  83. }],
  84. link: ''
  85. }, {
  86. name: '张三',
  87. age: '22',
  88. collage: '统计与数学学院',
  89. score: '97',
  90. url: ['查看更多', theUrl],
  91. link: ''
  92. }, {
  93. name: '李四',
  94. age: '19',
  95. collage: '城市与环境学院',
  96. score: '96',
  97. url: '',
  98. link: ['访问网址', httpUrl]
  99. }, {
  100. name: '王五',
  101. age: '20',
  102. collage: '旅游与酒店管理学院',
  103. score: '95',
  104. url: ['查看更多', theUrl],
  105. link: ''
  106. }, {
  107. name: '赵六 ',
  108. age: '20',
  109. collage: '',
  110. score: '88',
  111. url: ['查看更多', theUrl],
  112. link: ''
  113. }, {
  114. name: '孙七',
  115. age: '21',
  116. collage: '',
  117. score: '95',
  118. url: '',
  119. link: ['访问网址', httpUrl]
  120. }, {
  121. name: '周八 ',
  122. age: '21',
  123. collage: '会计学院',
  124. score: '85',
  125. url: ['查看更多', theUrl],
  126. link: ''
  127. }, {
  128. name: '吴九 ',
  129. age: '20',
  130. collage: '',
  131. score: '91',
  132. url: ['查看更多', theUrl],
  133. link: ''
  134. }, {
  135. name: '郑十',
  136. age: '19',
  137. collage: '',
  138. score: '95',
  139. url: '',
  140. link: ['访问网址', httpUrl]
  141. }],
  142. urlCol: [{
  143. type: 'route',
  144. key: 'url'
  145. }, {
  146. type: 'http',
  147. key: 'link'
  148. }]
  149. }
  150. },
  151. onLoad() {
  152. this.updateSteps();
  153. },
  154. methods: {
  155. //更新时间表
  156. updateSteps() {
  157. let aData = new Date();
  158. let Today = aData.getFullYear() + "-" + (aData.getMonth() + 1) + "-" + aData.getDate();
  159. for (let i = 0; i < this.stepsValue.length; i++) {
  160. let timeNow = new Date(Today).getTime();
  161. let time = new Date(this.stepsValue[this.active].desc).getTime();
  162. let time2 = new Date(this.stepsValue[this.active + 1].desc).getTime();
  163. if (timeNow > time && timeNow > time2) {
  164. this.active += 1;
  165. }
  166. }
  167. }
  168. },
  169. }
  170. </script>
  171. <style lang="scss">
  172. .home-container {
  173. height: 100%;
  174. .home-topinfo {
  175. height: 400rpx;
  176. background: linear-gradient(#0080ff, #fafafa);
  177. display: flex;
  178. justify-content: flex-start;
  179. align-items: center;
  180. .children-avatar {
  181. margin-top: 10px;
  182. margin-left: 20px;
  183. width: 48px;
  184. height: 48px;
  185. border-radius: 25px;
  186. border: 1px solid #FFFFFF;
  187. box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
  188. }
  189. .children-name {
  190. margin-top: 12px;
  191. margin-left: 10px;
  192. display: flex;
  193. flex-direction: column;
  194. .name {
  195. color: #6b778d;
  196. font-size: 13px;
  197. margin: 2px 0px 0px 5px;
  198. }
  199. .detail {
  200. color: #3B4144;
  201. font-weight: bold;
  202. margin: 5px 0px 0px 5px;
  203. }
  204. }
  205. }
  206. .steps-box {
  207. margin: -45px 17px 17px 17px;
  208. }
  209. .home-card {
  210. margin: 10px 17px 17px 17px;
  211. background-color: #FFFFFF;
  212. overflow: hidden;
  213. text-overflow: ellipsis;
  214. flex: 1 1 auto;
  215. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  216. display: flex;
  217. flex-direction: column;
  218. border-radius: 10px;
  219. padding: 3px;
  220. .card-title {
  221. font-size: 15px;
  222. margin: 10px;
  223. }
  224. .card-content {
  225. font-size: 12px;
  226. margin: 0px 10px 10px 10px;
  227. }
  228. }
  229. .chart-card {
  230. margin: 0 7px 7px 7px;
  231. .home-line-chart {
  232. margin-top: 45px
  233. }
  234. }
  235. }
  236. </style>