Skip to content

Commit

Permalink
feat: 登录设置静态页面 TencentBlueKing#1643
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 6142
  • Loading branch information
yuri0528 committed Apr 17, 2024
1 parent 3a34500 commit 9613109
Show file tree
Hide file tree
Showing 16 changed files with 1,153 additions and 1,336 deletions.
6 changes: 1 addition & 5 deletions src/pages/src/components/layouts/DataSourceCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<script setup lang="ts">
import { bkTooltips as vBkTooltips } from 'bkui-vue';
import { AngleDownLine } from 'bkui-vue/lib/icon';
import { computed, ref, watch } from 'vue';
import { computed, defineEmits, defineProps, ref } from 'vue';
import { t } from '@/language/index';
Expand Down Expand Up @@ -92,10 +92,6 @@ const isShow = ref(!props.dataSource?.id);
const text = computed(() => (isShow.value ? t('收起') : t('查看数据源类型')));
watch(() => props.showContent, (val) => {
isShow.value = !val;
});
const toggleState = () => {
isShow.value = !isShow.value;
};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/src/hooks/useDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export const useDataSource = () => {
const syncStatus = ref({});
const initSyncRecords = async () => {
const res = await getSyncRecords({ id: currentDataSourceId.value });
if (res.data?.count === 0 || ['success', 'failed'].includes(syncStatus.value?.status)) return;
syncStatus.value = res.data?.results[0];
if (syncStatus.value?.status === 'success' || syncStatus.value?.status === 'failed') return;
setTimeout(() => {
initSyncRecords();
}, 5000);
Expand Down
8 changes: 6 additions & 2 deletions src/pages/src/http/fetch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,19 @@ const handleResponse = <T>({

const handleReject = (error: AxiosError, config: Record<string, any>) => {
const { status } = error.response;
const { message } = error.response.data.error;
const { message, data } = error.response.data.error;

if (status === 401) {
if (error.config.url === '/api/v1/web/basic/current-user/') {
return window.location.href = getLoginUrl(false);
}
// 登录弹窗
const loginUrl = getLoginUrl();
showLoginModal({ loginUrl });
showLoginModal({
loginUrl,
width: data.width,
height: data.height,
});

return;
}
Expand Down
70 changes: 56 additions & 14 deletions src/pages/src/views/setting/LoginSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<span>{{ item.name }}</span>
<bk-tag
v-if="item.type === 'local'"
class="tag-info"
type="stroke"
theme="info"
>
Expand Down Expand Up @@ -82,7 +83,7 @@
</ul>
<!-- 认证源详情 -->
<bk-sideslider
width="640"
:width="(authDetails?.type === 'local' && detailsConfig.isEdit) ? 960 : 640"
:is-show="detailsConfig.show"
:title="detailsConfig.title"
:before-close="handleBeforeClose"
Expand All @@ -102,27 +103,34 @@
</div>
</template>
<template #default>
<Local
v-if="authDetails?.type === 'local' && detailsConfig.isEdit"
:data="authDetails"
@cancelEdit="cancelEdit" />
<WeCom
v-if="authDetails?.type === 'wecom' && detailsConfig.isEdit"
:data="authDetails"
@cancelEdit="cancelEdit" />
<ViewDetails v-else-if="!detailsConfig.isEdit" :data="authDetails" @updateRow="updateRow" />
<template v-if="authDetails?.type === 'local'">
<Local
v-if="detailsConfig.isEdit"
:current-id="authDetails?.id"
@cancel="cancelEdit"
@success="handleSuccess" />
<LocalView v-else :current-id="authDetails?.id" @updateRow="updateRow" />
</template>
<template v-if="authDetails?.type === 'wecom'">
<WeCom
v-if="detailsConfig.isEdit"
:data="authDetails"
@cancelEdit="cancelEdit" :current-id="authDetails?.id" />
<WeComView v-else />
</template>
</template>
</bk-sideslider>
</div>
</template>

<script setup lang="ts">
import { bkTooltips as vBkTooltips } from 'bkui-vue';
import { inject, reactive, ref } from 'vue';
import { bkTooltips as vBkTooltips, InfoBox } from 'bkui-vue';
import { h, inject, reactive, ref } from 'vue';
import Local from './auth-config/Local.vue';
import ViewDetails from './auth-config/ViewDetails.vue';
import LocalView from './auth-config/LocalView.vue';
import WeCom from './auth-config/WeCom.vue';
import WeComView from './auth-config/WeComView.vue';
import { t } from '@/language/index';
import { useMainViewStore } from '@/store';
Expand All @@ -133,7 +141,7 @@ const editLeaveBefore = inject('editLeaveBefore');
const loginMethods = ref([
{
id: 'a48b55c2f3fb41ec8df661a5ea0e1cb6',
id: '1',
logo: 'bk-sq-icon icon-personal-user',
name: '账密登录1',
status: 'enable',
Expand Down Expand Up @@ -226,6 +234,32 @@ const handleBeforeClose = async () => {
return Promise.resolve(enableLeave);
}
};
const handleSuccess = () => {
window.changeInput = false;
detailsConfig.show = false;
InfoBox({
title: t('配置成功'),
infoType: 'success',
subTitle: h('div', {
style: {
height: '44px',
background: '#F5F7FA',
lineHeight: '44px',
},
}, [
h('i', {
class: 'user-icon icon-info-i',
}),
h('span', {
style: {
fontSize: '12px',
marginLeft: '8px',
},
}, t('账号重置需要一定时间,账号生效以最终邮件通知为准')),
]),
});
};
</script>

<style lang="less" scoped>
Expand Down Expand Up @@ -291,6 +325,14 @@ const handleBeforeClose = async () => {
right: -6px;
background: #2DCB9D;
}
.tag-info {
background: #F0F5FF;
:deep(.bk-tag-text) {
background: #F0F5FF;
}
}
}
.not {
Expand Down
48 changes: 48 additions & 0 deletions src/pages/src/views/setting/auth-config/Local.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.details-wrapper {
position: relative;
height: calc(100vh - 84px);
padding: 24px;
background: #F5F7FA;

.div-flex {
display: flex;
align-items: center;
font-size: 14px;
color: #63656e;
}

.form-item-flex {
::v-deep .bk-form-content {
display: flex;

.input-password {
width: 240px;
margin-left: 28px;
}
}
}

.error-text {
font-size: 12px;
line-height: 1;
color: #ea3636;
}

.footer {
position: fixed;
bottom: 0;
left: 0;
z-index: 9;
width: 100%;
height: 48px;
padding-left: 24px;
margin-bottom: 0;
line-height: 48px;
background: #FAFBFD;
box-shadow: 0 -1px 0 0 #DCDEE5;

button {
min-width: 88px;
}
}
}
Loading

0 comments on commit 9613109

Please sign in to comment.