Commit bb673e6bf6d1d475b663d197199625d02f645b2c
1 parent
7866e886
up
Showing
9 changed files
with
24 additions
and
21 deletions
src/assets/banner1.png renamed to public/banner1.png
213 KB
src/assets/banner2.jpeg renamed to public/banner2.jpeg
66 KB
src/assets/banner3.jpeg renamed to public/banner3.jpeg
75.9 KB
src/components/Header.vue
src/components/__tests__/HelloWorld.spec.ts deleted
100644 → 0
1 | -import { describe, it, expect } from 'vitest' | |
2 | - | |
3 | -import { mount } from '@vue/test-utils' | |
4 | -import HelloWorld from '../HelloWorld.vue' | |
5 | - | |
6 | -describe('HelloWorld', () => { | |
7 | - it('renders properly', () => { | |
8 | - const wrapper = mount(HelloWorld, { props: { msg: 'Hello Vitest' } }) | |
9 | - expect(wrapper.text()).toContain('Hello Vitest') | |
10 | - }) | |
11 | -}) |
src/type.d.ts
... | ... | @@ -14,6 +14,17 @@ export interface Product { |
14 | 14 | name: string |
15 | 15 | id: string |
16 | 16 | imageUrl: string |
17 | + basename1: string | |
18 | + basename2: string | |
19 | + basename2: string | |
20 | + basecore1: string | |
21 | + basecore2: string | |
22 | + basecore3: string | |
23 | + model: string | |
24 | + brandName: string | |
25 | + physicalproperty: string | |
26 | + storage: string | |
27 | + productimageliststore: ProductImage[] | |
17 | 28 | } |
18 | 29 | |
19 | 30 | export interface ProductListQuery { |
... | ... | @@ -22,3 +33,8 @@ export interface ProductListQuery { |
22 | 33 | pageNo: number |
23 | 34 | pageSize: number |
24 | 35 | } |
36 | + | |
37 | +export interface ProductImage { | |
38 | + url: string | |
39 | + fileKey: string | |
40 | +} | ... | ... |
src/views/Home.vue
1 | 1 | <template> |
2 | 2 | <v-container class="mx-auto content"> |
3 | 3 | <v-carousel cycle height="360" hide-delimiter-background show-arrows="hover" class="tw-mb-16"> |
4 | - <v-carousel-item v-for="(slide, i) in slides" :key="i" :src="slide" cover> </v-carousel-item> | |
4 | + <v-carousel-item src="/banner1.png" cover> </v-carousel-item> | |
5 | + <v-carousel-item src="/banner2.jpeg" cover> </v-carousel-item> | |
6 | + <v-carousel-item src="/banner3.jpeg" cover> </v-carousel-item> | |
5 | 7 | </v-carousel> |
6 | 8 | <div v-for="item in store.list" :key="item.categoryDisplayName" class="tw-mb-[64px]"> |
7 | 9 | <HomeProductList :title="item.categoryDisplayName" :list="item.list" /> |
... | ... | @@ -12,7 +14,6 @@ |
12 | 14 | <script setup lang="ts"> |
13 | 15 | import HomeProductList from '@/components/HomeCategoryList.vue' |
14 | 16 | import { useCategoryStore } from '@/stores/category' |
15 | -const slides = ['src/assets/banner1.png', 'src/assets/banner2.jpeg', 'src/assets/banner3.jpeg'] | |
16 | 17 | |
17 | 18 | const store = useCategoryStore() |
18 | 19 | </script> | ... | ... |
src/views/ProductDetail.vue
... | ... | @@ -70,20 +70,21 @@ |
70 | 70 | |
71 | 71 | <script setup lang="ts"> |
72 | 72 | import { getDetail } from '@/service' |
73 | +import type { Product } from '@/type' | |
74 | +import type { ProductImage } from '@/type' | |
73 | 75 | import { onMounted, ref } from 'vue' |
74 | 76 | import { useRoute } from 'vue-router' |
75 | 77 | |
76 | 78 | const route = useRoute() |
77 | -const info = ref({ | |
79 | +const info = ref<Partial<Product>>({ | |
78 | 80 | productimageliststore: [] |
79 | 81 | }) |
80 | 82 | |
81 | 83 | onMounted(() => { |
82 | 84 | getDetail({ id: route.params.id as string }).then((res) => { |
83 | 85 | const data = res.data.data || {} |
84 | - console.log('%c [ data ]-117', 'font-size:13px; background:pink; color:#bf2c9f;', data) | |
85 | - data.productimageliststore = JSON.parse(data.productimageliststore) || [] | |
86 | - data.productimageliststore = data.productimageliststore.map((item) => ({ | |
86 | + data.productimageliststore = (JSON.parse(data.productimageliststore) || []) as ProductImage[] | |
87 | + data.productimageliststore = data.productimageliststore.map((item: ProductImage) => ({ | |
87 | 88 | ...item, |
88 | 89 | url: `http://112.74.45.244:8100/api/show/image?fileKey=${item.fileKey}` |
89 | 90 | })) | ... | ... |