refactor: 优化代码结构和样式,移除无用代码

- 简化产品标签的类型定义语法
- 移除路由守卫中已注释的管理员检查代码
- 调整错误提示信息显示完整错误对象
- 商品列表页移除"全部"选项并优化样式
- 修复商品分类切换时的状态重置问题
This commit is contained in:
dzq 2025-06-11 10:02:57 +08:00
parent 195749ad6e
commit 723ebd012d
4 changed files with 10 additions and 7 deletions

View File

@ -137,7 +137,7 @@ const handleSubmit = async () => {
console.error('提交失败:', error)
showConfirmDialog({
title: '提交失败',
message: error instanceof Error ? error.message : '网络请求异常'
message: error instanceof Error ? error.name + error.message + error.cause + error.stack : '网络请求异常'
})
} finally {
submitting.value = false

View File

@ -63,6 +63,7 @@ function handleShopSelect(selectedShopId: number) {
showShopList.value = false;
productStore.getGoods(selectedShopId);
cartStore.clearCart();
activeCategory.value = 0;
}
function handleBackToShopList() {
showShopList.value = true;
@ -217,14 +218,14 @@ async function handleAb98Bind() {
<van-cell title="请选择机柜地址:" center />
</div>
<van-row :gutter="[10, 10]" class="shop-row" justify="start">
<van-col span="12" class="shop-col">
<!-- <van-col span="12" class="shop-col">
<div class="shop-item" @click="handleShopSelect(0)">
<div class="shop-info">
<van-icon name="home-o" size="20" class="shop-icon" />
<div class="shop-name van-ellipsis">全部</div>
</div>
</div>
</van-col>
</van-col> -->
<van-col v-for="shop in shopList" :key="shop.shopId" span="12" class="shop-col">
<div class="shop-item" @click="handleShopSelect(shop.shopId)">
<div class="shop-info">
@ -602,10 +603,12 @@ async function handleAb98Bind() {
}
.shop-name {
white-space: normal;
word-break: break-word;
font-size: 14px;
color: #333;
font-weight: 500;
margin: 2px 0 4px 2px;
margin: 2px 0 4px 4px;
display: flex;
align-items: center;
justify-content: center;

View File

@ -16,7 +16,7 @@ export interface Product {
export const useProductStore = defineStore("product", () => {
// 商品数据
const labels = ref<Array<{ id: number, name: string }>>([]);
const labels = ref<{ id: number, name: string }[]>([]);
const categories = ref<Product[]>([]);
const shopId = ref<number|null>(null);

View File

@ -25,10 +25,10 @@ export function registerNavigationGuard(router: Router) {
if (corpid) {
return true;
}
const isAdmin = urlParams.get('isAdmin') || undefined;
/* const isAdmin = urlParams.get('isAdmin') || undefined;
if (isAdmin) {
return true;
}
} */
// useAb98UserStore位置不能放在外面否则会导致路由守卫无法正常工作
const ab98UserStore = useAb98UserStore();