<template>
  <div id="index">
    <el-col :span="24" class="main">
      <el-col :span="24" class="marketTop">
        <el-col :span="12" class="left">
          <el-col :span="1" class="leftTitle">
            <p>科<br />技<br />产<br />品</p>
            <p></p>
          </el-col>
          <el-col :span="23" class="infoLeft">
            <el-col :span="12" class="productList" v-for="(item, index) in productList" :key="index" @click.native="productDetail(item.id)">
              <el-image :src="item.image[0].url"></el-image>
              <p class="textOver">{{ item.name }}</p>
            </el-col>
          </el-col>
          <el-col :span="24" class="leftListDown"><span></span><span @click="toProductList">MORE</span></el-col>
        </el-col>
        <el-col :span="12" class="right">
          <el-col :span="24" class="rightListTop"><span @click="toTecList">MORE</span><span></span></el-col>
          <el-col :span="23" class="infoRight">
            <el-col :span="24" class="tecList" v-for="(item, index) in tecList" :key="index">
              <span></span>
              <span class="textOver" @click="tecDetail(item.id)">{{ item.name }}</span>
              <span>对接</span>
              <span>{{ item.meta | getDate }}</span>
            </el-col>
          </el-col>
          <el-col :span="1" class="rightTitle">
            <p></p>
            <p>技<br />术<br />供<br />求</p>
          </el-col>
        </el-col>
        <el-col :span="24">
          <el-image :src="gongqiuImage" class="gongqiuImage"></el-image>
        </el-col>
      </el-col>
      <el-col :span="24" class="marketDown">
        <el-col :span="24" class="downMain">
          <el-col :span="12" class="left">
            <el-col :span="24" class="downLeftTop">
              <el-image :src="downLeftTopImage"></el-image>
              <span class="topText">
                <span>服务供求</span>
                <span
                  ><p>S</p>
                  <p>ervice</p></span
                >
                <span @click="toServiceList">更多</span>
              </span>
            </el-col>
            <el-col :span="24" class="downLeftInfo">
              <el-col :span="24" class="bankingList" v-for="(item, index) in serviceList" :key="index" @click.native="serviceDetail(item.id)">
                <el-col :span="10">
                  <el-image :src="item.image[0].url"></el-image>
                </el-col>
                <el-col :span="14">
                  <span class="textOver">{{ item.name }}</span>
                  <span>{{ item.introduction }}</span>
                </el-col>
              </el-col>
            </el-col>
          </el-col>
          <el-col :span="12" class="right">
            <el-col :span="24" class="downLeftTop">
              <el-image :src="downLeftTopImage"></el-image>
              <span class="topText">
                <span>金融供求</span>
                <span
                  ><p>B</p>
                  <p>anking</p></span
                >
                <span>更多</span>
              </span>
            </el-col>
            <el-col :span="24" class="downRightImage">
              <el-image src="http://img2.imgtn.bdimg.com/it/u=1300722955,3173826431&fm=26&gp=0.jpg"></el-image>
            </el-col>
            <el-col :span="24">
              <el-col :span="24" class="downRightList" v-for="(item, index) in bankingList" :key="index">
                <span></span>
                <span>{{ item.title }}</span>
              </el-col>
            </el-col>
          </el-col>

          <el-col :span="24">
            <el-col :span="24" class="downLeftTop">
              <el-image :src="downLeftTopImage"></el-image>
              <span class="topText">
                <span>最新发布</span>
                <span
                  ><p>B</p>
                  <p>anking</p></span
                >
                <span @click="fabu()">我要发布</span>
              </span>
              <el-col :span="24" class="downLeftInfos">
                <el-col :span="12" class="bankingLists" v-for="(item, index) in serviceList" :key="index" @click.native="serviceDetail(item.id)">
                  <el-col :span="10">
                    <el-image :src="item.image[0].url"></el-image>
                  </el-col>
                  <el-col :span="12">
                    <span class="textOvers">{{ item.name }}</span>
                    <span>{{ item.introduction }}</span>
                  </el-col>
                </el-col>
              </el-col>
            </el-col>
          </el-col>
        </el-col>
      </el-col>
    </el-col>
  </div>
</template>

