diff --git a/components.d.ts b/components.d.ts index 078cddf..f9567c0 100644 --- a/components.d.ts +++ b/components.d.ts @@ -73,5 +73,6 @@ declare module '@vue/runtime-core' { CustomTag: typeof import('./src/components/CustomTag.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] + UploadPic: typeof import('./src/components/UploadPic.vue')['default'] } } diff --git a/src/api/consts.ts b/src/api/consts.ts index 4bc754a..532f7ce 100644 --- a/src/api/consts.ts +++ b/src/api/consts.ts @@ -19,3 +19,9 @@ export const updateEditConst = async (obj: Const) => export const createAddConst = async (obj: Const) => await useAxios.post(`/admin/const`, obj) export const deleteConst = async (id: number) => await useAxios.delete(`/api/const/${id}`) + +export const updateBannerConst = async (obj: Const) => + await useAxios.put(`/admin/const/2`, obj) + +export const getHeaderBannerConst = async () => + await useAxios.get>('/api/const/key/header_banner') \ No newline at end of file diff --git a/src/components/UploadPic.vue b/src/components/UploadPic.vue new file mode 100644 index 0000000..7bd9dc6 --- /dev/null +++ b/src/components/UploadPic.vue @@ -0,0 +1,123 @@ + + + + + + \ No newline at end of file diff --git a/src/model/banner.ts b/src/model/banner.ts new file mode 100644 index 0000000..4079fe8 --- /dev/null +++ b/src/model/banner.ts @@ -0,0 +1,45 @@ +export interface IBanner { + show: boolean + large: string | null + medium: string | null + small: string | null + banner1: string | null + banner2: string | null + banner3: string | null + banner4: string | null + banner5: string | null + banner6: string | null + banner_1_link: string | null + banner_2_link: string | null + banner_3_link: string | null + banner_4_link: string | null + banner_5_link: string | null + banner_6_link: string | null + } +export interface IBenefits { + show: boolean + icon: string | null + caption: string | null + link: string | null + } +export interface countryCreator { + caption: string | null + key: string | null + value: string | null +} +export interface priceRange { + min: number | null + max: number | null + key: string | null + value: string | null +} +export interface Categories { + caption: number | null + key: string | null + value: string | null + link: string | null +} +export interface notificationBar { + notifBar_text: string + notifBar_show: boolean +} \ No newline at end of file diff --git a/src/pages/menuPages/banners/index.vue b/src/pages/menuPages/banners/index.vue new file mode 100644 index 0000000..f5f5929 --- /dev/null +++ b/src/pages/menuPages/banners/index.vue @@ -0,0 +1,91 @@ + + + + + \ No newline at end of file diff --git a/src/pages/menuPages/products/base/index.vue b/src/pages/menuPages/products/base/index.vue index f5efca8..a505723 100644 --- a/src/pages/menuPages/products/base/index.vue +++ b/src/pages/menuPages/products/base/index.vue @@ -108,7 +108,16 @@ - + + + + + + = [ } ]; +const GaroosiCategoryItems: Array = [ + { + value: "طلا" + }, + { + value: "مکعب" + }, + { + value: "گوی" + }, + { + value: "سکه" + }, + { + value: "سکه پارسیان" + }, + { + value: "مس" + }, + { + value: "نقره" + } +]; const categoryItems: Array = [ { value: "آبشده" @@ -829,6 +862,7 @@ const minusPrice = () => { import customParseFormat from "dayjs/plugin/customParseFormat"; import locale from "ant-design-vue/es/date-picker/locale/fa_IR"; +import { getConfigApp } from '@/utils/config' dayjs.extend(customParseFormat); const customLocale = ref({ diff --git a/src/router/index.ts b/src/router/index.ts index d7efa92..7450ffa 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -2,6 +2,7 @@ //import router from '@/core/router/index' import { useRouterStore } from '@core/stores/router' import type { Router, RouteRecordRaw } from 'vue-router' +import { getConfigApp } from '@/utils/config' //const _router = useRouter() //import { cloneDeep } from 'lodash' @@ -12,6 +13,8 @@ export function setupRoutes(permissionsKeys: string[], router?: Router) { const routerStore = useRouterStore() const modules = import.meta.glob('./routes/*.ts', { eager: true }) console.log(modules) + const appName = getConfigApp('name') + function walkInRoutes(routes: RouteRecordRaw) { if (!routes.children) return routes.children = routes?.children?.filter( @@ -40,6 +43,17 @@ export function setupRoutes(permissionsKeys: string[], router?: Router) { } return } + + function filterRoutesByApp(routes: RouteRecordRaw) { + if (!routes.children) return + routes.children = routes.children.filter((item) => { + if (item.name === 'discounts' && appName !== 'goldsun') return false + if (item.name === 'banners' && appName !== 'garoosi') return false + return true + }) + routes.children.forEach((child) => filterRoutesByApp(child)) + } + routerStore.routes = [ { path: '/:pathMatch(.*)*', @@ -64,6 +78,7 @@ export function setupRoutes(permissionsKeys: string[], router?: Router) { const route: RouteRecordRaw | undefined = modules[modulesKey].default ?? undefined if (route) { if (permissionsKeys.length && permissionsKeys[0] == '*') { + filterRoutesByApp(route) routerStore.routes.push(route) if (router) { router.addRoute(route) @@ -74,6 +89,7 @@ export function setupRoutes(permissionsKeys: string[], router?: Router) { (route.meta.permissionsKey && permissionsKeys.includes(route.meta.permissionsKey)) ) { walkInRoutes(route) + filterRoutesByApp(route) routerStore.routes.push(route) if (router) { router.addRoute(route) diff --git a/src/router/routes/setting.ts b/src/router/routes/setting.ts index 691b6d5..5753b69 100644 --- a/src/router/routes/setting.ts +++ b/src/router/routes/setting.ts @@ -67,9 +67,9 @@ const Setting: RouteRecordRaw = { component: () => import('@/pages/menuPages/discount/index.vue'), meta: { permissionsKey: 'discounts', - icon: 'vuesax-linear:notification-bing', + icon: 'vuesax-linear:discount-shape', title: 'تخفیفات', - hideMenu: getConfigApp.name !== "goldsun" + hideMenu: getConfigApp('name') !== "goldsun" } }, { @@ -82,6 +82,16 @@ const Setting: RouteRecordRaw = { //hideChildren: false } }, + { + name: 'banners', + path: 'banners', + component: () => import('@/pages/menuPages/banners/index.vue'), + meta: { + icon: 'vuesax-linear:image', + title: 'بنرها', + hideMenu: getConfigApp('name') !== "garoosi" + } + }, ] } ]