<template>
  <div class="topicCell" :class="{topicCellMobile: mobile}" @click="clickArt(art, index)" :style="{marginLeft:
  left+'px'}">
    <div class="leftArea" :class="{noePic: !art.cover_url}">
      <div class="topicTitle">
        {{art.title}}
      </div>
      <div class="bottomArea">
        <div class="left" >
          <div class="userInfo">
            <img :src="info.icon_url || info.iconUrl">
            <div>{{info.nickname}}</div>
          </div>
          <div class="publishTime">
            <div>{{formatPublichTime(art.updated_at)}}</div>
          </div>
        </div>
        <div class="right">
          <div class="zan">
            <div class="icon"/>
            <div class="num">{{art.like_count}}</div>
          </div>
          <div class="comment">
            <div class="icon" />
            <div class="num">{{art.reply_count}}</div>
          </div>
        </div>
      </div>
    </div>
    <div class="rightArea" v-if="art.cover_url">
      <img :src="art.cover_url">
    </div>
  </div>
</template>

<script>
  export default {
    props: [ "art", "formatPublichTime", "mobile", "info", 'left' ],
    components: {},
    data() {
      return {

      }
    },
    computed: {},
    created() {
    },
    mounted() {
    },
    methods: {
      /**
       * 点击文章
       */
      clickArt(art, index) {
        location.href = `/p/${art.hash_id}`;
      },
    }
  };
</script>

<style lang="scss" scoped>
  @import "../../../assets/css/scssCommon.scss";
  .topicCell {
    margin: 0 auto;
    width:738px;
    height:174px;
    background:rgba(255,255,255,1);
    box-shadow:0px 0px 0px 0px rgba(0,0,0,0.1);

    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    padding: 30px 20px;

    .leftArea {
      width: 528px;
      height: 114px;
      display: flex;
      justify-content: space-between;
      align-items: left;
      flex-direction: column;

      &.noePic {
        width: 100%;
        padding-right: 0;
      }

      .topicTitle {
        height: 50px;
        font-size: 18px;
        font-weight:600;
        color:rgba(51,51,51,1);
        line-height: 25px;
        width: 100%;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        word-break: break-all;
      }

      .bottomArea {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        align-items: center;

        .left {
          display: flex;
          align-items: center;

          .userInfo {
            display: flex;
            align-items: center;
            img {
              width: 24px;
              height: 24px;
              border-radius: 50%;
            }
            div {
              margin-left: 4px;
              height:17px;
              font-size:12px;
              font-weight:500;
              color:rgba(34,34,34,1);
              line-height:17px;
            }
          }
          .publishTime {
            margin-left: 10px;
            padding-left: 10px;
            height:17px;
            font-size:12px;
            font-weight:400;
            color:rgba(218,218,218,1);
            line-height:17px;
            border-left: 1px solid #ededed;
            /*transform-origin:left center;*/
            /*transform: scale(0.83);*/
            word-break: keep-all;
            white-space: nowrap;

          }
        }
        .right {
          display: flex;
          align-items: center;
          justify-content: flex-start;
          .zan, .comment {
            margin-left: 23px;
            display: flex;
            align-items: center;
            .icon {
              width: 16px;
              height: 16px;
              background: url("~@/assets/quan/icon/zan.png") no-repeat;
              background-size: cover;
            }
            .num {
              margin-left: 1px;
              height:18px;
              font-size:13px;
              font-weight:500;
              color:rgba(153,153,153,1);
              line-height:18px;
              word-break: keep-all;
              white-space: nowrap;
            }
          }
          .comment {
            margin-left: 12px;
            .icon {
              background: url("~@/assets/quan/icon/common.png") no-repeat;
              background-size: cover;
            }
          }
        }
      }
    }
    .rightArea {
      flex-shrink: 0;
      font-size: 0;
      width:154px;
      height:114px;
      img {
        width:154px;
        height:114px;
        border-radius:2px;
      }
    }
  }
  .topicCellMobile {
    margin: 0 auto;
    width: pxtovw(355);
    height: pxtovw(118);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    padding: pxtovw(10) 0 pxtovw(19) 0;

    .leftArea {
      width: pxtovw(226);
      height: pxtovw(89);
      display: flex;
      justify-content: space-between;
      align-items: left;
      flex-direction: column;

      &.noePic {
        width: 100%;
        padding-right: 0;
      }

      .topicTitle {
        height: pxtovw(42);
        font-size:pxtovw(14);
        font-weight:600;
        color:rgba(51,51,51,1);
        line-height:pxtovw(21);
        width: 100%;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        word-break: break-all;
      }

      .bottomArea {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;

        .left {
          display: flex;
          align-items: center;

          .userInfo {
            display: flex;
            align-items: center;
            img {
              width: pxtovw(17);
              height: pxtovw(17);
              border-radius: 50%;
            }
            div {
              margin-left: pxtovw(5);
              height:pxtovw(14);
              font-size:pxtovw(10);
              font-weight:500;
              color:rgba(102,102,102,1);
              line-height:pxtovw(14);
              transform-origin:left center;
              transform: scale(0.83);
              word-break: keep-all;
              white-space: nowrap;
            }
          }
          .publishTime {
            margin-left: pxtovw(4);
            padding-left: pxtovw(10);
            height:pxtovw(14);
            font-size:pxtovw(10);
            font-weight:400;
            color:rgba(218,218,218,1);
            line-height:pxtovw(14);
            border-left: 1px solid #ededed;
            transform-origin:left center;
            transform: scale(0.83);
            word-break: keep-all;
            white-space: nowrap;
            max-width: pxtovw(80);
          }
        }
        .right {
          display: flex;
          align-items: center;
          justify-content: flex-end;
          .zan, .comment {
            display: flex;
            align-items: center;
            .icon {
              width: pxtovw(13);
              height: pxtovw(13);
              background: url("~@/assets/quan/icon/zan.png") no-repeat;
              background-size: cover;
            }
            .num {
              margin-left: pxtovw(2);
              font-size:10px;
              font-weight:500;
              color:rgba(153,153,153,1);
              line-height:14px;
              transform-origin:left center;
              transform: scale(0.83);
              word-break: keep-all;
              white-space: nowrap;
            }
          }
          .comment {
            margin-left: pxtovw(8);
            .icon {
              background: url("~@/assets/quan/icon/common.png") no-repeat;
              background-size: cover;
            }
          }
        }
      }
    }
    .rightArea {
      flex-shrink: 0;
      font-size: 0;
      width: pxtovw(120);
      height: pxtovw(89);
      img {
        width: pxtovw(120);
        height: pxtovw(89);
      }
    }
  }
</style>
