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
@@ -275,13 +275,13 @@
>
</div>
<div
v-for="item in activeHead.Comment"
:key="item.id"
v-for="item in activeHead?.Comment"
:key="item?.id"
class="mt-[1vw] relative bg-[#F8F8F8] rounded-[3.846vw] md:rounded-[0.781vw] flex justify-between p-[4vw] md:p-[1.55vw]"
>
<img
v-if="item.user?.avatarMedia"
:src="item.user?.avatarMedia"
v-if="item?.user?.avatarMedia"
:src="item?.user?.avatarMedia"
alt="profile"
class="w-[10.256vw] md:w-[3.958vw] h-[10.256vw] md:h-[3.958vw] rounded-[50%]"
/>
@@ -295,7 +295,7 @@
<div class="ps-[3vw] md:ps-[1vw] w-full">
<p class="text-[3.59vw] md:text-[0.938vw] text-[#383E43]">
{{ item.user.name ? item.user.name : "کاربر مهمان" }}
{{ item?.user?.name ? item?.user?.name : "کاربر مهمان" }}
</p>
<div class="thin mt-[4vw] md:mt-0">
<p class="text-[2.836vw] md:text-[0.741vw] text-[#878787]">
@@ -304,7 +304,7 @@
<p
class="w-[98%] text-[3.19vw] md:text-[0.833vw] text-[#383E43] leading-[4.785vw] md:leading-[1.25vw] mt-[2vw] md:mt-[0.5vw]"
>
{{ item.text }}
{{ item?.text }}
</p>
</div>
</div>
@@ -339,8 +339,8 @@
<div class="space-y-[5vw] md:space-y-[1vw]">
<div class="flex gap-[1vw]">
<img
v-if="authUser.user.avatarMedia"
:src="authUser.user.avatarMedia"
v-if="authUser?.user?.avatarMedia"
:src="authUser?.user?.avatarMedia"
alt=""
class="h-[10.256vw0] md:h-[3.385vw] w-[10.256vw] md:w-[3.385vw] rounded-[50%]"
/>
@@ -354,7 +354,7 @@
class="space-y-[4vw] mt-[1vw] md:mt-0 ms-[1vw] md:ms-0 md:space-y-0"
>
<p class="text-[3.59vw] md:text-[0.938vw]">
{{ authUser?.user.name ? authUser.user.name : "کاربر مهمان" }}
{{ authUser?.user?.name ? authUser?.user?.name : "کاربر مهمان" }}
</p>
<p class="text-[2.836vw] md:text-[0.741vw] text-[#878787]">
پرسش جدید
@@ -405,13 +405,13 @@
<input
type="radio"
@click="chengeVideo(item)"
:checked="item.headline === activeHead.headline"
:checked="item?.headline === activeHead?.headline"
class="accent-primaryGreen"
/>
{{ item.headline }}
{{ item?.headline }}
</div>
<div class="flexBox gap-[1vw] md:gap-[0.3vw]">
{{ convertStoMs(item.time) }}
{{ convertStoMs(item?.time) }}
<svg
class="h-[4.359vw] w-[4.359vw] md:h-[0.99vw] md:w-[0.99vw]"
viewBox="0 0 19 20"
@@ -458,7 +458,7 @@
class="flex justify-between text-[3.19vw] md:text-[0.833vw] font-semibold text-[#383E43]"
>
<span class="text-[3.59vw] md:text-[0.938vw]">پیشرفت شما</span>
<span>{{ Math.floor(progress.completionPercentage) }}%</span>
<span>{{ Math.floor(progress?.completionPercentage) }}%</span>
</div>
<div
id="progressbar"
@@ -21,7 +21,7 @@
<!-- comment 1 -->
<div
v-for="item in props.props" :key="item.id"
v-for="item in props?.props" :key="item?.id"
class="mt-[1vw] relative bg-[#F8F8F8] rounded-[3.846vw] md:rounded-[0.781vw] flex justify-between p-[4vw] md:p-[1.55vw]"
>
<img
@@ -41,7 +41,7 @@
<p
class="w-[98%] text-[3.19vw] md:text-[0.833vw] text-[#383E43] leading-[4.785vw] md:leading-[1.25vw] mt-[2vw] md:mt-[0.5vw]"
>
{{ item.text }}
{{ item?.text }}
</p>
</div>
@@ -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>
@@ -43,10 +43,10 @@
/>
</svg>
</h2>
<span v-if="props.props.completionPercentage > 99" class="text-[2.836vw] md:text-[0.741vw] text-[#878787]"
<span v-if="props?.props?.completionPercentage > 99" class="text-[2.836vw] md:text-[0.741vw] text-[#878787]"
>تکمیل شده</span
>
<span v-else-if="props.props.completionPercentage > 1 && props.props.completionPercentage < 99" class="text-[2.836vw] md:text-[0.741vw] text-[#878787]"
<span v-else-if="props?.props?.completionPercentage > 1 && props?.props?.completionPercentage < 99" class="text-[2.836vw] md:text-[0.741vw] text-[#878787]"
>در حال تکمیل</span
>
<span v-else class="text-[2.836vw] md:text-[0.741vw] text-[#878787]">در حال تولید</span>
@@ -54,7 +54,7 @@
<div>
<div class="flex justify-between text-[3.19vw] md:text-[0.833vw]">
<span class="text-[#383E43]">درصد تکمیل دوره</span>
<span>{{props.props.completionPercentage}}٪</span>
<span>{{props?.props?.completionPercentage}}٪</span>
</div>
<div
id="progressbar"
@@ -75,7 +75,7 @@
<script setup>
const adad = 2;
const props = defineProps(['props'])
const activeClass = ref(props.props.completionPercentage);
const activeClass = ref(props?.props?.completionPercentage);
</script>
<style scoped>
@@ -17,7 +17,7 @@
>توضیحات</span
>
</div>
<div v-html="props.props.description" class="descriptions mt-[4vw] md:mt-[2.1vw] thin">
<div v-html="props?.props?.description" class="descriptions mt-[4vw] md:mt-[2.1vw] thin">
</div>
</template>
@@ -2,16 +2,16 @@
<div class="w-full relative flex h-[86.41vw] md:h-[40.625vw]">
<NuxtImg
:placeholder="[30, 20]"
:src="props.props?.image"
:src="props?.props?.image"
alt="html"
class="absolute h-[86.41vw] md:h-[40.625vw] top-0 left-0 w-full object-cover brightness-75"
/>
<div class="mt-[14vw] ms-[9.5vw] z-[1] text-white">
<h1 class="text-[5.751vw] md:text-[1.69vw] font-[600] -tracking-[0.05vw]">
{{ props.props?.name }}
{{ props?.props?.name }}
</h1>
<p class="text-[3.19vw] md:text-[0.833vw] mt-[0.6vw] text-[#E5E5E5]">
{{ props.props?.categories[0].name }}
{{ props?.props?.categories[0]?.name }}
</p>
<div
v-html="describe"
@@ -22,7 +22,7 @@
>
مدرس دوره :
<span class="text-[3.59vw] md:text-[1.055vw] text-white ms-[1vw]"
>{{props.props?.teacher.name}}</span
>{{props?.props?.teacher?.name}}</span
>
</p>
<div
@@ -112,7 +112,7 @@
</svg>
<div class="space-y-[0.3vw]">
<p class="text-[3.59vw] md:text-[1.055vw]">آخرین بروزرسانی</p>
<p class="text-[2.518vw] md:text-[0.741vw]">{{jDate(props.props?.updatedAt)}}</p>
<p class="text-[2.518vw] md:text-[0.741vw]">{{jDate(props?.props?.updatedAt)}}</p>
</div>
</div>
<div class="border-l"></div>
@@ -142,7 +142,7 @@
<div class="space-y-[0.3vw]">
<p class="text-[3.59vw] md:text-[1.055vw]">مدت زمان دوره</p>
<p class="text-[2.518vw] md:text-[0.741vw]">
{{ props.props?.duration }} ساعت
{{ props?.props?.duration }} ساعت
</p>
</div>
</div>
@@ -186,7 +186,7 @@
<div class="space-y-[0.3vw]">
<p class="text-[3.59vw] md:text-[1.055vw]">
{{ props.props?.studentsCount }}
{{ props?.props?.studentsCount }}
</p>
<p class="text-[2.518vw] md:text-[0.741vw]">دانشجو</p>
</div>
@@ -210,6 +210,6 @@ import {jDate} from "@/utils/jDate"
return inputString;
}
}
const describe = hideEndOfString(props.props.description);
const describe = hideEndOfString(props?.props?.description);
</script>
@@ -19,19 +19,19 @@
</div>
<div class="mt-[6vw] md:mt-[2.1vw] space-y-[3vw] md:space-y-[1vw] thin">
<div
v-for="headline in props.props.courseHeadlines" :key="headline.id"
v-for="headline in props?.props?.courseHeadlines" :key="headline.id"
class="px-[3vw] md:px-[0.4vw] flex items-center bg-[#F4FDFD] rounded-[3.846vw] md:rounded-[0.781vw] h-[15.385vw] md:h-[3.438vw] w-full smallShadow"
>
<div class="flex items-center relative basis-5/6 md:basis-3/6 w-full">
<span
class=" border-b-[0.15vw] border-[#878787] px-[1vw] md:px-[0.5vw] ms-[0.3vw] me-[2vw] md:me-[0.5vw] text-[4.038vw] md:text-[1.055vw] font-black text-[#878787]"
>
{{ props.props.courseHeadlines.indexOf(headline)+1 }}
{{ props?.props?.courseHeadlines?.indexOf(headline)+1 }}
</span>
<h2 class="border-r ps-[2.2vw]">{{ headline.headline }}</h2>
<h2 class="border-r ps-[2.2vw]">{{ headline?.headline }}</h2>
</div>
<div class="hidden md:flex items-center text-[0.833vw] w-full md:basis-2/6">
<span>{{ convertStoMs(headline.time) }}</span>
<span>{{ convertStoMs(headline?.time) }}</span>
<svg
class="ms-[0.3vw] h-[1.042vw] w-[1.042vw]"
viewBox="0 0 20 20"