Skip to content

Commit 87434bb

Browse files
committed
refactor:统一和调高系统级 z-index 配置值
1 parent cee9acf commit 87434bb

11 files changed

Lines changed: 34 additions & 18 deletions

File tree

web/src/api/common.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { AxiosRequestConfig } from 'axios'
1010
import { uuid } from '/@/utils/random'
1111
import { i18n } from '../lang'
1212
import { adminBaseRoutePath } from '/@/router/static/adminBase'
13+
import { SYSTEM_ZINDEX } from '/@/stores/constant/common'
1314

1415
/*
1516
* 公共请求函数和Url定义
@@ -60,7 +61,7 @@ export function fileUpload(fd: FormData, params: anyObj = {}, forceLocal = false
6061
ElNotification({
6162
type: 'error',
6263
message: errorMsg,
63-
zIndex: 9999,
64+
zIndex: SYSTEM_ZINDEX,
6465
})
6566
reject(errorMsg)
6667
})

web/src/components/clickCaptcha/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { computed, reactive } from 'vue'
4343
import { Props } from './index'
4444
import { checkClickCaptcha, getCaptchaData } from '/@/api/common'
4545
import { i18n } from '/@/lang'
46+
import { SYSTEM_ZINDEX } from '/@/stores/constant/common'
4647
4748
const props = withDefaults(defineProps<Props>(), {
4849
uuid: '',
@@ -135,7 +136,7 @@ load()
135136
border: 1px solid var(--el-border-color-extra-light);
136137
background-color: var(--el-color-white);
137138
position: fixed;
138-
z-index: 9999991;
139+
z-index: v-bind('SYSTEM_ZINDEX');
139140
left: calc(50% - v-bind('captchaBoxLeft'));
140141
top: calc(50% - v-bind('captchaBoxTop'));
141142
border-radius: 10px;

web/src/components/contextmenu/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import { onMounted, reactive, toRaw } from 'vue'
2626
import { useEventListener } from '@vueuse/core'
2727
import type { Axis, ContextMenuItemClickEmitArg, Props } from './interface'
28+
import { SYSTEM_ZINDEX } from '/@/stores/constant/common'
2829
2930
const props = withDefaults(defineProps<Props>(), {
3031
width: 150,
@@ -115,7 +116,7 @@ onMounted(() => {
115116
<style scoped lang="scss">
116117
.ba-contextmenu {
117118
position: fixed;
118-
z-index: 9999;
119+
z-index: v-bind('SYSTEM_ZINDEX');
119120
}
120121
.el-popper,
121122
.el-popper.is-light .el-popper__arrow::before {

web/src/layouts/backend/components/aside.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import MenuVertical from '/@/layouts/backend/components/menus/menuVertical.vue'
1313
import MenuVerticalChildren from '/@/layouts/backend/components/menus/menuVerticalChildren.vue'
1414
import { useConfig } from '/@/stores/config'
1515
import { useNavTabs } from '/@/stores/navTabs'
16+
import { SYSTEM_ZINDEX } from '/@/stores/constant/common'
1617
1718
defineOptions({
1819
name: 'layout/aside',
@@ -48,6 +49,6 @@ const menuWidth = computed(() => config.menuWidth())
4849
position: fixed;
4950
top: 0;
5051
left: 0;
51-
z-index: 9999999;
52+
z-index: v-bind('SYSTEM_ZINDEX');
5253
}
5354
</style>

web/src/layouts/backend/components/closeFullScreen.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<script setup lang="ts">
1111
import { reactive, onMounted } from 'vue'
1212
import { useNavTabs } from '/@/stores/navTabs'
13+
import { SYSTEM_ZINDEX } from '/@/stores/constant/common'
1314
1415
const navTabs = useNavTabs()
1516
@@ -43,7 +44,7 @@ const onCloseFullScreen = () => {
4344
justify-content: center;
4445
position: fixed;
4546
right: calc(50% - 20px);
46-
z-index: 9999999;
47+
z-index: v-bind('SYSTEM_ZINDEX');
4748
height: 40px;
4849
width: 40px;
4950
background-color: rgba($color: #000000, $alpha: 0.1);
@@ -63,7 +64,7 @@ const onCloseFullScreen = () => {
6364
.close-full-screen-on {
6465
position: fixed;
6566
top: 0;
66-
z-index: 9999998;
67+
z-index: v-bind('SYSTEM_ZINDEX');
6768
height: 60px;
6869
width: 100px;
6970
left: calc(50% - 50px);

web/src/stores/constant/common.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* 公共常量定义
3+
*/
4+
5+
/**
6+
* 系统级 z-index 配置,比如全局通知消息的 z-index(浏览器支持的最大值通常为 2147483647)
7+
*/
8+
export const SYSTEM_ZINDEX = 2147483600

