Browse Source

身份切换

master
unknown 1 year ago
parent
commit
77721c3a4b
  1. 171
      components/UserTab/UserTab.vue
  2. 2
      components/user-info/user-info.vue
  3. 2
      manifest.json
  4. 2
      pages.json
  5. 10
      pages/login/login.vue
  6. 107
      pages/tabbar/mine/index.vue
  7. 1
      pages/tabbar/student/index.vue
  8. 20
      pages/userCenter/myCar/myCar.vue
  9. BIN
      static/images/userCenter/cut.png
  10. 7
      store/modules/user.js

171
components/UserTab/UserTab.vue

@ -22,91 +22,14 @@
currentIndex:0,
}
},
watch: {
identity(newVal) {
this.initTabbar()
}
},
created() {
this.currentName = this.name;
var _this = this
if (uni.getStorageSync('identity') == '实操教练') {
//
_this.list = [
// {
// "pagePath": "/pages/tabbar/statistics/index",
// "text": "",
// "iconPath": require("../../static/images/tabbar/tj.png"),
// "selectedIconPath": require("../../static/images/tabbar/tjActive.png")
// },
// {
// "pagePath": "/pages/tabbar/examSimulation/index",
// "text": "",
// "iconPath": require("../../static/images/tabbar/kc.png"),
// "selectedIconPath": require("../../static/images/tabbar/kcActive.png")
// },
{
"pagePath": "/pages/tabbar/student/index",
"text": "学员",
"iconPath": require("../../static/images/tabbar/xy.png"),
"selectedIconPath": require("../../static/images/tabbar/xyActive.png")
},
{
"pagePath": "/pages/tabbar/operateTrain/index",
"text": "实操训练",
"iconPath": require("../../static/images/tabbar/sc.png"),
"selectedIconPath": require("../../static/images/tabbar/scActive.png")
},
{
"pagePath": "/pages/tabbar/mine/index",
"text": "我的",
"iconPath": require("../../static/images/tabbar/wd.png"),
"selectedIconPath": require("../../static/images/tabbar/wdActive.png")
}
]
} else if(uni.getStorageSync('identity') == '校长') {
//
_this.list = [{
"pagePath": "/pages/tabbar/statistics/index",
"text": "统计",
"iconPath": require("../../static/images/tabbar/tj.png"),
"selectedIconPath": require("../../static/images/tabbar/tjActive.png")
},
{
"pagePath": "/pages/tabbar/student/index",
"text": "学员",
"iconPath": require("../../static/images/tabbar/xy.png"),
"selectedIconPath": require("../../static/images/tabbar/xyActive.png")
},
{
"pagePath": "/pages/tabbar/mine/index",
"text": "我的",
"iconPath": require("../../static/images/tabbar/wd.png"),
"selectedIconPath": require("../../static/images/tabbar/wdActive.png")
}
]
}else if(uni.getStorageSync('identity') == '考场模拟教练'){
_this.list = [{
"pagePath": "/pages/tabbar/statistics/index",
"text": "统计",
"iconPath": require("../../static/images/tabbar/tj.png"),
"selectedIconPath": require("../../static/images/tabbar/tjActive.png")
},
{
"pagePath": "/pages/tabbar/examSimulation/index",
"text": "预约记录",
"iconPath": require("../../static/images/tabbar/kc.png"),
"selectedIconPath": require("../../static/images/tabbar/kcActive.png")
},
{
"pagePath": "/pages/tabbar/mine/index",
"text": "我的",
"iconPath": require("../../static/images/tabbar/wd.png"),
"selectedIconPath": require("../../static/images/tabbar/wdActive.png")
}]
}else {
//
}
this.initTabbar()
},
methods: {
switchTab(item, index) {
@ -118,7 +41,87 @@
url
})
// uni.reLaunch({url:url})
}
},
initTabbar() {
if (uni.getStorageSync('identity') == '实操教练') {
//
this.list = [
// {
// "pagePath": "/pages/tabbar/statistics/index",
// "text": "",
// "iconPath": require("../../static/images/tabbar/tj.png"),
// "selectedIconPath": require("../../static/images/tabbar/tjActive.png")
// },
// {
// "pagePath": "/pages/tabbar/examSimulation/index",
// "text": "",
// "iconPath": require("../../static/images/tabbar/kc.png"),
// "selectedIconPath": require("../../static/images/tabbar/kcActive.png")
// },
{
"pagePath": "/pages/tabbar/student/index",
"text": "学员",
"iconPath": require("../../static/images/tabbar/xy.png"),
"selectedIconPath": require("../../static/images/tabbar/xyActive.png")
},
{
"pagePath": "/pages/tabbar/operateTrain/index",
"text": "实操训练",
"iconPath": require("../../static/images/tabbar/sc.png"),
"selectedIconPath": require("../../static/images/tabbar/scActive.png")
},
{
"pagePath": "/pages/tabbar/mine/index",
"text": "我的",
"iconPath": require("../../static/images/tabbar/wd.png"),
"selectedIconPath": require("../../static/images/tabbar/wdActive.png")
}
]
} else if(uni.getStorageSync('identity') == '校长') {
//
this.list = [{
"pagePath": "/pages/tabbar/statistics/index",
"text": "统计",
"iconPath": require("../../static/images/tabbar/tj.png"),
"selectedIconPath": require("../../static/images/tabbar/tjActive.png")
},
{
"pagePath": "/pages/tabbar/student/index",
"text": "学员",
"iconPath": require("../../static/images/tabbar/xy.png"),
"selectedIconPath": require("../../static/images/tabbar/xyActive.png")
},
{
"pagePath": "/pages/tabbar/mine/index",
"text": "我的",
"iconPath": require("../../static/images/tabbar/wd.png"),
"selectedIconPath": require("../../static/images/tabbar/wdActive.png")
}
]
}else if(uni.getStorageSync('identity') == '考场模拟教练'){
this.list = [{
"pagePath": "/pages/tabbar/statistics/index",
"text": "统计",
"iconPath": require("../../static/images/tabbar/tj.png"),
"selectedIconPath": require("../../static/images/tabbar/tjActive.png")
},
{
"pagePath": "/pages/tabbar/examSimulation/index",
"text": "预约记录",
"iconPath": require("../../static/images/tabbar/kc.png"),
"selectedIconPath": require("../../static/images/tabbar/kcActive.png")
},
{
"pagePath": "/pages/tabbar/mine/index",
"text": "我的",
"iconPath": require("../../static/images/tabbar/wd.png"),
"selectedIconPath": require("../../static/images/tabbar/wdActive.png")
}]
}else {
//
}
}
}
}
</script>

