publication v-1

This commit is contained in:
HAM!DREZA
2024-07-03 14:34:21 +03:30
parent d2f71b6b14
commit 1518075cc6
21 changed files with 247 additions and 185 deletions
@@ -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">
@@ -197,7 +197,9 @@
زبان
</p>
<p class="text-[#383E43] font-semibold">{{ props.props[0].language }}</p>
<p class="text-[#383E43] font-semibold">
{{ 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>
@@ -251,7 +253,7 @@
stroke-linejoin="round"
/>
</svg>
{{ props.props[1] ? 'مشاهده دوره' : 'شرکت در دوره' }}
{{ props.props[1] ? "مشاهده دوره" : "شرکت در دوره" }}
</button>
</div>
</div>
@@ -263,32 +265,29 @@ import { useToast } from "vue-toastification";
const { authUser } = useAuth();
const props = defineProps(["props"], ["access"]);
const toast = useToast()
const router = useRouter()
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: {
courseId: id,
code: "",
},
if (authUser.value === null) {
return router.push({
path: "/login",
});
if (data.data.value?.status === 406 || data.data.value?.status === 500) {
toast.error(data.data.value.message
)
} else {
toast.success('ثبت نام انجام شد')
}
}
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("ثبت نام انجام شد");
}
setTimeout(() => {
location.reload();
}, 1000);
};
</script>
@@ -17,7 +17,7 @@
>توضیحات</span
>
</div>
<div 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>
@@ -25,7 +25,4 @@
<script setup>
const props = defineProps(['props'])
if (process.client) {
document.querySelector('.descriptions').innerHTML = props.props.description;
}
</script>
@@ -14,6 +14,7 @@
{{ props.props?.categories[0].name }}
</p>
<div
v-html="describe"
class="descriptios hidden md:block w-[39.896vw] text-[1.055vw] leading-[1.582vw] mt-[1.2vw]"
></div>
<p
@@ -199,18 +200,16 @@
const props = defineProps(["props"]);
import {jDate} from "@/utils/jDate"
if (process.client) {
const des = props?.props.description;
function hideEndOfString(inputString) {
const words = inputString.split(" ");
if (words.length > 50) {
const truncatedWords = words.slice(0, 50);
return truncatedWords.join(" ") + "...";
} else {
return inputString;
function hideEndOfString(inputString) {
const words = inputString.split(" ");
if (words.length > 50) {
const truncatedWords = words.slice(0, 30);
return truncatedWords.join(" ") + "...";
} else {
return inputString;
}
}
}
const data = hideEndOfString(des);
document.querySelector(".descriptios").innerHTML = data;
}
const describe = hideEndOfString(props.props.description);
</script>
@@ -30,10 +30,8 @@
</span>
<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>08:55</span>
<span>{{ convertStoMs(headline.time) }}</span>
<svg
class="ms-[0.3vw] h-[1.042vw] w-[1.042vw]"
viewBox="0 0 20 20"
@@ -124,6 +122,18 @@ import { useToast } from 'vue-toastification'
const toast = useToast()
const props = defineProps(['props'])
const download = (val) => toast.warning(`برای ${val} باید در دوره شرکت کنید`);
function convertStoMs(seconds) {
let minutes = Math.floor(seconds / 60);
let extraSeconds = seconds % 60;
minutes = minutes < 10 ? "0" + minutes : minutes;
return (
minutes +
":" +
(extraSeconds < 10
? "0" + Math.floor(extraSeconds)
: Math.floor(extraSeconds))
);
}
</script>