@@ -67,7 +67,7 @@ const searchKeyword = ref('')
const sortBy = ref('')
const products = ref([])
-const filteredProducts = ref([])
+// const filteredProducts = ref([])
const loading = ref(false)
const loadingMore = ref(false)
const page = ref(1)
@@ -98,34 +98,36 @@ const switchFilter = (index) => {
})
const selectedFilter = filters.value[index]
- sortProducts(selectedFilter.sort)
+ console.log(selectedFilter.sort)
+ getProducts(false, selectedFilter.sort)
+ // sortProducts(selectedFilter.sort)
}
-const sortProducts = (sortType) => {
- switch (sortType) {
- case 'null':
- filteredProducts.value = products.value
- break
- case 'price_desc':
- filteredProducts.value = products.value.sort((a, b) => b.points_price - a.points_price)
- break
- case 'price_asc':
- filteredProducts.value = products.value.sort((a, b) => a.points_price - b.points_price)
- break
- case 'sales_desc':
- filteredProducts.value = products.value.sort((a, b) => b.sales - a.sales)
- break
- default:
- filteredProducts.value = products.value
- break
- }
-}
+// const sortProducts = (sortType) => {
+// switch (sortType) {
+// case 'null':
+// // filteredProducts.value = products.value
+// break
+// case 'price_desc':
+// // filteredProducts.value = products.value.sort((a, b) => b.points_price - a.points_price)
+// break
+// case 'price_asc':
+// // filteredProducts.value = products.value.sort((a, b) => a.points_price - b.points_price)
+// break
+// case 'sales_desc':
+// // filteredProducts.value = products.value.sort((a, b) => b.sales - a.sales)
+// break
+// default:
+// // filteredProducts.value = products.value
+// break
+// }
+// }
const changeStyle = () => {
isGridStyle.value = !isGridStyle.value
}
-const getProducts = async (isLoadMore = false) => {
+const getProducts = async (isLoadMore = false, sort) => {
try {
if (!isLoadMore) {
loading.value = true
@@ -140,7 +142,7 @@ const getProducts = async (isLoadMore = false) => {
limit: 20,
category: selectedCategory.value === 'all' ? '' : selectedCategory.value,
search: searchKeyword.value,
- sort: sortBy.value
+ sort: sort
}
})
@@ -165,7 +167,7 @@ const getProducts = async (isLoadMore = false) => {
hasMore.value = data.data.hasMore
page.value++
- filteredProducts.value = products.value
+ // filteredProducts.value = products.value
} catch (error) {
ElMessage.error('获取商品列表失败')
console.error('获取商品列表失败:', error)
diff --git a/src/views/ProductSummary.vue b/src/views/ProductSummary.vue
index cfc85ad..771f7fa 100644
--- a/src/views/ProductSummary.vue
+++ b/src/views/ProductSummary.vue
@@ -2,7 +2,7 @@
diff --git a/src/views/Shop.vue b/src/views/Shop.vue
index df84d0e..31e3ac2 100644
--- a/src/views/Shop.vue
+++ b/src/views/Shop.vue
@@ -63,15 +63,15 @@ const selectedCategory = ref('all')
const shopBarItems = [
{name: '商品分类',img: '/imgs/shop/1.png',path: '/productCategory'},
- {name: '观看直播',img: '/imgs/shop/2.png',path: ''},
+ // {name: '观看直播',img: '/imgs/shop/2.png',path: ''},
{name: '卡包管理',img: '/imgs/shop/3.png',path: '/couponmanage'},
- {name: '百亿补贴',img: '/imgs/shop/4.png',path: ''},
- {name: '现时秒杀',img: '/imgs/shop/5.png',path: ''},
- {name: '会员专区',img: '/imgs/shop/6.png',path: ''},
- {name: '商品收藏',img: '/imgs/shop/7.png',path: ''},
- {name: '充值缴费',img: '/imgs/shop/8.png',path: ''},
- {name: '资质认证',img: '/imgs/shop/9.png',path: ''},
- {name: '联系客服',img: '/imgs/shop/10.png',path: ''},
+ // {name: '百亿补贴',img: '/imgs/shop/4.png',path: ''},
+ // {name: '现时秒杀',img: '/imgs/shop/5.png',path: ''},
+ // {name: '会员专区',img: '/imgs/shop/6.png',path: ''},
+ // {name: '商品收藏',img: '/imgs/shop/7.png',path: ''},
+ // {name: '充值缴费',img: '/imgs/shop/8.png',path: ''},
+ // {name: '资质认证',img: '/imgs/shop/9.png',path: ''},
+ {name: '联系客服',img: '/imgs/shop/10.png',path: '/customerservice'},
]
const getProducts = async (isLoadMore = false) => {
@@ -176,10 +176,15 @@ onMounted(() => {
.shop-bar {
display: grid;
- grid-template-columns: repeat(5, 1fr);
+ grid-template-columns: repeat(3, 1fr);
column-gap: 21px;
row-gap: 12px;
margin-top: 20px;
+ background: #FFFFFF80;
+ border-radius: 10px;
+ width: 92%;
+ align-self: center;
+ padding: 12px 10px;
}
.shop-bar-item {
@@ -205,7 +210,7 @@ onMounted(() => {
margin-top: 15px;
border-radius: 5px;
height: 30px;
- width: auto;
+ width: 92%;
}
.tips-imgs {
diff --git a/vite.config.js b/vite.config.js
index 9fd165d..37bf0b7 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -15,7 +15,7 @@ export default defineConfig({
port: 5173,
proxy: {
'/api': {
- target: 'http://192.168.0.26:3000',
+ target: 'http://192.168.0.11:3000',
changeOrigin: true,
},
'/mid': {
@@ -24,7 +24,7 @@ export default defineConfig({
// rewrite: (path) => path.replace(/^\/mid/, '')
},
'/uploads': {
- target: 'http://192.168.0.26:3000',
+ target: 'http://192.168.0.11:3000',
changeOrigin: true
}
}