back-end done

This commit is contained in:
Amir Mohamadi
2020-12-10 16:36:48 +03:30
parent 80a7abafb7
commit bc5e617778
92 changed files with 5217 additions and 3379 deletions
+26 -10
View File
@@ -1,22 +1,17 @@
<template>
<div class="page blog-details--page">
<Hero :title="staticData.hero"/>
<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>News</span>
<span>{{categoryName(post.category)}}</span>
</span>
<span class="date">30/05/2020</span>
</div>
<div class="content">
<h2>لیست مقالات و اخبار</h2>
<br>
<br>
<p>ما می خواهیم اطلاعات بیشتری در مورد ما بدانید ، بنابراین ما اخبار ، رویدادها یا تحولات گریتینگ اراک ریل و صنعتی را که ما به آن تعلق داریم برای شما ارسال می کنیم ،بنابراین شما می دانید که چگونه ما در جای خود قرار گرفته ایم.</p>
<span class="date">{{jDate(post.created_at)}}</span>
</div>
<div class="content" v-html="post.post_details[$route.params.lang].description"></div>
<div class="share">
<p>{{staticData.t2}}</p>
<ul>
@@ -60,16 +55,37 @@
</template>
<script>
import moment from "moment-jalaali"
export default {
data() {
return {
domain: 'https://www.arakrail.com/'
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]
},
},
async asyncData({$axios, params}) {
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
}
}
}
</script>