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
@@ -73,7 +73,7 @@
تعداد ویدیو ها
</p>
<p class="text-[#383E43] font-semibold">
{{ props.props[0].countOfVideos }}
{{ props?.props[0]?.countOfVideos }}
</p>
</div>
<div class="py-[3vw] md:py-[0.9vw] w-full border-b flex justify-between">
@@ -113,7 +113,7 @@
حجم فایل ها
</p>
<p class="text-[#383E43] font-semibold">
{{ props.props[0].totalFileSize }} گیگابایت
{{ props?.props[0]?.totalFileSize }} گیگابایت
</p>
</div>
<div class="py-[3vw] md:py-[0.9vw] w-full border-b flex justify-between">
@@ -148,7 +148,7 @@
</svg>
سطح دوره
</p>
<p class="text-[#383E43] font-semibold">{{ props.props[0].level }}</p>
<p class="text-[#383E43] font-semibold">{{ props?.props[0]?.level }}</p>
</div>
<div class="py-[3vw] md:py-[0.9vw] w-full border-b flex justify-between">
<p class="flex items-center gap-[0.8vw]">
@@ -198,21 +198,21 @@
زبان
</p>
<p class="text-[#383E43] font-semibold">
{{ props.props[0].language }}
{{ props?.props[0]?.language }}
</p>
</div>
<div class="py-[3vw] md:py-[0.9vw] w-full border-b flex justify-between">
<p class="flex items-center gap-[0.8vw] ps-[2vw]">سطح رضایت</p>
<p class="text-[#383E43] font-semibold">
{{ props.props[0].satisfactionLevel }}
{{ props?.props[0]?.satisfactionLevel }}
</p>
</div>
<h2
v-if="props.props[0].price > 0"
v-if="props?.props[0]?.price > 0"
class="my-[5vw] md:my-[1.25vw] text-[4.544vw] md:text-[1.502vw] text-[#383E43] font-semibold flex items-center justify-end w-full gap-[0.5vw]"
>
{{ numberFormat(props.props[0].price) }}
{{ numberFormat(props?.props[0]?.price) }}
<p class="text-[2.836vw] md:text-[0.741vw]">تومان</p>
</h2>
<h2
@@ -223,7 +223,7 @@
</h2>
<button
class="greenButton h-[11.795vw] md:h-auto w-full flexBox text-[4.038vw] md:text-[1.055vw] rounded-[2.564vw] md:rounded-[0.521vw]"
@click="paymentHandler(props.props[0]._id)"
@click="paymentHandler(props?.props[0]._id)"
>
<svg
class="h-[5.641vw] md:h-[1.458vw] w-[5.641vw] md:w-[1.458vw]"
@@ -253,7 +253,7 @@
stroke-linejoin="round"
/>
</svg>
{{ props.props[1] ? "مشاهده دوره" : "شرکت در دوره" }}
{{ props?.props[1] ? "مشاهده دوره" : "شرکت در دوره" }}
</button>
</div>
</div>
@@ -267,27 +267,30 @@ const props = defineProps(["props"], ["access"]);
const toast = useToast();
const router = useRouter();
const paymentHandler = (id) => {
const paymentHandler = async (id) => {
if (authUser.value === null) {
return router.push({
path: "/login",
});
}
const data = useFetch("/api/user/registerCourse", {
method: "POST",
body: {
courseId: id,
code: "",
},
});
if (data.data.value?.status === 406 || data.data.value?.status === 500) {
toast.error(data.data.value.message);
} else {
toast.success("ثبت نام انجام شد");
try {
const data = await useFetch("/api/user/registerCurse", {
method: "POST",
body: {
courseId: id,
code: "",
},
});
if (data?.data?.value?.status === 406 || data?.data?.value?.status === 500) {
toast.error(data?.data?.value?.message);
} else {
toast.success("ثبت نام انجام شد");
}
setTimeout(() => {
location.reload();
}, 1000);
} catch (error) {
toast.error("خطا در برقراری ارتباط");
}
setTimeout(() => {
location.reload();
}, 1000);
};
</script>