Skip to content

Commit

Permalink
Merge pull request TencentBlueKing#2690 from TencentBlueKing/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
nannan00 authored Jun 4, 2024
2 parents d468057 + 6aea390 commit 23b1d7b
Show file tree
Hide file tree
Showing 116 changed files with 4,768 additions and 778 deletions.
28 changes: 15 additions & 13 deletions frontend/login_success.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,20 @@ <h1>登录成功</h1>
<script>
document.domain = '{{ SESSION_COOKIE_DOMAIN }}'

document.addEventListener('DOMContentLoaded', function () {
// setTimeout(function() {
// parent.bus.$emit('close-login-modal')
// }, 1000)
parent.bus.$emit('close-login-modal')
// var is_ajax = window.location.href.match(/is\_ajax\=(\d+)/)
// if (is_ajax && is_ajax[1]) {
// parent.bus.$emit('close-login-modal')
// }
// else {
// console.warn('#TODO 实现页面跳转')
// }
})
// document.addEventListener('DOMContentLoaded', function () {
// // setTimeout(function() {
// // parent.bus.$emit('close-login-modal')
// // }, 1000)
// // parent.bus.$emit('close-login-modal')
// // var is_ajax = window.location.href.match(/is\_ajax\=(\d+)/)
// // if (is_ajax && is_ajax[1]) {
// // parent.bus.$emit('close-login-modal')
// // }
// // else {
// // console.warn('#TODO 实现页面跳转')
// // }
// })
// window.opener && window.opener.location.reload()
window.close()
</script>
</html>
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@
"@babel/preset-env": "~7.4.5",
"@babel/register": "~7.4.4",
"@babel/runtime": "~7.4.5",
"@blueking/login-modal": "^1.0.0",
"@blueking/notice-component-vue2": "^2.0.3",
"@blueking/user-selector": "^1.0.11",
"@blueking/user-selector": "^1.0.14",
"@commitlint/cli": "~13.1.0",
"@commitlint/config-conventional": "~13.1.0",
"@icon-cool/bk-icon-bk-iam": "^0.0.3",
Expand Down
30 changes: 17 additions & 13 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<router-view class="views-layout" :key="routerKey" v-show="!mainContentLoading"></router-view>
</div>
</main>
<app-auth ref="bkAuth"></app-auth>
<!-- <app-auth ref="bkAuth"></app-auth> -->
</div>
</template>
<script>
Expand Down Expand Up @@ -187,18 +187,21 @@
});
},
mounted () {
const self = this;
bus.$on('show-login-modal', (payload) => {
self.$refs.bkAuth.showLoginModal(payload);
});
bus.$on('close-login-modal', () => {
self.$refs.bkAuth.hideLoginModal();
setTimeout(() => {
window.location.reload();
}, 0);
});
bus.$on('updatePoll', () => {
// const self = this;
// bus.$on('show-login-modal', (payload) => {
// self.$refs.bkAuth.showLoginModal(payload);
// });
// bus.$on('close-login-modal', () => {
// self.$refs.bkAuth.hideLoginModal();
// setTimeout(() => {
// window.location.reload();
// }, 0);
// });
bus.$on('updatePoll', (payload) => {
clearInterval(this.timer);
if (payload && payload.isStop) {
return;
}
this.timer = setInterval(() => {
this.fetchSyncStatus();
}, 15000);
Expand Down Expand Up @@ -300,6 +303,7 @@
? this.$t(`m.permTemplate['同步组织架构成功']`)
: this.$t(`m.permTemplate['同步组织架构失败']`)
});
bus.$emit('on-sync-record-status');
}
} catch (e) {
console.error(e);
Expand Down Expand Up @@ -367,7 +371,7 @@
.views-layout {
min-height: 100%;
min-width: 1120px;
/* min-width: 1120px; */
padding: 24px;
}
Expand Down
20 changes: 15 additions & 5 deletions frontend/src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
import Vue from 'vue';
import axios from 'axios';
import cookie from 'cookie';
import { bus } from '@/common/bus';
// import { bus } from '@/common/bus';
import il8n from '@/language';

import CachedPromise from './cached-promise';
import RequestQueue from './request-queue';
import { showLoginModal } from '@blueking/login-modal';
// import { messageError } from '@/common/bkmagic'

const CSRF_COOKIE_NAME = window.CSRF_COOKIE_NAME;
Expand Down Expand Up @@ -210,10 +210,20 @@ function handleReject (error, config) {
const { status, data } = error.response;
const nextError = { message: error.message, response: error.response };
if (status === 401) {
const loginPlainUrl = error.response.data.data.login_plain_url;
nextError.message = error.response.data.message;
bus.$emit('show-login-modal', loginPlainUrl);
// const loginPlainUrl = error.response.data.data.login_plain_url;
// nextError.message = error.response.data.message;
// bus.$emit('show-login-modal', loginPlainUrl);
// window.location = LOGIN_SERVICE_URL + '/?c_url=' + window.location.href
// const loginCallbackURL = `${window.location.origin}/static/login_success.html?is_ajax=1`;
const loginCallbackURL = `${window.origin + window.SITE_URL}login_success/?is_ajax=1`;
const siteLoginUrl = window.LOGIN_SERVICE_URL || '';
if (!siteLoginUrl) {
console.error('Login URL not configured!');
return;
}
// 增加encodeURIComponent防止回调地址特殊字符被转义
const loginUrl = `${window.LOGIN_SERVICE_URL}?size=big&app_code=1&c_url=${encodeURIComponent(loginCallbackURL)}`;
showLoginModal({ loginUrl, width: 700, height: 510 });
} else if (status === 500) {
nextError.message = il8n('common', '系统出现异常');
} else if (data && data.message) {
Expand Down
70 changes: 70 additions & 0 deletions frontend/src/assets/iconfont/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,18 @@ <h2 class="page-title">
<span class="icon iam-icon iamcenter-revoke"></span>
<p class="icon-text">revoke</p>
</li>
<li class="icon-item" title="qq">
<span class="icon iam-icon iamcenter-qq"></span>
<p class="icon-text">qq</p>
</li>
<li class="icon-item" title="qw">
<span class="icon iam-icon iamcenter-qw"></span>
<p class="icon-text">qw</p>
</li>
<li class="icon-item" title="wechat">
<span class="icon iam-icon iamcenter-wechat"></span>
<p class="icon-text">wechat</p>
</li>
<li class="icon-item" title="user-directory">
<span class="icon iam-icon iamcenter-user-directory"></span>
<p class="icon-text">user-directory</p>
Expand Down Expand Up @@ -669,6 +681,22 @@ <h2 class="page-title">
<span class="icon iam-icon iamcenter-renyuanmuban"></span>
<p class="icon-text">renyuanmuban</p>
</li>
<li class="icon-item" title="setting">
<span class="icon iam-icon iamcenter-setting"></span>
<p class="icon-text">setting</p>
</li>
<li class="icon-item" title="notification">
<span class="icon iam-icon iamcenter-notification"></span>
<p class="icon-text">notification</p>
</li>
<li class="icon-item" title="duanxin">
<span class="icon iam-icon iamcenter-duanxin"></span>
<p class="icon-text">duanxin</p>
</li>
<li class="icon-item" title="youjian">
<span class="icon iam-icon iamcenter-youjian"></span>
<p class="icon-text">youjian</p>
</li>
</ul>
<h3 class="describe-title">为什么使用</h3>
<ul class="use-describe">
Expand Down Expand Up @@ -1118,6 +1146,24 @@ <h3 class="describe-title">如何使用</h3>
</svg>
<p class="icon-text">revoke</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#iamcenter-qq"></use>
</svg>
<p class="icon-text">qq</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#iamcenter-qw"></use>
</svg>
<p class="icon-text">qw</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#iamcenter-wechat"></use>
</svg>
<p class="icon-text">wechat</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#iamcenter-user-directory"></use>
Expand Down Expand Up @@ -1514,6 +1560,30 @@ <h3 class="describe-title">如何使用</h3>
</svg>
<p class="icon-text">renyuanmuban</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#iamcenter-setting"></use>
</svg>
<p class="icon-text">setting</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#iamcenter-notification"></use>
</svg>
<p class="icon-text">notification</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#iamcenter-duanxin"></use>
</svg>
<p class="icon-text">duanxin</p>
</li>
<li class="colorful-icon">
<svg class="icon svg-icon">
<use xlink:href="#iamcenter-youjian"></use>
</svg>
<p class="icon-text">youjian</p>
</li>
</ul>
<h3 class="describe-title">为什么使用</h3>
<ul class="use-describe">
Expand Down
Binary file modified frontend/src/assets/iconfont/fonts/iconcool.eot
Binary file not shown.
Loading

0 comments on commit 23b1d7b

Please sign in to comment.