diff --git a/front/public/static/config/location.js b/front/public/static/config/location.js index e748085c..a75068ec 100644 --- a/front/public/static/config/location.js +++ b/front/public/static/config/location.js @@ -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'] + } diff --git a/front/src/layout/vab-avatar/index.vue b/front/src/layout/vab-avatar/index.vue index 61088be9..25b0da1a 100644 --- a/front/src/layout/vab-avatar/index.vue +++ b/front/src/layout/vab-avatar/index.vue @@ -10,7 +10,7 @@ - {{ username }} + {{ realName }} diff --git a/front/src/store/modules/user.js b/front/src/store/modules/user.js index bb545609..08a7e1db 100644 --- a/front/src/store/modules/user.js +++ b/front/src/store/modules/user.js @@ -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 获取用户信息,后续执行部分操作 diff --git a/front/src/views/home/DetailsPageconetent.vue b/front/src/views/home/DetailsPageconetent.vue index b17ab6b2..eff61da6 100644 --- a/front/src/views/home/DetailsPageconetent.vue +++ b/front/src/views/home/DetailsPageconetent.vue @@ -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 = [] diff --git a/front/src/views/home/components/header.vue b/front/src/views/home/components/header.vue index 95b5e0ba..5ae0e50e 100644 --- a/front/src/views/home/components/header.vue +++ b/front/src/views/home/components/header.vue @@ -4,7 +4,7 @@ props.showView === 'algorithm-details' ? '' : '', ]">
-
+

城市云脑通用能力服务平台

@@ -57,10 +57,10 @@ - {{ user.username }} + {{ user.realName }} 退出 @@ -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