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.

202 lines
6.0 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
8 months ago
7 months ago
8 months ago
5 months ago
5 months ago
8 months ago
  1. <template>
  2. <view class="pageBgImg">
  3. <view class="status_bar"></view>
  4. <view class="" style="height: 44rpx;"></view>
  5. <view class="card">
  6. <view class="cut_row" @click.stop="showRole=true" v-if="vuex_loginInfo.userType==5">
  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="goSanCode" >
  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: [{name: '实操教练', id: 3}, {name: '校长', id: 4}],
  39. showRole: false
  40. }
  41. },
  42. onLoad() {
  43. // this.$store.dispatch('refreshToken')
  44. this.initMenu()
  45. },
  46. onShow() {
  47. uni.hideTabBar();
  48. this.test()
  49. // this.getIpAddress()
  50. },
  51. methods: {
  52. test() {
  53. let a = 1
  54. function fn () {
  55. let a = 2
  56. function fn2 () {
  57. let a = 3
  58. console.log(a)
  59. }
  60. fn2()
  61. console.log(a)
  62. }
  63. fn()
  64. },
  65. goPage(item) {
  66. // if(item.text=='结算统计') {
  67. // uni.switchTab({
  68. // url: item.url
  69. // })
  70. // }
  71. console.log(item.url)
  72. this.$goPage(item.url)
  73. },
  74. // 点击扫码小图标
  75. goSanCode() {
  76. if(this.identity=='校长') {
  77. this.$goPage('/pages/userCenter/scanCode/scanCodeSchool')
  78. }else if(this.identity=='实操教练') {
  79. this.$goPage('/pages/userCenter/scanCode/scanCode')
  80. }
  81. },
  82. initMenu() {
  83. if(this.identity=='实操教练') {
  84. this.tabData = [
  85. {text: '上课学员', icon: require('../../../static/images/coach/ic_zhibiao.png'), id: 2, url: '/pages/recordEntry/operate/todayStudent/todayStudent'},
  86. {text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
  87. {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
  88. {text: '教学数据', icon: require('../../../static/images/coach/ic_shuju.png'), id: 6, url: '/pages/userCenter/teachingData/teachingData'},
  89. // {text: '我的签名', icon: require('../../../static/images/coach/ic_daijiesuan.png'), id: 1, url: '/pages/userCenter/signature/signature'},
  90. // {text: '学员退款', icon: require('../../../static/images/coach/ic_tuikuan.png'), id: 7, url: '/pages/userCenter/refund/refund'},
  91. ]
  92. }else if(this.identity=='校长'||this.identity=='驾校财务') {
  93. this.tabData = [
  94. {text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
  95. {text: '驾校场地', icon: require('../../../static/images/coach/site.png'), id: 7, url: '/pages/userCenter/schoolSite/schoolSite'},
  96. {text: '驾校教练', icon: require('../../../static/images/coach/coach.png'), id: 7, url: '/pages/userCenter/schoolCoach/schoolCoach'},
  97. // {text: '教学数据', icon: require('../../../static/images/coach/ic_shuju.png'), id: 6, url: '/pages/userCenter/teachingData/teachingData'},
  98. {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
  99. {text: '学员退款', icon: require('../../../static/images/coach/ic_tuikuan.png'), id: 7, url: '/pages/userCenter/refund/refund'},
  100. ]
  101. }else if(this.identity=='考场模拟教练') {
  102. this.tabData = [
  103. {text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
  104. {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
  105. ]
  106. }else if(this.identity=='模拟器老师') {
  107. this.tabData = [
  108. {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
  109. ]
  110. }
  111. },
  112. // 切换角色
  113. selectClick(item) {
  114. this.showRole = false
  115. this.$store.commit('upDateIdentity', item.name)
  116. this.initMenu()
  117. uni.reLaunch({
  118. url: '/pages/tabbar/mine/index'
  119. })
  120. },
  121. getIpAddress() {
  122. // 使用第三方API服务获取IP地址,例如ipinfo.io
  123. fetch('https://ipinfo.io/json')
  124. .then(response => response.json())
  125. .then(data => {
  126. const ipAddress = data.ip;
  127. console.log(data)
  128. console.log('用户的IP地址是:', ipAddress);
  129. })
  130. .catch(error => {
  131. console.error('获取IP地址时出错:', error);
  132. });
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .pageBgImg {
  139. padding: 40rpx 28rpx;
  140. }
  141. .card {
  142. margin-bottom: 24rpx;
  143. padding: 28rpx;
  144. position: relative;
  145. .qcode {
  146. width: 76rpx;
  147. height: 76rpx;
  148. position: absolute;
  149. right: 34rpx;
  150. bottom: 24rpx;
  151. }
  152. .cut_row {
  153. display: flex;
  154. justify-content: flex-end;
  155. margin-bottom: 6rpx;
  156. .cut_icon {
  157. width: 24rpx;
  158. height: 24rpx;
  159. }
  160. .cut_text {
  161. font-size: 24rpx;
  162. color: $themC;
  163. margin-left: 5rpx;
  164. }
  165. }
  166. }
  167. .ul {
  168. display: flex;
  169. flex-wrap: wrap;
  170. .li {
  171. display: flex;
  172. align-items: center;
  173. flex-direction: column;
  174. padding: 10rpx 0 50rpx 0;
  175. width: 33.33%;
  176. .icon {
  177. width: 72rpx;
  178. height: 72rpx;
  179. }
  180. .text {
  181. font-size: 28rpx;
  182. margin-top: 16rpx;
  183. }
  184. }
  185. }
  186. </style>