101 lines
3.1 KiB
Vue
101 lines
3.1 KiB
Vue
<template>
|
|
<div class="page blog-details--page latin-digits">
|
|
<Hero :title="categoryName(post.category)"/>
|
|
<section class="s1">
|
|
<div class="container">
|
|
<div class="panel">
|
|
<div class="date-category">
|
|
<span class="category">
|
|
<span>{{ staticData.t1 }}</span>
|
|
<span>{{ categoryName(post.category) }}</span>
|
|
</span>
|
|
<span class="date">{{ jDate(post.created_at) }}</span>
|
|
</div>
|
|
<div class="ck-content" v-html="post.post_details[$route.params.lang].description"></div>
|
|
<div class="share">
|
|
<p>{{ staticData.t2 }}</p>
|
|
<ul>
|
|
<li>
|
|
<a target="_blank" title="Twitter" :href="'https://twitter.com/intent/tweet?url=' + domain + $route.fullPath">
|
|
<i class="fab fa-twitter"></i>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a target="_blank" title="WhatsApp" :href="'whatsapp://send?text=' + domain + $route.fullPath">
|
|
<i class="fab fa-whatsapp"></i>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a target="_blank" title="Linked In" :href="'https://www.linkedin.com/shareArticle?mini=true&url=' + domain + $route.fullPath">
|
|
<i class="fab fa-linkedin-in"></i>
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a target="_blank" title="Facebook" :href="'https://www.facebook.com/sharer.php?u=' + domain + $route.fullPath">
|
|
<i class="fab fa-facebook-f"></i>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<section class="s2">
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<h2 class="title">{{ staticData.t3 }}</h2>
|
|
<nuxt-link :to="{name: 'lang-blog',params: {lang: $route.params.lang}}" class="btn btn-primary">{{ staticData.t4 }}</nuxt-link>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<CustomersCommunication/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import moment from "moment-jalaali"
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
post: null,
|
|
blogCategories: null,
|
|
domain: 'https://www.arakrail.com'
|
|
}
|
|
},
|
|
computed: {
|
|
staticData() {
|
|
return this.$store.state.staticData.blog_details[this.$route.params.lang]
|
|
}
|
|
},
|
|
methods: {
|
|
categoryName(id) {
|
|
return this.blogCategories.filter(item => item._id === id)[0].blogCategory_details[this.$route.params.lang].name
|
|
},
|
|
jDate(date) {
|
|
if (this.$route.params.lang === 'fa') return moment(date).format('jYYYY/jMM/jDD')
|
|
else return date.split(' ')[0]
|
|
},
|
|
},
|
|
head() {
|
|
return {
|
|
title: this.post.post_details[this.$route.params.lang].title
|
|
}
|
|
},
|
|
async asyncData({$axios, params, error}) {
|
|
try {
|
|
const post = await $axios.get(`/api/public/blog/${params.post}`)
|
|
const blogCategories = await $axios.get(`/api/public/blogCategories`)
|
|
return {
|
|
post: post.data,
|
|
blogCategories: blogCategories.data
|
|
}
|
|
} catch (e) {
|
|
error({status: 404, message: 'Page not found'})
|
|
}
|
|
}
|
|
}
|
|
</script>
|