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,13 +30,15 @@ | ||
30 | tab-slider-size="6px" | 30 | tab-slider-size="6px" |
31 | selected-class="active" | 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 | <v-tab :value="3" to="/about" | 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 | <!-- <v-tab :value="4" to="/contact" | 42 | <!-- <v-tab :value="4" to="/contact" |
41 | ><span class="text-grey-lighten-3 tw-font-bold">Contact</span></v-tab | 43 | ><span class="text-grey-lighten-3 tw-font-bold">Contact</span></v-tab |
42 | > --> | 44 | > --> |
@@ -47,7 +49,7 @@ | @@ -47,7 +49,7 @@ | ||
47 | </template> | 49 | </template> |
48 | 50 | ||
49 | <script setup lang="ts"> | 51 | <script setup lang="ts"> |
50 | -import { ref } from 'vue' | 52 | +import { ref, watchEffect } from 'vue' |
51 | import ContactDialog from '@/components/ContactDialog.vue' | 53 | import ContactDialog from '@/components/ContactDialog.vue' |
52 | import { useProductListStore } from '@/stores/product_list' | 54 | import { useProductListStore } from '@/stores/product_list' |
53 | import { useRouter } from 'vue-router' | 55 | import { useRouter } from 'vue-router' |
@@ -69,13 +71,22 @@ const handleKeyDown = (e: any) => { | @@ -69,13 +71,22 @@ const handleKeyDown = (e: any) => { | ||
69 | } | 71 | } |
70 | 72 | ||
71 | const handleClick = () => { | 73 | const handleClick = () => { |
72 | - // categoryStore.updateDisplay() | 74 | + categoryStore.updateDisplay(!input.value) |
73 | productStore.updateKeyword(input.value) | 75 | productStore.updateKeyword(input.value) |
74 | productStore.updatePageNo(1) | 76 | productStore.updatePageNo(1) |
75 | router.push('/products') | 77 | router.push('/products') |
76 | } | 78 | } |
77 | 79 | ||
78 | const tab = ref(1) | 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 | </script> | 90 | </script> |
80 | 91 | ||
81 | <style lang="scss" scoped> | 92 | <style lang="scss" scoped> |
src/stores/category.ts
@@ -8,7 +8,7 @@ export const useCategoryStore = defineStore('category', () => { | @@ -8,7 +8,7 @@ export const useCategoryStore = defineStore('category', () => { | ||
8 | const selectedCategory = ref('') // 选中的一级类别 | 8 | const selectedCategory = ref('') // 选中的一级类别 |
9 | const selectedSubCategory = ref('') // 选中的二级类别 | 9 | const selectedSubCategory = ref('') // 选中的二级类别 |
10 | const selectedFuncCategory = ref('') | 10 | const selectedFuncCategory = ref('') |
11 | - const categoryVisible = ref(false) | 11 | + const categoryVisible = ref(true) |
12 | let resetFuncValue = '' | 12 | let resetFuncValue = '' |
13 | let resetCategoryValue = '' | 13 | let resetCategoryValue = '' |
14 | 14 | ||
@@ -45,6 +45,7 @@ export const useCategoryStore = defineStore('category', () => { | @@ -45,6 +45,7 @@ export const useCategoryStore = defineStore('category', () => { | ||
45 | selectedSubCategory, | 45 | selectedSubCategory, |
46 | selectedFuncCategory, | 46 | selectedFuncCategory, |
47 | resetCategoryValue, | 47 | resetCategoryValue, |
48 | + categoryVisible, | ||
48 | getList, | 49 | getList, |
49 | updateCategory, | 50 | updateCategory, |
50 | updateSubCategory, | 51 | updateSubCategory, |
src/stores/product_list.ts
@@ -13,7 +13,7 @@ export const useProductListStore = defineStore('productList', () => { | @@ -13,7 +13,7 @@ export const useProductListStore = defineStore('productList', () => { | ||
13 | const params = ref() | 13 | const params = ref() |
14 | 14 | ||
15 | const getList = async (params: ProductListQuery) => { | 15 | const getList = async (params: ProductListQuery) => { |
16 | - if (params.productCategoryId) { | 16 | + if (params.productCategoryId || params.keyword) { |
17 | const res = await getProductList(params) | 17 | const res = await getProductList(params) |
18 | const data = res.data?.data || {} | 18 | const data = res.data?.data || {} |
19 | list.value = | 19 | list.value = |
src/views/About.vue
@@ -76,7 +76,10 @@ | @@ -76,7 +76,10 @@ | ||
76 | </v-sheet> | 76 | </v-sheet> |
77 | </v-container> | 77 | </v-container> |
78 | </v-sheet> | 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 | <v-container> | 83 | <v-container> |
81 | <MainTitle title="Milestone" /> | 84 | <MainTitle title="Milestone" /> |
82 | <v-timeline direction="horizontal"> | 85 | <v-timeline direction="horizontal"> |
src/views/ProductList.vue
1 | <template> | 1 | <template> |
2 | <div class="tw-m-auto tw-pb-[64px]"> | 2 | <div class="tw-m-auto tw-pb-[64px]"> |
3 | - <CategoryList /> | 3 | + <CategoryList v-if="categoryStore.categoryVisible" /> |
4 | <v-container class=""> | 4 | <v-container class=""> |
5 | <div class="tw-text-center" v-if="loading"> | 5 | <div class="tw-text-center" v-if="loading"> |
6 | <v-progress-circular | 6 | <v-progress-circular |
@@ -76,27 +76,32 @@ const categoryStore = useCategoryStore() | @@ -76,27 +76,32 @@ const categoryStore = useCategoryStore() | ||
76 | const loading = ref(false) | 76 | const loading = ref(false) |
77 | 77 | ||
78 | watchEffect(async () => { | 78 | watchEffect(async () => { |
79 | - let params = { | ||
80 | - // productCategoryId: '78b86c6e917841cf9a292234f2805e24', | ||
81 | - productCategoryId: categoryStore.selectedSubCategory, | 79 | + let params: any = { |
82 | pageNo: productStore.pageNo, | 80 | pageNo: productStore.pageNo, |
83 | pageSize: 20 | 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 | params.keyword = productStore.keyword | 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 | if (categoryStore.selectedSubCategory && !isEqual(productStore.params, params)) { | 100 | if (categoryStore.selectedSubCategory && !isEqual(productStore.params, params)) { |
95 | - loading.value = true | ||
96 | productStore.updateParams(params) | 101 | productStore.updateParams(params) |
97 | await productStore.getList(params) | 102 | await productStore.getList(params) |
98 | - loading.value = false | ||
99 | } | 103 | } |
104 | + loading.value = false | ||
100 | }) | 105 | }) |
101 | 106 | ||
102 | const length = computed(() => | 107 | const length = computed(() => |