Commit 021874d2788eff585d3836a1888eb2eac43c3820
1 parent
41fc147c
up
Showing
6 changed files
with
42 additions
and
22 deletions
public/about_img/bg.png
0 → 100644
998 KB
src/components/Header.vue
... | ... | @@ -30,13 +30,15 @@ |
30 | 30 | tab-slider-size="6px" |
31 | 31 | selected-class="active" |
32 | 32 | > |
33 | - <v-tab :value="1" to="/"><span class="text-grey-lighten-3 tw-font-bold">Home</span> </v-tab> | |
34 | - <v-tab :value="2" to="/products" | |
35 | - ><span class="text-grey-lighten-3 tw-font-bold">Products</span></v-tab | |
36 | - > | |
33 | + <v-tab :value="1" to="/" | |
34 | + ><span @click="handleTabClick" class="text-grey-lighten-3 tw-font-bold">Home</span> | |
35 | + </v-tab> | |
36 | + <v-tab :value="2" to="/products"> | |
37 | + <span @click="handleTabClick" class="text-grey-lighten-3 tw-font-bold">Products</span> | |
38 | + </v-tab> | |
37 | 39 | <v-tab :value="3" to="/about" |
38 | - ><span class="text-grey-lighten-3 tw-font-bold">About</span></v-tab | |
39 | - > | |
40 | + ><span @click="handleTabClick" class="text-grey-lighten-3 tw-font-bold">About</span> | |
41 | + </v-tab> | |
40 | 42 | <!-- <v-tab :value="4" to="/contact" |
41 | 43 | ><span class="text-grey-lighten-3 tw-font-bold">Contact</span></v-tab |
42 | 44 | > --> |
... | ... | @@ -47,7 +49,7 @@ |
47 | 49 | </template> |
48 | 50 | |
49 | 51 | <script setup lang="ts"> |
50 | -import { ref } from 'vue' | |
52 | +import { ref, watchEffect } from 'vue' | |
51 | 53 | import ContactDialog from '@/components/ContactDialog.vue' |
52 | 54 | import { useProductListStore } from '@/stores/product_list' |
53 | 55 | import { useRouter } from 'vue-router' |
... | ... | @@ -69,13 +71,22 @@ const handleKeyDown = (e: any) => { |
69 | 71 | } |
70 | 72 | |
71 | 73 | const handleClick = () => { |
72 | - // categoryStore.updateDisplay() | |
74 | + categoryStore.updateDisplay(!input.value) | |
73 | 75 | productStore.updateKeyword(input.value) |
74 | 76 | productStore.updatePageNo(1) |
75 | 77 | router.push('/products') |
76 | 78 | } |
77 | 79 | |
78 | 80 | const tab = ref(1) |
81 | + | |
82 | +const handleTabClick = () => { | |
83 | + categoryStore.updateDisplay(true) | |
84 | + productStore.updateKeyword('') | |
85 | +} | |
86 | + | |
87 | +watchEffect(() => { | |
88 | + input.value = productStore.keyword | |
89 | +}) | |
79 | 90 | </script> |
80 | 91 | |
81 | 92 | <style lang="scss" scoped> | ... | ... |
src/stores/category.ts
... | ... | @@ -8,7 +8,7 @@ export const useCategoryStore = defineStore('category', () => { |
8 | 8 | const selectedCategory = ref('') // 选中的一级类别 |
9 | 9 | const selectedSubCategory = ref('') // 选中的二级类别 |
10 | 10 | const selectedFuncCategory = ref('') |
11 | - const categoryVisible = ref(false) | |
11 | + const categoryVisible = ref(true) | |
12 | 12 | let resetFuncValue = '' |
13 | 13 | let resetCategoryValue = '' |
14 | 14 | |
... | ... | @@ -45,6 +45,7 @@ export const useCategoryStore = defineStore('category', () => { |
45 | 45 | selectedSubCategory, |
46 | 46 | selectedFuncCategory, |
47 | 47 | resetCategoryValue, |
48 | + categoryVisible, | |
48 | 49 | getList, |
49 | 50 | updateCategory, |
50 | 51 | updateSubCategory, | ... | ... |
src/stores/product_list.ts
... | ... | @@ -13,7 +13,7 @@ export const useProductListStore = defineStore('productList', () => { |
13 | 13 | const params = ref() |
14 | 14 | |
15 | 15 | const getList = async (params: ProductListQuery) => { |
16 | - if (params.productCategoryId) { | |
16 | + if (params.productCategoryId || params.keyword) { | |
17 | 17 | const res = await getProductList(params) |
18 | 18 | const data = res.data?.data || {} |
19 | 19 | list.value = | ... | ... |
src/views/About.vue
... | ... | @@ -76,7 +76,10 @@ |
76 | 76 | </v-sheet> |
77 | 77 | </v-container> |
78 | 78 | </v-sheet> |
79 | - <v-sheet class="tw-py-[64px]"> | |
79 | + <v-sheet | |
80 | + class="tw-py-[64px]" | |
81 | + style="background: url('/about_img/bg.png') no-repeat; background-size: 100% 100%" | |
82 | + > | |
80 | 83 | <v-container> |
81 | 84 | <MainTitle title="Milestone" /> |
82 | 85 | <v-timeline direction="horizontal"> | ... | ... |
src/views/ProductList.vue
1 | 1 | <template> |
2 | 2 | <div class="tw-m-auto tw-pb-[64px]"> |
3 | - <CategoryList /> | |
3 | + <CategoryList v-if="categoryStore.categoryVisible" /> | |
4 | 4 | <v-container class=""> |
5 | 5 | <div class="tw-text-center" v-if="loading"> |
6 | 6 | <v-progress-circular |
... | ... | @@ -76,27 +76,32 @@ const categoryStore = useCategoryStore() |
76 | 76 | const loading = ref(false) |
77 | 77 | |
78 | 78 | watchEffect(async () => { |
79 | - let params = { | |
80 | - // productCategoryId: '78b86c6e917841cf9a292234f2805e24', | |
81 | - productCategoryId: categoryStore.selectedSubCategory, | |
79 | + let params: any = { | |
82 | 80 | pageNo: productStore.pageNo, |
83 | 81 | pageSize: 20 |
84 | - } as any | |
85 | - | |
86 | - if (categoryStore.selectedFuncCategory) { | |
87 | - params.productFunctionId = categoryStore.selectedFuncCategory | |
88 | 82 | } |
89 | 83 | |
90 | - if (productStore.keyword) { | |
84 | + loading.value = true | |
85 | + if (productStore.keyword && !isEqual(productStore.params, params)) { | |
91 | 86 | params.keyword = productStore.keyword |
87 | + productStore.updateParams(params) | |
88 | + await productStore.getList(params) | |
89 | + loading.value = false | |
90 | + return | |
91 | + } | |
92 | + | |
93 | + params.productCategoryId = categoryStore.selectedSubCategory | |
94 | + // productCategoryId: '78b86c6e917841cf9a292234f2805e24', | |
95 | + | |
96 | + if (categoryStore.selectedFuncCategory) { | |
97 | + params.productFunctionId = categoryStore.selectedFuncCategory | |
92 | 98 | } |
93 | 99 | |
94 | 100 | if (categoryStore.selectedSubCategory && !isEqual(productStore.params, params)) { |
95 | - loading.value = true | |
96 | 101 | productStore.updateParams(params) |
97 | 102 | await productStore.getList(params) |
98 | - loading.value = false | |
99 | 103 | } |
104 | + loading.value = false | |
100 | 105 | }) |
101 | 106 | |
102 | 107 | const length = computed(() => | ... | ... |