feat: add ci cd files dont edit those files

This commit is contained in:
mahyargdz
2024-10-21 10:22:26 +03:30
commit fb5b440d42
321 changed files with 188273 additions and 0 deletions
+643
View File
@@ -0,0 +1,643 @@
<template>
<div class="category">
<!----------------------Page Top Button----------------------------->
<section class="s1">
<div class="container">
<div class="row">
<div class="col-12 top-btns" v-if="btnsLength > 1">
<div class="mt-2 view-link" v-if="category.category.hasNewsTab">
<button
@click="setChangeInPage({id: $route.query.id ,type: 'news', page: 1})"
class="btn bigBtn btn-primary"
:class="type === 'news' && 'btn-active'"
>
<span>اخبار</span>
</button>
</div>
<div class="mt-2 view-link" v-if="category.category.hasNewsFileTab">
<button
@click="setChangeInPage({id: $route.query.id ,type: 'newsFile'})"
class="btn bigBtn btn-primary"
:class="type === 'newsFile' && 'btn-active'"
>
<span>پرونده خبری</span>
</button>
</div>
<div class="mt-2 view-link" v-if="category.category.hasContentTab">
<button
@click="setChangeInPage({id: $route.query.id ,type: 'content'})"
class="btn bigBtn btn-primary"
:class="type === 'content' && 'btn-active'"
>
<span>درباره ی ...</span>
</button>
</div>
<div class="mt-2 view-link" v-if="category.category.hasMediaTab">
<button
@click="setChangeInPage({id: $route.query.id ,type: 'gallery', galleryType: 'image',page: 1})"
class="btn bigBtn btn-primary"
:class="type === 'gallery' && 'btn-active'"
>
<span>چند رسانه ای</span>
</button>
</div>
<div class="mt-2 view-link" v-if="category.category.hasSubMenusTab">
<button
@click="setChangeInPage({id: $route.query.id ,type: 'subMenu'})"
class="btn bigBtn btn-primary"
:class="type === 'subMenu' && 'btn-active'"
>
<span>صفحات مرتبط</span>
<!-- <span>{{ category.category.title }}</span>-->
</button>
</div>
<div class="mt-2 view-link" v-if="category.category.hasTermsTab">
<button
@click="setChangeInPage({id: $route.query.id ,type: 'terms'})"
class="btn bigBtn btn-primary"
:class="type === 'terms' && 'btn-active'"
>
<span>قوانین و دستوالعمل ها</span>
</button>
</div>
<div class="mt-2 view-link" v-if="category.category.hasNazarTab">
<button
@click="setChangeInPage({id: $route.query.id ,type: 'survey'})"
class="btn bigBtn btn-primary"
:class="type === 'survey' && 'btn-active'"
>
<span>نظر سنجی</span>
</button>
</div>
<div class="mt-2 view-link" v-if="category.category.hasNotificationsTab">
<button
@click="setChangeInPage({id: $route.query.id,type: 'event'})"
class="btn bigBtn btn-primary"
:class="type === 'event' && 'btn-active'"
>
<span>اطلاعیه ها</span>
</button>
</div>
<div class="mt-2 view-link" v-if="category.category.hasSpecNewsTab">
<button
@click="setChangeInPage({id: $route.query.id,type: 'special'})"
class="btn bigBtn btn-primary"
:class="type === 'special' && 'btn-active'"
>
<span>مطالب ویژه</span>
</button>
</div>
</div>
</div>
</div>
</section>
<div class="container">
<div class="row">
<main class="col-12 main-content" :class="(noSideBar && type !== 'gallery') && 'col-lg-9'">
<!-------------------------------News Category------------------------->
<section class="s2" v-if="type === 'news'">
<LineTxt :label="` اخبار ${category.category.title}`"/>
<div class="sectionStyle" v-if="category.news.docs.length">
<template>
<!-- <div class="heronews" v-if="category.heroNews">-->
<!-- <div class="title-holder">-->
<!-- <div class="row">-->
<!-- <div class="col-12 col-md-6 view-img">-->
<!-- <img class="image" :src="category.heroNews.thumbCover" :alt="category.heroNews.title">-->
<!-- </div>-->
<!-- <div class="col-12 col-md-6">-->
<!-- <h2 class="title" :title="category.heroNews.title">{{ category.heroNews.title }}</h2>-->
<!-- <p class="paragraph" :title="category.heroNews.summaryTitle">{{ category.heroNews.summaryTitle }}</p>-->
<!-- <span class="s1-date">-->
<!-- {{ jData2(category.heroNews.customDate) }}-->
<!-- </span>-->
<!-- <nuxt-link class="btn btn-primary" :to="{name: 'portal-news-details',params: {portal: currentPortal,details: category.heroNews.title}}">ادامه مطلب</nuxt-link>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<CategoryHeroNews v-if="category.heroNews" :data="category.heroNews"/>
<CategoryHeroNews v-else :data="category.news.docs[0]"/>
<!-- <div class="heronews" v-else>-->
<!-- <div class="title-holder">-->
<!-- <div class="row">-->
<!-- <div class="col-12 col-md-6 view-img">-->
<!-- <img class="image" :src="category.news.docs[0].thumbCover" :alt="category.news.docs[0].title">-->
<!-- </div>-->
<!-- <div class="col-12 col-md-6">-->
<!-- <h2 class="title" :title="category.news.docs[0].title">{{ category.news.docs[0].title }}</h2>-->
<!-- <p class="paragraph" :title="category.news.docs[0].summaryTitle">{{ category.news.docs[0].summaryTitle }}</p>-->
<!-- <span class="s1-date">-->
<!-- {{ jData2(category.news.docs[0].customDate) }}-->
<!-- </span>-->
<!-- <nuxt-link class="btn btn-primary" :to="{name: 'portal-news-details',params: {portal: currentPortal,details: category.news.docs[0].title}}">ادامه مطلب</nuxt-link>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<div class="list-news">
<div class="mt-3 mb-4">
<div class="line"></div>
</div>
<div class="row">
<NewsBox v-for="(item,index) in category.news.docs" :key="item._id" v-if="category.heroNews || index > 0" :item="item" :timeIsAgo="false"/>
<!-- ******************************************* old style ******************************************* -->
<!-- <div class="col-12 col-sm-6 col-lg-3 mb-5 stretch" v-for="item in category.news.docs" :key="item._id">-->
<!-- <div class="news-card justifyBetween">-->
<!-- <img :src="item.thumbCover" :alt="item.title">-->
<!-- <h2>{{ item.title }}</h2>-->
<!-- <nuxt-link :to="{name: 'portal-news-details',params: {portal: currentPortal,details: item.title}}">-->
<!-- <div class="whole-wrapper">-->
<!-- <span class="whole-wrapper-date">-->
<!-- {{ jData2(item.customDate) + ' ' + jData(item.customDate) }}-->
<!-- </span>-->
<!-- <span class="whole-wrapper-title"> ادامه مطلب<i class="fas fa-chevron-left"></i> </span>-->
<!-- </div>-->
<!-- </nuxt-link>-->
<!-- </div>-->
<!-- </div>-->
<!-- ******************************************* old style ******************************************* -->
</div>
</div>
</template>
</div>
<div class="not-found" v-else>
<p>موردی وجود ندارد!</p>
</div>
<div class="paginate">
<div class="row">
<div class="col-12">
<el-pagination
layout="next, pager, prev"
v-if="paginate"
class="el-pagination"
@current-change="newsPageNumber"
:current-page="Number($route.query.page)"
:page-count="Number(category.news.totalPages)"
>
</el-pagination>
</div>
</div>
</div>
</section>
<!-------------------------------Child Category------------------------->
<section class="s3" v-if="type === 'subMenu'">
<LineTxt :label="` صفحات مرتبط با ${category.category.title}`"/>
<div class="link" v-if="category.category.childs.length">
<ul>
<nuxt-link
v-for="item in category.category.childs"
:key="item._id"
class="btn bigBtn btn-primary"
:to="{name: 'portal-category-details',params: {portal: currentPortal,details: item.title},query: {type: 'news',page: 1, id: item._id}}" v-slot="{navigate,href,isActive}" custom
exact>
<li @click="navigate">
<a :href="href">{{ item.title }}</a>
</li>
</nuxt-link>
</ul>
</div>
<div class="not-found" v-else>
<p>موردی وجود ندارد!</p>
</div>
</section>
<!-----------------------------Page Gallery--------------------------->
<CategoryGallerySection
v-if="type === 'gallery'"
:url="url"
:setChangeInPage="setChangeInPage"
:galleryType="galleryType"
:media="media"
:category="category"
:pageNumber="pageNumber"
:key="galleryComponentKey"
/>
<!-----------------------------Page content--------------------------->
<section class="s5" v-if="type === 'content'">
<LineTxt :label="` درباره ${category.category.title}`"/>
<div class="view-page-content ck-content" v-html="category.category.pageContent"
v-if="category.category.pageContent.length"></div>
<div class="not-found" v-else>
<p>موردی وجود ندارد!</p>
</div>
</section>
<!-----------------------------Page Terms--------------------------->
<section class="s6" v-if="type === 'terms'">
<LineTxt :label="` قوانین و دستورالعمل ها ${category.category.title}`"/>
<div class="row">
<div class="col-12 view-page-terms" v-for="item in category.category.terms" :key="item._id">
<div class="view-item-terms">
<div class="view-title-terms">
<i class="far fa-folder-open"></i>
<h3 :title="item.title">{{ item.title }}</h3>
</div>
<div>
<a class="btn btn-primary" :href="item.file" target="_blank">مطالعه کنید</a>
<a class="btn btn-primary" :href="item.file" target="_blank" download>دانلود</a>
</div>
</div>
</div>
</div>
<div class="not-found" v-if="!category.category.terms.length">
<p>موردی وجود ندارد!</p>
</div>
</section>
<!-----------------------------Page Survey--------------------------->
<section class="s7" v-if="type === 'survey'">
<LineTxt :label="` نظرسنجی ${category.category.title}`"/>
<div class="view-page-survey" v-for="item in category.polls" :key="item._id">
<div class="survey-item1">
<h2>{{ item.title }}</h2>
<p class="about-title">درباره نظر سنجی :</p>
<p class="about-txt">{{ item.description }}</p>
</div>
<div class="row survey-item2" v-if="!item.userIds.includes(userToken)">
<div class="col-12 col-md-6 mb-3">
<el-radio-group v-model="radio" v-for="(itemSelect, index) in item.options" :key="index"
v-if="item.surveyType === 'radio'">
<el-radio :label="itemSelect">{{ itemSelect }}</el-radio>
</el-radio-group>
<el-checkbox-group v-model="checkList"
v-if="item.surveyType === 'check'">
<el-checkbox v-for="(itemSelect2, index) in item.options" :key="index" :label="itemSelect2">
{{ itemSelect2 }}
</el-checkbox>
</el-checkbox-group>
</div>
<div class="col-12 col-md-6 comment-btn">
<button @click="post(item._id, item.surveyType)"
class="btn bigBtn btn-primary "
:disabled="item.surveyType === 'check' ? !checkList.length : !radio"
> ثبت نظر
</button>
</div>
</div>
<div class="survey-item2"
v-for="(answerItem, index) in item.options" :key="index"
v-if="item.userIds.includes(userToken)">
<h4>{{ answerItem }}</h4>
<el-progress :percentage="progress(item, answerItem)" color="#CC0000"></el-progress>
</div>
</div>
<div class="not-found" v-if="!category.polls.length">
<p>موردی وجود ندارد!</p>
</div>
</section>
<!-----------------------------Page Survey--------------------------->
<section class="s8" v-if="type === 'event'">
<LineTxt :label="` اطلاعیه ها ${category.category.title}`"/>
<ul>
<nuxt-link
v-for="item in category.events"
:key="item._id"
:to="{name: 'portal-news-details', params: {portal:currentPortal, details: item._id}}"
v-slot="{href,navigate}"
custom
>
<li @click="navigate">
<i class="fas fa-megaphone"></i>
<a :href="href">{{ item.title }}</a>
</li>
</nuxt-link>
</ul>
<div class="not-found" v-if="!category.events.length">
<p>موردی وجود ندارد!</p>
</div>
</section>
<!-----------------------------Page Survey--------------------------->
<section class="s9" v-if="type === 'special'">
<LineTxt :label="` مطالب ویژه ${category.category.title}`"/>
<ul>
<nuxt-link
:to="{name: 'portal-news-details', params: {portal:currentPortal, details: item._id}}"
v-for="item in category.specials"
:key="item._id"
v-slot="{href,navigate}"
>
<li>
<i class="fas fa-sparkles"></i>
<a :href="href">{{ item.title }}</a>
</li>
</nuxt-link>
</ul>
<div class="not-found" v-if="!category.specials.length">
<p>موردی وجود ندارد!</p>
</div>
</section>
<!-----------------------------Page Terms--------------------------->
<section class="s10" v-if="type === 'newsFile'">
<div class="container">
<LineTxt :label="` پرونده خبری ${category.category.title}`"/>
<div class="row">
<div class="col-12 view-page-newsFile" v-for="(item, index) in category.newsFile"
:key="item._id"
>
<div class="view-item-newsFile">
<nuxt-link :to="{name: 'portal-newsfile-details', params: {portal:currentPortal, details: item.title}, query: { page: 1 }}" class="view-title-newsFile">
<span>{{ index + 1 }}</span>
<h3>{{ item.title }}</h3>
</nuxt-link>
</div>
</div>
</div>
<div class="not-found" v-if="!category.newsFile.length">
<p>موردی وجود ندارد!</p>
</div>
</div>
</section>
</main>
<!-- <aside class="col-lg-3 d-none side-bar" :class="noSideBar && 'd-lg-block'"-->
<!-- v-if="type === 'gallery'">-->
<!-- <div-->
<!-- class="managerInfo sideBarItem"-->
<!-- v-if="category.category.hasManagerInfo"-->
<!-- :class="type === 'gallery' && 'galleryPage'"-->
<!-- >-->
<!-- <SideBarLineTxt label="برگزیده ها"/>-->
<!-- <div class="sectionStyle" v-for="(item,index) in media.favorites" :key="item._id + 1" v-if="index < 3">-->
<!-- <img :src="item.cover" :alt="item.title">-->
<!-- <nuxt-link class="view-title" :to="url(item.title)" :title="item.title">-->
<!-- <div class="title">-->
<!-- <h4>{{ item.title }}</h4>-->
<!-- </div>-->
<!-- </nuxt-link>-->
<!-- </div>-->
<!-- <div class="not-found" v-if="!media.favorites.length">-->
<!-- <p>موردی وجود ندارد!</p>-->
<!-- </div>-->
<!-- </div>-->
<!-- </aside>-->
<aside class="col-lg-3 d-none side-bar" :class="noSideBar && 'd-lg-block'" v-if="type !== 'gallery'">
<div
class="managerInfo sideBarItem"
v-if="category.category.hasManagerInfo"
:class="type === 'gallery' && 'galleryPage'"
>
<SideBarLineTxt label="معرفی مدیر"/>
<div class="sectionStyle">
<img :src="category.category.managerCover" :alt="category.category.managerName">
<div class="txtBox">
<h2>{{ category.category.managerName }}</h2>
<p>{{ category.category.managerDescription }}</p>
</div>
</div>
</div>
<div
class="specNews sidebarLinks mt-3 sideBarItem"
v-if="category.specials.length"
:class="type === 'gallery' && !category.category.hasManagerInfo && 'galleryPage'"
>
<SideBarLineTxt label="مطالب ویژه"/>
<div class="sectionStyle">
<!-- <ul>-->
<!-- <li v-for="(item,index) in category.specials" :key="item._id + 1" v-if="index < 4">-->
<!-- <nuxt-link :to="{name: 'portal-news-details', params: {portal: currentPortal,details: item.title}}" :title="item.title">-->
<!-- <i class="fas fa-sparkles"></i>-->
<!-- <span>{{ item.title }}</span>-->
<!-- </nuxt-link>-->
<!-- </li>-->
<!-- </ul>-->
<div id="slides-spec">
<nuxt-link
v-for="(item,index) in category.specials"
:key="item._id + 1"
v-if="index < 4"
:to="{name: 'portal-news-details', params: {portal: currentPortal,details: item._id}}"
v-slot="{href,navigate}"
custom
>
<div @click="navigate" class="slide pointer" :title="item.title">
<img :src="item.cover" :alt="item.title">
<a :href="href">{{ item.title }}</a>
</div>
</nuxt-link>
</div>
</div>
</div>
<div
class="notifications sidebarLinks mt-3 sideBarItem"
v-if="category.events.length"
:class="type === 'gallery' && !category.category.hasManagerInfo && !category.specials.length && 'galleryPage'"
>
<SideBarLineTxt label="اطلاعیه ها"/>
<div class="sectionStyle">
<ul>
<li v-for="(item,index) in category.events" :key="item._id + 2" v-if="index < 4">
<nuxt-link :to="{name: 'portal-news-details', params: {portal: currentPortal,details: item._id}}" :title="item.title">
<i class="fal fa-megaphone"></i>
<span>{{ item.title }}</span>
</nuxt-link>
</li>
</ul>
</div>
</div>
<div
class="latestNews sidebarLinks mt-3 sideBarItem"
v-if="category.events.length"
:class="type === 'gallery' && !category.category.hasManagerInfo && !category.specials.length && !category.events.length && 'galleryPage'"
>
<SideBarLineTxt label="آخرین اخبار"/>
<div class="sectionStyle">
<ul>
<li v-for="item in category.latestNews" :key="item._id + 3">
<nuxt-link :to="{name: 'portal-news-details', params: {portal: currentPortal,details: item._id}}" :title="item.title">
<i class="fas fa-circle"></i>
<span>{{ item.title }}</span>
</nuxt-link>
</li>
</ul>
</div>
</div>
</aside>
</div>
</div>
</div>
</template>
<script>
if (process.client) require("slick-carousel")
import moment from "moment-jalaali"
export default {
data() {
return {
category: null,
terms: [],
survey: [],
media: null,
radio: null,
checkList: [],
galleryComponentKey: 0
}
},
computed: {
paginate() {
return this.category.news.totalPages > 1
},
currentPortal() {
return this.$route.params.portal
},
pageQuery() {
return this.$route.query.page
},
type() {
return this.$route.query.type
},
galleryType() {
return this.$route.query.galleryType
},
btnsLength() {
let count = 0
if (this.category.category.hasNewsTab) count++
if (this.category.category.hasContentTab) count++
if (this.category.category.hasMediaTab) count++
if (this.category.category.hasSubMenusTab) count++
if (this.category.category.hasTermsTab) count++
if (this.category.category.hasNotificationsTab) count++
if (this.category.category.hasSpecNewsTab) count++
if (this.category.category.hasNazarTab) count++
return count
},
userToken() {
return this.$store.state.front.pollToken
},
noSideBar() {
return this.category.category.hasManagerInfo || this.category.specials?.length || this.category.events?.length
}
},
watch: {
pageQuery(newVal, oldVal) {
this.$nuxt.refresh()
},
galleryType(newVal, oldVal) {
this.$nuxt.refresh()
},
type(newVal, oldVal) {
},
media(newVal, oldVal) {
this.galleryComponentKey = Math.random()
},
},
methods: {
url(title) {
if (this.galleryType === 'image') {
return {name: 'portal-gallery-media', params: {portal: this.currentPortal, media: title}}
}
if (this.galleryType === 'video') {
return {name: 'portal-videos-video', params: {portal: this.currentPortal, video: title}}
}
if (this.galleryType === 'graphic') {
return {name: 'portal-graphics-graphic', params: {portal: this.currentPortal, graphic: title}}
}
},
pageNumber(val) {
this.$router.push({
name: 'portal-category-details',
params: {portal: this.currentPortal, details: this.$route.params.details},
query: {type: 'gallery', galleryType: this.galleryType, page: val, id: this.$route.query.id}
})
$(window).scrollTop(0)
},
newsPageNumber(val) {
this.$router.push({
name: 'portal-category-details',
params: {portal: this.currentPortal, details: this.$route.params.details},
query: {type: 'news', page: val, id: this.$route.query.id}
})
$(window).scrollTop(0)
},
jData(data) {
return moment(data).locale('fa').format('LL')
},
jData2(data) {
return moment(data).locale('fa').fromNow()
},
setChangeInPage(query) {
this.$router.push({name: 'portal-category-details', params: {portal: this.currentPortal, details: this.$route.params.details, id: this.$route.params.id}, query: query})
},
post(id, type) {
this.$axios.post('/api/public/answer', {
surveyId: id,
option: type === 'radio' ? [this.radio] : this.checkList,
pollToken: this.$store.state.front.pollToken
})
.then(res => {
this.$nuxt.refresh()
this.$message({
type: 'success',
message: 'نظر شما با موفقیت ثبت شد'
})
})
.catch(e => {
console.log(e)
})
},
progress(item, answerItem) {
let filteredAnswers = item.answers.filter(item0 => item.options.includes(item0))
let num = filteredAnswers.filter(item1 => item1 === answerItem).length
return Number(((num * 100 / filteredAnswers.length) || 0).toFixed(0))
}
},
mounted() {
$(document).ready(() => {
$("#slides-spec").slick({
dots: true,
slidesToShow: 1,
rtl: true,
autoplay: true,
autoplaySpeed: 3000,
speed: 1000,
arrows: false,
infinite: false,
pauseOnHover: true
})
})
},
async asyncData({$axios, params, error, query}) {
try {
const request = [
$axios.get(`/api/public/getCategory/${encodeURIComponent(params.details)}?page=${query.page}`),
$axios.get(`/api/public/getGalleryCat/${query.id}?type=${query.galleryType}&page=${query.page}`)
]
const fetch = await Promise.all(request)
const [category, media] = fetch
return {
category: category.data,
media: media.data
}
} catch (e) {
console.log('e', e)
error({status: 404, message: 'مشکلی پیش آمده است!'})
}
}
}
</script>