<template>
  <div class="container">
    <!-- <el-row :gutter="40" class="el-row" type="flex" justify="start" style="flex-wrap: wrap; flex-direction:row; margin: 0px 10px 60px">
    <el-col v-for="(item, index) in metDataList" :key="index" :xs="24" :sm="12" :md="8"  style="flex: 1; padding: 0;" >
      <meetingItem :MetData="item" />
    </el-col>
  </el-row> -->
    <!-- <div v-for="(item, index) in metDataList" :key="index" style="width: 370px;">
      <meetingItem :MetData="item" />
    </div> -->
    <!-- <div style="height:30PX"></div> -->
    <div class="item" v-for="(item, index) in metDataList" :key="index">
      <div class="time">
        <p>
          {{ item.startTime && item.startTime.substring(0, 2) }}月{{
            item.startTime && item.startTime.substring(3, 5)
          }}日 {{ item.startTime && item.startTime.substr(6) }}
        </p>
        <p style="color: #b2b5be">{{ item.createTime && item.createTime.substring(0, 4) }} 年</p>
      </div>
      <div class="info" @click="detils(item.id)">
        <div class="left">
          <p>
            结束时间: {{ item.endTime && item.endTime.substring(0, 2) }}月{{
              item.endTime && item.endTime.substring(3, 5)
            }}日 {{ item.endTime && item.endTime.substr(6) }}
          </p>
          <p class="title">{{ item.theme }}</p>
          <p>
            <span>时间: {{ item.startTime && item.startTime.substr(6) }} </span>
            <span>发起人: {{ item.createName }}</span>
          </p>
        </div>
        <div class="right">
          <van-icon name="arrow" size="20" color="#545965" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import tabBar from '@/components/tabbar/tabbar.vue'
import TabBarItem from '@/components/tabbar/TabBarItem.vue'
import meetingItem from '@/components/meetingTemplate/meetingItem.vue'
import {Message} from 'element-ui'

export default {
  data() {
    return {
      metDataList: [],
    }
  },
  components: {
    // tabBar,
    // TabBarItem,
    // meetingItem
  },
  mounted() {
    window.scrollTo(0, 0)
  },
  created() {
    let url = `${window.context.xqhk}/meeting/v1/getJson`
    this.$http
      .post(url, {
        groupRelation: 'AND',
        groupTree: {},
        pageBean: {
          page: 1,
          pageSize: 10,
          showTotal: true,
        },
        params: {},
        querys: [
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'meeting_status_',
            relation: 'AND',
            value: '1',
          },
          {
            group: 'main',
            operation: 'EQUAL',
            parentGroup: '',
            property: 'meeting_status_',
            relation: 'OR',
            value: '2',
          },
        ],
        sorter: [
          {
            direction: 'DESC',
            property: 'meeting_status_',
          },
          {
            direction: 'DESC',
            property: 'start_time_',
          },
        ],
      })
      .then((res) => {
        console.log(res, 'res')
        if (res.status == 200) {
          this.metDataList = res.data.value.rows
          // console.log(this.metDataList, 'this.metDataList')
          // this.metDataList.forEach(e => {
          //   this.users.push(e.name)
          // })
        } else {
          Message.error(res.data.message)
        }
      })
    // if(!sessionStorage.getItem('code') || !sessionStorage.getItem("currentUser")){
    // 	location.href =	`https://open.weixin.qq.com/connect/oauth2/authorize`+
    // 		`?appid=wwd000d294d60d85bc&redirect_uri=laptop-kkottu8t.com:8080/fvue/oauth`+
    // 		`&response_type=code&scope=snsapi_privateinfo`+
    // 		`&agentid=1000019#wechat_redirect`
    // }else{
    // 	let search = window.location.search
    // 	if(search.indexOf('?code=') != -1){
    // 		var str = search.match(/=(\S*)&/)[1]
    // 		this.code = str
    // 		uni.setStorageSync('code',str)
    // 	}
    // }
  },
  methods: {
    orderClick() {
      let departmentList = encodeURIComponent(
        JSON.stringify(this.departmentList)
      )
      let userList = encodeURIComponent(JSON.stringify(this.userList))
      uni.navigateTo({
        url:
          '../order/order?departmentList=' +
          departmentList +
          '&userList=' +
          userList,
      })
    },
    detils(id) {
      this.$router.push({
        name: 'meetingDetail',
        query: {
          id,
        },
      })
    },
  },
}
</script>
<style lang="scss" scoped>
* {
  padding: 0;
  margin: 0;
}
.item {
  width: 100%;
  display: flex;
  flex-direction: column;
  .time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5em 0.4em;
    background-color: #f6f8fb;
    font-size: 1.2em;
  }
  .info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5em;
    background-color: #fff;
    color: #b2b5be;
    p {
      margin: 0.5em 0;
      font-size: 1.2em;
    }
    span {
      font-size: 1em;
      margin-right: 1.8em;
    }
    .title {
      font-size: 1.5em;
      font-weight: bold;
      color: #0b0b0b;
      max-width: 15em;
      text-overflow: ellipsis; /*让截断的文字显示为点点。还有一个值是clip意截断不显示点点*/
      white-space: nowrap; /*让文字不换行*/
      overflow: hidden; /*超出要隐藏*/
    }
  }
}

/* @media screen and (min-width:750px) {
  .container {
    width: 335PX;
    display: flex;
  }
} */
</style>
