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.

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