From e2feb34a33953dc44219c79a3329dfd29142662c Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期五, 22 九月 2023 17:08:04 +0800 Subject: [PATCH] 完整单点登录测试-已完成 --- Source/UBCS-WEB/src/page/login/index.vue | 18 --------- Source/UBCS-WEB/src/page/login/userlogin.vue | 1 Source/UBCS-WEB/src/api/system/user.js | 13 ++---- Source/UBCS-WEB/src/views/integration/systemInfo.vue | 19 ++++++++- Source/UBCS-WEB/src/store/modules/user.js | 6 +- Source/UBCS-WEB/src/page/login/sso.vue | 26 ++++++------ 6 files changed, 38 insertions(+), 45 deletions(-) diff --git a/Source/UBCS-WEB/src/api/system/user.js b/Source/UBCS-WEB/src/api/system/user.js index ed42c7e..041d64c 100644 --- a/Source/UBCS-WEB/src/api/system/user.js +++ b/Source/UBCS-WEB/src/api/system/user.js @@ -160,16 +160,13 @@ }) } //鍗曠偣鐧诲綍鎺ュ彛 -export const oaSsos =(userName) => { +export const ssoLogin =(empCode) => { return request({ - url: '/api/ubcs-code/passwordFree/oaSsos', - method: 'post', + url: '/api/ubcs-code/passwordFree/ssoLogin', + method: 'get', params:{ - userName - }, - headers: { - 'empCode': 'ZVKcWmOH1JvFYaM7BuNVm1BWbaw6OcMi04aAT2H+X3Y=' - }, + empCode + } }) } diff --git a/Source/UBCS-WEB/src/page/login/index.vue b/Source/UBCS-WEB/src/page/login/index.vue index 576ec66..efca008 100644 --- a/Source/UBCS-WEB/src/page/login/index.vue +++ b/Source/UBCS-WEB/src/page/login/index.vue @@ -21,12 +21,6 @@ </h4> <userLogin v-if="activeName==='user'"></userLogin> <thirdLogin v-else-if="activeName==='third'"></thirdLogin> -<!-- <div class="login-menu">--> -<!-- <a href="#" @click.stop="activeName='user'">{{ $t('login.userLogin') }}</a>--> -<!-- <a href="#" @click.stop="activeName='code'">{{ $t('login.phoneLogin') }}</a>--> -<!-- <a href="#" @click.stop="activeName='third'">{{ $t('login.thirdLogin') }}</a>--> -<!-- <a :href="website.ssoUrl + website.redirectUri">{{ $t('login.ssoLogin') }}</a>--> -<!-- </div>--> </div> </div> @@ -43,9 +37,6 @@ import topColor from "@/page/index/top/top-color"; import {getQueryString, getTopUrl} from "@/util/util"; import "@/styles/login.scss"; - //瑙e瘑js搴� - import CryptoJS from 'crypto-js'; - import AES from 'crypto-js/aes'; export default { name: "login", components: { @@ -74,7 +65,6 @@ created() { this.handleLogin(); this.getTime(); - this.getPassword() }, mounted() { }, @@ -83,14 +73,6 @@ }, props: [], methods: { - getPassword(){ - const plaintext = 'Hello, World!'; - const key = 'This is a secret key'; - const encrypted = AES.encrypt(plaintext, key).toString(); - console.log('鍔犲瘑鍚庣殑鏁版嵁锛�', encrypted); - const decrypted = AES.decrypt(encrypted, key).toString(CryptoJS.enc.Utf8); - console.log('瑙e瘑鍚庣殑鏁版嵁锛�', decrypted); - }, getTime() { setInterval(() => { this.time = dateFormat(new Date()); diff --git a/Source/UBCS-WEB/src/page/login/sso.vue b/Source/UBCS-WEB/src/page/login/sso.vue index 3565fc3..26e9510 100644 --- a/Source/UBCS-WEB/src/page/login/sso.vue +++ b/Source/UBCS-WEB/src/page/login/sso.vue @@ -3,31 +3,31 @@ </template> <script> -import {oaSsos} from "@/api/system/user.js" +import {ssoLogin} from "@/api/system/user.js" import {mapGetters} from "vuex"; import {setStore} from "@/util/store"; export default { name: "sso", data() { - return {} + return { + PathString:'', + } }, - computed: {}, + computed: { + ...mapGetters(["tagWel"]) + }, created() { this.onLoad() }, + methods: { onLoad() { - const loading = this.$loading({ - lock: true, - text: 'Loading', - spinner: 'el-icon-loading', - background: 'rgba(0, 0, 0, 0.7)' - }); - setTimeout(() => { - loading.close(); - }, 2000); - + this.PathString=this.$route.query.empCode; + this.$store.dispatch("LoginBySso", { PathString: this.PathString }).then((res) => { + console.log('res', res) + this.$router.push({ path: this.tagWel.value }); + }) } } } diff --git a/Source/UBCS-WEB/src/page/login/userlogin.vue b/Source/UBCS-WEB/src/page/login/userlogin.vue index 1311274..a368aa4 100644 --- a/Source/UBCS-WEB/src/page/login/userlogin.vue +++ b/Source/UBCS-WEB/src/page/login/userlogin.vue @@ -349,7 +349,6 @@ }, handleLogin: function () { - debugger this.userInfo = this.$store.state.upadatastatus localStorage.setItem('username', this.loginForm.username) this.$refs.loginForm.validate(valid => { diff --git a/Source/UBCS-WEB/src/store/modules/user.js b/Source/UBCS-WEB/src/store/modules/user.js index 8227677..ac03016 100644 --- a/Source/UBCS-WEB/src/store/modules/user.js +++ b/Source/UBCS-WEB/src/store/modules/user.js @@ -5,7 +5,7 @@ import {deepClone} from '@/util/util' import website from '@/config/website' import {loginByUsername, loginBySocial, loginBySso, getUserInfo, logout, refreshToken, getButtons} from '@/api/user' -import {oaSsos} from "@/api/system/user.js" +import {ssoLogin} from "@/api/system/user.js" import {getTopMenu, getRoutes} from '@/api/system/menu' import md5 from 'js-md5' @@ -110,9 +110,9 @@ }) }, //鏍规嵁鍗曠偣淇℃伅鐧诲綍 - LoginBySso({commit}) { + LoginBySso({commit},{PathString}) { return new Promise((resolve) => { - oaSsos().then(res => { + ssoLogin(PathString).then(res => { const data = res.data; if (data.error_description) { Message({ diff --git a/Source/UBCS-WEB/src/views/integration/systemInfo.vue b/Source/UBCS-WEB/src/views/integration/systemInfo.vue index 0826c26..4d3dee2 100644 --- a/Source/UBCS-WEB/src/views/integration/systemInfo.vue +++ b/Source/UBCS-WEB/src/views/integration/systemInfo.vue @@ -59,6 +59,7 @@ return { checkAll: {}, ParentList: [], + ParentRemoveList:[], //閬垮厤缂撳瓨 reload: Math.random(), TreeLoading: false, @@ -181,8 +182,22 @@ console.log(this.ParentList); } } else { - this.ParentList = this.ParentList.filter(res => res.classifyId !== row.classifyId); - console.log(this.ParentList); + if (!row.parentId && row.children) { + this.ParentRemoveList = this.ParentList.filter(record => record.oid !== row.oid); + + if (row.children && row.children.length > 0) { + for (let child of row.children) { + this.ParentRemoveList = this.ParentList.filter(record => record.oid !== child.oid); + + if (child.children && child.children.length > 0) { + for (let subChild of child.children) { + this.ParentRemoveList = this.ParentList.filter(record => record.oid !== subChild.oid); + } + } + } + } + } + console.log(this.ParentRemoveList) } }, //鍒嗙被鎺堟潈 -- Gitblit v1.9.3