diff --git a/src/components/comHeader/index.vue b/src/components/comHeader/index.vue index 6a2e0f462..015755d84 100644 --- a/src/components/comHeader/index.vue +++ b/src/components/comHeader/index.vue @@ -74,6 +74,10 @@ export default { confirmButtonClass: 'common-button-primary', roundButton: false }).then(() => { + this.$http.post('/logout', {}, res => { + window.location.href = 'http://testsso1.foton.com.cn/oauth2.0/authorize?client_id=app_slrs&redirect_uri=http://127.0.0.1:9090&response_type=code' + }) + return this.$store.commit('setTypeFlag', 'loginOut') this.$http.get('logout', {}, { _this: this diff --git a/src/pages/config/pages/attributeCustom/components/stand.vue b/src/pages/config/pages/attributeCustom/components/stand.vue index f36390630..0ea9cfe17 100644 --- a/src/pages/config/pages/attributeCustom/components/stand.vue +++ b/src/pages/config/pages/attributeCustom/components/stand.vue @@ -261,7 +261,7 @@ { + let hasHomeMenu = false + menuList.map((menuItem) => { + if (menuItem.id === 'asdfadf') { + hasHomeMenu = true + } + }) + window.sessionStorage.setItem('hasHomeMenu', hasHomeMenu); // del + window.sessionStorage.setItem('menuList', menuList); // del + if (hasHomeMenu) { + this.setMenu(JSON.stringify(menuList)).then(res => { + this.$router.push('/home1') + }, e => { + this.$message.warning('未获取到菜单') + }) + } else { + alert('无系统权限') + // window.location.href = 'http://testsso1.foton.com.cn/oauth2.0/authorize?client_id=app_slrs&redirect_uri=http://127.0.0.1:9090&response_type=code'; + } + }) + }, ...mapMutations(['setToken', 'setUserInfo', 'resetTime', 'rememberPwd', 'setJESSCookie']), ...mapActions(['setMenu']) }, computed: { }, mounted () { - console.log(document.cookie); - let url = window.location.search - if (url) { - url = url.substr(1); - url = url.split('&'); - let info = []; - let obj = {}; - for (let i = 0,len = url.length; i < len; i++) { - info = url[i].split('=') - obj[info[0]] = decodeURI(info[1]); - url[i] = obj; - } - let code = url[0].code - this.$http.post('login', { - code: code - }, res => { - if (res.ok) { - const JSESSIONID = document.cookie - this.setJESSCookie(JSESSIONID) - if (res.data.orgId === null || res.data.orgId === '') { - this.$message.warning('未分配组织机构,请联系管理员分配后重新登录') - return - } - // debugger - let Base64 = require('js-base64').Base64 - let userInfoStr = Base64.decode(res.data) - let userInfo2 = decodeURIComponent(userInfoStr) - let userInfoObj = JSON.parse(userInfo2) - userInfoObj.userId = userInfoObj.usid - this.setToken(userInfoObj.token) // vuex存储token - let userInfo = {} - for (let key in userInfoObj) { - if (key !== 'uname') { - userInfo[key] = userInfoObj[key] - } else { - userInfo.uName = userInfoObj[key] - } - } - this.setUserInfo(JSON.stringify((userInfo))) - this.resetTime() - // 获取用户菜单 - this.getMenu().then((menuList) => { - let hasHomeMenu = false - menuList.map((menuItem) => { - if (menuItem.id === 'asdfadf') { - hasHomeMenu = true - } - }) - if (hasHomeMenu) { - this.setMenu(JSON.stringify(menuList)).then(res => { - this.$router.push('/home1') - }, e => { - this.$message.warning('未获取到菜单') - }) - } else { - window.location.href = "http://testsso1.foton.com.cn/logout?service=127.0.0.1"; - } - }) - } else if (res.respCode === 'r0012') { - this.loading = false - this.$message.error(res.message) - } else { - this.loading = false - } - }) - } + // let url = window.location.search + // let code = '' + // if (url) { + // url = url.substr(1); + // url = url.split('&'); + // let info = []; + // let obj = {}; + // for (let i = 0,len = url.length; i < len; i++) { + // info = url[i].split('=') + // obj[info[0]] = decodeURI(info[1]); + // url[i] = obj; + // } + // code = url[0].code + // window.localStorage.setItem('code', code); + // } else if (window.localStorage.getItem('code') && !url) { + // code = window.localStorage.getItem('code'); + // } else { + // window.location.href = 'http://testsso1.foton.com.cn/oauth2.0/authorize?client_id=app_slrs&redirect_uri=http://127.0.0.1:9090&response_type=code' + // } + // if (code) { + // this.$http.post('login', { + // code: code + // }, res => { + // if (res.ok) { + // window.sessionStorage.setItem('go', '开始第0步'); // del + // this.loginNew(res) + // } else { + // window.location.href = 'http://testsso1.foton.com.cn/oauth2.0/authorize?client_id=app_slrs&redirect_uri=http://127.0.0.1:9090&response_type=code' + // } + // }) + // } if (this.$store.state.laws_urm !== '') { this.isRemember = true }