Skip to content

Commit

Permalink
feat(front): 导航规范(closed #1501)
Browse files Browse the repository at this point in the history
  • Loading branch information
GONGONGONG authored and ZhuoZhuoCrayon committed Jul 12, 2023
1 parent 0498ea5 commit 03b813b
Show file tree
Hide file tree
Showing 21 changed files with 280 additions and 62 deletions.
6 changes: 5 additions & 1 deletion frontend/index-dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
const LOGIN_URL = ''
const VERSION = ''
const CMDB_URL = ''
const BKAPP_NAV_OPEN_SOURCE_URL = ''
const BKAPP_NAV_HELPER_URL = ''

return {
SITE_URL: SITE_URL,
Expand Down Expand Up @@ -66,7 +68,9 @@
TAM_ID,
LOGIN_URL,
VERSION,
CMDB_URL
CMDB_URL,
BKAPP_NAV_OPEN_SOURCE_URL,
BKAPP_NAV_HELPER_URL,
}
})()
window.$DHCP = window.PROJECT_CONFIG.BKAPP_ENABLE_DHCP === 'True'
Expand Down
48 changes: 26 additions & 22 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,37 +40,41 @@
const LOGIN_URL = '{{ LOGIN_URL }}'
const VERSION = '{{ VERSION }}'
const CMDB_URL = '{{ CMDB_URL }}'
const BKAPP_NAV_HELPER_URL = '{{ BKAPP_NAV_HELPER_URL }}'
const BKAPP_NAV_OPEN_SOURCE_URL = '{{ BKAPP_NAV_OPEN_SOURCE_URL }}'

