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