江西小程序管理端
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.

154 lines
4.7 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="tab-bar">
  3. <view v-for="(item,index) in list" :key="index" class="tab-bar-item" @click="switchTab(item, index)">
  4. <image class="tab_img" :src="name == item.text ? item.selectedIconPath : item.iconPath"></image>
  5. <view class="tab_text" :style="{color: name == item.text ? selectedColor : color}">{{item.text}}</view>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. props: {
  12. name: { // 当前选中的tab index
  13. default: 0
  14. },
  15. },
  16. data() {
  17. return {
  18. color: "#999",
  19. selectedColor: "#218DFF",
  20. list: [],
  21. currentIndex:0,
  22. }
  23. },
  24. created() {
  25. this.currentName = this.name;
  26. var _this = this
  27. if (uni.getStorageSync('identity') == '实操教练') {
  28. //教练
  29. _this.list = [{
  30. "pagePath": "/pages/tabbar/statistics/index",
  31. "text": "统计",
  32. "iconPath": require("../../static/images/tabbar/tj.png"),
  33. "selectedIconPath": require("../../static/images/tabbar/tjActive.png")
  34. },
  35. {
  36. "pagePath": "/pages/tabbar/examSimulation/index",
  37. "text": "考场模拟",
  38. "iconPath": require("../../static/images/tabbar/kc.png"),
  39. "selectedIconPath": require("../../static/images/tabbar/kcActive.png")
  40. },
  41. {
  42. "pagePath": "/pages/tabbar/operateTrain/index",
  43. "text": "实操训练",
  44. "iconPath": require("../../static/images/tabbar/sc.png"),
  45. "selectedIconPath": require("../../static/images/tabbar/scActive.png")
  46. },
  47. {
  48. "pagePath": "/pages/tabbar/student/index",
  49. "text": "学员",
  50. "iconPath": require("../../static/images/tabbar/xy.png"),
  51. "selectedIconPath": require("../../static/images/tabbar/xyActive.png")
  52. },
  53. {
  54. "pagePath": "/pages/tabbar/mine/index",
  55. "text": "我的",
  56. "iconPath": require("../../static/images/tabbar/wd.png"),
  57. "selectedIconPath": require("../../static/images/tabbar/wdActive.png")
  58. }
  59. ]
  60. } else if(uni.getStorageSync('identity') == '校长') {
  61. //校长
  62. _this.list = [{
  63. "pagePath": "/pages/tabbar/statistics/index",
  64. "text": "统计",
  65. "iconPath": require("../../static/images/tabbar/tj.png"),
  66. "selectedIconPath": require("../../static/images/tabbar/tjActive.png")
  67. },
  68. {
  69. "pagePath": "/pages/tabbar/student/index",
  70. "text": "学员",
  71. "iconPath": require("../../static/images/tabbar/xy.png"),
  72. "selectedIconPath": require("../../static/images/tabbar/xyActive.png")
  73. },
  74. {
  75. "pagePath": "/pages/tabbar/mine/index",
  76. "text": "我的",
  77. "iconPath": require("../../static/images/tabbar/wd.png"),
  78. "selectedIconPath": require("../../static/images/tabbar/wdActive.png")
  79. }
  80. ]
  81. }else if(uni.getStorageSync('identity') == '考场模拟教练'){
  82. _this.list = [{
  83. "pagePath": "/pages/tabbar/statistics/index",
  84. "text": "统计",
  85. "iconPath": require("../../static/images/tabbar/tj.png"),
  86. "selectedIconPath": require("../../static/images/tabbar/tjActive.png")
  87. },
  88. {
  89. "pagePath": "/pages/tabbar/examSimulation/index",
  90. "text": "预约记录",
  91. "iconPath": require("../../static/images/tabbar/kc.png"),
  92. "selectedIconPath": require("../../static/images/tabbar/kcActive.png")
  93. },
  94. {
  95. "pagePath": "/pages/tabbar/mine/index",
  96. "text": "我的",
  97. "iconPath": require("../../static/images/tabbar/wd.png"),
  98. "selectedIconPath": require("../../static/images/tabbar/wdActive.png")
  99. }]
  100. }else {
  101. // 模拟器老师
  102. }
  103. },
  104. methods: {
  105. switchTab(item, index) {
  106. this.currentName = item.text;
  107. let url = item.pagePath;
  108. console.log(url)
  109. uni.switchTab({
  110. url
  111. })
  112. // uni.reLaunch({url:url})
  113. }
  114. }
  115. }
  116. </script>
  117. <style lang="scss">
  118. .tab-bar {
  119. position: fixed;
  120. bottom: 0;
  121. left: 0;
  122. right: 0;
  123. height: 100rpx;
  124. background: white;
  125. display: flex;
  126. justify-content: center;
  127. align-items: center;
  128. padding-bottom: env(safe-area-inset-bottom); // 适配iphoneX的底部
  129. .tab-bar-item {
  130. flex: 1;
  131. text-align: center;
  132. display: flex;
  133. justify-content: center;
  134. align-items: center;
  135. flex-direction: column;
  136. .tab_img {
  137. width: 48rpx;
  138. height: 48rpx;
  139. }
  140. .tab_text {
  141. font-size: 24rpx;
  142. margin-top: 4rpx;
  143. }
  144. }
  145. }
  146. </style>