<template>
  <div>
    <section class="grid section">
      <div class="grid__wrapper section-wrapper">
        <aside class="grid__side">
          <div class="news-side">
            <div class="news-side__wrapper">
              <h2 class="news-side__title">
                <a href="/news">Лента новостей</a>
              </h2>
              <!-- <div class="news-side__banner">
                <div class="banner banner_side">
                  <a class="banner__link" href="javascript:void(0)">
                    <div class="banner__time">12:07:48</div>
                    <div class="banner__title">
                      осталось до&nbsp;конца распродажи в&nbsp;DNS
                    </div>
                    <div class="banner__icon">
                      <BaseIcon :name="'dns'" /></div
                  ></a>
                </div>
              </div> -->

              <WidgetLent :params="{showad:false,showadMainPage:true}" />
            </div>
          </div>
        </aside>
      </div>
    </section>
    <div class="section-wrapper">
      <NewsTypeExtendHeader v-if="indexNewsList.sections['daily_news'] && indexNewsList.sections['daily_news'].news[0]" :news="indexNewsList.sections['daily_news'].news[0]" />
    </div>
    <div v-if="indexNewsList.sections['section_1'] && indexNewsList.sections['section_1'].news[0]" class="grid__wrapper section-wrapper">
      <NewsTypeMainHeader
        :main-news-list="indexNewsList.sections['section_1']"
      />
    </div>
    <NewsTypeCommon v-if="indexNewsList.sections['section_2'] && indexNewsList.sections['section_2'].news[0]" :news-list="indexNewsList.sections['section_2']" />
    <NewsTypeExtendBody v-if="indexNewsList.sections['section_3'] && indexNewsList.sections['section_3'].news[0]" :news="indexNewsList.sections['section_3'].news[0]" />
    <NewsTypeMainWeek v-if="indexNewsList.sections['section_4'] && indexNewsList.sections['section_4'].news[0]" :week-news-list="indexNewsList.sections['section_4']" />
    <BannersW1254H100 />
    <NewsModuleWrapper v-if="indexNewsList.modules[0] && indexNewsList.modules[0].news[0]" :module="indexNewsList.modules[0]" />
    <NewsTypeBodyCommon v-if="indexNewsList.sections['section_5'] && indexNewsList.sections['section_5'].news[0]" :news-list="indexNewsList.sections['section_5']" />
    <NewsTypeSlider v-if="indexNewsList.sections['section_6'] && indexNewsList.sections['section_6'].news[0]" :slider-news="indexNewsList.sections['section_6']" />
    <BannersW1254H300 />
    <NewsModuleWrapper v-if="indexNewsList.modules[1] && indexNewsList.modules[1].news[0]" :module="indexNewsList.modules[1]" />
    <NewsTypeCommon v-if="indexNewsList.sections['section_7'] && indexNewsList.sections['section_7'].news[0]" :news-list="indexNewsList.sections['section_7']" />
    <BannersW1254H100Or90 />
    <NewsModuleWrapper v-if="indexNewsList.modules[2] && indexNewsList.modules[2].news[0]" :module="indexNewsList.modules[2]" />
  </div>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
import SkyScrapperMain from '~/components/Banners/SkyScrapperMain.vue'
export default {
  components: { SkyScrapperMain },
  async asyncData ({ store }) {
    await store.dispatch('modules/news/setIndexNewsList')
    await store.dispatch('modules/news/getNewsFeedList')
  },
  data () {
    // return {
    //   script3: `window.yaContextCb=window.yaContextCb||[];window.yaContextCb.push(()=>{Ya.adfoxCode.create({ownerId:279920,containerId:"adfox_1630315824593273",params:{pp:"i",ps:"dbpj",p2:"hijl"}})});`,
    //   script2: `window.yaContextCb=window.yaContextCb||[];window.yaContextCb.push(()=>{Ya.adfoxCode.create({ownerId:279920,containerId:"adfox_16303082032982855",params:{pp:"h",ps:"dbpj",p2:"hhya"}})});`,
    //   script1: `window.yaContextCb=window.yaContextCb||[];window.yaContextCb.push(()=>{Ya.adfoxCode.create({ownerId:279920,containerId:"adfox_163005842132031396",params:{pp:"g",ps:"dbpj",p2:"hhxx"}})});`
    // }
  },
  // mounted() {
  //   setInterval(this.setIndexNewsList, 240000);
  // },
  computed: {
    ...mapGetters({
      indexNewsList: 'modules/news/indexNewsList'
    }),
    sliders () {
      return this.indexNewsList.sliders
    },
    nzk_logo () {
      return require('~/static/png/nzk_logo.png')
    }
  },
  methods: {
    ...mapActions({
      setIndexNewsList: 'modules/news/setIndexNewsList'
    }),
    isMobile () {
      return this.$device.isMobile
    }
  },
  head () {
    return {
      title: 'Новости Барнаула и Алтайского края — на сайте amic.ru ИА Амител',
      meta: [
        {
          hid: 'description',
          name: 'description',
          content: 'Новости в Барнауле и Алтайском крае: оперативно репортажи с фото и видео. Интересные темы, эксперты,  ответы на вопросы, тесты, игры.'
        }
      ],
      link: [
        { rel: 'canonical', href: 'https://www.amic.ru/' }
      ],
      script: [
        {
          // src: 'https://cdn.onthe.io/io.js/d7T3K6DqlqQy',
          async: true,
          innerHTML: `
            window._io_config = window._io_config || {};
            window._io_config["0.2.0"] = window._io_config["0.2.0"] || [];
            window._io_config["0.2.0"].push({
              page_url: "https://old.amic.ru/",
              page_url_canonical: "https://www.amic.ru/",
              page_title: 'Новости Барнаула и Алтайского края — на сайте amic.ru ИА Амител',
              page_type: "main",
              page_language: "ru"
            })`
        }
      ],
      __dangerouslyDisableSanitizers: ['script']
    }
  }
}
</script>

<style lang="less">
/* @import url("@/assets/css/style.css"); */

.container {
  margin: 0 auto;
  min-height: 100vh;
}

.title {
  font-family: "Quicksand", "Source Sans Pro", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: block;
  font-weight: 300;
  font-size: 100px;
  color: #35495e;
  letter-spacing: 1px;
}

.subtitle {
  font-weight: 300;
  font-size: 42px;
  color: #526488;
  word-spacing: 5px;
  padding-bottom: 15px;
}

.links {
  padding-top: 15px;
}
.VuePagination__count {
  display: none;
}
.nzk_banner{
  position: absolute;
  top: -15px;
  right: 0;
  width: 100px;
}
</style>
