fix: 产品页面完善,增加空白布局与布局切换
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
export type LayoutType = 'vertical';
|
export type LayoutType = | 'vertical' | 'blankPage';
|
||||||
|
|
||||||
// 仿豆包折叠逻辑
|
// 仿豆包折叠逻辑
|
||||||
export type CollapseType =
|
export type CollapseType
|
||||||
| 'alwaysCollapsed' // 始终折叠
|
= | 'alwaysCollapsed' // 始终折叠
|
||||||
| 'followSystem' // 跟随系统视口宽度
|
| 'followSystem' // 跟随系统视口宽度
|
||||||
| 'alwaysExpanded' // 始终打开
|
| 'alwaysExpanded' // 始终打开
|
||||||
| 'narrowExpandWideCollapse'; // 系统视口 宽小则张,宽大则收
|
| 'narrowExpandWideCollapse'; // 系统视口 宽小则张,宽大则收
|
||||||
|
|
||||||
export interface DesignConfigState {
|
export interface DesignConfigState {
|
||||||
// 系统主题
|
// 系统主题
|
||||||
|
|||||||
9
Yi.Ai.Vue3/src/layouts/LayoutBlankPage/index.vue
Normal file
9
Yi.Ai.Vue3/src/layouts/LayoutBlankPage/index.vue
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<!-- LayoutBlankPage/index.vue -->
|
||||||
|
<template>
|
||||||
|
<!-- 完全空白,不包裹任何容器 -->
|
||||||
|
<router-view />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 无样式 */
|
||||||
|
</style>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<!-- 主布局 -->
|
<!-- 主布局 -->
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { LayoutType } from '@/config/design';
|
import type { LayoutType } from '@/config/design';
|
||||||
|
import LayoutBlankPage from '@/layouts/LayoutBlankPage/index.vue';
|
||||||
// import { useScreenStore } from '@/hooks/useScreen';
|
// import { useScreenStore } from '@/hooks/useScreen';
|
||||||
import LayoutVertical from '@/layouts/LayoutVertical/index.vue';
|
import LayoutVertical from '@/layouts/LayoutVertical/index.vue';
|
||||||
import { useDesignStore } from '@/stores';
|
import { useDesignStore } from '@/stores';
|
||||||
@@ -8,6 +9,7 @@ import { useDesignStore } from '@/stores';
|
|||||||
// 这里添加布局类型
|
// 这里添加布局类型
|
||||||
const LayoutComponent: Record<LayoutType, Component> = {
|
const LayoutComponent: Record<LayoutType, Component> = {
|
||||||
vertical: LayoutVertical,
|
vertical: LayoutVertical,
|
||||||
|
blankPage: LayoutBlankPage,
|
||||||
};
|
};
|
||||||
|
|
||||||
const designStore = useDesignStore();
|
const designStore = useDesignStore();
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ app.use(ElementPlusX);
|
|||||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||||
app.component(key, component);
|
app.component(key, component);
|
||||||
}
|
}
|
||||||
app.use(store);
|
|
||||||
|
|
||||||
|
app.use(store);
|
||||||
app.mount('#app');
|
app.mount('#app');
|
||||||
|
|||||||
@@ -3,7 +3,13 @@ import type { Product } from '@/api/products/products';
|
|||||||
import { ArrowDown, CircleCheck } from '@element-plus/icons-vue';
|
import { ArrowDown, CircleCheck } from '@element-plus/icons-vue';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { products } from '@/data/products';
|
import { products } from '@/data/products';
|
||||||
|
import { useDesignStore } from '@/stores';
|
||||||
|
|
||||||
|
const designStore = useDesignStore();
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
designStore._setLayout('blankPage');
|
||||||
|
});
|
||||||
const productsSection = ref<HTMLElement | null>(null);
|
const productsSection = ref<HTMLElement | null>(null);
|
||||||
|
|
||||||
function scrollToProducts() {
|
function scrollToProducts() {
|
||||||
@@ -174,6 +180,8 @@ const comparisonData = computed(() => {
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.products-page {
|
.products-page {
|
||||||
|
height: 100vh;
|
||||||
|
overflow: auto;
|
||||||
color: #333;
|
color: #333;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useNProgress } from '@vueuse/integrations/useNProgress';
|
|||||||
import { createRouter, createWebHistory } from 'vue-router';
|
import { createRouter, createWebHistory } from 'vue-router';
|
||||||
import { ROUTER_WHITE_LIST } from '@/config';
|
import { ROUTER_WHITE_LIST } from '@/config';
|
||||||
import { errorRouter, layoutRouter, staticRouter } from '@/routers/modules/staticRouter';
|
import { errorRouter, layoutRouter, staticRouter } from '@/routers/modules/staticRouter';
|
||||||
import { useUserStore } from '@/stores';
|
import { useDesignStore, useUserStore } from '@/stores';
|
||||||
|
|
||||||
const { start, done } = useNProgress(0, {
|
const { start, done } = useNProgress(0, {
|
||||||
showSpinner: false,
|
showSpinner: false,
|
||||||
@@ -28,6 +28,8 @@ router.beforeEach(
|
|||||||
next: NavigationGuardNext,
|
next: NavigationGuardNext,
|
||||||
) => {
|
) => {
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
const designStore = useDesignStore(); // 必须在守卫内部调用
|
||||||
|
designStore._setLayout(to.meta?.layout || 'vertical');
|
||||||
|
|
||||||
// 1、NProgress 开始
|
// 1、NProgress 开始
|
||||||
start();
|
start();
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ export const layoutRouter: RouteRecordRaw[] = [
|
|||||||
title: '产品页面',
|
title: '产品页面',
|
||||||
keepAlive: true, // 如果需要缓存
|
keepAlive: true, // 如果需要缓存
|
||||||
isDefaultChat: false, // 根据实际情况设置
|
isDefaultChat: false, // 根据实际情况设置
|
||||||
|
layout: 'blankPage', // 如果需要自定义布局
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -32,9 +32,10 @@ export const useDesignStore = defineStore(
|
|||||||
const layout = ref<LayoutType>(reLayout);
|
const layout = ref<LayoutType>(reLayout);
|
||||||
|
|
||||||
// 当前只有一个布局,暂时不将这个方法暴露出去
|
// 当前只有一个布局,暂时不将这个方法暴露出去
|
||||||
// const _setLayout = (layoutType: 'vertical') => {
|
// const _setLayout = (layoutType: LayoutType) => {
|
||||||
// layout.value = layoutType;
|
const _setLayout = (layoutType: any) => {
|
||||||
// };
|
layout.value = layoutType;
|
||||||
|
};
|
||||||
|
|
||||||
// 折叠状态
|
// 折叠状态
|
||||||
const collapseType = ref<CollapseType>(reCollapseType);
|
const collapseType = ref<CollapseType>(reCollapseType);
|
||||||
@@ -94,6 +95,7 @@ export const useDesignStore = defineStore(
|
|||||||
isSafeAreaHover,
|
isSafeAreaHover,
|
||||||
setSafeAreaHover,
|
setSafeAreaHover,
|
||||||
hasActivatedHover,
|
hasActivatedHover,
|
||||||
|
_setLayout,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
2
Yi.Ai.Vue3/types/import_meta.d.ts
vendored
2
Yi.Ai.Vue3/types/import_meta.d.ts
vendored
@@ -6,8 +6,6 @@ interface ImportMetaEnv {
|
|||||||
readonly VITE_WEB_ENV: string;
|
readonly VITE_WEB_ENV: string;
|
||||||
readonly VITE_WEB_BASE_API: string;
|
readonly VITE_WEB_BASE_API: string;
|
||||||
readonly VITE_API_URL: string;
|
readonly VITE_API_URL: string;
|
||||||
readonly SSO_SEVER_URL: string;
|
|
||||||
readonly SSO_CLIENT_ID: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare interface ImportMeta {
|
declare interface ImportMeta {
|
||||||
|
|||||||
Reference in New Issue
Block a user