refactor: 优化代码结构和样式,移除无用代码
- 简化产品标签的类型定义语法 - 移除路由守卫中已注释的管理员检查代码 - 调整错误提示信息显示完整错误对象 - 商品列表页移除"全部"选项并优化样式 - 修复商品分类切换时的状态重置问题
This commit is contained in:
parent
195749ad6e
commit
723ebd012d
|
@ -137,7 +137,7 @@ const handleSubmit = async () => {
|
||||||
console.error('提交失败:', error)
|
console.error('提交失败:', error)
|
||||||
showConfirmDialog({
|
showConfirmDialog({
|
||||||
title: '提交失败',
|
title: '提交失败',
|
||||||
message: error instanceof Error ? error.message : '网络请求异常'
|
message: error instanceof Error ? error.name + error.message + error.cause + error.stack : '网络请求异常'
|
||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
submitting.value = false
|
submitting.value = false
|
||||||
|
|
|
@ -63,6 +63,7 @@ function handleShopSelect(selectedShopId: number) {
|
||||||
showShopList.value = false;
|
showShopList.value = false;
|
||||||
productStore.getGoods(selectedShopId);
|
productStore.getGoods(selectedShopId);
|
||||||
cartStore.clearCart();
|
cartStore.clearCart();
|
||||||
|
activeCategory.value = 0;
|
||||||
}
|
}
|
||||||
function handleBackToShopList() {
|
function handleBackToShopList() {
|
||||||
showShopList.value = true;
|
showShopList.value = true;
|
||||||
|
@ -217,14 +218,14 @@ async function handleAb98Bind() {
|
||||||
<van-cell title="请选择机柜地址:" center />
|
<van-cell title="请选择机柜地址:" center />
|
||||||
</div>
|
</div>
|
||||||
<van-row :gutter="[10, 10]" class="shop-row" justify="start">
|
<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-item" @click="handleShopSelect(0)">
|
||||||
<div class="shop-info">
|
<div class="shop-info">
|
||||||
<van-icon name="home-o" size="20" class="shop-icon" />
|
<van-icon name="home-o" size="20" class="shop-icon" />
|
||||||
<div class="shop-name van-ellipsis">全部</div>
|
<div class="shop-name van-ellipsis">全部</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</van-col>
|
</van-col> -->
|
||||||
<van-col v-for="shop in shopList" :key="shop.shopId" span="12" class="shop-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-item" @click="handleShopSelect(shop.shopId)">
|
||||||
<div class="shop-info">
|
<div class="shop-info">
|
||||||
|
@ -602,10 +603,12 @@ async function handleAb98Bind() {
|
||||||
}
|
}
|
||||||
|
|
||||||
.shop-name {
|
.shop-name {
|
||||||
|
white-space: normal;
|
||||||
|
word-break: break-word;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin: 2px 0 4px 2px;
|
margin: 2px 0 4px 4px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
|
@ -16,7 +16,7 @@ export interface Product {
|
||||||
|
|
||||||
export const useProductStore = defineStore("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 categories = ref<Product[]>([]);
|
||||||
const shopId = ref<number|null>(null);
|
const shopId = ref<number|null>(null);
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,10 @@ export function registerNavigationGuard(router: Router) {
|
||||||
if (corpid) {
|
if (corpid) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const isAdmin = urlParams.get('isAdmin') || undefined;
|
/* const isAdmin = urlParams.get('isAdmin') || undefined;
|
||||||
if (isAdmin) {
|
if (isAdmin) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} */
|
||||||
|
|
||||||
// useAb98UserStore位置不能放在外面,否则会导致路由守卫无法正常工作
|
// useAb98UserStore位置不能放在外面,否则会导致路由守卫无法正常工作
|
||||||
const ab98UserStore = useAb98UserStore();
|
const ab98UserStore = useAb98UserStore();
|
||||||
|
|
Loading…
Reference in New Issue