2
components/user-info/user-info.vue

@ -43,7 +43,7 @@
.name_row {
display: flex;
align-items: center;
padding: 6rpx 20rpx 22rpx 0;
padding: 6rpx 20rpx 28rpx 0;
.name {
font-size: 48rpx;

2
manifest.json

@ -82,7 +82,7 @@
"disableHostCheck" : true,
"proxy" : {
"/api" : {
"target" : "http://192.168.1.36:48080/",
"target" : "http://192.168.1.39:48080/",
"changeOrigin" : true,
"secure" : true,
"pathRewrite" : {

2
pages.json

@ -281,7 +281,7 @@
"style": {
"navigationBarTitleText": "考场信息",
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
}
},

10
pages/login/login.vue

@ -58,17 +58,12 @@
list: [],
title: '请选择您要登录的角色',
showRole: false,
roleObj: {
schoolManager: '校长',
schoolFinance: '驾校财务',
coach: '实操教练',
examSiteCoach: '考场模拟教练',
bookingSimulationTeacher: '模拟器老师'
}
roleObj: {}
}
},
onLoad() {
this.tenantPageFn()
this.roleObj = this.$store.state.user.vuex_role
},
computed: {
@ -191,7 +186,6 @@
this.chooseIdentity(this.list[0].name)
}
console.log(this.list)
return
}
}

107
pages/tabbar/mine/index.vue

