Completion of APIs except for user progress

This commit is contained in:
HAM!DREZA
2024-06-23 11:23:05 +03:30
parent 607ead8528
commit 46dd3d65a0
17 changed files with 356 additions and 411 deletions
+8 -5
View File
@@ -3,21 +3,24 @@
class="flex flex-col md:flex-row justify-between items-center py-[10vw] md:py-0 absolute top-[140vw] md:top-[54.3vw] w-full z-[3] border-y h-[133.846vw] md:h-[9.115vw] text-[#383E43] px-[10vw]"
>
<div class="flexBox flex-col">
<p class="text-[8.318vw] md:text-[2.344vw]">280</p>
<p class="text-[8.318vw] md:text-[2.344vw]">{{info.data.value.expertise}}</p>
<p class="text-[3.59vw] md:text-[0.938vw]">حوزه تخصصی</p>
</div>
<div class="flexBox flex-col">
<p class="text-[8.318vw] md:text-[2.344vw]">2,200,000</p>
<p class="text-[8.318vw] md:text-[2.344vw]">{{ numberFormat(info.data.value.student) }}</p>
<p class="text-[3.59vw] md:text-[0.938vw]">دانشجو</p>
</div>
<div class="flexBox flex-col">
<p class="text-[8.318vw] md:text-[2.344vw]">8,100</p>
<p class="text-[8.318vw] md:text-[2.344vw]">{{ numberFormat(info.data.value.title) }}</p>
<p class="text-[3.59vw] md:text-[0.938vw]">عنوان آموزشی</p>
</div>
<div class="flexBox flex-col">
<p class="text-[8.318vw] md:text-[2.344vw]">27,000</p>
<p class="text-[8.318vw] md:text-[2.344vw]">{{ numberFormat(info.data.value.hours) }}</p>
<p class="text-[3.59vw] md:text-[0.938vw]">ساعت آموزش</p>
</div>
</div>
</template>
</template>
<script setup>
const info = await useFetch('/api/settings')
</script>
+8 -3
View File
@@ -41,7 +41,7 @@
</defs>
</svg>
<div class="text-[#383E43] font-semibold">
<p class="text-[5.11vw] md:text-[1.979vw]">+2000</p>
<p class="text-[5.11vw] md:text-[1.979vw]">{{info.data.value.student}} +</p>
<p class="text-[3.59vw] md:text-[1.502vw]">دانشجو</p>
</div>
</div>
@@ -78,7 +78,7 @@
</svg>
<div class="text-[#383E43] font-semibold">
<p class="text-[5.11vw] md:text-[1.979vw]">375</p>
<p class="text-[5.11vw] md:text-[1.979vw]">{{info.data.value.title}}</p>
<p class="text-[3.59vw] md:text-[1.502vw]">ویدئوی آموزشی</p>
</div>
</div>
@@ -120,4 +120,9 @@
</div>
</div>
</div>
</template>
</template>
<script setup>
const info = await useFetch('/api/settings')
</script>
+132 -68
View File
@@ -235,28 +235,13 @@
</div>
</div>
<!-- comments -->
<div class="flex items-center gap-[3vw] md:gap-[0.7vw] mt-[15vw] md:mt-[7vw]">
<div
class="flex items-center gap-[3vw] md:gap-[0.7vw] mt-[15vw] md:mt-[7vw]"
>
<svg
class="w-[1.538vw] md:w-[0.521vw] h-[8.462vw] md:h-[2.76vw]"
class="w-[1.538vw] md:w-[0.521vw] h-[8.462vw] md:h-[2.76vw]"
viewBox="0 0 10 53"
fill="none"
xmlns="http://www.w3.org/2000/svg"
@@ -266,37 +251,117 @@
fill="#0D3F40"
/>
</svg>
<span class="text-[4.544vw] md:text-[1.481vw] font-semibold">پرسش و پاسخ</span>
<span class="text-[4.544vw] md:text-[1.481vw] font-semibold"
>پرسش و پاسخ</span
>
</div>
<div class="bg-[#F8F8F8] p-[4vw] md:p-[1vw] rounded-[3.846vw] md:rounded-[0.781vw] mt-[6vw] md:mt-[2vw]">
<div
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"
alt="profile"
class="w-[10.256vw] md:w-[3.958vw] h-[10.256vw] md:h-[3.958vw] rounded-[50%]"
/>
<img
v-else
src="/public/images/alt.png"
alt="profile"
class="w-[10.256vw] md:w-[3.958vw] h-[10.256vw] md:h-[3.958vw] rounded-[50%]"
/>
<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 : "کاربر مهمان" }}
</p>
<div class="thin">
<p class="text-[2.836vw] md:text-[0.741vw] text-[#878787]">
{{ jDate(item.createdAt) }}
</p>
<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 }}
</p>
</div>
</div>
<svg
@click="reply(item.id)"
class="cursor-pointer absolute md:left-[2vw] left-[5vw] h-[4.615vw] w-[4.615vw] md:h-[1.25vw] md:w-[1.25vw]"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M7.12988 18.3101H15.1299C17.8899 18.3101 20.1299 16.0701 20.1299 13.3101C20.1299 10.5501 17.8899 8.31006 15.1299 8.31006H4.12988"
stroke="#383E43"
stroke-width="1.5"
stroke-miterlimit="10"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M6.43012 10.8099L3.87012 8.24994L6.43012 5.68994"
stroke="#383E43"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</div>
<div
class="bg-[#F8F8F8] p-[4vw] md:p-[1vw] rounded-[3.846vw] md:rounded-[0.781vw] mt-[6vw] md:mt-[2vw]"
>
<div class="space-y-[5vw] md:space-y-[1vw]">
<div class="flex gap-[1vw]">
<img
src="/public/images/client1.png"
v-if="authUser.avatarMedia"
:src="authUser.avatarMedia"
alt=""
class="h-[10.256vw0] md:h-[3.385vw] w-[10.256vw] md:w-[3.385vw] rounded-[50%]"
/>
<div 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]">علی مصلحی</p>
<p class="text-[2.836vw] md:text-[0.741vw] text-[#878787]">پرسش جدید</p>
<img
v-else
src="/public/images/alt.png"
alt=""
class="h-[10.256vw0] md:h-[3.385vw] w-[10.256vw] md:w-[3.385vw] rounded-[50%]"
/>
<div
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?.name ? authUser.name : "کاربر مهمان" }}
</p>
<p class="text-[2.836vw] md:text-[0.741vw] text-[#878787]">
پرسش جدید
</p>
{{replyId}}
</div>
</div>
<textarea
v-model="comment"
v-model="comment"
class="h-[50vw] md:h-[18vw] w-full rounded-[3.846vw] md:rounded-[0.781vw] p-[1vw]"
name=""
id=""
cols="30"
rows="10"
></textarea>
<div class="flex justify-end gap-[1vw] text-[3.19vw] md:text-[0.833vw] text-white">
<div
class="flex justify-end gap-[1vw] text-[3.19vw] md:text-[0.833vw] text-white"
>
<button
@click="replyId = null"
class="h-[8.974vw] md:h-[2.292vw] w-[20.769vw] md:w-[5.573vw] rounded-[2.051vw] md:rounded-[0.521vw] bg-[#5A6268]"
>
حذف
</button>
<button
@click="sendComment"
@click="sendComment"
class="h-[8.974vw] md:h-[2.292vw] w-[20.769vw] md:w-[5.573vw] rounded-[2.051vw] md:rounded-[0.521vw] bg-primaryGreen"
>
ثبت
@@ -304,29 +369,6 @@
</div>
</div>
</div>
</div>
<div class="w-full md:w-[23.438vw]">
@@ -338,7 +380,7 @@
<label
v-for="item in data"
:key="item.id"
:class="{ 'bg-[#F4FDFD]': item === activeHead }"
class="cursor-pointer text-[#383E43] h-[14.615vw] md:h-[3.125vw] px-[3vw] md:px-[1.25vw] text-[3.59vw] md:text-[0.833vw] w-full flex justify-between"
>
<div class="flexBox gap-[1vw] md:gap-[0.3vw]">
@@ -404,8 +446,9 @@ const video = ref(null);
const url = ref(null);
const query = ref({});
const toast = useToast();
const comment = ref(null)
const comment = ref(null);
query.value = route.query;
const { authUser } = useAuth();
const { data, refresh } = await useFetch("/api/courseHeadlines", {
query: {
id: route.params.product,
@@ -414,27 +457,47 @@ const { data, refresh } = await useFetch("/api/courseHeadlines", {
const sendComment = () => {
const comments = useFetch('/api/comments/courseHeadline',{
method: 'POST',
const sendComment = async () => {
if (comment.value === "" || comment.value === null) {
return toast.error("متن خود را وارد کنید");
}
if (replyId.value === null) {
const commentss = await $fetch("/api/comments/courseHeadline", {
method: "POST",
body: {
id: activeHead.value.id,
text: comment.value,
},
});
refresh();
toast.success("نظر شما با موفقیت ثبت شد");
comment.value = "";
}else{
await $fetch("/api/comments/courseHeadlineReply", {
method: "POST",
body: {
id: activeHead.value.id,
text: comment.value
}
})
}
id: replyId,
text: comment.value,
},
});
refresh();
toast.success("نظر شما با موفقیت ثبت شد");
comment.value = "";
}
};
const replyId = ref(null)
const reply = async (id) => {
replyId.value = id
};
console.log('s',activeHead);
function copyUrl() {
navigator.clipboard.writeText(window.location.href);
toast.success("آدرس صفحه کپی شد");
}
if (query.value.hasOwnProperty("episode")) {
const fimd = data.value.find((items) => items.id === query.value.episode);
activeHead.value = fimd;
@@ -455,6 +518,7 @@ const chengeVideo = (item) => {
});
refresh();
};
console.log(activeHead.value.Comment);
</script>
@@ -260,10 +260,17 @@
<script setup>
import { useToast } from "vue-toastification";
const { authUser } = useAuth();
console.log('user', authUser.value === null);
const props = defineProps(["props"], ["access"]);
const toast = useToast()
const router = useRouter()
const paymentHandler = (id) => {
if (authUser.value === null) {
return router.push({
path: '/login'
})
}
const data = useFetch("/api/user/registerCourse", {
method: "POST",
body: {
@@ -59,7 +59,8 @@
<div class="flex gap-[1vw] basis-1/6 md:basis-1/6 w-full text-end justify-end md:pe-[2vw]">
<svg
class="h-[4.615vw] w-[4.615vw] md:h-[1.25vw] md:w-[1.25vw]"
@click="download('دانلود')"
class="cursor-pointer h-[4.615vw] w-[4.615vw] md:h-[1.25vw] md:w-[1.25vw]"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
@@ -95,7 +96,8 @@
</svg>
<svg
class="h-[4.615vw] w-[4.615vw] md:h-[1.25vw] md:w-[1.25vw]"
@click="download('مشاهده')"
class="cursor-pointer h-[4.615vw] w-[4.615vw] md:h-[1.25vw] md:w-[1.25vw]"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
@@ -143,8 +145,10 @@
<script setup>
import { useToast } from 'vue-toastification'
const toast = useToast()
const props = defineProps(['props'])
const download = (val) => toast.warning(`برای ${val} باید در دوره شرکت کنید`);
</script>