diff --git a/src/App.vue b/src/App.vue index dbb9162..543fa48 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,11 +1,12 @@ - diff --git a/src/Route/route.ts b/src/Route/route.ts index ace9922..800bad4 100644 --- a/src/Route/route.ts +++ b/src/Route/route.ts @@ -3,6 +3,12 @@ import { createRouter, createWebHistory } from 'vue-router' // 导入组件 import Home from '../Views/Home.vue' import Login from '../Views/Login.vue' +import Search from '../Views/Search.vue' +import ProductDetail from '../Views/product/productdetil.vue' +import Cart from '../Views/Cart.vue' +import Order from '../Views/Order.vue' + + const routes = [ { @@ -10,11 +16,31 @@ const routes = [ name: 'home', component: Home }, + { + path: '/search', + name: 'search', + component: Search + }, + { + path: '/product', + name: 'productDetail', + component: ProductDetail + }, { path: '/login', name: 'login', component: Login }, + { + path: '/cart', + name: 'cart', + component: Cart + }, + { + path: '/order', + name: 'order', + component: Order + }, ] const router = createRouter({ diff --git a/src/Style/App.css b/src/Style/App.css new file mode 100644 index 0000000..da10fdf --- /dev/null +++ b/src/Style/App.css @@ -0,0 +1,13 @@ +/* 全局样式 */ +body { + height: 100%; + padding: 0 20px; +} + +a { + text-decoration: none; + color: #000; + font-size: 16px; + font-weight: bold; + transition: all 0.3s ease-in-out; +} diff --git a/src/Util/Type.ts b/src/Util/Type.ts index 50b6511..0377ffe 100644 --- a/src/Util/Type.ts +++ b/src/Util/Type.ts @@ -7,6 +7,45 @@ export type ProductDetail = { price: string img: string } +// 店铺详情类型 +export type ShopDetail = { + id: string + name: string + img: string +} +// 购物车类型 +export type Cart = { + id: string + name: string + price: string + img: string + count: number +} + +// 商品类型 +export type Product = { + id: string + name: string + price: string + img: string + model: string +} + +// 订单详情类型 +export type OrderDetail = { + id: string + name: string + price: string + img: string + count: number +} +// 注册类型 +export type Register = { + username: string + password: string + confirmPassword: string +} +// 登录类型 export type Login = { username: string password: string diff --git a/src/Views/Cart.vue b/src/Views/Cart.vue new file mode 100644 index 0000000..2e920ac --- /dev/null +++ b/src/Views/Cart.vue @@ -0,0 +1,1377 @@ + + + \ No newline at end of file diff --git a/src/Views/Home.vue b/src/Views/Home.vue index 0e7e5e6..a4656fd 100644 --- a/src/Views/Home.vue +++ b/src/Views/Home.vue @@ -1,18 +1,10 @@ - diff --git a/src/Views/Myttw.vue b/src/Views/Myttw.vue new file mode 100644 index 0000000..fd5b7a7 --- /dev/null +++ b/src/Views/Myttw.vue @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/Views/Order.vue b/src/Views/Order.vue new file mode 100644 index 0000000..697de59 --- /dev/null +++ b/src/Views/Order.vue @@ -0,0 +1,18 @@ + + + + \ No newline at end of file diff --git a/src/Views/Search.vue b/src/Views/Search.vue new file mode 100644 index 0000000..c23a868 --- /dev/null +++ b/src/Views/Search.vue @@ -0,0 +1,46 @@ + + + + diff --git a/src/Views/Shop.vue b/src/Views/Shop.vue new file mode 100644 index 0000000..8d2fe6b --- /dev/null +++ b/src/Views/Shop.vue @@ -0,0 +1,19 @@ + + + \ No newline at end of file diff --git a/src/Views/User/Userinfo.vue b/src/Views/User/Userinfo.vue new file mode 100644 index 0000000..05ec47c --- /dev/null +++ b/src/Views/User/Userinfo.vue @@ -0,0 +1,29 @@ + + + \ No newline at end of file diff --git a/src/Views/footer.vue b/src/Views/footer.vue index 9e88f6a..6cc4d20 100644 --- a/src/Views/footer.vue +++ b/src/Views/footer.vue @@ -42,12 +42,23 @@ const productLists = ref([ price: '400', img: '', }, + { + id: '4', + name: '商品4', + price: '400', + img: '', + }, + { + id: '4', + name: '商品4', + price: '400', + img: '', + }, ]) \ No newline at end of file diff --git a/src/Views/main.vue b/src/Views/main.vue index 12edcc6..5d7138a 100644 --- a/src/Views/main.vue +++ b/src/Views/main.vue @@ -1,69 +1,438 @@ \ No newline at end of file diff --git a/src/Views/product/productList.vue b/src/Views/product/productList.vue index 9a42d39..b0270e7 100644 --- a/src/Views/product/productList.vue +++ b/src/Views/product/productList.vue @@ -1,21 +1,23 @@ @@ -23,6 +25,7 @@ import { type PropType } from 'vue' import type { ProductDetail } from '@/Util/Type' import { useGlobalStore } from '@/Util/globalStore' +import router from '@/Route/route' // 接收父类传递的商品列表 const props = defineProps({ productList: { @@ -30,7 +33,13 @@ const props = defineProps({ default: () => [], }, }) - +// 点击商品跳转详情页 +const handleClick = (product: ProductDetail) => { + // id 加密 + const encryptedId = btoa(product.id) + // 跳转详情页 (新开页面) + window.open(`/product?id=${encryptedId}`, '_blank') +} \ No newline at end of file diff --git a/src/Views/product/productdetil.vue b/src/Views/product/productdetil.vue index c5702e2..5dec3e3 100644 --- a/src/Views/product/productdetil.vue +++ b/src/Views/product/productdetil.vue @@ -1,27 +1,809 @@ -