Skip to content

Commit

Permalink
feature: 蓝鲸统一登录改造——支持限制非腾讯用户访问方案 #2247
Browse files Browse the repository at this point in the history
  • Loading branch information
hLinx committed Jul 20, 2023
1 parent 2283f70 commit c3aed86
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
10 changes: 7 additions & 3 deletions src/frontend/src/common/bkmagic.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import ApplyPermissionDialog from '@components/apply-permission/apply-dialog';

import PassLogin from '@blueking/paas-login';

import i18n from '@/i18n';

// 全量引入
import './fully-import';

Expand Down Expand Up @@ -143,9 +145,11 @@ export const permissionDialog = (authParams = {}, authResult = {}) => {
let systemPermissionInstance;
export const systemPermission = (message) => {
if (!systemPermissionInstance) {
systemPermissionInstance = new Vue(SystemPermission).$mount();
systemPermissionInstance.message = message;
console.dir(systemPermissionInstance.$el);
systemPermissionInstance = new Vue({
i18n,
render: h => h(SystemPermission, { attrs: { message } }),
}).$mount();

systemPermissionInstance.$nextTick(() => {
document.body.innerHTML = systemPermissionInstance.$el.outerHTML;
});
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/i18n/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,4 +594,5 @@ export default {
取消收藏成功: 'Remove from my-favorite-list successful',
'复制 IP': 'Copy IP',
'复制 IPv6': 'Copy IPv6',
无该应用的访问权限: 'Do not have access permission for the current application.',
};
2 changes: 1 addition & 1 deletion src/frontend/src/utils/request/middleware/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default (interceptors) => {
// 没权限
case 403: {
// 系统访问权限
if (error.response.data.code === 1302403) {
if (error.response.data.code === 1247403) {
systemPermission(error.response.data.data);
} else {
// 资源访问权限
Expand Down
8 changes: 6 additions & 2 deletions src/frontend/src/views/system-permission.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<template>
<div class="system-permission">
<bk-exception type="403">
<span>无该应用的访问权限</span>
<span>{{ $t('无该应用的访问权限') }}</span>
<div class="text-subtitle">
请联系 {{ message }} 开通
{{ message }}
</div>
</bk-exception>
</div>
</template>
<script setup>
import { getCurrentInstance } from 'vue';
defineProps({
message: String,
});
console.log('getCurrentInstance = ', getCurrentInstance());
</script>
<style lang="postcss">
.system-permission{
Expand Down

0 comments on commit c3aed86

Please sign in to comment.