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

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