<script>
import _ from 'lodash';
import { mapActions, mapState, createNamespacedHelpers } from 'vuex';
const { mapActions: product } = createNamespacedHelpers('marketproduct');
const { mapActions: talentExperts } = createNamespacedHelpers('talentExperts');
var moment = require('moment');
export default {
  name: 'index',
  props: {},
  components: {},
  data: () => ({
    gongqiuImage: require('@/assets/live/main2.png'),
    downLeftTopImage: require('@/assets/live/square_big.png'),
    productList: [],
    tecList: [],
    bankingList: [
      {
        image:
          'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1588061253920&di=18e7a68061c9debd24a2db64967b891c&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Fback_pic%2F03%2F51%2F81%2F1257923ada49020.jpg',
        title: '测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据',
        content:
          '测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据',
      },
      {
        image:
          'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1588061253920&di=18e7a68061c9debd24a2db64967b891c&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Fback_pic%2F03%2F51%2F81%2F1257923ada49020.jpg',
        title: '测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据',
        content:
          '测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据',
      },
      {
        image:
          'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1588061253920&di=18e7a68061c9debd24a2db64967b891c&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Fback_pic%2F03%2F51%2F81%2F1257923ada49020.jpg',
        title: '测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据',
        content:
          '测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据',
      },
      {
        image:
          'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1588061253920&di=18e7a68061c9debd24a2db64967b891c&imgtype=0&src=http%3A%2F%2Fbpic.588ku.com%2Fback_pic%2F03%2F51%2F81%2F1257923ada49020.jpg',
        title: '测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据',
        content:
          '测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据测试型数据测试型数测试型数测试型数据',
      },
    ],
    serviceList: [],
  }),
  created() {
    this.search();
  },
  filters: {
    getDate(meta) {
      let createdAt = _.get(meta, `createdAt`);
      let date = new Date(createdAt)
        .toLocaleDateString()
        .replace('/', '-')
        .replace('/', '-');
      return date;
    },
  },
  computed: {},
  methods: {
    ...product(['query']),
    ...talentExperts({ expertQuery: 'query' }),
    async search() {
      let res = await this.query({ skip: 0, limit: 4, totaltype: '0' });
      if (this.$checkRes(res)) this.$set(this, `tecList`, res.data);
      res = await this.query({ skip: 0, limit: 4, totaltype: '1' });
      if (this.$checkRes(res)) this.$set(this, `productList`, res.data);
      res = await this.query({ skip: 0, limit: 4, totaltype: '2' });
      if (this.$checkRes(res)) this.$set(this, `serviceList`, res.data);
      // res = await this.expertQuery({ skip: 0, limit: 4 });
      // if (this.$checkRes(res)) this.$set(this, `expertsList`, res.data);
    },
    toProductList() {
      window.location.href = 'http://free.liaoningdoupo.com/platweb/supermaket/supermarketlist?totaltype=1';
    },
    productDetail(id) {
      window.location.href = 'http://free.liaoningdoupo.com/platweb/supermaket/supermarketdetail?totaltype=2&&?&id=' + id + '';
    },
    toTecList() {
      window.location.href = 'http://free.liaoningdoupo.com/platweb/supermaket/supermarketlist?totaltype=0';
    },
    tecDetail(id) {
      window.location.href = 'http://free.liaoningdoupo.com/platweb/supermaket/supermarketdetail?totaltype=0&&?&id=' + id + '';
    },
    toServiceList() {
      window.location.href = 'http://free.liaoningdoupo.com/platweb/supermaket/supermarketlist?totaltype=2';
    },
    serviceDetail(id) {
      window.location.href = 'http://free.liaoningdoupo.com/platweb/supermaket/supermarketdetail?totaltype=2&&?&id=' + id + '';
    },

    fabu() {
      window.location.href = 'http://localhost:8002/enterprise/enterprisexuqiu';
    },
  },
};
</script>

