diff --git a/src/layout/header.vue b/src/layout/header.vue index 40f0e4b..da1d072 100644 --- a/src/layout/header.vue +++ b/src/layout/header.vue @@ -289,24 +289,24 @@ const nickNameNew = computed(() => { }) const onJumpUser = () => { - // router.push({ name: 'my-user' }) - const isType: any = localStorage.getItem('rolesType') - if (isType == 3) { - const host = window.location.origin + router.push({ name: 'my-user' }) + // const isType: any = localStorage.getItem('rolesType') + // if (isType == 3) { + // const host = window.location.origin - if (host.indexOf('sgwpdm.ah.sgcc.com.cn') > -1) { - window.open(`${host}/iws/glweb/login?token@${store.token}@`) - } else { - // window.open(`${host}/glweb/?token@${store.token}@`) - if (import.meta.env.VITE_ENV === 'production') { - window.open(`${host}/glweb/?token@${store.token}@`) - } else { - window.open(`${host}/iws/glweb/?token@${store.token}@`) - } - } - } else { - router.push({ name: 'my-user' }) - } + // if (host.indexOf('sgwpdm.ah.sgcc.com.cn') > -1) { + // window.open(`${host}/iws/glweb/login?token@${store.token}@`) + // } else { + // // window.open(`${host}/glweb/?token@${store.token}@`) + // if (import.meta.env.VITE_ENV === 'production') { + // window.open(`${host}/glweb/?token@${store.token}@`) + // } else { + // window.open(`${host}/iws/glweb/?token@${store.token}@`) + // } + // } + // } else { + // router.push({ name: 'my-user' }) + // } } const onClickLogin = () => { diff --git a/src/views/user/index.vue b/src/views/user/index.vue index b1d14fb..141d0c5 100644 --- a/src/views/user/index.vue +++ b/src/views/user/index.vue @@ -7,26 +7,28 @@ import { useRoute } from 'vue-router' const store: any = useStore() const router = useRouter() const route = useRoute() +const isAdmin = ref(JSON.parse(localStorage.getItem('main')).userInfo.admin) +console.log('๐Ÿš€ ~ isAdmin:', isAdmin) import imgSrc from '@/assets/img/logo.png' import { el } from 'element-plus/es/locale' const handleSelect = (name: any, path: any) => { console.log('๐Ÿš€ ~ handleSelect ~ name:', name) - console.log('๐Ÿš€ ~ handleSelect ~ store.token:', store.token) if (name == 'admin') { - // const host = window.location.origin + const token = localStorage.getItem('tokenNew') + const host = window.location.origin - // if (host.indexOf('sgwpdm.ah.sgcc.com.cn') > -1) { - // window.open(`${host}/iws/glweb/login?token@${store.token}@`) - // } else { - // // window.open(`${host}/glweb/?token@${store.token}@`) - // if (import.meta.env.VITE_ENV === 'production') { - // window.open(`${host}/glweb/?token@${store.token}@`) - // } else { - // window.open(`${host}/iws/glweb/?token@${store.token}@`) - // } - // } + if (host.indexOf('sgwpdm.ah.sgcc.com.cn') > -1) { + window.open(`${host}/iws/glweb/login?token=${token}`) + } else { + if (import.meta.env.VITE_ENV === 'production') { + window.open(`${host}/glweb/?token=${token}`) + } else { + window.open(`${host}/iws/glweb/?token=${token}`) + // window.open(`${'http://localhost:1024'}/iws/glweb/?token=${token}`) + } + } } else { store.editcurrentMenuItem(name) router.push({ @@ -53,14 +55,14 @@ const lessorMenus: MenuItem[] = [ { title: 'ๆŽฅๅ•็ฎก็†', name: 'accept-orders', permission: ['1'] }, { title: '่ดจๆฃ€็ฎก็†', name: 'quality-manage', permission: ['1'] }, { title: 'ๅˆๅŒ็ฎก็†', name: 'contract-manage', permission: ['1'] }, - // { title: 'ๅŽๅฐ็ฎก็†', name: 'admin', permission: ['1'] }, + { title: 'ๅŽๅฐ็ฎก็†', name: 'admin', permission: ['1'] }, ] // ๆŒ‰่ง’่‰ฒๅˆ†็ป„ๅฎšไน‰่œๅ•---ๆ‰ฟ็งŸๆ–น const lesseeMenus: MenuItem[] = [ { title: '้œ€ๆฑ‚็ฎก็†', name: 'sourcingNeed', permission: ['2'] }, { title: '็งŸ่ต่ฎขๅ•', name: 'orderManagement', permission: ['2'] }, { title: 'ๆ”ถ่ดงๅœฐๅ€็ฎก็†', name: 'address-manage', permission: ['2'] }, - // { title: 'ๅŽๅฐ็ฎก็†', name: 'admin', permission: ['2'] }, + { title: 'ๅŽๅฐ็ฎก็†', name: 'admin', permission: ['2'] }, ] // ๅˆๅนถๆ‰€ๆœ‰่œๅ•้กน @@ -73,8 +75,20 @@ if (localStorage.getItem('rolesTypeName')) { } const menuList: any = computed(() => { return rolesType.value == 'ๆ‰ฟ็งŸๆ–น' - ? allList.filter((e) => e.permission.includes('2')) - : allList.filter((e) => e.permission.includes('1')) + ? allList.filter((e) => { + if (isAdmin.value) { + return e.permission.includes('2') + } else { + return e.permission.includes('2') && e.name != 'admin' + } + }) + : allList.filter((e) => { + if (isAdmin.value) { + return e.permission.includes('1') + } else { + return e.permission.includes('1') && e.name != 'admin' + } + }) }) const activeItem = computed(() => {