学员端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
3.6 KiB

1 year ago
  1. <template>
  2. <view class="">
  3. <!-- 学生端 -->
  4. <u-tabbar v-if="showWho=='student'" :value="student" @change="studentChange" :fixed="true" :placeholder="true"
  5. :safeAreaInsetBottom="true" activeColor="#31aef1">
  6. <u-tabbar-item v-for="i in studentList" :key='i.id' :text="i.name" :name="i.name">
  7. <image class="u-page__item__slot-icon" slot="active-icon" :src="i.active" mode="widthFix"></image>
  8. <image class="u-page__item__slot-icon" slot="inactive-icon" :src="i.inactive" mode="widthFix"></image>
  9. </u-tabbar-item>
  10. </u-tabbar>
  11. <!-- 教师端 -->
  12. <u-tabbar :value="teacher" @change="teacherChange" :fixed="true" :placeholder="true"
  13. :safeAreaInsetBottom="true" activeColor="#31aef1">
  14. <u-tabbar-item v-for="i in teacherList" :key='i.id' :text="i.name" :name="i.name">
  15. <image class="u-page__item__slot-icon" slot="active-icon" :src="i.active" mode="widthFix"></image>
  16. <image class="u-page__item__slot-icon" slot="inactive-icon" :src="i.inactive" mode="widthFix"></image>
  17. </u-tabbar-item>
  18. </u-tabbar>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. props: ['tabNumber'],
  24. data() {
  25. return {
  26. teacher: '课堂',
  27. student: '',
  28. showWho: 'teacher',
  29. teacherList: [{
  30. id: 1,
  31. name: '课堂',
  32. active: '../../static/images/tabbar/syActive.png',
  33. inactive: '../../static/images/tabbar/sy.png'
  34. },
  35. {
  36. id: 2,
  37. name: '兴趣小组',
  38. active: '../../static/images/tabbar/tkActive.png',
  39. inactive: '../../static/images/tabbar/tk.png'
  40. },
  41. {
  42. id: 3,
  43. name: '我的',
  44. active: '../../static/images/tabbar/zxActive.png',
  45. inactive: '../../static/images/tabbar/zx.png'
  46. }
  47. ],
  48. studentList: [{
  49. id: 1,
  50. name: '学员课堂',
  51. active: '../../static/images/tabbar/syActive.png',
  52. inactive: '../../static/images/tabbar/sy.png'
  53. },
  54. {
  55. id: 2,
  56. name: '学员兴趣小组',
  57. active: '../../static/images/tabbar/tkActive.png',
  58. inactive: '../../static/images/tabbar/tk.png'
  59. },
  60. {
  61. id: 3,
  62. name: '学员我的',
  63. active: '../../static/images/tabbar/zxActive.png',
  64. inactive: '../../static/images/tabbar/zx.png'
  65. }
  66. ],
  67. }
  68. },
  69. mounted() {
  70. // if (uni.getStorageSync('status') == 'teacher') {
  71. // this.showWho = 'student'
  72. // } else {
  73. // this.showWho = 'teacher'
  74. // }
  75. this.student = this.tabNumber
  76. this.teacher = this.tabNumber
  77. },
  78. methods: {
  79. teacherChange(e) {
  80. this.teacher = e
  81. if (e == '课堂') {
  82. uni.reLaunch({
  83. url: "/pages/tabbar/index/index"
  84. })
  85. // uni.hideHomeButton() //为了防止跳转页面后,小程序右上角会出现一个回到主页的小房子
  86. } else if (e == "兴趣小组") {
  87. uni.reLaunch({
  88. url: "/pages/tabbar/question/index"
  89. })
  90. // uni.hideHomeButton()
  91. } else if (e == "我的") {
  92. uni.reLaunch({
  93. url: "/pages/tabbar/mine/index"
  94. })
  95. // uni.hideHomeButton()
  96. }
  97. },
  98. studentChange(e) {
  99. this.student = e
  100. uni.hideHomeButton()
  101. // if (e == '课堂') {
  102. // uni.reLaunch({
  103. // url: "/pages/index/CourseTeacherIndex"
  104. // })
  105. // uni.hideHomeButton() //为了防止跳转页面后,小程序右上角会出现一个回到主页的小房子
  106. // } else if (e == "兴趣小组") {
  107. // uni.reLaunch({
  108. // url: "/pages/interestGroup/interestGroup"
  109. // })
  110. // uni.hideHomeButton()
  111. // } else if (e == "我的") {
  112. // uni.reLaunch({
  113. // url: "/pages/mine/mine"
  114. // })
  115. // uni.hideHomeButton()
  116. // }
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .u-page__item__slot-icon {
  123. display: block;
  124. width: 56rpx;
  125. height: 56rpx;
  126. }
  127. </style>