@ -2,6 +2,14 @@
<view class="pageBgImg">
<view class="status_bar"></view>
<view class="card">
<view class="cut_row" @click.stop="showRole=true" v-if="list.length>1">
<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="$goPage('/pages/userCenter/scanCode/scanCode')">
<image src="@/static/images/coach/ic_erweima.png" mode=""></image>
</view>
@ -19,6 +27,8 @@
</view>
</view>
<u-action-sheet :actions="list" title="请选择您要登录的角色" :show="showRole" @select="selectClick" ></u-action-sheet>
<UserTab name ='我的'></UserTab>
</view>
</template>
@ -27,40 +37,66 @@
export default {
data() {
return {
tabData: []
tabData: [],
list: [],
showRole: false
}
},
onLoad() {
if(this.identity=='实操教练') {
this.tabData = [
// {text: '', icon: require('../../../static/images/coach/ic_daijiesuan.png'), id: 1, url: '/pages/userCenter/settled/settled'},
// {text: '', icon: require('../../../static/images/coach/ic_zhibiao.png'), id: 2, url: '/pages/userCenter/indicatorRecharge/indicatorRecharge'},
{text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
{text: '考场信息', icon: require('../../../static/images/coach/ic_changdi.png'), id: 4, url: '/pages/userCenter/examinInfo/examinInfo'},
{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_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_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'},
]
}
console.log('我的页面')
this.initMenu()
this.roleListFn()
},
onShow() {
uni.hideTabBar();
this.getIpAddress()
// this.getIpAddress()
},
methods: {
initMenu() {
if(this.identity=='实操教练') {
this.tabData = [
// {text: '', icon: require('../../../static/images/coach/ic_daijiesuan.png'), id: 1, url: '/pages/userCenter/settled/settled'},
// {text: '', icon: require('../../../static/images/coach/ic_zhibiao.png'), id: 2, url: '/pages/userCenter/indicatorRecharge/indicatorRecharge'},
{text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
{text: '考场信息', icon: require('../../../static/images/coach/ic_changdi.png'), id: 4, url: '/pages/userCenter/examinInfo/examinInfo'},
{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_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_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'},
]
}
},
//
selectClick(item) {
this.showRole = false
this.$store.commit('upDateIdentity', item.name)
this.initMenu()
uni.switchTab({
url: '/pages/tabbar/index/index'
})
},
roleListFn() {
this.list = []
if(this.role.length<=1) return
let roleObj = this.$store.state.user.vuex_role
this.role.forEach((item)=>{
let obj = {
name: roleObj[item]
}
this.list.push(obj)
})
},
goPage() {},
getIpAddress() {
@ -93,9 +129,22 @@
width: 76rpx;
height: 76rpx;
position: absolute;
right: 16rpx;
top: 50%;
transform: translateY(-50%);
right: 24rpx;
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;
}
}
}

1
pages/tabbar/student/index.vue

@ -139,7 +139,6 @@
},
onLoad() {
this.studentRecordPageFn()
this.schoolClassFn()
},
methods: {
confirmDatePicker(val) {

20
pages/userCenter/myCar/myCar.vue

@ -20,6 +20,10 @@
</view>
</view>
</view>
<view style="padding-bottom: 20rpx;" v-if="list.length">
<u-loadmore :status="status" />
</view>
<nodata v-if="!list.length&&status=='nomore'"></nodata>
</view>
</template>
@ -32,17 +36,31 @@
params: {
pageNo: 1,
pageSize: 20
}
},
total: 20,
status: 'loading'
}
},
onLoad() {
this.carPageFn()
},
onPullDownRefresh() {
this.list = []
this.params.pageNo = 1
this.carPageFn().then(()=>{uni.stopPullDownRefresh()})
},
onReachBottom() {
if(this.total>this.list.length) {
this.carPageFn()
}
},
methods: {
async carPageFn() {
const {data: res} = await carPage(this.params)
this.params.pageNo ++
this.list.push(...res.list)
this.total = res.total
if(this.list.length>=this.total) this.status = 'nomore'
console.log(res)
}
}

BIN
static/images/userCenter/cut.png

After

Width: 9  |  Height: 9  |  Size: 345 B

7
store/modules/user.js

@ -8,6 +8,13 @@ const user = {
vuex_userInfo: uni.getStorageSync('vuex_userInfo') ? uni.getStorageSync('vuex_userInfo') : {},
vuex_loginInfo: uni.getStorageSync('vuex_loginInfo') ? uni.getStorageSync('vuex_loginInfo') : {},
vuex_TenantId: uni.getStorageSync('vuex_TenantId') ? uni.getStorageSync('vuex_TenantId') : '',
vuex_role: {
schoolManager: '校长',
schoolFinance: '驾校财务',
coach: '实操教练',
examSiteCoach: '考场模拟教练',
bookingSimulationTeacher: '模拟器老师'
}
},
mutations: {
// 更新用户身份

Loading…
Cancel
Save