tabBar.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <!-- 教育考试tab导航 -->
  2. <template>
  3. <view class="safetyEducationExamination-tab-bar">
  4. <view class="flex-full-p"></view>
  5. <view class="button-box" @click="checkButton(1)">
  6. <span class="tab-icon">🏠</span>
  7. <view :class="checkButtonType == 1?'check-p':''">工作台</view>
  8. </view>
  9. <view class="flex-full-p"></view>
  10. <view class="button-box" @click="checkButton(2)">
  11. <span class="tab-icon">📚</span>
  12. <view :class="checkButtonType == 2?'check-p':''">学习培训</view>
  13. </view>
  14. <view class="flex-full-p"></view>
  15. <view class="button-box" @click="checkButton(3)">
  16. <span class="tab-icon">🎓</span>
  17. <view :class="checkButtonType == 3?'check-p':''">在线考试</view>
  18. </view>
  19. <view class="flex-full-p"></view>
  20. <view class="button-box" @click="checkButton(4)">
  21. <span class="tab-icon">✏️</span>
  22. <view :class="checkButtonType == 4?'check-p':''">刷题练习</view>
  23. </view>
  24. <view class="flex-full-p"></view>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. config
  30. } from '@/api/request/config.js'
  31. import {
  32. systemMineUserEdit
  33. } from '@/pages_safetyEducationExamination/api/index.js'
  34. let currentTabCache = 1;
  35. export default {
  36. data() {
  37. return {
  38. checkButtonType: currentTabCache,
  39. }
  40. },
  41. created() {
  42. uni.$on('update-tab-bar', (type) => {
  43. this.checkButtonType = type;
  44. currentTabCache = type;
  45. });
  46. },
  47. beforeDestroy() {
  48. uni.$off('update-tab-bar');
  49. },
  50. methods: {
  51. checkButton(type){
  52. if (this.checkButtonType != type) {
  53. this.checkButtonType = type;
  54. currentTabCache = type;
  55. uni.$emit('update-tab-bar', type);
  56. }
  57. },
  58. }
  59. }
  60. </script>
  61. <style lang="stylus" scoped>
  62. .safetyEducationExamination-tab-bar {
  63. // height:80rpx;
  64. display: flex;
  65. padding: 20rpx 0 30rpx;
  66. background-color: #fff;
  67. .flex-full-p {
  68. flex: 1;
  69. }
  70. .button-box {
  71. width: 140rpx;
  72. display: flex;
  73. flex-direction: column;
  74. align-items: center;
  75. view {
  76. text-align: center;
  77. margin-top:20rpx;
  78. font-size:24rpx;
  79. }
  80. .check-p{
  81. color:#1857d4;
  82. }
  83. span {
  84. display: flex;
  85. justify-content: center;
  86. align-items: center;
  87. width: 50rpx;
  88. height: 50rpx;
  89. font-size: 50rpx;
  90. --blue: #1857d4;
  91. --blue-deep: #0f3ea8;
  92. --blue-mid: #2e6fe0;
  93. --blue-light: #eef3fd;
  94. --blue-xlight: #f5f8ff;
  95. --green: #10a37f;
  96. --green-dark: #0d8f6f;
  97. --green-light: #edfaf6;
  98. --orange: #e67e22;
  99. --orange-light: #fef6ec;
  100. --red: #e53e3e;
  101. --red-light: #fff5f5;
  102. --gray: #8896a7;
  103. --gray-light: #f4f6fa;
  104. --gray-border: #dde3ed;
  105. --text-primary: #1a2233;
  106. --text-secondary: #4a5568;
  107. --text-hint: #8896a7;
  108. --bg: #f0f4fb;
  109. --white: #ffffff;
  110. --radius: 12px;
  111. --shadow: 0 2px 12px rgba(24, 87, 212, .08);
  112. --shadow-md: 0 4px 20px rgba(24, 87, 212, .12);
  113. --header-bg: linear-gradient(135deg, #1857d4 0%, #2e6fe0 100%);
  114. }
  115. }
  116. }
  117. </style>