Skip to content

Commit

Permalink
Merge pull request #2651 from lhzzforever/dev/develop_ci_renewal_notice
Browse files Browse the repository at this point in the history
feature: 注释通知模板入口
  • Loading branch information
ielgnaw authored May 11, 2024
2 parents cb17142 + 2f9c399 commit 2363bab
Show file tree
Hide file tree
Showing 11 changed files with 225 additions and 54 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>
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"@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.14",
"@commitlint/cli": "~13.1.0",
Expand Down
22 changes: 11 additions & 11 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,16 +187,16 @@
});
},
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);
});
// 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) {
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
5 changes: 3 additions & 2 deletions frontend/src/components/auth/index.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<template>
<div class="bk-login-dialog" v-if="isShow">
<!-- <div class="bk-login-dialog" v-if="isShow">
<div class="bk-login-wrapper">
<iframe :src="iframeSrc" scrolling="no" border="0" width="400" height="400"></iframe>
</div>
</div>
</div> -->
<div></div>
</template>

<script>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/header-nav/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@
window.localStorage.removeItem('iam-header-name-cache');
window.localStorage.removeItem('applyGroupList');
window.localStorage.removeItem('index');
window.location = window.LOGIN_SERVICE_URL + '/?c_url=' + window.location.href;
window.location = `${window.LOGIN_SERVICE_URL}/?c_url=${encodeURIComponent(window.location.href)}`;
},
handleManager () {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/group/components/member-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@
width: auto !important;
.bk-cascade-options {
width: auto !important;
height: 70px !important;
height: 72px !important;
}
.bk-cascade-panel {
.bk-cascade-panel-ul {
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/views/perm/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,12 @@
{ code: teporarySystemCode, data: teporarySystemData },
{ code: departmentGroupCode, data: departmentGroupData }
] = await Promise.all(requestList);
const personalGroupList = personalGroupData && personalGroupData.results ? personalGroupData.results : [];
this.personalGroupList.splice(0, this.personalGroupList.length, ...personalGroupList);
this.$set(this.panels[0], 'count', personalGroupData.count || 0);
this.emptyData = formatCodeData(personalGroupCode, this.emptyData, this.personalGroupList.length === 0);
const systemList = customData || [];
this.systemList.splice(0, this.systemList.length, ...systemList);
this.systemListStorage = _.cloneDeep(systemList);
Expand Down Expand Up @@ -438,19 +438,19 @@
{ code: memberTempByUserCode, data: memberTempByUserData },
{ code: memberTempByDepartCode, data: memberTempByDepartData }
] = await Promise.all(list);
const memberTempByUserCount = memberTempByUserData.count || 0;
this.memberTempByUserList = memberTempByUserData.results || [];
const memberTempByDepartCount = memberTempByDepartData.count || 0;
this.memberTempByDepartList = memberTempByDepartData.results || [];
this.panels[2] = Object.assign(this.panels[2], {
userCount: memberTempByUserCount,
departCount: memberTempByDepartCount,
count: memberTempByUserCount + memberTempByDepartCount
});
this.emptyDepartmentGroupData = formatCodeData(
memberTempByUserCode || memberTempByDepartCode,
this.emptyMemberTemplateData,
Expand Down Expand Up @@ -483,7 +483,7 @@
}
}
},
// 获取搜索的个人用户组
async fetchUserGroupSearch () {
try {
Expand Down Expand Up @@ -767,7 +767,7 @@
}
return payload || [];
},
formatCheckGroups () {
const selectList = this.panels[0].selectList.map(item => item.id.toString());
setTimeout(() => {
Expand Down Expand Up @@ -859,7 +859,7 @@
name: 'applyProvisionPerm'
});
},
handleEmptyRefresh () {
this.isSearchPerm = false;
this.$refs.iamResourceSearchRef && this.$refs.iamResourceSearchRef.handleEmptyRefresh();
Expand Down
24 changes: 13 additions & 11 deletions frontend/src/views/renewal-notice/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
</div>
<div class="gou" />
</div>
<div class="notice-temp">
<!-- 暂时注释,待二期后台提供接口对接 -->
<!-- <div class="notice-temp">
<Icon type="setting" class="notice-temp-icon" />
<div class="notice-temp-label" @click.stop="handleShowNoticeTemp(item)" :style="tempSetStyle">
{{ $t(`m.renewalNotice['模板']`) }}
</div>
</div>
</div> -->
</div>
</div>
<div v-if="isMethodsEmpty" class="notice-empty-error methods-empty-error">
Expand Down Expand Up @@ -287,19 +288,19 @@
}
},
created () {
this.fetchSuperNoticeConfig(false, false);
this.fetchSuperNoticeConfig(false, false, true);
},
mounted () {
this.handleGetBusQueryData();
},
methods: {
async fetchSuperNoticeConfig (isReset = false, isStatus = false) {
this.isLoading = true;
async fetchSuperNoticeConfig (isReset = false, isStatus = false, isLoading = false) {
this.isLoading = isLoading;
try {
const { data } = await this.$store.dispatch('renewalNotice/getSuperNoticeConfig');
if (data) {
if (!data.hasOwnProperty('enable')) {
data.enable = true;
data.enable = false;
}
// 如果是重置操作,只需赋值给重置变量
if (isReset) {
Expand Down Expand Up @@ -329,7 +330,7 @@
const typeMap = {
submit: async () => {
if (JSON.stringify(this.noticeForm) !== JSON.stringify(this.noticeFormReset)) {
await this.fetchSuperNoticeConfig(true, false);
await this.fetchSuperNoticeConfig(true, false, false);
}
await this.$store.dispatch('renewalNotice/updateSuperNoticeConfig', this.noticeForm);
this.messageSuccess(this.$t(`m.info['保存成功']`), 3000);
Expand Down Expand Up @@ -496,7 +497,7 @@
handleGetBusQueryData () {
bus.$on('on-update-renewal-notice', async ({ isShowRenewalNotice }) => {
await this.fetchSuperNoticeConfig(false, true);
await this.fetchSuperNoticeConfig(false, true, false);
this.noticeForm.enable = isShowRenewalNotice || false;
await this.handleSubmit('status');
});
Expand Down Expand Up @@ -555,7 +556,8 @@
}
}
.notice-methods {
margin-bottom: 44px;
/* margin-bottom: 44px; */
margin-bottom: 24px;
&-list {
display: flex;
align-items: center;
Expand Down Expand Up @@ -758,9 +760,9 @@
color: #ff5656;
font-size: 12px;
margin-top: 4px;
&.methods-empty-error {
/* &.methods-empty-error {
margin-top: 24px;
}
} */
}
.renewal-notice-footer {
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion saas/backend/api/admin/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# 用户组基本信息更新 & 删除
path(
"groups/<int:id>/",
views.AdminGroupInfoViewSet.as_view({"get": "update", "delete": "destroy"}),
views.AdminGroupInfoViewSet.as_view({"put": "update", "delete": "destroy"}),
name="open.admin.group",
),
# 用户组成员
Expand Down
Loading

0 comments on commit 2363bab

Please sign in to comment.