【修改】idm系统单点登录
This commit is contained in:
+4
-1
@@ -2,6 +2,8 @@ import { getAction, deleteAction,putAction, postAction, httpAction } from '@/api
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import {UI_CACHE_DB_DICT_DATA } from '@/store/mutation-types'
|
import {UI_CACHE_DB_DICT_DATA } from '@/store/mutation-types'
|
||||||
|
|
||||||
|
// idm 系统单点登录 获取用户信息
|
||||||
|
const loginIdmPlatform = (params) => getAction('',params)
|
||||||
//角色管理
|
//角色管理
|
||||||
const addRole = (params)=>postAction('/sys/role/add',params)
|
const addRole = (params)=>postAction('/sys/role/add',params)
|
||||||
const editRole = (params)=>postAction('/sys/role/edit',params)
|
const editRole = (params)=>postAction('/sys/role/edit',params)
|
||||||
@@ -180,7 +182,8 @@ export {
|
|||||||
getContactsById,
|
getContactsById,
|
||||||
getFileInfo,
|
getFileInfo,
|
||||||
getKeyIv,
|
getKeyIv,
|
||||||
getContactsByCompanyNoLimit
|
getContactsByCompanyNoLimit,
|
||||||
|
loginIdmPlatform
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+23
-2
@@ -4,15 +4,18 @@ import store from './store'
|
|||||||
import NProgress from 'nprogress' // progress bar
|
import NProgress from 'nprogress' // progress bar
|
||||||
import 'nprogress/nprogress.css' // progress bar style
|
import 'nprogress/nprogress.css' // progress bar style
|
||||||
// import notification from 'ant-design-vue/es/notification'
|
// import notification from 'ant-design-vue/es/notification'
|
||||||
import { ACCESS_TOKEN, INDEX_MAIN_PAGE_PATH } from '@/store/mutation-types'
|
import { ACCESS_TOKEN, INDEX_MAIN_PAGE_PATH,USER_INFO } from '@/store/mutation-types'
|
||||||
import { generateIndexRouter } from '@/utils/util'
|
import { generateIndexRouter } from '@/utils/util'
|
||||||
|
import {loginIdmPlatform} from '@api/api'
|
||||||
|
import {notification} from 'ant-design-vue'
|
||||||
|
|
||||||
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
||||||
// ,'/signupentrance','/signUpPage'
|
// ,'/signupentrance','/signUpPage'
|
||||||
|
|
||||||
const whiteList = ['/user/login', '/user/register', '/user/register-result', '/user/alteration'] // no redirect whitelist
|
const whiteList = ['/user/login', '/user/register', '/user/register-result', '/user/alteration'] // no redirect whitelist
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
|
// 会员系统的单点登录
|
||||||
if (to.query.token) {
|
if (to.query.token) {
|
||||||
Vue.ls.set(ACCESS_TOKEN, to.query.token, 7 * 24 * 60 * 60 * 1000)
|
Vue.ls.set(ACCESS_TOKEN, to.query.token, 7 * 24 * 60 * 60 * 1000)
|
||||||
store.commit('SET_TOKEN', to.query.token)
|
store.commit('SET_TOKEN', to.query.token)
|
||||||
@@ -21,6 +24,24 @@ router.beforeEach((to, from, next) => {
|
|||||||
store.commit('SET_SYSTEM', to.query.system)
|
store.commit('SET_SYSTEM', to.query.system)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// idm系统单点登录
|
||||||
|
if(to.path === '/user/login' && to.query.v){
|
||||||
|
let result = await loginIdmPlatform({uuid:to.query.v})
|
||||||
|
if(result.success){
|
||||||
|
Vue.ls.set(USER_INFO, result.result.userInfo, 7 * 24 * 60 * 60 * 1000)
|
||||||
|
Vue.ls.set(ACCESS_TOKEN, result.result.token, 7 * 24 * 60 * 60 * 1000)
|
||||||
|
}else {
|
||||||
|
notification['error']({
|
||||||
|
message: '登录失败',
|
||||||
|
description: result.message,
|
||||||
|
duration: 4,
|
||||||
|
})
|
||||||
|
Vue.ls.remove(ACCESS_TOKEN)
|
||||||
|
Vue.ls.remove(USER_INFO)
|
||||||
|
next({ path: '/user/login' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NProgress.start() // start progress bar
|
NProgress.start() // start progress bar
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,12 @@
|
|||||||
:readOnly="!!model.id" :disabled="disableSubmit || disabledEdit"/>
|
:readOnly="!!model.id" :disabled="disableSubmit || disabledEdit"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="员工号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||||
|
<a-input placeholder="请输入员工号" @change="event => event.target.value = event.target.value.trim()"
|
||||||
|
:maxLength="50" v-decorator.trim="[ 'userNo', validatorRules.userNo]"
|
||||||
|
:disabled="disableSubmit"/>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
<template v-if="!model.id">
|
<template v-if="!model.id">
|
||||||
<a-form-item label="登录密码" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-form-item label="登录密码" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||||
<a-input-password type="password" placeholder="请输入登录密码" :maxLength="50" autocomplete='new-password'
|
<a-input-password type="password" placeholder="请输入登录密码" :maxLength="50" autocomplete='new-password'
|
||||||
@@ -228,6 +234,13 @@ export default {
|
|||||||
}],
|
}],
|
||||||
validateTrigger: 'blur'
|
validateTrigger: 'blur'
|
||||||
},
|
},
|
||||||
|
userNo: {
|
||||||
|
rules: [{
|
||||||
|
required: true,
|
||||||
|
message: '请输入员工号'
|
||||||
|
}],
|
||||||
|
validateTrigger: 'blur'
|
||||||
|
},
|
||||||
emailPassword: {
|
emailPassword: {
|
||||||
rules: [{
|
rules: [{
|
||||||
required: false,
|
required: false,
|
||||||
@@ -408,7 +421,7 @@ export default {
|
|||||||
|
|
||||||
}
|
}
|
||||||
that.$nextTick(() => {
|
that.$nextTick(() => {
|
||||||
that.form.setFieldsValue(pick(this.model, 'username', 'realname', 'email', 'phone', 'post', 'selecteddeparts', 'emailPassword'))
|
that.form.setFieldsValue(pick(this.model, 'username','userNo', 'realname', 'email', 'phone', 'post', 'selecteddeparts', 'emailPassword'))
|
||||||
})
|
})
|
||||||
//身份为上级显示负责部门,否则不显示
|
//身份为上级显示负责部门,否则不显示
|
||||||
if (this.model.userIdentity == '2') {
|
if (this.model.userIdentity == '2') {
|
||||||
|
|||||||
Reference in New Issue
Block a user