index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <view class="content">
  3. <u-navbar back-icon-size="0" title="星火纵横" :title-color="mainColor" title-bold></u-navbar>
  4. <u-card :head-border-bottom="false" :foot-border-top="false" padding="0px" margin="10px" borderRadius="40" v-for="(item, index) in cardList"
  5. :key="index" class="card-box" @click="goToHandle(item)">
  6. <view class="card-content" slot="body">
  7. <view class="iconfont" :class="item.icon"></view>
  8. <view class="card-label">{{item.label}}</view>
  9. <view class="iconfont iconjinru"></view>
  10. </view>
  11. </u-card>
  12. <u-top-tips ref="uTips"></u-top-tips>
  13. </view>
  14. </template>
  15. <script>
  16. import {
  17. mapGetters
  18. } from 'vuex'
  19. const NET = require('@/utils/request')
  20. const API = require('@/config/api')
  21. export default {
  22. computed: {
  23. ...mapGetters([
  24. 'mainColor',
  25. ])
  26. },
  27. data() {
  28. return {
  29. cardList: [{
  30. icon: 'iconzu4931',
  31. label: '我的补课',
  32. path: 'extraLessonsForm'
  33. },
  34. {
  35. icon: 'iconwodebanji',
  36. label: '我的班级',
  37. path: 'classList'
  38. },
  39. {
  40. icon: 'iconwodepaiban',
  41. label: '我的排班',
  42. path: 'timetable'
  43. }
  44. ]
  45. }
  46. },
  47. onLoad() {
  48. // uni.setStorage({
  49. // key: 'token',
  50. // data: 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJDT0FDSDo4OSJ9.7DPbdHQIkhpCXE2Tf6eHkdl0Y69C6kbRwntVdKm4DXu1_LlP1ue_2t4LKW0CYLm-enBRzBvIxkgvYjZSoKhqSA'
  51. // })
  52. if (!uni.getStorageSync('token')) {
  53. uni.navigateTo({
  54. url: '/pages/login/index'
  55. });
  56. }
  57. },
  58. methods: {
  59. // 跳转
  60. goToHandle(item) {
  61. uni.removeStorageSync({
  62. key: 'extraLessonsUserList'
  63. })
  64. uni.navigateTo({
  65. url: '/pagesClass/' + item.path
  66. });
  67. },
  68. },
  69. }
  70. </script>
  71. <style>
  72. page {
  73. width: 100%;
  74. height: 100%;
  75. background-color: #f7f7f7;
  76. }
  77. </style>
  78. <style lang="scss" scoped>
  79. @import "@/static/css/themes.scss";
  80. .content {
  81. width: 100%;
  82. float: left;
  83. /deep/.u-navbar {
  84. .u-title {
  85. font-weight: bold;
  86. }
  87. }
  88. .card-box {
  89. .card-content {
  90. padding: 20px 15px;
  91. display: flex;
  92. align-items: center;
  93. .iconfont {
  94. width: 40px;
  95. height: 40px;
  96. font-size: 32px;
  97. color: $mainColor;
  98. display: flex;
  99. align-items: center;
  100. }
  101. .card-label {
  102. font-size: 16px;
  103. font-weight: bold;
  104. flex: 1;
  105. margin-left: 10px;
  106. }
  107. .iconjinru {
  108. font-size: 22px;
  109. justify-content: flex-end;
  110. }
  111. }
  112. }
  113. }
  114. </style>