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

155 lines
4.8 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. <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. // {
  31. // "pagePath": "/pages/tabbar/statistics/index",
  32. // "text": "统计",
  33. // "iconPath": require("../../static/images/tabbar/tj.png"),
  34. // "selectedIconPath": require("../../static/images/tabbar/tjActive.png")
  35. // },
  36. // {
  37. // "pagePath": "/pages/tabbar/examSimulation/index",
  38. // "text": "考场模拟",
  39. // "iconPath": require("../../static/images/tabbar/kc.png"),
  40. // "selectedIconPath": require("../../static/images/tabbar/kcActive.png")
  41. // },
  42. {
  43. "pagePath": "/pages/tabbar/student/index",
  44. "text": "学员",
  45. "iconPath": require("../../static/images/tabbar/xy.png"),
  46. "selectedIconPath": require("../../static/images/tabbar/xyActive.png")
  47. },
  48. {
  49. "pagePath": "/pages/tabbar/operateTrain/index",
  50. "text": "实操训练",
  51. "iconPath": require("../../static/images/tabbar/sc.png"),
  52. "selectedIconPath": require("../../static/images/tabbar/scActive.png")
  53. },
  54. {
  55. "pagePath": "/pages/tabbar/mine/index",
  56. "text": "我的",
  57. "iconPath": require("../../static/images/tabbar/wd.png"),
  58. "selectedIconPath": require("../../static/images/tabbar/wdActive.png")
  59. }
  60. ]
  61. } else if(uni.getStorageSync('identity') == '校长') {
  62. //校长
  63. _this.list = [{
  64. "pagePath": "/pages/tabbar/statistics/index",
  65. "text": "统计",
  66. "iconPath": require("../../static/images/tabbar/tj.png"),
  67. "selectedIconPath": require("../../static/images/tabbar/tjActive.png")
  68. },
  69. {
  70. "pagePath": "/pages/tabbar/student/index",
  71. "text": "学员",
  72. "iconPath": require("../../static/images/tabbar/xy.png"),
  73. "selectedIconPath": require("../../static/images/tabbar/xyActive.png")
  74. },
  75. {
  76. "pagePath": "/pages/tabbar/mine/index",
  77. "text": "我的",
  78. "iconPath": require("../../static/images/tabbar/wd.png"),
  79. "selectedIconPath": require("../../static/images/tabbar/wdActive.png")
  80. }
  81. ]
  82. }else if(uni.getStorageSync('identity') == '考场模拟教练'){
  83. _this.list = [{
  84. "pagePath": "/pages/tabbar/statistics/index",
  85. "text": "统计",
  86. "iconPath": require("../../static/images/tabbar/tj.png"),
  87. "selectedIconPath": require("../../static/images/tabbar/tjActive.png")
  88. },
  89. {
  90. "pagePath": "/pages/tabbar/examSimulation/index",
  91. "text": "预约记录",
  92. "iconPath": require("../../static/images/tabbar/kc.png"),
  93. "selectedIconPath": require("../../static/images/tabbar/kcActive.png")
  94. },
  95. {
  96. "pagePath": "/pages/tabbar/mine/index",
  97. "text": "我的",
  98. "iconPath": require("../../static/images/tabbar/wd.png"),
  99. "selectedIconPath": require("../../static/images/tabbar/wdActive.png")
  100. }]
  101. }else {
  102. // 模拟器老师
  103. }
  104. },
  105. methods: {
  106. switchTab(item, index) {
  107. this.currentName = item.text;
  108. let url = item.pagePath;
  109. console.log(url)
  110. uni.switchTab({
  111. url
  112. })
  113. // uni.reLaunch({url:url})
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss">
  119. .tab-bar {
  120. position: fixed;
  121. bottom: 0;
  122. left: 0;
  123. right: 0;
  124. height: 100rpx;
  125. background: white;
  126. display: flex;
  127. justify-content: center;
  128. align-items: center;
  129. padding-bottom: env(safe-area-inset-bottom); // 适配iphoneX的底部
  130. .tab-bar-item {
  131. flex: 1;
  132. text-align: center;
  133. display: flex;
  134. justify-content: center;
  135. align-items: center;
  136. flex-direction: column;
  137. .tab_img {
  138. width: 48rpx;
  139. height: 48rpx;
  140. }
  141. .tab_text {
  142. font-size: 24rpx;
  143. margin-top: 4rpx;
  144. }
  145. }
  146. }
  147. </style>