|
@@ -15,8 +15,9 @@
|
|
|
import { Decrypt } from '@/utils/secret.js'
|
|
|
import store from '@/store'
|
|
|
import Cookies from 'js-cookie'
|
|
|
+ import { setToken } from '@/utils/auth'
|
|
|
import { getLogoInfo, getUrlConfig } from '@/api/system/publicConfig'
|
|
|
- import { ssoGetLoginUser, getLoginUser } from '@/api/login'
|
|
|
+ import { ssoGetLoginUser, getInfo } from '@/api/login'
|
|
|
|
|
|
export default {
|
|
|
name: 'Login',
|
|
@@ -66,11 +67,8 @@
|
|
|
created() {
|
|
|
let url = window.location.href
|
|
|
if (url.indexOf('token') != -1) {
|
|
|
- // url = url.split('ticket')[1].split('=')[1].split('#')
|
|
|
- // url = url[1].split('=')
|
|
|
- // url = url[1].split('#')
|
|
|
- console.log('url',url)
|
|
|
- // this.getLoginUser()
|
|
|
+ setToken(url.split('=')[1])
|
|
|
+ this.getInfo();
|
|
|
} else {
|
|
|
console.log('没找到====>')
|
|
|
this.ssoGetLoginUser()
|
|
@@ -81,10 +79,22 @@
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
- getLoginUser(type) {
|
|
|
- getLoginUser().then(response => {
|
|
|
+ getInfo(type) {
|
|
|
+ getInfo().then(response => {
|
|
|
console.log('response', response)
|
|
|
- this.msgSuccess('操作成功')
|
|
|
+ localStorage.setItem('userType',response.data.type)
|
|
|
+ localStorage.setItem('userId',response.data.user_id)
|
|
|
+ localStorage.setItem('tenantId',response.data.tenantId)
|
|
|
+ localStorage.setItem('identity',response.data.screen_token);
|
|
|
+ localStorage.setItem('identityType',response.data.screen_type);
|
|
|
+ //等待配置与字段获取到后跳转
|
|
|
+ Promise.all([
|
|
|
+ this.getLogoInfo(),
|
|
|
+ this.getUrlConfig()
|
|
|
+ ]).then((result)=>{
|
|
|
+ this.fullScreen();
|
|
|
+ this.$router.push({ path: this.redirect || "/home" }).catch(()=>{});
|
|
|
+ }).catch((error) => {})
|
|
|
})
|
|
|
},
|
|
|
//获取身份标识
|
|
@@ -93,8 +103,7 @@
|
|
|
// window.open('https://icas.jnu.edu.cn/cas/login?service=http://localhost:8081/sso/getLoginUser','_self')
|
|
|
})
|
|
|
},
|
|
|
- //获取公共配置数据
|
|
|
- getLogoInfo() {
|
|
|
+ getLogoInfo(){
|
|
|
getLogoInfo().then(response => {
|
|
|
console.log('公共配置', response.data)
|
|
|
store.dispatch('settings/setSmartAlarmType', response.data.smartLock)
|
|
@@ -104,13 +113,13 @@
|
|
|
localStorage.setItem('rectangleLogo', response.data.rectangleLogo)
|
|
|
localStorage.setItem('videoCover', response.data.videoCover)
|
|
|
})
|
|
|
+ },
|
|
|
+ getUrlConfig() {
|
|
|
getUrlConfig().then(response => {
|
|
|
console.log('开发配置', response.data)
|
|
|
//判定http或者https
|
|
|
let urlText = window.location.href.split('://')[0] + '://'
|
|
|
-
|
|
|
let outerNet = window.location.href.indexOf(response.data.ipIdentify) == -1//true外网 false 内网
|
|
|
-
|
|
|
if (outerNet) {//外网
|
|
|
//文件预览地址
|
|
|
localStorage.setItem('filePreviewUrl', urlText + response.data.fileExtranetUrl)
|