Completion of APIs except for user progress
This commit is contained in:
@@ -1,244 +0,0 @@
|
||||
<template>
|
||||
<div class="flex w-full flex-col pb-[30vw] md:pb-[7vw]">
|
||||
<template>
|
||||
<div class="flex items-center flex-col pb-[25vw] md:pb-[6vw]">
|
||||
<div
|
||||
class="flex flex-col gap-[1vw] flex-col-reverse md:flex-row justify-between w-[87.69%] md:w-full mt-[8.2vw]"
|
||||
>
|
||||
<div
|
||||
class="w-full md:w-[56.354vw] text-[#383E43] text-[1.055vw] leading-[1.582vw]"
|
||||
>
|
||||
|
||||
|
||||
<product-page-attended-coursesVideo />
|
||||
<product-page-attended-coursesDownload-box />
|
||||
<product-page-attended-coursesChats />
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="w-full md:w-[23.438vw]">
|
||||
|
||||
|
||||
<div
|
||||
class="mt-[82vw] md:mt-[4.6vw] min-h-[87.692vw] md:min-h-[29.635vw] rounded-[3.846vw] md:rounded-[0.781vw] bg-[#F8F8F8] pinkShadow space-y-[2vw] thin"
|
||||
>
|
||||
<div class="flexBox w-full flex-col text-[0.938vw] text-[#878787]">
|
||||
<label
|
||||
v-for="item in data.course.courseHeadlines" :key="item.id"
|
||||
class="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]">
|
||||
<input type="radio" class="accent-primaryGreen" />
|
||||
{{ item.headline }}
|
||||
</div>
|
||||
<div class="flexBox gap-[1vw] md:gap-[0.3vw]">
|
||||
02:24
|
||||
<svg
|
||||
class="h-[4.359vw] w-[4.359vw] md:h-[0.99vw] md:w-[0.99vw]"
|
||||
viewBox="0 0 19 20"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<g clip-path="url(#clip0_1_896)">
|
||||
<path
|
||||
d="M17.4166 10C17.4166 14.37 13.8699 17.9167 9.49992 17.9167C5.12992 17.9167 1.58325 14.37 1.58325 10C1.58325 5.63001 5.12992 2.08334 9.49992 2.08334C13.8699 2.08334 17.4166 5.63001 17.4166 10Z"
|
||||
stroke="#383E43"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M12.437 12.5175L9.98286 11.0529C9.55536 10.7996 9.20703 10.19 9.20703 9.69124V6.4454"
|
||||
stroke="#383E43"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_1_896">
|
||||
<rect
|
||||
width="19"
|
||||
height="19"
|
||||
fill="white"
|
||||
transform="translate(0 0.5)"
|
||||
/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<!-- <label
|
||||
class="bg-[#FDF4FB] 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]">
|
||||
<input
|
||||
type="radio"
|
||||
checked="checked"
|
||||
class="accent-primaryGreen"
|
||||
/>
|
||||
آشنایی با ساختار صفحات
|
||||
</div>
|
||||
<div class="flexBox gap-[1vw] md:gap-[0.3vw]">
|
||||
08:44
|
||||
<svg
|
||||
class="h-[4.359vw] w-[4.359vw] md:h-[0.99vw] md:w-[0.99vw]"
|
||||
viewBox="0 0 19 20"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<g clip-path="url(#clip0_1_896)">
|
||||
<path
|
||||
d="M17.4166 10C17.4166 14.37 13.8699 17.9167 9.49992 17.9167C5.12992 17.9167 1.58325 14.37 1.58325 10C1.58325 5.63001 5.12992 2.08334 9.49992 2.08334C13.8699 2.08334 17.4166 5.63001 17.4166 10Z"
|
||||
stroke="#383E43"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M12.437 12.5175L9.98286 11.0529C9.55536 10.7996 9.20703 10.19 9.20703 9.69124V6.4454"
|
||||
stroke="#383E43"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_1_896">
|
||||
<rect
|
||||
width="19"
|
||||
height="19"
|
||||
fill="white"
|
||||
transform="translate(0 0.5)"
|
||||
/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
</div>
|
||||
</label>
|
||||
|
||||
<label
|
||||
class="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]">
|
||||
<input type="radio" class="accent-primaryGreen" />
|
||||
تگ های Heading
|
||||
</div>
|
||||
<div class="flexBox gap-[1vw] md:gap-[0.3vw]">
|
||||
07:41
|
||||
<svg
|
||||
class="h-[4.359vw] w-[4.359vw] md:h-[0.99vw] md:w-[0.99vw]"
|
||||
viewBox="0 0 19 20"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<g clip-path="url(#clip0_1_896)">
|
||||
<path
|
||||
d="M17.4166 10C17.4166 14.37 13.8699 17.9167 9.49992 17.9167C5.12992 17.9167 1.58325 14.37 1.58325 10C1.58325 5.63001 5.12992 2.08334 9.49992 2.08334C13.8699 2.08334 17.4166 5.63001 17.4166 10Z"
|
||||
stroke="#383E43"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
<path
|
||||
d="M12.437 12.5175L9.98286 11.0529C9.55536 10.7996 9.20703 10.19 9.20703 9.69124V6.4454"
|
||||
stroke="#383E43"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_1_896">
|
||||
<rect
|
||||
width="19"
|
||||
height="19"
|
||||
fill="white"
|
||||
transform="translate(0 0.5)"
|
||||
/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
</div>
|
||||
</label> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<product-page-attended-coursesProgress-bar />
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useToast } from "vue-toastification";
|
||||
const toast = useToast();
|
||||
const route = useRoute();
|
||||
const replayTarget = ref(null);
|
||||
const { data, refresh } = await useFetch("/api/productId", {
|
||||
method: "POST",
|
||||
body: {
|
||||
id: route.params.product,
|
||||
},
|
||||
});
|
||||
const courseHeadline = await useFetch("/api/courseHeadlines", {
|
||||
method: 'POST',
|
||||
query: {
|
||||
id: route.params.product
|
||||
}
|
||||
})
|
||||
|
||||
console.log(courseHeadline.data.value);
|
||||
const comment = ref(null);
|
||||
|
||||
const sendComment = async () => {
|
||||
if (comment.value === "" || comment.value === null) {
|
||||
return toast.error("متن خود را وارد کنید");
|
||||
}
|
||||
const comments = await useFetch("/api/comments/sendcomment", {
|
||||
method: "POST",
|
||||
query: {
|
||||
id: data.value.course._id,
|
||||
},
|
||||
body: {
|
||||
text: comment.value,
|
||||
parent: replayTarget.value,
|
||||
},
|
||||
});
|
||||
comment.value = null;
|
||||
toast.success("نظر شما با موفقیت ثبت شد");
|
||||
refresh();
|
||||
};
|
||||
|
||||
const sendReplay = (id) => {
|
||||
replayTarget.value = id;
|
||||
};
|
||||
const deleteComment = () => {
|
||||
replayTarget.value = null;
|
||||
comment.value = null;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
+20
-3
@@ -11,7 +11,7 @@
|
||||
<p
|
||||
class="text-[3.59vw] md:text-[1.055vw] font-[600] text-[#383E43]"
|
||||
>
|
||||
1 روز
|
||||
{{ roundDay }} روز
|
||||
</p>
|
||||
<p
|
||||
class="text-[2.836vw] md:text-[0.741vw] font-[400] text-[#383E43]"
|
||||
@@ -373,8 +373,8 @@
|
||||
|
||||
<div class="flex justify-center items-center flex-col mt-[1.823vw]">
|
||||
<img
|
||||
v-if="authUser.avatarMedia"
|
||||
:src="authUser?.avatarMedia"
|
||||
v-if="profileImage"
|
||||
:src="profileImage"
|
||||
class="h-[27.949vw] md:h-[7.24vw] w-[27.949vw] md:w-[7.24vw] rounded-full"
|
||||
alt=""
|
||||
/>
|
||||
@@ -530,6 +530,7 @@
|
||||
|
||||
|
||||
<script setup>
|
||||
const profileImage = useState('profileImage')
|
||||
const tickets = await useFetch("/api/ticket");
|
||||
const lastTickets = tickets.data.value.slice(-2);
|
||||
const myCourses = await useFetch("/api/auth/me");
|
||||
@@ -537,6 +538,22 @@ const lastCourses = myCourses.data.value.course.slice(-2);
|
||||
const balance = await useFetch("/api/user/balance");
|
||||
const { authUser } = useAuth();
|
||||
|
||||
const today = new Date(); // تاریخ امروز
|
||||
const pastDate = new Date(authUser.value.createdAt); // تاریخ گذشته
|
||||
|
||||
// تفاوت زمانی را محاسبه میکنیم
|
||||
const timeDifference = today.getTime() - pastDate.getTime();
|
||||
|
||||
// تبدیل میلیثانیه به روز
|
||||
const dayDifference = timeDifference / (1000 * 3600 * 24);
|
||||
const roundDay = Math.ceil(dayDifference)
|
||||
|
||||
console.log(`تفاوت بین تاریخ امروز و تاریخ گذشته: ${roundDay} روز`);
|
||||
|
||||
|
||||
|
||||
console.log(today);
|
||||
console.log(today - authUser.value.createdAt);
|
||||
definePageMeta({
|
||||
middleware: "auth",
|
||||
});
|
||||
|
||||
+44
-28
@@ -2,13 +2,13 @@
|
||||
<div class="flex justify-between flex-col text-[#383E43]">
|
||||
<div class="relative">
|
||||
<img
|
||||
v-if="authUser.avatarMedia"
|
||||
:src="authUser?.avatarMedia"
|
||||
v-if="profileImage"
|
||||
:src="profileImage"
|
||||
class="w-[40.256vw] md:w-[8.177vw] h-[40.256vw] md:h-[8.177vw] rounded-[50%]"
|
||||
alt="profile"
|
||||
/>
|
||||
<img
|
||||
v-else
|
||||
v-else
|
||||
src="/public/images/alt.png"
|
||||
class="w-[40.256vw] md:w-[8.177vw] h-[40.256vw] md:h-[8.177vw] rounded-[50%]"
|
||||
alt="profile"
|
||||
@@ -79,7 +79,7 @@
|
||||
/>
|
||||
</svg>
|
||||
</label>
|
||||
<input type="file" id="file-upload" @change="changePhoto"/>
|
||||
<input type="file" id="file-upload" @change="changePhoto" />
|
||||
</div>
|
||||
<FormKit
|
||||
type="form"
|
||||
@@ -97,7 +97,7 @@
|
||||
<input
|
||||
type="text"
|
||||
name="name"
|
||||
:value="authUser?.phone"
|
||||
:value="data?.phone"
|
||||
readonly
|
||||
class="bg-[#F5F5F5] h-[13.59vw] md:h-[2.969vw] w-full md:w-[19.01vw] rounded-[2.564vw] md:rounded-[0.521vw] px-[1vw]"
|
||||
/>
|
||||
@@ -108,7 +108,7 @@
|
||||
>
|
||||
<FormKit
|
||||
name="name"
|
||||
:value="authUser?.name"
|
||||
:value="data?.name"
|
||||
type="text"
|
||||
input-class="bg-[#F5F5F5] h-[13.59vw] md:h-[2.969vw] w-full md:w-[19.01vw] rounded-[2.564vw] md:rounded-[0.521vw] px-[1vw]"
|
||||
/>
|
||||
@@ -119,7 +119,7 @@
|
||||
>
|
||||
<FormKit
|
||||
name="userName"
|
||||
:value="authUser?.userName"
|
||||
:value="data?.userName"
|
||||
type="text"
|
||||
input-class="bg-[#F5F5F5] h-[13.59vw] md:h-[2.969vw] w-full md:w-[19.01vw] rounded-[2.564vw] md:rounded-[0.521vw] px-[1vw]"
|
||||
/>
|
||||
@@ -130,7 +130,7 @@
|
||||
>
|
||||
<FormKit
|
||||
name="email"
|
||||
:value="authUser?.email"
|
||||
:value="data?.email"
|
||||
type="text"
|
||||
input-class="bg-[#F5F5F5] h-[13.59vw] md:h-[2.969vw] w-full md:w-[19.01vw] rounded-[2.564vw] md:rounded-[0.521vw] px-[1vw]"
|
||||
/>
|
||||
@@ -147,51 +147,67 @@
|
||||
</div>
|
||||
</FormKit>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
const profileName = useState('profileName')
|
||||
const profileImage = useState('profileImage')
|
||||
import { useToast } from "vue-toastification";
|
||||
const toast = useToast();
|
||||
const { authUser } = useAuth();
|
||||
const loading = ref(false);
|
||||
const name = ref("avater");
|
||||
const {data, refresh} = await useFetch('/api/auth/me')
|
||||
|
||||
const edit = async (formData) => {
|
||||
|
||||
if (formData.name !== authUser.value.name) {
|
||||
profileName.value = formData.name
|
||||
}
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
await $fetch("/api/user/update", {
|
||||
method: "PUT",
|
||||
body: formData,
|
||||
});
|
||||
location.reload();
|
||||
toast.success('اطلاعات با موفقیت ویرایش شد')
|
||||
refresh()
|
||||
// location.reload();
|
||||
} catch (error) {
|
||||
toast.error(error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
//const token = getCookie(event, 'token');
|
||||
async function changePhoto(val) {
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file', val.target.files[0]);
|
||||
formData.append('directoryName', name.value);
|
||||
|
||||
try {
|
||||
const dataa = await $fetch("/api/uploader", {
|
||||
method: "POST",
|
||||
body: formData
|
||||
});
|
||||
console.log('dataa',dataa);
|
||||
} catch (error) {
|
||||
console.log('error client', error.data.data.message);
|
||||
}
|
||||
// console.log('ss', formData);
|
||||
formData.append("directoryName", "test");
|
||||
formData.append("file", val.target.files[0]);
|
||||
|
||||
// const data = await useFetch("api/uploader", {
|
||||
// method: 'POST',
|
||||
// body: formData
|
||||
// });
|
||||
const data = await useFetch("/api/uploader", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
});
|
||||
|
||||
if (data.data.value.url) {
|
||||
console.log('done');
|
||||
await $fetch("/api/user/update", {
|
||||
method: "PUT",
|
||||
body: {
|
||||
avatarMedia: data.data.value.url
|
||||
},
|
||||
});
|
||||
profileImage.value = data.data.value.url
|
||||
toast.success('تصویر پروفایل تغییر کرد')
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
>
|
||||
|
||||
<p class="text-[3.59vw] md:text-[0.938vw] text-[#383E43]">
|
||||
{{ item.reason }}
|
||||
{{ item.reason === 'deposit' ? 'افزایش موجودی' : 'کاهش موجودی'}}
|
||||
</p>
|
||||
<p class="text-[3.59vw] md:text-[0.938vw] text-[#383E43]">
|
||||
{{ numberFormat(item.amount) }}
|
||||
@@ -51,7 +51,7 @@
|
||||
class="flex justify-between items-center"
|
||||
>
|
||||
<p class="text-[3.59vw] md:text-[0.938vw] text-[#383E43]">
|
||||
{{ item.reason }}
|
||||
{{ item.reason === 'deposit' ? 'افزایش موجودی' : 'کاهش موجودی'}}
|
||||
</p>
|
||||
<p class="text-[3.59vw] md:text-[0.938vw] text-[#383E43]">
|
||||
{{ numberFormat(item.amount) }}
|
||||
@@ -83,7 +83,7 @@
|
||||
class="flex justify-between items-center"
|
||||
>
|
||||
<p class="text-[3.59vw] md:text-[0.938vw] text-[#383E43]">
|
||||
{{ item.reason }}
|
||||
{{ item.reason === 'deposit' ? 'افزایش موجودی' : 'کاهش موجودی'}}
|
||||
</p>
|
||||
<p class="text-[3.59vw] md:text-[0.938vw] text-[#383E43]">
|
||||
{{ numberFormat(item.amount) }}
|
||||
|
||||
Reference in New Issue
Block a user