<style lang="less" scoped>
.gongqiuImage {
  width: 100%;
  height: 100%;
}
.main {
  width: 100%;
  margin: 20px auto;
  float: none;
}
.marketTop {
  width: 80%;
  margin: 20px auto;
  float: none;
}
.left {
  float: left;
  height: 500px;
  margin: 10px 0 20px 0;
  overflow: hidden;
}
.leftTitle {
  text-align: center;
  position: relative;
}
.leftTitle p:first-child {
  font-size: 18px;
  color: #044b79;
  font-weight: bold;
}
.leftTitle p:last-child {
  float: left;
  width: 2px;
  height: 402px;
  background-color: #044b79;
  margin: 0 5px;
  position: absolute;
  left: 9px;
}
.infoLeft {
  height: 480px;
  padding: 0 10px;
}
.productList {
  position: relative;
  margin: 0 10px 10px 0;
  width: 48%;
  height: 220px;
}
.productList:nth-child(2n) {
  margin: 0 0 10px 0;
}
.productList .el-image {
  width: 100%;
  height: 220px;
}
.productList p {
  position: absolute;
  text-align: center;
  bottom: 0;
  height: 50px;
  line-height: 50px;
  text-indent: 5px;
  // padding: 0 10px;
  background: #044b799f;
  color: #fff;
  width: 100%;
  font-size: 18px;
}
.leftListDown {
  position: relative;
}
.leftListDown span:first-child {
  display: inline-block;
  width: 80%;
  height: 3px;
  background: rgba(4, 75, 121, 0.37);
  margin: 0 10px 0 0;
  position: absolute;
  left: -10px;
  top: 10px;
}
.leftListDown span:last-child {
  font-size: 16px;
  float: right;
  padding: 0 15px 0 0;
  color: #044b79;
  font-weight: 700;
  cursor: pointer;
}
.right {
  float: right;
  height: 500px;
  overflow: hidden;
  margin: 10px 0 20px 0;
}
.rightListTop {
  position: relative;
}
.rightListTop span:first-child {
  font-size: 16px;
  float: left;
  padding: 0 0 0 15px;
  color: #044b79;
  font-weight: 700;
  cursor: pointer;
}
.rightListTop span:last-child {
  display: inline-block;
  width: 80%;
  height: 3px;
  background: rgba(4, 75, 121, 0.37);
  margin: 0 10px 0 0;
  position: absolute;
  right: -10px;
  top: 10px;
}
.infoRight {
  height: 480px;
  padding: 0 10px;
}
.tecList {
  padding: 0 15px;
  margin: 10px 0 10px 0;
}
.tecList span:first-child {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #2188c6;
  border-radius: 90px;
}
.tecList span:nth-child(2n) {
  display: inline-block;
  width: 80%;
  font-size: 18px;
  padding: 0 15px;
}
.tecList span:nth-child(3n) {
  display: inline-block;
  width: 10%;
  text-align: center;
  background-color: #044b79;
  color: #ffffff;
  font-size: 16px;
  padding: 3px 0px;
}
.tecList span:last-child {
  display: block;
  width: 120px;
  text-align: left;
  padding: 5px 0 5px 25px;
  font-size: 14px;
}
.rightTitle {
  text-align: center;
}
.rightTitle p:first-child {
  width: 2px;
  height: 370px;
  background: #044b79;
  position: relative;
  left: 10px;
  top: -20px;
}
.rightTitle p:last-child {
  font-size: 18px;
  font-weight: bold;
  color: #044b79;
}
.marketDown {
  height: 780px;
  overflow: hidden;
  margin: 20px 0 20px 0;
  background: #e9edf6;
  padding-top: 30px;
}
.downMain {
  width: 80%;
  float: none;
  height: 550px;
  margin: 0 auto;
}
.downLeftTop .el-image {
  width: 40px;
}
.topText {
  width: 89%;
  border-bottom: 2.5px solid #044b79;
  display: inline-block;
  position: relative;
  top: -10px;
  margin: 0 0 0 5px;
}
.topText span:first-child {
  font-size: 24px;
  font-weight: 700;
  color: #000000;
  padding: 0 10px;
  top: 4px;
}
.topText span p:first-child {
  font-weight: 800;
  font-size: 34px;

  color: #92959a;

  top: 11px;
  display: inline-block;
}
.topText span p:last-child {
  display: inline-block;
  font-weight: 700;
  font-size: 18px;
  color: #92959a;
}
.topText span:last-child {
  float: right;
  font-size: 16px;
  font-weight: 700;
  color: #044b79;
  position: relative;
  top: 20px;
  cursor: pointer;
}
.bankingLists {
  height: 152px;
}
.bankingLists .el-image {
  width: 100%;
  height: 130px;
  display: inline-block;
}
.bankingLists span {
  margin: 0 5px 0 5px;
  display: inline-block;
  width: 80%;
  font-size: 18px;
  padding: 0 0 0 10px;
  color: #044b79;
  font-weight: 700;
}
.bankingLists span:last-child {
  margin: 10px 0 0 5px;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 4;
  word-break: break-all;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  padding: 0 0 0 10px;
  color: #666;
  line-height: 25px;
  font-weight: 400;
}

.bankingList {
  height: 152px;
}
.bankingList .el-image {
  width: 100%;
  height: 130px;
  display: inline-block;
}
.bankingList span {
  margin: 0 5px 0 5px;
  display: inline-block;
  width: 80%;
  font-size: 18px;
  padding: 0 0 0 10px;
  color: #044b79;
  font-weight: 700;
}
.bankingList span:last-child {
  margin: 10px 0 0 5px;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 4;
  word-break: break-all;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  padding: 0 0 0 10px;
  color: #666;
  line-height: 25px;
  font-weight: 400;
}

.downRightImage {
  float: none;
  width: 85%;
  margin: 0 auto;
}
.downRightImage .el-image {
  height: 200px;
  width: 100%;
}
.downRightList {
  float: none;
  width: 85%;
  margin: 10px auto;
  height: 50px;
  font-size: 16px;
  line-height: 35px;
}
.downRightList span:first-child {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #2188c6;
  border-radius: 90px;
  margin: 10px;
}
.downRightList span:last-child {
  width: 80%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: inline-block;
}
</style>
