西海岸:特殊用户增加可查看所有权限
This commit is contained in:
parent
a04241c9a5
commit
5db6afcb6c
|
@ -23,6 +23,8 @@ const infrastructure = {}
|
|||
const mapTestNum = {}
|
||||
// 底部数据
|
||||
const footerDataList = {}
|
||||
// 西海岸--特殊用户
|
||||
const xhaHasPermissionUser = {}
|
||||
// qingdao
|
||||
if (newLocation !== 'baotou' && newLocation !== 'xihaian') {
|
||||
whoShow.itShowQingDao = true
|
||||
|
@ -521,4 +523,6 @@ else if (newLocation === 'xihaian') {
|
|||
},
|
||||
],
|
||||
}
|
||||
xhaHasPermissionUser.list = ['xihaian01', 'xihaian02', 'xihaian03', 'xihaian04', 'admin']
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<a-dropdown>
|
||||
<span class="ant-dropdown-link">
|
||||
<a-avatar :src="avatar" />
|
||||
{{ username }}
|
||||
{{ realName }}
|
||||
<DownOutlined />
|
||||
</span>
|
||||
<template v-slot:overlay>
|
||||
|
@ -23,14 +23,14 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { recordRoute } from '@/config'
|
||||
import { DownOutlined } from '@ant-design/icons-vue'
|
||||
import user from '@/assets/home/user.png'
|
||||
import { useStore } from 'vuex'
|
||||
import { computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { recordRoute } from '@/config'
|
||||
import { DownOutlined } from '@ant-design/icons-vue'
|
||||
import user from '@/assets/home/user.png'
|
||||
import { useStore } from 'vuex'
|
||||
import { computed, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
export default {
|
||||
export default {
|
||||
name: 'VabAvatar',
|
||||
components: { DownOutlined },
|
||||
setup() {
|
||||
|
@ -49,21 +49,23 @@
|
|||
}
|
||||
return {
|
||||
avatar: user,
|
||||
username: computed(() => store.getters['user/username']),
|
||||
// username: computed(() => store.getters['user/username']),
|
||||
realName: computed(() => store.getters['user/realName']),
|
||||
logout,
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
.vab-avatar {
|
||||
.vab-avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.ant-dropdown-link {
|
||||
display: block;
|
||||
// min-height: 64px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -14,6 +14,7 @@ import { message, notification } from 'ant-design-vue'
|
|||
const state = () => ({
|
||||
accessToken: getAccessToken(),
|
||||
username: '',
|
||||
realName: '',
|
||||
userId: '',
|
||||
avatar: '',
|
||||
role: 0, // 用户管理员权限
|
||||
|
@ -21,6 +22,7 @@ const state = () => ({
|
|||
const getters = {
|
||||
accessToken: (state) => state.accessToken,
|
||||
username: (state) => state.username,
|
||||
realName: (state) => state.realName,
|
||||
avatar: (state) => state.avatar,
|
||||
role: (state) => state.role,
|
||||
userId: (state) => state.userId,
|
||||
|
@ -45,6 +47,15 @@ const mutations = {
|
|||
setUsername(state, username) {
|
||||
state.username = username
|
||||
},
|
||||
/**
|
||||
* @author chuzhixin 1204505056@qq.com
|
||||
* @description 设置真实用户名
|
||||
* @param {*} state
|
||||
* @param {*} username
|
||||
*/
|
||||
setRealname(state, realName) {
|
||||
state.realName = realName
|
||||
},
|
||||
// 设置角色
|
||||
setRole(state, role) {
|
||||
state.role = role
|
||||
|
@ -75,6 +86,7 @@ const actions = {
|
|||
})
|
||||
commit('setAvatar', 'https://i.gtimg.cn/club/item/face/img/2/15922_100.gif')
|
||||
commit('setUsername', 'admin(未开启登录拦截)')
|
||||
commit('setRealname', 'admin(未开启登录拦截)')
|
||||
},
|
||||
/**
|
||||
* @author chuzhixin 1204505056@qq.com
|
||||
|
@ -120,7 +132,8 @@ const actions = {
|
|||
return false
|
||||
}
|
||||
// debugger
|
||||
commit('setUsername', data.data.realName)
|
||||
commit('setUsername', data.data.username)
|
||||
commit('setRealname', data.data.realName)
|
||||
commit('setRole', data.data.roleIdList.length)
|
||||
commit('setUserId', data.data.id)
|
||||
// TODO 获取用户信息,后续执行部分操作
|
||||
|
|
|
@ -450,7 +450,7 @@ import DetailsPageResource from '@/views/home/components/DetailsPageResource.vue
|
|||
import infrastructurePage from '@/views/home/infrastructurePage.vue'
|
||||
import detailsPageInfrastructureTree from '@/views/home/detailsPageInfrastructureTree.vue'
|
||||
import { DETAIL_PAGE_CONTENT_DEFAULT_TAB } from '@/global/GlobalConfig.js'
|
||||
|
||||
import { useStore } from 'vuex'
|
||||
import { message } from 'ant-design-vue'
|
||||
import {
|
||||
titleNameArray,
|
||||
|
@ -521,6 +521,13 @@ export default defineComponent({
|
|||
orderType: 'DESC', // ASC 升序 DESC 降序
|
||||
}
|
||||
|
||||
const store = useStore()
|
||||
// 用户信息
|
||||
const user = ref({
|
||||
username: store.getters['user/username'],
|
||||
realName: store.getters['user/realName'],
|
||||
})
|
||||
|
||||
const searchResultListDom = ref(null)
|
||||
|
||||
// 读取本地存储查询条件
|
||||
|
@ -1268,8 +1275,10 @@ export default defineComponent({
|
|||
}
|
||||
const changeCards = (name) => {
|
||||
// 西海岸-特殊处理
|
||||
if(whoShow1.value.itShowXiHaiAn && name !== '基础设施') {
|
||||
return message.warn('正在建设中!')
|
||||
if(whoShow1.value.itShowXiHaiAn) {
|
||||
if(name !== '基础设施' && !xhaHasPermissionUser.list.includes(user.value.username)) {
|
||||
return message.warn('暂无权限')
|
||||
}
|
||||
}
|
||||
resourceList.data = []
|
||||
videoList.data = []
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
props.showView === 'algorithm-details' ? '' : '',
|
||||
]">
|
||||
<div class="name" @click="goToHome">
|
||||
<div class="name-bg" v-if="!whoShow1.itShowXiHaiAn"></div>
|
||||
<div class="name-bg" v-if="!itShowXiHaiAn"></div>
|
||||
<div class="name-bg-xihaian" v-else></div>
|
||||
<div class="name-content">
|
||||
<p>城市云脑通用能力服务平台</p>
|
||||
|
@ -57,10 +57,10 @@
|
|||
<i class="img"></i>
|
||||
<a-tooltip placement="bottom">
|
||||
<template #title>
|
||||
<span>{{ user.username }}</span>
|
||||
<span>{{ user.realName }}</span>
|
||||
</template>
|
||||
<span class="name" @click="jumpPage({ name: '个人中心', key: 'personalCenter' })">
|
||||
{{ user.username }}
|
||||
{{ user.realName }}
|
||||
</span>
|
||||
</a-tooltip>
|
||||
<span @click="logout" class="out">退出</span>
|
||||
|
@ -102,34 +102,29 @@ const store = useStore()
|
|||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const whoShow1 = ref(whoShow)
|
||||
const itShowXiHaiAn = ref(whoShow.itShowXiHaiAn)
|
||||
|
||||
// 用户信息
|
||||
const user = ref({
|
||||
username: store.getters['user/username'],
|
||||
realName: store.getters['user/realName'],
|
||||
})
|
||||
// user.username.value = store.getters(['user/username'])
|
||||
const select = ref(router.currentRoute.value.name)
|
||||
const mynoticeFlag = ref(false)
|
||||
const mynoticeData = ref([])
|
||||
console.log('navListManagement------------>', navListManagement)
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const navList = ref(navListManagement.navList)
|
||||
console.log('navList------------>', navList)
|
||||
|
||||
const props = defineProps({
|
||||
showView: { type: String, default: '' },
|
||||
})
|
||||
// // 获取用户信息
|
||||
// getUser().then((res) => {
|
||||
// user.value = res.data.data
|
||||
// // console.log('user===============>', user.value)
|
||||
// })
|
||||
|
||||
// 退出登录
|
||||
const logout = async () => {
|
||||
await store.dispatch('user/logout')
|
||||
window.sessionStorage.setItem('visits', JSON.stringify([]))
|
||||
// 西海岸不返回登录页
|
||||
if (!whoShow1.itShowXiHaiAn) {
|
||||
if (!itShowXiHaiAn.value) {
|
||||
if (recordRoute) {
|
||||
const fullPath = route.fullPath
|
||||
router.push(`/login?redirect=${fullPath}`)
|
||||
|
@ -147,10 +142,10 @@ const goToHome = () => {
|
|||
// 跳转页面
|
||||
const jumpPage = (item) => {
|
||||
// 西海岸
|
||||
if (whoShow1.itShowXiHaiAn) {
|
||||
if (itShowXiHaiAn.value) {
|
||||
let _arr = ['共享门户', '能力云图', '能力统计', '需求中心', '赋能案例']
|
||||
if (_arr.includes(item.name)) {
|
||||
return message.warn('正在建设中!')
|
||||
if (_arr.includes(item.name) && !xhaHasPermissionUser.list.includes(user.value.username)) {
|
||||
return message.warn('暂无权限')
|
||||
}
|
||||
}
|
||||
select.value = item.key
|
||||
|
|
Loading…
Reference in New Issue