From ad106d35ebd06e5e122fd1af31c8e2aac94ab0c7 Mon Sep 17 00:00:00 2001 From: p-honggang.li <p-honggang.li@pcitc.com> Date: 星期五, 29 八月 2025 14:01:08 +0800 Subject: [PATCH] 修改配置 --- src/utils/env.ts | 65 ++++++++++++++++++++++++++++++++ src/views/layout/index.vue | 23 ++++++++--- src/components/fileInfoPreview/index.vue | 2 src/views/productManage/price/index.vue | 6 --- 4 files changed, 83 insertions(+), 13 deletions(-) diff --git a/src/components/fileInfoPreview/index.vue b/src/components/fileInfoPreview/index.vue index b885d58..a4c7a64 100644 --- a/src/components/fileInfoPreview/index.vue +++ b/src/components/fileInfoPreview/index.vue @@ -6,7 +6,7 @@ <div v-if="state.fileSuffix == '.doc'" ref="fileT" class="files"></div> <div v-if="state.fileSuffix == '.pdf'" style="height: 81vh"> <iframe - :src="`/manage/pdfjs/web/viewer.html?file=${encodeURIComponent(pdfurl)}`" + :src="`/trade/pdfjs/web/viewer.html?file=${encodeURIComponent(pdfurl)}`" width="100%" height="100%" /> diff --git a/src/utils/env.ts b/src/utils/env.ts new file mode 100644 index 0000000..258ff87 --- /dev/null +++ b/src/utils/env.ts @@ -0,0 +1,65 @@ +/** + * 鐜閰嶇疆绠$悊 + */ + +// 鐜绫诲瀷鏋氫妇 +export enum Environment { + DEVELOPMENT = 'development', + PRODUCTION = 'production', + TEST = 'test' +} + +// 鑾峰彇褰撳墠鐜 +export const getCurrentEnvironment = (): Environment => { + const mode = import.meta.env.MODE + if (mode === 'development') return Environment.DEVELOPMENT + if (mode === 'production') return Environment.PRODUCTION + if (mode === 'test') return Environment.TEST + return Environment.DEVELOPMENT // 榛樿寮�鍙戠幆澧� +} + +// 鏄惁涓哄紑鍙戠幆澧� +export const isDevelopment = (): boolean => { + return import.meta.env.DEV +} + +// 鏄惁涓虹敓浜х幆澧� +export const isProduction = (): boolean => { + return import.meta.env.PROD +} + +// 鏄惁涓烘祴璇曠幆澧� +export const isTest = (): boolean => { + return import.meta.env.MODE === 'test' +} + +// 鑿滃崟鏄剧ず閰嶇疆 +export const getMenuConfig = () => { + return { + // 寮�鍙戠幆澧冩樉绀烘墍鏈夎彍鍗� + showLeftMenu: isDevelopment(), + showTopMenu: isDevelopment(), + showHeader: isDevelopment(), + showFooter: isDevelopment(), + // 鐢熶骇鐜鍙樉绀洪〉闈㈠唴瀹� + showPageContent: true + } +} + +// 甯冨眬鏍峰紡閰嶇疆 +export const getLayoutConfig = () => { + const isDev = isDevelopment() + return { + // 涓诲鍣ㄩ珮搴� + mainContainerHeight: isDev ? 'calc(95vh - 90px)' : '100vh', + // 鏄惁鏄剧ず渚ц竟鏍� + showSidebar: isDev, + // 鏄惁鏄剧ず椤堕儴瀵艰埅 + showTopNav: isDev, + // 鏄惁鏄剧ず澶撮儴 + showHeader: isDev, + // 鏄惁鏄剧ず搴曢儴鐗堟潈淇℃伅 + showFooter: isDev + } +} + diff --git a/src/views/layout/index.vue b/src/views/layout/index.vue index 3d30d3a..5146abe 100644 --- a/src/views/layout/index.vue +++ b/src/views/layout/index.vue @@ -1,27 +1,30 @@ <template> <div class="app-wrapper" :class="classObj"> - <div class="header" style="width: auto; overflow: inherit" v-if="!containerOperate?.specialcontainer"> + <!-- 澶撮儴鑿滃崟 - 鏍规嵁鐜閰嶇疆鏄剧ず --> + <div class="header" style="width: auto; overflow: inherit" v-if="!containerOperate?.specialcontainer && menuConfig.showHeader"> <AppHeader @menuCollapse="changeMenuCollapse"></AppHeader> </div> - <div class="header" style="width: auto; overflow: inherit" v-if="containerOperate?.specialcontainer"> + <div class="header" style="width: auto; overflow: inherit" v-if="containerOperate?.specialcontainer && menuConfig.showHeader"> <template v-if="currentMenuCode!='activityInitiate'&¤tMenuCode!='activityInitiate6'"> <AppActHeader ref='appActHeaderRef' ></AppActHeader> </template> </div> <div :class="containerOperate?.specialcontainer?'content-wrapperall':'content-wrapper'"> + <!-- 宸︿晶鑿滃崟 - 鏍规嵁鐜閰嶇疆鏄剧ず --> <LeftSidebar - v-if="!containerOperate?.specialcontainer" + v-if="!containerOperate?.specialcontainer && menuConfig.showLeftMenu" class="sidebar-container" :menuState="menuState" ></LeftSidebar> <div class="main-container"> - <topMenu class="nav-head" v-if="!containerOperate?.specialcontainer"></topMenu> + <!-- 椤堕儴鑿滃崟 - 鏍规嵁鐜閰嶇疆鏄剧ず --> + <topMenu class="nav-head" v-if="!containerOperate?.specialcontainer && menuConfig.showTopMenu"></topMenu> <!-- <el-main class="main"> <Breadcrumb id="breadcrumb" class="breadcrumb" /> </el-main> --> <el-scrollbar class="scrollbar-main" - :style="{ 'max-height': 'calc(95vh - 90px)','min-width':'900px' }" + :style="{ 'max-height': layoutConfig.mainContainerHeight, 'min-width':'900px' }" ref="scrollViewContainer" > <router-view v-slot="{ Component, route }"> @@ -36,7 +39,8 @@ </transition> </router-view> </el-scrollbar> - <div class="fontDiv">涓浗浜ら�氬缓璁鹃泦鍥㈡湁闄愬叕鍙� 鐗堟潈鎵�鏈�</div> + <!-- 鐗堟潈淇℃伅 - 鏍规嵁鐜閰嶇疆鏄剧ず --> + <div class="fontDiv" v-if="menuConfig.showFooter">涓浗浜ら�氬缓璁鹃泦鍥㈡湁闄愬叕鍙� 鐗堟潈鎵�鏈�</div> </div> </div> </div> @@ -53,6 +57,8 @@ import { storeToRefs } from 'pinia' import { useNavTabs } from '@/stores/modules/navTabs' import { useRoute } from 'vue-router' +// 瀵煎叆鐜閰嶇疆宸ュ叿 +import { getMenuConfig, getLayoutConfig } from '@/utils/env' const navTabsStore = useNavTabs() const appActHeaderRef=ref() @@ -60,6 +66,11 @@ const { cachedViews, excludeViews } = storeToRefs(navTabsStore) const scrollViewContainer = ref() const isRouterAlive = ref<boolean>(true) + +// 鐜閰嶇疆 +const menuConfig = computed(() => getMenuConfig()) +const layoutConfig = computed(() => getLayoutConfig()) + const reload = () => { isRouterAlive.value = false nextTick(() => { diff --git a/src/views/productManage/price/index.vue b/src/views/productManage/price/index.vue index 5752e6e..57e9d93 100644 --- a/src/views/productManage/price/index.vue +++ b/src/views/productManage/price/index.vue @@ -223,12 +223,6 @@ </template> </el-dialog> - <!-- 浠锋牸鏌ョ湅鍣� --> - <ProductPriceViewer - v-model="showPriceViewer" - :product-id="currentProductId" - @order="handleOrderResult" - /> </div> </template> -- Gitblit v1.8.0