|
|
<template> <view class="pageBg"> <view class="pageBgImg"> <view class="status_bar"></view> <view class="" style="height: 44rpx;"></view> <view class="card"> <view class="cut_row" @click.stop="showRole=true" v-if="vuex_loginInfo.userType==5"> <view class="flex-b"> <view class="cut_icon"> <image src="@/static/images/userCenter/cut.png" mode=""></image> </view> <view class="cut_text">切换身份</view> </view> </view> <view class="qcode" @click="goSanCode" > <image src="@/static/images/coach/ic_erweima.png" mode=""></image> </view> <user-info/> </view> <view class="card" style="padding: 35rpx 0 0 0;"> <view class="ul"> <view class="li" v-for="(item,index) in tabData" :key="index" @click="goPage(item)"> <view class="icon"> <image :src="item.icon" mode=""></image> </view> <view class="text">{{ item.text }}</view> </view> </view> </view> <u-action-sheet :actions="list" title="请选择您要登录的角色" :show="showRole" @select="selectClick" @close="showRole=false" ></u-action-sheet> <UserTab name ='我的'></UserTab> </view> </view> </template>
<script> export default { data() { return { tabData: [], list: [{name: '实操教练', id: 3}, {name: '校长', id: 4}], showRole: false } }, onLoad() { // this.$store.dispatch('refreshToken')
this.initMenu() }, onShow() { uni.hideTabBar(); this.test() // this.getIpAddress()
}, methods: { test() { let a = 1 function fn () { let a = 2 function fn2 () { let a = 3 console.log(a) } fn2() console.log(a) } fn() }, goPage(item) { // if(item.text=='结算统计') {
// uni.switchTab({
// url: item.url
// })
// }
console.log(item.url) this.$goPage(item.url) }, // 点击扫码小图标
goSanCode() { if(this.identity=='校长') { this.$goPage('/pages/userCenter/scanCode/scanCodeSchool') }else if(this.identity=='实操教练') { this.$goPage('/pages/userCenter/scanCode/scanCode') } }, initMenu() { if(this.identity=='实操教练') { this.tabData = [ {text: '上课学员', icon: require('../../../static/images/coach/ic_zhibiao.png'), id: 2, url: '/pages/recordEntry/operate/todayStudent/todayStudent'}, {text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'}, {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'}, {text: '教学数据', icon: require('../../../static/images/coach/ic_shuju.png'), id: 6, url: '/pages/userCenter/teachingData/teachingData'}, // {text: '我的签名', icon: require('../../../static/images/coach/ic_daijiesuan.png'), id: 1, url: '/pages/userCenter/signature/signature'},
// {text: '学员退款', icon: require('../../../static/images/coach/ic_tuikuan.png'), id: 7, url: '/pages/userCenter/refund/refund'},
] }else if(this.identity=='校长'||this.identity=='驾校财务') { this.tabData = [ {text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'}, {text: '驾校场地', icon: require('../../../static/images/coach/site.png'), id: 7, url: '/pages/userCenter/schoolSite/schoolSite'}, {text: '驾校教练', icon: require('../../../static/images/coach/coach.png'), id: 7, url: '/pages/userCenter/schoolCoach/schoolCoach'}, // {text: '教学数据', icon: require('../../../static/images/coach/ic_shuju.png'), id: 6, url: '/pages/userCenter/teachingData/teachingData'},
{text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'}, {text: '学员退款', icon: require('../../../static/images/coach/ic_tuikuan.png'), id: 7, url: '/pages/userCenter/refund/refund'}, ] }else if(this.identity=='考场模拟教练') { this.tabData = [ {text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'}, {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'}, ] }else if(this.identity=='模拟器老师') { this.tabData = [ {text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'}, ] } }, // 切换角色
selectClick(item) { this.showRole = false this.$store.commit('upDateIdentity', item.name) this.initMenu() uni.reLaunch({ url: '/pages/tabbar/mine/index' }) }, getIpAddress() { // 使用第三方API服务获取IP地址,例如ipinfo.io
fetch('https://ipinfo.io/json') .then(response => response.json()) .then(data => { const ipAddress = data.ip; console.log(data) console.log('用户的IP地址是:', ipAddress); }) .catch(error => { console.error('获取IP地址时出错:', error); }); } } } </script>
<style lang="scss" scoped> .pageBgImg { padding: 40rpx 28rpx; } .card { margin-bottom: 24rpx; padding: 28rpx; position: relative; .qcode { width: 76rpx; height: 76rpx; position: absolute; right: 34rpx; bottom: 24rpx; } .cut_row { display: flex; justify-content: flex-end; margin-bottom: 6rpx; .cut_icon { width: 24rpx; height: 24rpx; } .cut_text { font-size: 24rpx; color: $themC; margin-left: 5rpx; } } } .ul { display: flex; flex-wrap: wrap; .li { display: flex; align-items: center; flex-direction: column; padding: 10rpx 0 50rpx 0; width: 33.33%; .icon { width: 72rpx; height: 72rpx; } .text { font-size: 28rpx; margin-top: 16rpx; } } } </style>
|