From c91fc14b9c988987c439dd1dd4b8665cad039631 Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Tue, 18 Apr 2023 20:25:58 +0800 Subject: [PATCH] 123 --- src/components/TopNav/index.vue | 4 +++- src/store/modules/detail.js | 4 ++++ src/views/Index/components/Recruit/index.vue | 7 ++++--- src/views/Index/index.vue | 4 +++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/TopNav/index.vue b/src/components/TopNav/index.vue index 3b99ebc..21fb700 100644 --- a/src/components/TopNav/index.vue +++ b/src/components/TopNav/index.vue @@ -25,11 +25,12 @@ import Logo1 from '@/assets/img/banner/logo1.png' import Logo from '@/assets/img/banner/logo.png' import LogoWhite from '@/assets/img/banner/logo3.png' -import { useSwiperStore, useCountStore } from '@/store' +import { useSwiperStore, useCountStore, useDetailStore } from '@/store' import { onMounted, ref, watch } from 'vue' import { storeToRefs } from 'pinia' const swiperStore = useSwiperStore() const countStore = useCountStore() +const detailStore = useDetailStore() const { activeIndex } = storeToRefs(swiperStore) const getActiveClass = index => { @@ -40,6 +41,7 @@ const getActiveClass = index => { } const scrollToPage = index => { + detailStore.changeRecruitDetail(false) // 让数字动 swiperStore.swiper.slideTo(index, 0, false) if (index == 3) { diff --git a/src/store/modules/detail.js b/src/store/modules/detail.js index 6f6c83d..d32f6c1 100644 --- a/src/store/modules/detail.js +++ b/src/store/modules/detail.js @@ -8,10 +8,14 @@ export const useDetailStore = defineStore({ example_id: '1', hardwareExampleId: '1', hardware_id: '1', + showRecruitDetail: false, } }, // actions actions: { + changeRecruitDetail(flag) { + this.showRecruitDetail = flag + }, updateHardwareId(hardware_id) { this.hardware_id = hardware_id }, diff --git a/src/views/Index/components/Recruit/index.vue b/src/views/Index/components/Recruit/index.vue index 49720c3..8c57273 100644 --- a/src/views/Index/components/Recruit/index.vue +++ b/src/views/Index/components/Recruit/index.vue @@ -27,7 +27,7 @@
@@ -45,10 +45,11 @@ import { handleScreenAuto, handleScreenToFlexCenter } from '@/common/utils' import { postList } from '@/mock/post' import Detail from './Detail' import Card from './Card' -const showDetail = ref(false) +import { useDetailStore } from '@/store' +const detailStore = useDetailStore() const postId = ref(null) const handleDetail = (flag, id) => { - showDetail.value = flag + detailStore.changeRecruitDetail(flag) postId.value = id } const mouseleave = () => { diff --git a/src/views/Index/index.vue b/src/views/Index/index.vue index c4bd5ff..7195302 100644 --- a/src/views/Index/index.vue +++ b/src/views/Index/index.vue @@ -73,7 +73,7 @@