fix user header and modal detail
This commit is contained in:
@@ -268,6 +268,7 @@ watch(showSplash, (visible) => {
|
|||||||
--app-z-wallet-add-bar: 4510;
|
--app-z-wallet-add-bar: 4510;
|
||||||
--app-z-action-sheet: 5200;
|
--app-z-action-sheet: 5200;
|
||||||
--app-z-dialog: 5300;
|
--app-z-dialog: 5300;
|
||||||
|
--app-z-modal: 1010000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-main {
|
.app-main {
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
|
import { setDialogDefaultOptions } from 'vant'
|
||||||
import VueLazyLoad from 'vue3-lazyload'
|
import VueLazyLoad from 'vue3-lazyload'
|
||||||
import VueApexCharts from 'vue3-apexcharts'
|
import VueApexCharts from 'vue3-apexcharts'
|
||||||
import App from '@/App.vue'
|
import App from '@/App.vue'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
|
import { APP_Z_MODAL } from '@/utils/zIndex'
|
||||||
|
|
||||||
|
setDialogDefaultOptions({
|
||||||
|
teleport: 'body',
|
||||||
|
zIndex: APP_Z_MODAL,
|
||||||
|
})
|
||||||
|
|
||||||
export function createVueApp() {
|
export function createVueApp() {
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|||||||
@@ -152,6 +152,12 @@ html.app-layout--desktop {
|
|||||||
transition: background-color 0.3s ease;
|
transition: background-color 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ماسک مدال روی کل صفحه — هدر، ناوبری و فوتر اعتبار */
|
||||||
|
.ant-modal-mask,
|
||||||
|
.ant-modal-wrap {
|
||||||
|
z-index: var(--app-z-modal, 1010000) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.slide-left-enter-active,
|
.slide-left-enter-active,
|
||||||
.slide-left-leave-active,
|
.slide-left-leave-active,
|
||||||
.slide-right-enter-active,
|
.slide-right-enter-active,
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
import { APP_Z_MODAL } from '@/utils/zIndex'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
show?: boolean
|
show?: boolean
|
||||||
@@ -74,7 +75,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
showCancel: true,
|
showCancel: true,
|
||||||
showOk: true,
|
showOk: true,
|
||||||
okText: 'ثبت',
|
okText: 'ثبت',
|
||||||
zIndex: 5200, // --app-z-action-sheet
|
zIndex: APP_Z_MODAL,
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
v-model:visible="localValue"
|
v-model:visible="localValue"
|
||||||
:title="props.title"
|
:title="props.title"
|
||||||
centered
|
centered
|
||||||
|
:z-index="props.zIndex"
|
||||||
|
:get-container="getModalContainer"
|
||||||
@ok="emits('ok')"
|
@ok="emits('ok')"
|
||||||
@cancel="emits('close')"
|
@cancel="emits('close')"
|
||||||
@close="emits('close')"
|
@close="emits('close')"
|
||||||
@@ -28,6 +30,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
//define emit
|
//define emit
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
import { APP_Z_MODAL, getModalContainer } from '@/utils/zIndex'
|
||||||
|
|
||||||
const emits = defineEmits(['ok', 'close', 'update:visible'])
|
const emits = defineEmits(['ok', 'close', 'update:visible'])
|
||||||
|
|
||||||
@@ -43,6 +46,7 @@ interface Prop {
|
|||||||
wrapClassName?: string
|
wrapClassName?: string
|
||||||
closable?: boolean
|
closable?: boolean
|
||||||
destroyOnClose?:boolean
|
destroyOnClose?:boolean
|
||||||
|
zIndex?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Prop>(), {
|
const props = withDefaults(defineProps<Prop>(), {
|
||||||
@@ -52,7 +56,8 @@ const props = withDefaults(defineProps<Prop>(), {
|
|||||||
customFooter: false,
|
customFooter: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
wrapClassName: '',
|
wrapClassName: '',
|
||||||
closable: true
|
closable: true,
|
||||||
|
zIndex: APP_Z_MODAL,
|
||||||
})
|
})
|
||||||
|
|
||||||
const localValue = computed({
|
const localValue = computed({
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, watch } from 'vue'
|
import { computed, watch } from 'vue'
|
||||||
|
import { APP_Z_MODAL } from '@/utils/zIndex'
|
||||||
|
|
||||||
defineOptions({ inheritAttrs: false })
|
defineOptions({ inheritAttrs: false })
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ const props = withDefaults(
|
|||||||
{
|
{
|
||||||
show: false,
|
show: false,
|
||||||
timeOut: 3000,
|
timeOut: 3000,
|
||||||
zIndex: 5300,
|
zIndex: APP_Z_MODAL,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/** بالای ناوبری (5000)، هدر (1999) و فوتر اعتبار (1000000) */
|
||||||
|
export const APP_Z_MODAL = 1_010_000
|
||||||
|
|
||||||
|
export function getModalContainer(): HTMLElement {
|
||||||
|
return document.body
|
||||||
|
}
|
||||||
@@ -1,20 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
:class="y > 50 ? 'bg-white shadow opacity-95' : ''"
|
ref="headerRef"
|
||||||
class="px-4 py-2 top-0 z-5 wrap-fix background-color-transition"
|
class="app-header px-4 py-2 top-0 z-30 wrap-fix background-color-transition"
|
||||||
|
:class="{ 'app-header--scrolled': scrollY > 50 }"
|
||||||
>
|
>
|
||||||
<div class="flex justify-between my-2 items-center">
|
<div class="flex justify-between my-2 items-center">
|
||||||
<div v-if="isBoursecuProject()" class="flex items-center gap-2">
|
<div v-if="isBoursecuProject()" class="flex items-center gap-2">
|
||||||
<img :src="projectLogo" alt="" class="h-10 w-auto max-w-[9rem] object-contain" />
|
<img :src="projectLogo" alt="" class="h-10 w-auto max-w-[9rem] object-contain" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="flex items-center gap-2" @click.stop="router.push({ name: 'user' })">
|
<div v-else class="flex items-center gap-2" @click.stop="router.push({ name: 'user' })">
|
||||||
<div
|
<div class="z-100000 rounded-full border-1 text-primary border-primary">
|
||||||
class="z-100000 rounded-full border-1"
|
|
||||||
:class="y > 50 ? 'text-primary border-primary' : 'text-primary border-primary'"
|
|
||||||
>
|
|
||||||
<Icon icon="vuesax-linear:user" size="20" />
|
<Icon icon="vuesax-linear:user" size="20" />
|
||||||
</div>
|
</div>
|
||||||
<div :class="y > 50 ? 'text-primary' : 'text-primary'" class="color-transition font-bold">
|
<div class="text-primary color-transition font-bold">
|
||||||
{{ userStore.userInfo?.name }}
|
{{ userStore.userInfo?.name }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,23 +40,68 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||||
import { useWindowScroll } from '@vueuse/core'
|
|
||||||
import { useUserStore } from '@/store/userStore'
|
import { useUserStore } from '@/store/userStore'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import Icon from '@/components/BasicPacks/BasicIcon.vue'
|
import Icon from '@/components/BasicPacks/BasicIcon.vue'
|
||||||
import { getProjectMobileNavLogo, isBoursecuProject } from '@/utils/config'
|
import { getProjectMobileNavLogo, isBoursecuProject } from '@/utils/config'
|
||||||
|
|
||||||
const { y } = useWindowScroll()
|
const headerRef = ref<HTMLElement | null>(null)
|
||||||
|
const scrollY = ref(0)
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const projectLogo = computed(() => getProjectMobileNavLogo())
|
const projectLogo = computed(() => getProjectMobileNavLogo())
|
||||||
|
|
||||||
|
let scrollTarget: HTMLElement | Window | null = null
|
||||||
|
|
||||||
|
function findScrollParent(el: HTMLElement | null): HTMLElement | null {
|
||||||
|
let node = el?.parentElement ?? null
|
||||||
|
|
||||||
|
while (node) {
|
||||||
|
const { overflowY } = getComputedStyle(node)
|
||||||
|
if (overflowY === 'auto' || overflowY === 'scroll') {
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
node = node.parentElement
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateScrollY() {
|
||||||
|
if (!scrollTarget) return
|
||||||
|
scrollY.value = scrollTarget instanceof Window ? scrollTarget.scrollY : scrollTarget.scrollTop
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
scrollTarget = findScrollParent(headerRef.value) ?? window
|
||||||
|
scrollTarget.addEventListener('scroll', updateScrollY, { passive: true })
|
||||||
|
updateScrollY()
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
scrollTarget?.removeEventListener('scroll', updateScrollY)
|
||||||
|
})
|
||||||
|
|
||||||
defineEmits<{
|
defineEmits<{
|
||||||
logout: []
|
logout: []
|
||||||
}>()
|
}>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.app-header {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* عین bg-white shadow opacity-95 قبلی */
|
||||||
|
.app-header--scrolled {
|
||||||
|
background-color: #fff;
|
||||||
|
opacity: 0.95;
|
||||||
|
box-shadow:
|
||||||
|
0 1px 3px 0 rgb(0 0 0 / 0.1),
|
||||||
|
0 1px 2px -1px rgb(0 0 0 / 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
.mhome-header-btn {
|
.mhome-header-btn {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user