<template>
  <view class="message">


    <view class="top custom_box" style="background: linear-gradient(180deg, rgb(254,245,246), rgb(245,245,245)); color: black;" >
      <!-- #ifdef MP || APP-PLUS -->
      <view class="sys-head">
        <view class="sys-bar" :style="{ height: sysHeight }"></view>
        <!-- #ifdef MP -->
        <view class="sys-title">消息</view>
        <!-- #endif -->
      </view>
      <!-- #endif -->
    </view>

    <view class="header-group bord" :style="{ 'margin-top': sysHeightTop}">
      <view class="tabs">
        <u-tabs class="defalt-utabs" :is-scroll="false" :list="navigationList" @change="changeNav" lineColor="#B22338" :current="tabIndex"
          :inactiveStyle="{ color: '#999999' }" :activeStyle="{ color: '#B22338', fontWeight: 'bold' }"
          keyName="title"></u-tabs>
      </view>
    </view>

    <view  :style="{ height: height }" >
      <swiper :style="{ height: height }" :current="tabIndex" @change="swiperChange">
        <swiper-item v-for="(tab,index) in navigationList" :key="index">
          <view>
            <mescroll-item ref="MescrollItem"  :i="index" :index="tabIndex" :tabs="navigationList" :height="height">
            </mescroll-item>
          </view>
        </swiper-item>
      </swiper>
    </view>
    <my-swiper :type=4 ></my-swiper>

  </view>
</template>

<script>
let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
let sysHeightTop = (uni.getSystemInfoSync().statusBarHeight + 43) + 'px';
import {
  mapGetters
} from "vuex";
import recommend from '@/components/recommend';
import productWindow from '@/components/productWindow';
import pageFooter from '@/components/pageFooter/index.vue'
import colors from "@/mixins/color";
import MescrollItem from "./module/mescrollUni-item.vue";

export default {
  components: {
    MescrollItem,
    pageFooter,
    recommend,
    productWindow,

  },
  mixins: [colors],
  data () {
    return {
      sysHeight: sysHeight,
      sysHeightTop: sysHeightTop,
      height:'550px',
      tabIndex:0,
      navigationList: [{
        title: '个人消息',
        id: 'normal-msg'
      }, {
        title: '系统公告',
        id: 'sys-msg'
      }],

    };
  },
  computed: mapGetters(['isLogin']),

  onLoad (options) {

  },
  onShow () {
    let sysInfo = uni.getSystemInfoSync()
    this.height= sysInfo.windowHeight -(sysInfo.screenWidth/750) * (200) +'px';
    console.log(this.height)
  },
  created () {
  },
  methods: {
    swiperChange(e) {
      this.tabIndex = e.detail.current
    },
    changeNav (e) {
      this.tabIndex = e.index
    },

  },
}
</script>

<style scoped lang="scss">
.message {
  display: flex;
  flex-direction: column;
}


.sys-head {
  position: relative;
  width: 100%;
  // background: linear-gradient(90deg, $bg-star1 0%, $bg-end1 100%);

  .bg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--view-theme);
    background-size: 100% auto;
    background-position: left bottom;
  }

  .sys-title {
    font-family: STYuanti-SC-Regular, STYuanti-SC;
    z-index: 10;
    position: relative;
    height: 43px;
    text-align: left;
    line-height: 43px;
    font-size: 36rpx;
    color: rgba(17, 17, 17, 1);
    /*font-weight: bolder;*/
    font-weight: 400;
    padding-left: 36rpx;

  }
}
</style>