return {
SITE_URL: SITE_URL,
STATIC_URL: STATIC_URL,
REMOTE_STATIC_URL: REMOTE_STATIC_URL,
RUN_VER: RUN_VER,
APP_CODE,
APPO_IP,
BK_DOCS_CENTER_URL,
BK_PAAS_HOST,
BKAPP_ENABLE_DHCP,
BKAPP_NAV_HELPER_URL,
BKAPP_NAV_OPEN_SOURCE_URL,
BKAPP_NODEMAN_CALLBACK_URL,
BKAPP_RUN_ENV,
CMDB_URL,
DEFAULT_CLOUD: parseInt(DEFAULT_CLOUD),
DEFAULT_SSH_PORT,
DESTOP_URL,
GLOBAL_TASK_CONFIG_PERMISSION,
GLOBAL_SETTING_PERMISSION,
GSE_LISTEN_PORT,
LOGIN_URL,
NGINX_IP,
NGINX_PORT,
APPO_IP,
GSE_LISTEN_PORT,
PROXY_LISTEN_PORT,
WEB_TITLE,
USERNAME,
GLOBAL_TASK_CONFIG_PERMISSION,
GLOBAL_SETTING_PERMISSION,
REMOTE_STATIC_URL: REMOTE_STATIC_URL,
RUN_VER: RUN_VER,
SITE_URL: SITE_URL,
STATIC_URL: STATIC_URL,
TAM_ID,
USE_IAM,
APP_CODE,
WXWORK_UIN,
DESTOP_URL,
BKAPP_NODEMAN_CALLBACK_URL,
BK_PAAS_HOST,
DEFAULT_SSH_PORT,
USE_TJJ,
BK_DOCS_CENTER_URL,
BKAPP_RUN_ENV,
BKAPP_ENABLE_DHCP,
TAM_ID,
LOGIN_URL,
USERNAME,
VERSION,
CMDB_URL
WEB_TITLE,
WXWORK_UIN,
}
})()
window.$DHCP = window.PROJECT_CONFIG.BKAPP_ENABLE_DHCP === 'True'
Expand Down
Binary file modified frontend/src/bk_icon_font/fonts/iconcool.eot
Binary file not shown.
6 changes: 6 additions & 0 deletions frontend/src/bk_icon_font/fonts/iconcool.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/src/bk_icon_font/fonts/iconcool.ttf
Binary file not shown.
Binary file modified frontend/src/bk_icon_font/fonts/iconcool.woff
Binary file not shown.
6 changes: 6 additions & 0 deletions frontend/src/bk_icon_font/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ url("fonts/iconcool.eot?#iefix") format("embedded-opentype");
.nc-parenet-node-line:before {
content: "\e169";
}
.nc-lang-zh-cn:before {
content: "\e170";
}
.nc-lang-en:before {
content: "\e171";
}
.nc-copy-2:before {
content: "\e16a";
}
Expand Down
96 changes: 96 additions & 0 deletions frontend/src/components/common/MixinsControlDropdown.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<template>
<div>
<div
ref="dropdownDefaultRef"
:class="isShow ? 'dropdown-active' : ''"
@click="clickShow"
v-bk-clickoutside="clickoutside">
<slot />
</div>
<div v-show="false">
<div ref="dropdownContentRef" class="bk-dropdown-content" @click="contentClick">
<slot name="content" />
</div>
</div>
</div>
</template>
<script lang="ts">
import { Vue, Component, Prop, Ref } from 'vue-property-decorator';
@Component({
name: 'table-header',
})
export default class MixinsControlDropdown extends Vue {
@Prop({ type: String, default: '' }) private readonly extCls!: string;
@Prop({ type: String, default: 'bottom' }) private readonly placement!: string;
@Prop({ type: String, default: 'nav-dropdown' }) private readonly theme!: string;
@Prop({ type: Boolean, default: false }) private readonly arrow!: boolean;
@Prop({ type: Boolean, default: false }) private readonly disabled!: boolean;
@Prop({ type: Number, default: '0, 0' }) private readonly offset!: string;
@Ref('dropdownDefaultRef') protected readonly dropdownDefaultRef!: any;
@Ref('dropdownContentRef') protected readonly dropdownContentRef!: any;
private isShow = false;
// 切换Popover的触发方式, 规避无法切换导致的问题 (setProps函数的替代方案, 低版tippy本无此方法)
private trigger: 'mouseenter' | 'manual' = 'mouseenter';
private popoverInstance: any = null;
private closeTimer: number | null = null;
private mounted() {
this.updateInstance();
}
private beforeDestroy() {
this.popoverInstance && this.popoverInstance.destroy();
}
public updateInstance() {
this.popoverInstance = this.$bkPopover(this.dropdownDefaultRef, {
content: this.dropdownContentRef,
allowHTML: true,
trigger: 'mouseenter',
arrow: this.arrow,
theme: `light bk-dropdown-popover ${this.theme}`,
offset: this.offset,
maxWidth: 274,
sticky: true,
duration: [275, 0],
interactive: true,
boundary: 'window',
placement: 'top',
hideOnClick: 'toggle',
onHide: () => this.trigger === 'mouseenter',
onTrigger: () => this.isShow = true,
onHidden: () => this.isShow = false,
});
}
public clickShow() {
if (this.popoverInstance) {
this.trigger = 'manual';
this.popoverInstance.show();
}
}
public clickoutside() {
this.setTimer();
}
public contentClick() {
this.clearTimer();
// 可增加 beforeClose 钩子
this.setTimer();
}
public hide() {
this.trigger = 'mouseenter';
this.popoverInstance && this.popoverInstance.hide();
}
public setTimer() {
this.closeTimer = window.setTimeout(this.hide, 50);
};
public clearTimer() {
if (this.closeTimer) {
window.clearTimeout(this.closeTimer);
this.closeTimer = null;
}
};
}
</script>
<style lang="postcss">
</style>
6 changes: 3 additions & 3 deletions frontend/src/components/common/footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export default class NmFooter extends Vue {
private created() {
this.version = window.PROJECT_CONFIG.VERSION;
if (window.PROJECT_CONFIG.RUN_VER === 'ieod') {
if (window.PROJECT_CONFIG.BKAPP_RUN_ENV === 'ieod') {
this.link = [
{
name: window.i18n.t('联系BK助手'),
href: window.PROJECT_CONFIG.WXWORK_UIN,
href: window.PROJECT_CONFIG.BKAPP_NAV_HELPER_URL,
target: '_blank',
},
{
Expand All @@ -40,7 +40,7 @@ export default class NmFooter extends Vue {
this.link = [
{
name: window.i18n.t('技术支持'),
href: 'https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true',
href: window.PROJECT_CONFIG.BKAPP_NAV_HELPER_URL,
target: '_blank',
},
{
Expand Down
Loading

0 comments on commit 03b813b

Please sign in to comment.