huangyinfeng
6 天以前 a9a03d64cf190188d3db04d14970fc0908b03491
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
 
<template>
  <div>
      <a-layout class="default-theme" style="display: flex; height: 100%; background-color: #fff">
        <a-layout-sider width="250"  style="border-inline-end: 1px solid rgb(5 5 5 / 6%)" :style="siderStyle"  v-show="collapseStore.isOpen">
          <LeftNav></LeftNav>
        </a-layout-sider>
        <a-layout>
        <a-layout-content :style="contentStyle">
          <RouterView>
            <template #default="{ Component, route }">
              <transition
                :name="
                  getTransitionName({
                    route,
                    openCache,
                    enableTransition: getEnableTransition,
                    cacheTabs: getCaches,
                    def: getBasicTransition,
                  })
                "
                mode="out-in"
                appear
              >
                <keep-alive v-if="openCache" :include="getCaches">
                  <component :is="Component" :key="route.fullPath" />
                </keep-alive>
                <component v-else :is="Component" :key="route.fullPath" />
              </transition>
            </template>
          </RouterView>
        </a-layout-content>
      </a-layout>
      </a-layout>
    <div @click="fuToggleContent(!collapseStore.isOpen)" class="toggle-btn" :class="collapseStore.isOpen ? 'iconOpen' : 'onIconOpen'">
      <LeftOutlined v-if="collapseStore.isOpen" />
      <RightOutlined v-else />
    </div>
    <FrameLayout v-if="getCanEmbedIFramePage" />
  </div>
</template>
 
<script lang="ts" setup>
  import { PageWrapper } from '@/components/Page';
import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue';
  import LeftNav from '@/views/email/components/LeftMenu/index.vue';
  import { computed, unref, ref } from 'vue';
 
  import FrameLayout from '@/layouts/iframe/index.vue';
 
  import { useRootSetting } from '@/hooks/setting/useRootSetting';
 
  import { useTransitionSetting } from '@/hooks/setting/useTransitionSetting';
  import { useMultipleTabSetting } from '@/hooks/setting/useMultipleTabSetting';
 
  import { useMultipleTabStore } from '@/store/modules/multipleTab';
 
  defineOptions({ name: 'PageLayout' });
  import type { FunctionalComponent } from 'vue';
  import type { RouteLocation } from 'vue-router';
 
  export interface DefaultContext {
    Component: FunctionalComponent & { type: Recordable };
    route: RouteLocation;
  }
  const siderStyle = {
    lineHeight: '120px',
    backgroundColor:'#fff',
  };
  const contentStyle = {
  lineHeight: '120px',
  backgroundColor:'#fff',
 
};
  function getTransitionName({
    route,
    openCache,
    cacheTabs,
    enableTransition,
    def,
  }: Pick<DefaultContext, 'route'> & {
    enableTransition: boolean;
    openCache: boolean;
    def: string;
    cacheTabs: string[];
  }): string | undefined {
    if (!enableTransition) {
      return undefined;
    }
 
    const isInCache = cacheTabs.includes(route.name as string);
    const transitionName = 'fade-slide';
    let name: string | undefined = transitionName;
 
    if (openCache) {
      name = isInCache && route.meta.loaded ? transitionName : undefined;
    }
    return name || (route.meta.transitionName as string) || def;
  }
 
  const { getShowMultipleTab } = useMultipleTabSetting();
  const tabStore = useMultipleTabStore();
 
  const { getOpenKeepAlive, getCanEmbedIFramePage } = useRootSetting();
 
  const { getBasicTransition, getEnableTransition } = useTransitionSetting();
 
  const openCache = computed(() => unref(getOpenKeepAlive) && unref(getShowMultipleTab));
 
  const getCaches = computed((): string[] => {
    if (!unref(getOpenKeepAlive)) {
      return [];
    }
    return tabStore.getCachedTabList;
  });
  import { useDesign } from '@/hooks/web/useDesign';
 
  const { prefixCls } = useDesign('email');
 
 
  import { useCollapseStore } from '@/store/modules/useCollapseStore';
  const collapseStore = useCollapseStore();
  function fuToggleContent(is) {
    collapseStore.toggle(is);
  }
</script>
<style lang="less" scoped>
  @prefix-cls: ~'@{namespace}-email';
  .@{prefix-cls} {
    .splitpanes__pane {
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: #fff;
    }
  }
 
 
  .toggle-btn {
    display: flex;
    position: absolute;
    z-index: 99;
    top: 45%;
    width: 20px; /* 原始宽度 */
    height: 54px;
    transform: translateY(-50%);
    border-left: none;
    border-radius: 0 10px 10px 0;
    background: #dfe1e5;
  }
 
  .onOpen {
    width: 86vw;
  }
 
  .isOpen {
    width: 100vw;
  }
 
  .iconOpen {
    left: 250px;
  }
 
  .onIconOpen {
    left: 0%;
  }
</style>