home.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <!-- 教育考试首页 -->
  2. <template>
  3. <view class="safetyEducationExamination-home">
  4. <view class="safetyEducationExamination-home-page">
  5. <workbench class="safetyEducationExamination-content" v-show="currentTab == 1"></workbench>
  6. <learning class="safetyEducationExamination-content" v-show="currentTab == 2"></learning>
  7. <online-exams class="safetyEducationExamination-content" v-show="currentTab == 3"></online-exams>
  8. <practice class="safetyEducationExamination-content" v-show="currentTab == 4"></practice>
  9. </view>
  10. <tab-bar></tab-bar>
  11. </view>
  12. </template>
  13. <script>
  14. import {
  15. systemMineUserEdit
  16. } from '@/pages_safetyEducationExamination/api/index.js'
  17. import {
  18. workbench
  19. } from '@/pages_safetyEducationExamination/component/workbench/index'
  20. import {
  21. learning
  22. } from '@/pages_safetyEducationExamination/component/learning/index'
  23. import {
  24. onlineExams
  25. } from '@/pages_safetyEducationExamination/component/onlineExams/index'
  26. import {
  27. practice
  28. } from '@/pages_safetyEducationExamination/component/practice/index'
  29. import {
  30. tabBar
  31. } from '@/pages_safetyEducationExamination/component/tabBar'
  32. export default {
  33. components: {
  34. workbench,
  35. learning,
  36. onlineExams,
  37. practice,
  38. tabBar,
  39. },
  40. data() {
  41. return {
  42. currentTab: 1 ,
  43. tabTitles: {
  44. 1: { title: '安全教育考试', bgColor: '#1857d4', frontColor: '#ffffff' },
  45. 2: { title: '学习培训', bgColor: '#10a37f', frontColor: '#ffffff' },
  46. 3: { title: '在线考试', bgColor: '#e67e22', frontColor: '#ffffff' },
  47. 4: { title: '刷题练习', bgColor: '#ffffff', frontColor: '#000000' }
  48. }
  49. }
  50. },
  51. created() {
  52. uni.$on('update-tab-bar', (type) => {
  53. this.currentTab = type;
  54. const style = this.tabTitles[type];
  55. uni.setNavigationBarTitle({
  56. title: style.title
  57. });
  58. uni.setNavigationBarColor({
  59. frontColor: style.frontColor, // 仅支持 #ffffff 和 #000000
  60. backgroundColor: style.bgColor, // 必须是十六进制颜色
  61. animation: {
  62. duration: 200, // 设置 200ms 的过渡动画,体验更丝滑
  63. timingFunc: 'easeIn'
  64. }
  65. });
  66. });
  67. },
  68. onShow() {
  69. uni.$emit('update-tab-bar', this.currentTab);
  70. },
  71. methods: {
  72. },
  73. beforeDestroy() {
  74. uni.$off('update-tab-bar');
  75. }
  76. }
  77. </script>
  78. <style lang="stylus" scoped>
  79. .safetyEducationExamination-home {
  80. height: 100%;
  81. display: flex;
  82. flex-direction: column;
  83. overflow: hidden;
  84. background-color: #f0f4fb;
  85. .safetyEducationExamination-home-page{
  86. flex:1;
  87. display: flex;
  88. flex-direction: column;
  89. overflow: hidden;
  90. .safetyEducationExamination-content{
  91. flex:1;
  92. display: flex;
  93. flex-direction: column;
  94. overflow: hidden;
  95. }
  96. }
  97. }
  98. </style>