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.

191 lines
5.9 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. <template>
  2. <view class="pageBgImg">
  3. <view class="status_bar"></view>
  4. <view class="" style="height: 88rpx;"></view>
  5. <view class="card">
  6. <view class="cut_row" @click.stop="showRole=true" v-if="list.length>1">
  7. <view class="flex-b">
  8. <view class="cut_icon">
  9. <image src="@/static/images/userCenter/cut.png" mode=""></image>
  10. </view>
  11. <view class="cut_text">切换身份</view>
  12. </view>
  13. </view>
  14. <view class="qcode" @click="$goPage('/pages/userCenter/scanCode/scanCode')" >
  15. <image src="@/static/images/coach/ic_erweima.png" mode=""></image>
  16. </view>
  17. <user-info/>
  18. </view>
  19. <view class="card" style="padding: 35rpx 0 0 0;">
  20. <view class="ul">
  21. <view class="li" v-for="(item,index) in tabData" :key="index" @click="goPage(item)">
  22. <view class="icon">
  23. <image :src="item.icon" mode=""></image>
  24. </view>
  25. <view class="text">{{ item.text }}</view>
  26. </view>
  27. </view>
  28. </view>
  29. <u-action-sheet :actions="list" title="请选择您要登录的角色" :show="showRole" @select="selectClick" @close="showRole=false" ></u-action-sheet>
  30. <UserTab name ='我的'></UserTab>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. tabData: [],
  38. list: [],
  39. showRole: false
  40. }
  41. },
  42. onLoad() {
  43. // this.$store.dispatch('refreshToken')
  44. this.initMenu()
  45. this.roleListFn()
  46. },
  47. onShow() {
  48. uni.hideTabBar();
  49. // this.getIpAddress()
  50. },
  51. methods: {
  52. goPage(item) {
  53. // if(item.text=='结算统计') {
  54. // uni.switchTab({
  55. // url: item.url
  56. // })
  57. // }
  58. this.$goPage(item.url)
  59. },
  60. initMenu() {
  61. if(this.identity=='实操教练') {
  62. this.tabData = [
  63. {text: '今日预约', icon: require('../../../static/images/coach/ic_zhibiao.png'), id: 2, url: '/pages/recordEntry/operate/todayStudent/todayStudent'},
  64. {text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
  65. // {text: '考场信息', icon: require('../../../static/images/coach/ic_changdi.png'), id: 4, url: '/pages/userCenter/examinInfo/examinInfo'},
  66. {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
  67. {text: '教学数据', icon: require('../../../static/images/coach/ic_shuju.png'), id: 6, url: '/pages/userCenter/teachingData/teachingData'},
  68. {text: '结算统计', icon: require('../../../static/images/coach/ic_daijiesuan.png'), id: 1, url: '/pages/tabbar/statistics/index'},
  69. // {text: '学员退款', icon: require('../../../static/images/coach/ic_tuikuan.png'), id: 7, url: '/pages/userCenter/refund/refund'},
  70. ]
  71. }else if(this.identity=='校长'||this.identity=='驾校财务') {
  72. this.tabData = [
  73. {text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
  74. {text: '驾校场地', icon: require('../../../static/images/coach/site.png'), id: 7, url: '/pages/userCenter/schoolSite/schoolSite'},
  75. {text: '驾校教练', icon: require('../../../static/images/coach/coach.png'), id: 7, url: '/pages/userCenter/schoolCoach/schoolCoach'},
  76. {text: '教学数据', icon: require('../../../static/images/coach/ic_shuju.png'), id: 6, url: '/pages/userCenter/teachingData/teachingData'},
  77. {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
  78. {text: '学员退款', icon: require('../../../static/images/coach/ic_tuikuan.png'), id: 7, url: '/pages/userCenter/refund/refund'},
  79. ]
  80. }else if(this.identity=='考场模拟教练') {
  81. this.tabData = [
  82. {text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
  83. {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
  84. ]
  85. }else if(this.identity=='模拟器老师') {
  86. this.tabData = [
  87. {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
  88. ]
  89. }
  90. },
  91. // 切换角色
  92. selectClick(item) {
  93. this.showRole = false
  94. this.$store.commit('upDateIdentity', item.name)
  95. this.initMenu()
  96. uni.reLaunch({
  97. url: '/pages/tabbar/mine/index'
  98. })
  99. },
  100. roleListFn() {
  101. this.list = []
  102. if(this.role.length<=1) return
  103. let roleObj = this.$store.state.user.vuex_role
  104. this.role.forEach((item)=>{
  105. let obj = {
  106. name: roleObj[item]
  107. }
  108. this.list.push(obj)
  109. })
  110. },
  111. getIpAddress() {
  112. // 使用第三方API服务获取IP地址,例如ipinfo.io
  113. fetch('https://ipinfo.io/json')
  114. .then(response => response.json())
  115. .then(data => {
  116. const ipAddress = data.ip;
  117. console.log(data)
  118. console.log('用户的IP地址是:', ipAddress);
  119. })
  120. .catch(error => {
  121. console.error('获取IP地址时出错:', error);
  122. });
  123. }
  124. }
  125. }
  126. </script>
  127. <style lang="scss" scoped>
  128. .pageBgImg {
  129. padding: 40rpx 28rpx;
  130. }
  131. .card {
  132. margin-bottom: 24rpx;
  133. padding: 28rpx;
  134. position: relative;
  135. .qcode {
  136. width: 76rpx;
  137. height: 76rpx;
  138. position: absolute;
  139. right: 34rpx;
  140. bottom: 24rpx;
  141. }
  142. .cut_row {
  143. display: flex;
  144. justify-content: flex-end;
  145. margin-bottom: 6rpx;
  146. .cut_icon {
  147. width: 24rpx;
  148. height: 24rpx;
  149. }
  150. .cut_text {
  151. font-size: 24rpx;
  152. color: $themC;
  153. margin-left: 5rpx;
  154. }
  155. }
  156. }
  157. .ul {
  158. display: flex;
  159. flex-wrap: wrap;
  160. .li {
  161. display: flex;
  162. align-items: center;
  163. flex-direction: column;
  164. padding: 10rpx 0 50rpx 0;
  165. width: 33.33%;
  166. .icon {
  167. width: 72rpx;
  168. height: 72rpx;
  169. }
  170. .text {
  171. font-size: 28rpx;
  172. margin-top: 16rpx;
  173. }
  174. }
  175. }
  176. </style>