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

173 lines
5.1 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. <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">
  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.initMenu()
  43. this.roleListFn()
  44. },
  45. onShow() {
  46. uni.hideTabBar();
  47. // this.getIpAddress()
  48. },
  49. methods: {
  50. initMenu() {
  51. if(this.identity=='实操教练') {
  52. this.tabData = [
  53. // {text: '待结算记录', icon: require('../../../static/images/coach/ic_daijiesuan.png'), id: 1, url: '/pages/userCenter/settled/settled'},
  54. // {text: '指标充值记录', icon: require('../../../static/images/coach/ic_zhibiao.png'), id: 2, url: '/pages/userCenter/indicatorRecharge/indicatorRecharge'},
  55. {text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
  56. {text: '考场信息', icon: require('../../../static/images/coach/ic_changdi.png'), id: 4, url: '/pages/userCenter/examinInfo/examinInfo'},
  57. {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
  58. {text: '教学数据', icon: require('../../../static/images/coach/ic_shuju.png'), id: 6, url: '/pages/userCenter/teachingData/teachingData'},
  59. // {text: '学员退款', icon: require('../../../static/images/coach/ic_tuikuan.png'), id: 7, url: '/pages/userCenter/refund/refund'},
  60. ]
  61. }else if(this.identity=='校长') {
  62. this.tabData = [
  63. {text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
  64. {text: '教学数据', icon: require('../../../static/images/coach/ic_shuju.png'), id: 6, url: '/pages/userCenter/teachingData/teachingData'},
  65. {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
  66. {text: '学员退款', icon: require('../../../static/images/coach/ic_tuikuan.png'), id: 7, url: '/pages/userCenter/refund/refund'},
  67. ]
  68. }else if(this.identity=='考场模拟教练') {
  69. this.tabData = [
  70. {text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
  71. {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
  72. ]
  73. }
  74. },
  75. // 切换角色
  76. selectClick(item) {
  77. this.showRole = false
  78. this.$store.commit('upDateIdentity', item.name)
  79. this.initMenu()
  80. uni.switchTab({
  81. url: '/pages/tabbar/index/index'
  82. })
  83. },
  84. roleListFn() {
  85. this.list = []
  86. if(this.role.length<=1) return
  87. let roleObj = this.$store.state.user.vuex_role
  88. this.role.forEach((item)=>{
  89. let obj = {
  90. name: roleObj[item]
  91. }
  92. this.list.push(obj)
  93. })
  94. },
  95. goPage() {},
  96. getIpAddress() {
  97. // 使用第三方API服务获取IP地址,例如ipinfo.io
  98. fetch('https://ipinfo.io/json')
  99. .then(response => response.json())
  100. .then(data => {
  101. const ipAddress = data.ip;
  102. console.log(data)
  103. console.log('用户的IP地址是:', ipAddress);
  104. })
  105. .catch(error => {
  106. console.error('获取IP地址时出错:', error);
  107. });
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. .pageBgImg {
  114. padding: 120rpx 28rpx 40rpx 28rpx;
  115. }
  116. .card {
  117. margin-bottom: 24rpx;
  118. padding: 28rpx;
  119. position: relative;
  120. .qcode {
  121. width: 76rpx;
  122. height: 76rpx;
  123. position: absolute;
  124. right: 24rpx;
  125. bottom: 24rpx;
  126. }
  127. .cut_row {
  128. display: flex;
  129. justify-content: flex-end;
  130. margin-bottom: 6rpx;
  131. .cut_icon {
  132. width: 24rpx;
  133. height: 24rpx;
  134. }
  135. .cut_text {
  136. font-size: 24rpx;
  137. color: $themC;
  138. margin-left: 5rpx;
  139. }
  140. }
  141. }
  142. .ul {
  143. display: flex;
  144. flex-wrap: wrap;
  145. .li {
  146. display: flex;
  147. align-items: center;
  148. flex-direction: column;
  149. padding: 10rpx 0 50rpx 0;
  150. width: 33.33%;
  151. .icon {
  152. width: 72rpx;
  153. height: 72rpx;
  154. }
  155. .text {
  156. font-size: 28rpx;
  157. margin-top: 16rpx;
  158. }
  159. }
  160. }
  161. </style>