|
@@ -11,17 +11,23 @@ import { getToken, setToken, removeToken } from '@/utils/auth'
|
|
import { sso } from '@/api/sso/ssoLogin';
|
|
import { sso } from '@/api/sso/ssoLogin';
|
|
export default {
|
|
export default {
|
|
data () {
|
|
data () {
|
|
- return {}
|
|
|
|
|
|
+ return {
|
|
|
|
+ }
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- this.jump()
|
|
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.jump()
|
|
|
|
+ })
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
jump() {
|
|
jump() {
|
|
let userInfo = JSON.parse(localStorage.getItem('userInfo'))
|
|
let userInfo = JSON.parse(localStorage.getItem('userInfo'))
|
|
// console.log('拿到userInfo了不:', userInfo)
|
|
// console.log('拿到userInfo了不:', userInfo)
|
|
|
|
+ // console.log('路径拿到了不:', this.GetQueryString('path'))
|
|
|
|
+ var jumpPath = this.GetQueryString('path')
|
|
|
|
+ console.log('jumpPath', jumpPath)
|
|
// axios.post('https://test-sy.derom.com/drp-admin/login/sso', userInfo).then(res => {
|
|
// axios.post('https://test-sy.derom.com/drp-admin/login/sso', userInfo).then(res => {
|
|
sso(userInfo).then(res => {
|
|
sso(userInfo).then(res => {
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
@@ -29,10 +35,17 @@ export default {
|
|
setToken(token)
|
|
setToken(token)
|
|
this.$store.commit('SET_TOKEN', token)
|
|
this.$store.commit('SET_TOKEN', token)
|
|
this.$store.dispatch("GetInfo").then(() => {})
|
|
this.$store.dispatch("GetInfo").then(() => {})
|
|
- this.$store.dispatch("GenerateRoutes").then(() => {})
|
|
|
|
- this.$router.push({ path: "/system/user" })
|
|
|
|
|
|
+ this.$store.dispatch("GenerateRoutes").then(
|
|
|
|
+ this.$router.push({ path: jumpPath }).catch(()=>{})
|
|
|
|
+ )
|
|
|
|
+ // this.$router.push({ path: "/" })
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ },
|
|
|
|
+ GetQueryString(name) {
|
|
|
|
+ var reg = new RegExp( "(^|&)" + name + "=([^&]*)(&|$)" );
|
|
|
|
+ var r = window.location.search.substr(1).match(reg);
|
|
|
|
+ if (r!= null ) return unescape(r[2]); return null ;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|