This commit is contained in:
HAM!DREZA
2024-12-31 11:52:10 +03:30
parent 6c388b6e07
commit 01c8e31ee1
27 changed files with 331 additions and 396 deletions
+13 -13
View File
@@ -88,7 +88,7 @@
<p
class="text-[3.59vw] md:text-[1.055vw] font-[600] text-[#383E43]"
>
{{ myCourses.data.value.user.course.length }}
{{ myCourses?.data?.value?.user?.course?.length }}
دوره
</p>
<p
@@ -133,7 +133,7 @@
<p
class="text-[3.59vw] md:text-[1.055vw] font-[600] text-[#383E43]"
>
{{ tickets?.data.value.result.length }}
{{ tickets?.data?.value?.result?.length }}
تیکت
</p>
<p
@@ -172,7 +172,7 @@
<p
class="text-[3.59vw] md:text-[1.055vw] font-[600] text-[#383E43]"
>
{{ numberFormat(balance.data.value) }}
{{ numberFormat(balance?.data?.value) }}
تومان
</p>
<p
@@ -261,10 +261,10 @@
class="flex justify-between items-center mt-[1.25vw] px-2"
>
<p class="basis-2/6 text-[3.19vw] md:text-[0.833vw] text-[#000]">
{{ ticket.subject }}
{{ ticket?.subject }}
</p>
<p class="basis-2/6 text-[3.19vw] md:text-[0.833vw] text-[#878787]">
{{ jDate(ticket.createdAt) }}
{{ jDate(ticket?.createdAt) }}
</p>
<nuxt-link
to="/account/tickets"
@@ -277,7 +277,7 @@
</div>
</div>
<div v-if="lastCourses.length > 0" class="lastCources mt-[20vw] md:mt-[2.917vw] mb-8">
<div v-if="lastCourses?.length > 0" class="lastCources mt-[20vw] md:mt-[2.917vw] mb-8">
<div class="flex flex-col">
<div class="flex justify-between items-center border-b pb-[0.833vw]">
<p class="text-[4.038vw] md:text-[1.055vw] font-[500]">
@@ -361,8 +361,8 @@
<div class="flex justify-center items-center flex-col mt-[1.823vw]">
<img
v-if="authUser.user.avatarMedia"
:src="authUser.user.avatarMedia"
v-if="authUser?.user?.avatarMedia"
:src="authUser?.user?.avatarMedia"
class="h-[27.949vw] md:h-[7.24vw] w-[27.949vw] md:w-[7.24vw] rounded-full"
alt=""
/>
@@ -376,12 +376,12 @@
<p
class="text-[4.038vw] md:text-[0.938vw] text-[#383E43] font-semibold mt-[1.25vw]"
>
{{ authUser.user.name ? authUser.user.name : 'کاربر مهمان' }}
{{ authUser?.user?.name ? authUser?.user?.name : 'کاربر مهمان' }}
</p>
<p
class="font-[400] text-[3.19vw] md:text-[0.833vw] text-[#878787] mt-[0.417vw]"
>
{{ authUser.user.userName ? authUser.user.userName + '@' : 'نام کاربری'}}
{{ authUser?.user?.userName ? authUser?.user?.userName + '@' : 'نام کاربری'}}
</p>
</div>
@@ -519,15 +519,15 @@
<script setup>
const tickets = await useFetch("/api/ticket/getTickets");
const lastTickets = tickets?.data?.value.result.slice(-2);
const lastTickets = tickets?.data?.value.result?.slice(-2);
const myCourses = await useFetch("/api/auth/me");
const lastCourses = myCourses.data?.value.com.slice(-2);
const lastCourses = myCourses?.data?.value?.com?.slice(-2);
const balance = await useFetch("/api/user/balance");
const { authUser } = useAuth();
const today = new Date(); // تاریخ امروز
const pastDate = new Date(authUser.value.user.createdAt); // تاریخ گذشته
const pastDate = new Date(authUser?.value?.user?.createdAt); // تاریخ گذشته
// تفاوت زمانی را محاسبه می‌کنیم
const timeDifference = today.getTime() - pastDate.getTime();