From 8def8862c461b2ced15103bf332dc94261da7ed0 Mon Sep 17 00:00:00 2001
From: fengachen <373943794@qq.com>
Date: Wed, 6 Apr 2022 10:45:27 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91idm?=
=?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=8D=95=E7=82=B9=E7=99=BB=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/api.js | 5 ++++-
src/permission.js | 25 +++++++++++++++++++++++--
src/views/system/modules/UserModal.vue | 15 ++++++++++++++-
3 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/src/api/api.js b/src/api/api.js
index 052a94a..b694c64 100644
--- a/src/api/api.js
+++ b/src/api/api.js
@@ -2,6 +2,8 @@ import { getAction, deleteAction,putAction, postAction, httpAction } from '@/api
import Vue from 'vue'
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 editRole = (params)=>postAction('/sys/role/edit',params)
@@ -180,7 +182,8 @@ export {
getContactsById,
getFileInfo,
getKeyIv,
- getContactsByCompanyNoLimit
+ getContactsByCompanyNoLimit,
+ loginIdmPlatform
}
diff --git a/src/permission.js b/src/permission.js
index cc87ad6..bcccf9e 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -4,15 +4,18 @@ import store from './store'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
// 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 {loginIdmPlatform} from '@api/api'
+import {notification} from 'ant-design-vue'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
// ,'/signupentrance','/signUpPage'
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) {
Vue.ls.set(ACCESS_TOKEN, to.query.token, 7 * 24 * 60 * 60 * 1000)
store.commit('SET_TOKEN', to.query.token)
@@ -21,6 +24,24 @@ router.beforeEach((to, from, next) => {
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
diff --git a/src/views/system/modules/UserModal.vue b/src/views/system/modules/UserModal.vue
index 5dda5d1..f840591 100644
--- a/src/views/system/modules/UserModal.vue
+++ b/src/views/system/modules/UserModal.vue
@@ -28,6 +28,12 @@
:readOnly="!!model.id" :disabled="disableSubmit || disabledEdit"/>
+
+ event.target.value = event.target.value.trim()"
+ :maxLength="50" v-decorator.trim="[ 'userNo', validatorRules.userNo]"
+ :disabled="disableSubmit"/>
+
+
{
- 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') {