处理未登录情况

This commit is contained in:
2024-03-31 19:10:00 +08:00
parent a06d74934f
commit 935d56227d
8 changed files with 78 additions and 48 deletions

View File

@@ -40,7 +40,7 @@
<script setup lang='ts'>
import SkuDialog from '@/components/sku-dialog.vue';
import { assetsUrl } from '@/utils/assets';
import { goPath } from '@/utils';
import { goLogin, goPath, isLogin } from '@/utils';
import { getCategoryList, getGoodsList } from '@/api/goods';
import { CategoryBean, GoodsBean } from '@/api/goods/types';
import useShoppingCartStore from '@/store/modules/shoppingcart';
@@ -54,6 +54,11 @@ const categorySelectedIndex = ref<number>(0);
const goodsList = ref<GoodsBean[]>([]);
onLoad(() => {
if(!isLogin()) {
goLogin();
return;
}
fetchCategoryList();
});