|
@@ -1,10 +1,12 @@
|
|
|
import Vue from 'vue'
|
|
|
-import { login, logout, phoneLogin, thirdLogin } from "@/api/login"
|
|
|
+import { login, logout, phoneLogin, thirdLogin, iotSsoLogin } from "@/api/login"
|
|
|
import { ACCESS_TOKEN, USER_NAME,USER_INFO,USER_AUTH,SYS_BUTTON_AUTH,UI_CACHE_DB_DICT_DATA,TENANT_ID,CACHE_INCLUDED_ROUTES } from "@/store/mutation-types"
|
|
|
import { welcome } from "@/utils/util"
|
|
|
import { queryPermissionsByUser } from '@/api/api'
|
|
|
import { getAction } from '@/api/manage'
|
|
|
|
|
|
+import cookie from 'js-cookie'
|
|
|
+
|
|
|
const user = {
|
|
|
state: {
|
|
|
token: '',
|
|
@@ -191,6 +193,8 @@ const user = {
|
|
|
let serviceUrl = encodeURIComponent(sevice)
|
|
|
window.location.href = process.env.VUE_APP_CAS_BASE_URL + '/logout?service=' + serviceUrl
|
|
|
}
|
|
|
+ // 删除EIToken
|
|
|
+ cookie.remove('EIToken')
|
|
|
resolve()
|
|
|
}).catch(() => {
|
|
|
resolve()
|
|
@@ -220,6 +224,30 @@ const user = {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ // IoT Edge相关 修改框架
|
|
|
+ // iot EIToken登录
|
|
|
+ IotSsoLogin({ commit }, param) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ iotSsoLogin(param).then(response => {
|
|
|
+ if(response.code =='200'){
|
|
|
+ const result = response.result
|
|
|
+ const userInfo = result.userInfo
|
|
|
+ Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000)
|
|
|
+ Vue.ls.set(USER_NAME, userInfo.username, 7 * 24 * 60 * 60 * 1000)
|
|
|
+ Vue.ls.set(USER_INFO, userInfo, 7 * 24 * 60 * 60 * 1000)
|
|
|
+ commit('SET_TOKEN', result.token)
|
|
|
+ commit('SET_INFO', userInfo)
|
|
|
+ commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname, welcome: welcome() })
|
|
|
+ commit('SET_AVATAR', userInfo.avatar)
|
|
|
+ resolve(response)
|
|
|
+ }else{
|
|
|
+ reject(response)
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ reject(error)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
saveTenant({ commit }, id){
|
|
|
Vue.ls.set(TENANT_ID, id, 7 * 24 * 60 * 60 * 1000)
|
|
|
commit('SET_TENANT', id)
|