Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
yanyizhou
2021-08-30 15:25:12 +08:00
3 changed files with 89 additions and 72 deletions
+4
View File
@@ -74,6 +74,10 @@ export default {
confirmButtonClass: 'common-button-primary', confirmButtonClass: 'common-button-primary',
roundButton: false roundButton: false
}).then(() => { }).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.$store.commit('setTypeFlag', 'loginOut')
this.$http.get('logout', {}, { this.$http.get('logout', {}, {
_this: this _this: this
@@ -261,7 +261,7 @@
<el-form-item label="所属模块" prop="sarType" class="add-form-item"> <el-form-item label="所属模块" prop="sarType" class="add-form-item">
<el-select v-model="displayLocationDialogFormData.sarType" filterable> <el-select v-model="displayLocationDialogFormData.sarType" filterable>
<el-option <el-option
v-for="item in sarTypeLocationOptions" v-for="item in sarTypeOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
+54 -41
View File
@@ -55,10 +55,6 @@
}, },
// 点击登录按钮事件 // 点击登录按钮事件
signin () { signin () {
// let username = getCookie();
// console.log(username);
// window.location.href = "http://testsso1.foton.com.cn/logout?service=http://127.0.0.1";
// return
if (this.username === '') { if (this.username === '') {
this.$message.warning('用户名不能为空') this.$message.warning('用户名不能为空')
} else if (this.password === '') { } else if (this.password === '') {
@@ -275,7 +271,7 @@
}) })
}, },
/** /**
* @description: 获取菜单 * @description: 获取菜单logout
* @author: chenxiaoxi * @author: chenxiaoxi
* @date: 2018/11/11 13:42:14 * @date: 2018/11/11 13:42:14
*/ */
@@ -292,41 +288,24 @@
}) })
}) })
}, },
...mapMutations(['setToken', 'setUserInfo', 'resetTime', 'rememberPwd', 'setJESSCookie']), loginNew (res) {
...mapActions(['setMenu']) window.sessionStorage.setItem('go1', '开始第一步'); // del
},
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 === '') { if (res.data.orgId === null || res.data.orgId === '') {
this.$message.warning('未分配组织机构,请联系管理员分配后重新登录') this.$message.warning('未分配组织机构,请联系管理员分配后重新登录')
return return
} }
// debugger window.sessionStorage.setItem('go2', '开始第二步'); // del
let Base64 = require('js-base64').Base64 let Base64 = require('js-base64').Base64
window.sessionStorage.setItem('go3', '开始第3步'); // del
let userInfoStr = Base64.decode(res.data) let userInfoStr = Base64.decode(res.data)
window.sessionStorage.setItem('go4', '开始第4步'); // del
let userInfo2 = decodeURIComponent(userInfoStr) let userInfo2 = decodeURIComponent(userInfoStr)
window.sessionStorage.setItem('go5', '开始第5步'); // del
let userInfoObj = JSON.parse(userInfo2) let userInfoObj = JSON.parse(userInfo2)
window.sessionStorage.setItem('go6', '开始第6步'); // del
userInfoObj.userId = userInfoObj.usid userInfoObj.userId = userInfoObj.usid
window.sessionStorage.setItem('go7', '开始第7步'); // del
window.sessionStorage.setItem('userInfoObj', userInfoObj); // del
this.setToken(userInfoObj.token) // vuex存储token this.setToken(userInfoObj.token) // vuex存储token
let userInfo = {} let userInfo = {}
for (let key in userInfoObj) { for (let key in userInfoObj) {
@@ -337,8 +316,9 @@
} }
} }
this.setUserInfo(JSON.stringify((userInfo))) this.setUserInfo(JSON.stringify((userInfo)))
this.resetTime() // this.resetTime()
// 获取用户菜单 // 获取用户菜单
window.sessionStorage.setItem('userInfo', userInfo); // del
this.getMenu().then((menuList) => { this.getMenu().then((menuList) => {
let hasHomeMenu = false let hasHomeMenu = false
menuList.map((menuItem) => { menuList.map((menuItem) => {
@@ -346,6 +326,8 @@
hasHomeMenu = true hasHomeMenu = true
} }
}) })
window.sessionStorage.setItem('hasHomeMenu', hasHomeMenu); // del
window.sessionStorage.setItem('menuList', menuList); // del
if (hasHomeMenu) { if (hasHomeMenu) {
this.setMenu(JSON.stringify(menuList)).then(res => { this.setMenu(JSON.stringify(menuList)).then(res => {
this.$router.push('/home1') this.$router.push('/home1')
@@ -353,17 +335,48 @@
this.$message.warning('未获取到菜单') this.$message.warning('未获取到菜单')
}) })
} else { } else {
window.location.href = "http://testsso1.foton.com.cn/logout?service=127.0.0.1"; 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';
} }
}) })
} else if (res.respCode === 'r0012') { },
this.loading = false ...mapMutations(['setToken', 'setUserInfo', 'resetTime', 'rememberPwd', 'setJESSCookie']),
this.$message.error(res.message) ...mapActions(['setMenu'])
} else { },
this.loading = false computed: {
} },
}) mounted () {
} // 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 !== '') { if (this.$store.state.laws_urm !== '') {
this.isRemember = true this.isRemember = true
} }