diff --git a/src/views/Home/index.vue b/src/views/Home/index.vue index fab089d..1169d5f 100644 --- a/src/views/Home/index.vue +++ b/src/views/Home/index.vue @@ -113,7 +113,7 @@ onBeforeMount(async () => { router.push("/login"); } } - + await userStore.getUserData(); await cardStore.getCardData(); @@ -135,9 +135,8 @@ const noticeClick = (num) => { window.open(url, "_blank"); }; -const handleAD = async () => { - console.log(userInfo.value); - if(userInfo.value.status !== 1){ +const handleAD = async () => { + if (userInfo.value.status !== 1) { let res; res = await getMarquee(); if (res.code === 200) { @@ -146,10 +145,13 @@ const handleAD = async () => { res = await getMovie(); if (res.code === 200) { - adData.value = res.data; - popShow.value = true; + // 判斷res.data是否為空Object + if (Object.keys(res.data).length !== 0) { + adData.value = res.data; + popShow.value = true; + } } - } + } }; const popShow = ref(false); @@ -328,7 +330,7 @@ const handleLogout = () => {
- --> + -->
@@ -352,22 +354,20 @@ const handleLogout = () => { @@ -442,7 +442,7 @@ const handleLogout = () => {
- +