Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: 使用npm包统一登录弹窗方案 #1275

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions webfe/package_vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@blueking/cli-service-webpack": "0.0.0-beta.73",
"@blueking/eslint-config-bk": "^2.1.0-beta.12",
"@blueking/log": "^2.0.16",
"@blueking/login-modal": "^1.0.1",
"@blueking/notice-component-vue2": "^2.0.3",
"@blueking/stylelint-config-bk": "^2.1.0-beta.9",
"@blueking/user-selector": "^1.0.5-beta.2",
Expand Down
27 changes: 4 additions & 23 deletions webfe/package_vue/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { bus } from '@/common/bus';
import paasHeader from '@/components/paas-header';
import paasFooter from '@/components/paas-footer';
import NoticeComponent from '@blueking/notice-component-vue2';
import { showLoginModal as showLoginPopup } from '@blueking/login-modal';
import '@blueking/notice-component-vue2/dist/style.css';

export default {
Expand Down Expand Up @@ -118,31 +119,11 @@ export default {
document.body.style.backgroundColor = this.isPlugin ? '#F5F6FA' : '';
},
// 打开登录窗口
openLoginWindow(w = 500, h = 420) {
openLoginWindow() {
const loginCallbackURL = `${window.location.origin}/static/login_success.html?is_ajax=1`;
const loginURL = `${window.GLOBAL_CONFIG.LOGIN_SERVICE_URL}/plain/?size=big&app_code=1&c_url=${loginCallbackURL}`;
// 宽/高
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
const loginUrl = `${window.GLOBAL_CONFIG.LOGIN_SERVICE_URL}/plain/?size=big&app_code=1&c_url=${loginCallbackURL}`;

// 打开新窗口
this.loginWindow = window.open(loginURL, '_blank', `
width=${w},
height=${h},
top=${(screenHeight - h) / 2},
left=${(screenWidth - w) / 2},
channelmode=0,
directories=0,
fullscreen=0,
location=0,
menubar=0,
resizable=0,
scrollbars=0,
status=0,
titlebar=0,
toolbar=0,
close=0
`);
showLoginPopup({ loginUrl });

if (this.loginWindow) this.loginWindow.focus();
},
Expand Down