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

176 lines
5.5 KiB

1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
11 months ago
1 year ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months 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. }
  77. },
  78. // 切换角色
  79. selectClick(item) {
  80. this.showRole = false
  81. this.$store.commit('upDateIdentity', item.name)
  82. this.initMenu()
  83. uni.switchTab({
  84. url: '/pages/tabbar/index/index'
  85. })
  86. },
  87. roleListFn() {
  88. this.list = []
  89. if(this.role.length<=1) return
  90. let roleObj = this.$store.state.user.vuex_role
  91. this.role.forEach((item)=>{
  92. let obj = {
  93. name: roleObj[item]
  94. }
  95. this.list.push(obj)
  96. })
  97. },
  98. goPage() {},
  99. getIpAddress() {
  100. // 使用第三方API服务获取IP地址,例如ipinfo.io
  101. fetch('https://ipinfo.io/json')
  102. .then(response => response.json())
  103. .then(data => {
  104. const ipAddress = data.ip;
  105. console.log(data)
  106. console.log('用户的IP地址是:', ipAddress);
  107. })
  108. .catch(error => {
  109. console.error('获取IP地址时出错:', error);
  110. });
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. .pageBgImg {
  117. padding: 120rpx 28rpx 40rpx 28rpx;
  118. }
  119. .card {
  120. margin-bottom: 24rpx;
  121. padding: 28rpx;
  122. position: relative;
  123. .qcode {
  124. width: 76rpx;
  125. height: 76rpx;
  126. position: absolute;
  127. right: 24rpx;
  128. bottom: 24rpx;
  129. }
  130. .cut_row {
  131. display: flex;
  132. justify-content: flex-end;
  133. margin-bottom: 6rpx;
  134. .cut_icon {
  135. width: 24rpx;
  136. height: 24rpx;
  137. }
  138. .cut_text {
  139. font-size: 24rpx;
  140. color: $themC;
  141. margin-left: 5rpx;
  142. }
  143. }
  144. }
  145. .ul {
  146. display: flex;
  147. flex-wrap: wrap;
  148. .li {
  149. display: flex;
  150. align-items: center;
  151. flex-direction: column;
  152. padding: 10rpx 0 50rpx 0;
  153. width: 33.33%;
  154. .icon {
  155. width: 72rpx;
  156. height: 72rpx;
  157. }
  158. .text {
  159. font-size: 28rpx;
  160. margin-top: 16rpx;
  161. }
  162. }
  163. }
  164. </style>