web/src/stores/terminal.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { nextTick, reactive } from 'vue'
44
import { buildTerminalUrl } from '/@/api/common'
55
import { i18n } from '/@/lang/index'
66
import { STORE_TERMINAL } from '/@/stores/constant/cacheKey'
7+
import { SYSTEM_ZINDEX } from '/@/stores/constant/common'
78
import { taskStatus } from '/@/stores/constant/terminalTaskStatus'
89
import type { Terminal } from '/@/stores/interface/index'
910
import { timeFormat } from '/@/utils/common'
@@ -124,7 +125,7 @@ export const useTerminal = defineStore(
124125
ElNotification({
125126
type: 'error',
126127
message: i18n.global.t('terminal.Newly added tasks will never start because they are blocked by failed tasks'),
127-
zIndex: 9999,
128+
zIndex: SYSTEM_ZINDEX,
128129
})
129130
break
130131
}

web/src/styles/app.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ body,
9494
transform: translateY(-4px) scale(1.02);
9595
-webkit-box-shadow: 0 14px 24px rgba(0, 0, 0, 0.2);
9696
box-shadow: 0 14px 24px rgba(0, 0, 0, 0.2);
97-
z-index: 999;
97+
z-index: 2147483600;
9898
border-radius: 6px;
9999
}
100100
/* 鼠标置入浮动效果-e */
@@ -148,7 +148,7 @@ body,
148148
height: 100vh;
149149
width: 100vw;
150150
background-color: rgba(0, 0, 0, 0.5);
151-
z-index: 9999990;
151+
z-index: 2147483599;
152152
}
153153
/* 全局遮罩-e */
154154

@@ -216,7 +216,7 @@ body,
216216
#nprogress {
217217
.bar,
218218
.spinner {
219-
z-index: 999999;
219+
z-index: 2147483600;
220220
}
221221
}
222222
/* NProgress-e */

web/src/styles/loading.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
width: 100%;
33
height: 100%;
44
position: fixed;
5-
z-index: 9990;
5+
z-index: 2147483600;
66
background-color: var(--ba-bg-color);
77
}
88
.block-loading .block-loading-box {

web/src/utils/axios.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import adminBaseRoute from '/@/router/static/adminBase'
88
import { memberCenterBaseRoutePath } from '/@/router/static/memberCenterBase'
99
import { useAdminInfo } from '/@/stores/adminInfo'
1010
import { useConfig } from '/@/stores/config'
11+
import { SYSTEM_ZINDEX } from '/@/stores/constant/common'
1112
import { useUserInfo } from '/@/stores/userInfo'
1213
import { isAdminApp } from '/@/utils/common'
1314

@@ -173,7 +174,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(axiosConfig: AxiosRequest
173174
ElNotification({
174175
type: 'error',
175176
message: response.data.msg,
176-
zIndex: 9999,
177+
zIndex: SYSTEM_ZINDEX,
177178
})
178179
}
179180
// 自动跳转到路由name或path
@@ -201,7 +202,7 @@ function createAxios<Data = any, T = ApiPromise<Data>>(axiosConfig: AxiosRequest
201202
ElNotification({
202203
message: response.data.msg ? response.data.msg : i18n.global.t('axios.Operation successful'),
203204
type: 'success',
204-
zIndex: 9999,
205+
zIndex: SYSTEM_ZINDEX,
205206
})
206207
}
207208
}
@@ -281,7 +282,7 @@ function httpErrorStatusHandle(error: any) {
281282
ElNotification({
282283
type: 'error',
283284
message,
284-
zIndex: 9999,
285+
zIndex: SYSTEM_ZINDEX,
285286
})
286287
}
287288

0 commit comments

Comments
 (0)