Browse Source

身份切换

master
unknown 11 months ago
parent
commit
77721c3a4b
  1. 39
      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. 67
      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

39
components/UserTab/UserTab.vue

@ -22,16 +22,30 @@
currentIndex:0,
}
},
watch: {
identity(newVal) {
this.initTabbar()
}
},
created() {
this.currentName = this.name;
this.initTabbar()
},
methods: {
switchTab(item, index) {
this.currentName = item.text;
var _this = this
let url = item.pagePath;
console.log(url)
uni.switchTab({
url
})
// uni.reLaunch({url:url})
},
initTabbar() {
if (uni.getStorageSync('identity') == '实操教练') {
//
_this.list = [
this.list = [
// {
// "pagePath": "/pages/tabbar/statistics/index",
// "text": "",
@ -65,7 +79,7 @@
]
} else if(uni.getStorageSync('identity') == '校长') {
//
_this.list = [{
this.list = [{
"pagePath": "/pages/tabbar/statistics/index",
"text": "统计",
"iconPath": require("../../static/images/tabbar/tj.png"),
@ -85,7 +99,7 @@
}
]
}else if(uni.getStorageSync('identity') == '考场模拟教练'){
_this.list = [{
this.list = [{
"pagePath": "/pages/tabbar/statistics/index",
"text": "统计",
"iconPath": require("../../static/images/tabbar/tj.png"),
@ -107,17 +121,6 @@
//
}
},
methods: {
switchTab(item, index) {
this.currentName = item.text;
let url = item.pagePath;
console.log(url)
uni.switchTab({
url
})
// uni.reLaunch({url:url})
}
}
}

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
}
}

67
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,10 +37,22 @@
export default {
data() {
return {
tabData: []
tabData: [],
list: [],
showRole: false
}
},
onLoad() {
this.initMenu()
this.roleListFn()
},
onShow() {
uni.hideTabBar();
// 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'},
@ -54,13 +76,27 @@
{text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
]
}
console.log('我的页面')
},
onShow() {
uni.hideTabBar();
this.getIpAddress()
//
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)
})
},
methods: {
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