changes of giftCard page

This commit is contained in:
2026-10-20 12:11:46 +03:30
parent 2927d64c64
commit e5b3d0c931
55 changed files with 1495 additions and 140 deletions
@@ -16,6 +16,7 @@
<script setup lang="ts">
import { menuIconSize } from '@root/config'
import type { RouteRecordRaw } from 'vue-router'
import { confirmMenuAccess } from '@/utils/adminPageAccess'
const router = useRouter()
interface Props {
@@ -25,6 +26,7 @@ interface Props {
const props = withDefaults(defineProps<Props>(), {})
async function handleClickMenuItem(item: RouteRecordRaw) {
if (!confirmMenuAccess(item.name)) return
router.push({ name: item.name })
}
</script>
+18 -19
View File
@@ -10,7 +10,7 @@
<AMenu
:mode="layoutStore.sideMenu.mode"
:theme="menuTheme"
v-model:selectedKeys="selectedKeys"
:selectedKeys="selectedKeys"
>
<template v-for="item in menu">
<BasicSubMenu
@@ -26,7 +26,7 @@
</template>
<script lang="ts" setup>
import { computed, ref } from 'vue'
import { computed, ref, watch } from 'vue'
import type { ComputedRef } from 'vue'
import { sortBy } from 'lodash'
import { usePrefix } from '@core/composable/usePrefix'
@@ -45,29 +45,28 @@ const selectedKeys = ref<(RouteRecordName | undefined)[]>([])
const routerStore = useRouterStore()
const { menuTheme } = useAdminTheme()
const path: (RouteRecordName | undefined)[] = []
function walkInRoutes(routes: RouteRecordRaw[]) {
for (const route of routes) {
if (route.name == currentRoute.name) {
path.push(route.name)
return true
}
if (route.children && route.children.length > 0) {
path.push(route.name)
const res = walkInRoutes(route.children)
if (!res) {
path.pop()
} else {
function syncSelectedKeys() {
const path: (RouteRecordName | undefined)[] = []
function walkInRoutes(routes: RouteRecordRaw[]): boolean {
for (const route of routes) {
if (route.name == currentRoute.name) {
path.push(route.name)
return true
}
if (route.children && route.children.length > 0) {
path.push(route.name)
const res = walkInRoutes(route.children)
if (!res) path.pop()
else return true
}
}
return false
}
return false
walkInRoutes(routerStore.routes)
selectedKeys.value = path
}
walkInRoutes(routerStore.routes)
selectedKeys.value = path
watch(() => currentRoute.name, syncSelectedKeys, { immediate: true })
function isSupportMenuRoute(item: RouteRecordRaw): boolean {
return item.name === 'support' || item.meta?.permissionsKey === 'support'
+29 -1
View File
@@ -9,6 +9,8 @@ import {
showServerUnavailableOverlay,
} from '@/utils/serverUnavailable'
import { message } from 'ant-design-vue'
import { mutationBlockMessage } from '@/utils/adminPageAccess'
import { readAdminAccessState } from '@/utils/adminAccessState'
//import { isToken } from '@/utils/is'
//import router from '@/router'
//import { getToken, removeToken } from '@/utils/useUtility'
@@ -58,6 +60,18 @@ _axios.interceptors.request.use(
//@ts-ignore
config.headers['Authorization'] = 'Bearer ' + token
}
const routeName = readAdminAccessState().routeName
if (routeName) {
//@ts-ignore
config.headers['X-Admin-Page'] = routeName
}
}
const blocked = mutationBlockMessage(String(config.method || 'get'), config.url)
if (blocked) {
message.warning({ content: blocked, key: 'admin-page-denied' })
const error = new Error(blocked) as Error & { pageAccessDenied?: boolean }
error.pageAccessDenied = true
return Promise.reject(error)
}
return config
},
@@ -77,6 +91,15 @@ _axios.interceptors.response.use(
return response.data
},
async function (error) {
const deniedText = String(error?.message || '')
if (
error?.pageAccessDenied ||
deniedText === 'شما به این صفحه دسترسی ندارید' ||
deniedText === 'شما مجوز ویرایش در این صفحه را ندارید' ||
deniedText === 'شما مجوز حذف در این صفحه را ندارید'
) {
return Promise.reject(error)
}
const router = useRouter()
//console.log('this is axios error', error)
/* if (error.response.data && error.response.data.code) {
@@ -109,7 +132,12 @@ _axios.interceptors.response.use(
await router.push({ name: 'login' })
} else if (error.response && error.response.status == 403) {
if (!error.config?.meta?.silent) {
message.error('شما دسترسی لازم برای انجام این عملیات را ندارید (403)')
const apiMessage = error.response.data?.message
message.error(
typeof apiMessage === 'string' && apiMessage.trim()
? apiMessage
: 'شما دسترسی لازم برای انجام این عملیات را ندارید'
)
}
} else if (error.response && error.response.status == 422) {
if (!error.config?.meta?.silent) {