<template>
    <div class="put-list">
        <ul v-if="list.length > 0">
            <li class="put-list-index" v-for="item in list" :key="item.id">
                <p class="portal-summary-text" style="margin-bottom:18px;margin-top:10px">
                    <span v-if="!personal || isFollow">{{item.aname}}</span>{{item.cusInfo}}
                    <span style="margin-left:28px">{{item.eventTime}}</span>
                    <span v-if="item.aid == userInfo.aid" class="follow-hide pointer" style="float:right">
                        <span v-if="item.hidden">已隐藏</span>
                        <span v-else  @click="emitHide(item.id)">  <svg-icon style="margin-right: 10px;font-size:22px;padding-top: 4px;" icon-class="eyes"></svg-icon>隐藏 </span>
                    </span>
                </p>
                <h6 class="put-title-info follow-home-title">
                    <span class="pointer" @click="jumpDetail(item.info)">{{item.info.title || item.contentInfo}}</span>
                    <!-- <span class="portal-time follow-hide pointer" style="float:right" v-if="!isDynamic && personal">
                        <span v-if="item.hidden">已隐藏</span>
                        <span v-else  @click="emitHide(item.id)">  <svg-icon style="margin-right: 10px;font-size:22px;padding-top: 4px;" icon-class="eyes"></svg-icon>隐藏 </span>
                    </span> -->
                </h6>
                <div class="put-footer">
                   <div style="margin-top:20px;font-size: 14px;color: #666666;">{{item.info.answers}}个回答</div>
                   <el-button class="btn" plain @click="jumpDetail(item.info)">去回答</el-button>
                </div>
            </li>
        </ul>
        <!-- <div v-else class="home-no-list">
            <img class="img" style="width:204px;height:160px" :src="`${webBaseUrl}/images/homeWu/no-put.png`" alt="" srcset="">
            <p v-if="isFollow" class="text">暂时没有动态</p>
            <p v-else class="text">还没有提问</p>
        </div> -->
    </div>
  </template>

  <script>
    import interactBar from "@/components/Portal/interactBar.vue";
    import { mapGetters,mapActions } from 'vuex';
    // import author from "@/components/Portal/authorInfo.vue";
      export default{
        name:"PutList",
        components: {
          interactBar,
          // timeShow,
        //   author
        },
        props:{
            list:{
                type:Array,
                default:()=>[]
            },
            isDynamic:{
                type:Boolean,
                default:false,
            },
            personal:{
                type:Boolean,
                default:false,
            },
            isFollow:{
                type:Boolean,
                default:false,
            }
        },
        computed: {
          ...mapGetters(['userInfo']),
        },
          data(){
              return{
                putList:[]
              }
          },
      methods:{
        emitHide(id) {
          this.$emit('hideIndex',id)
        },
        jumpDetail(data) {
                if(!data.id){
                    return;
                }
                if(item.info.deleted){
                  this.$message.warning("此问题已删除");
                  return;
                }
                this.$router.push({ path: '/qa/answer', query: { id: data.id } });
            },

       }
      }
  </script>

  <style lang="scss" scoped>
    .put-list{
        .put-title-info{
            margin: 0;
        }
        ul{
            margin: 0;
        }
        .put-footer{
            display: flex;
            justify-content: space-between;
            margin-top: 24px;
            .btn{
                width: 140px;
                height: 40px;
            }
            .el-button{
                border: 1px solid #3379FB;
                border-radius: 4px;
                color: #3379FB;
            }
        }
        .put-list-index{
            padding: 40px 0 36px 0;
            border-bottom: 1px solid rgba($color: #999999, $alpha: 0.2);
            &:first-child{
                padding-top: 20px;
            }
        }
    }

  </style>
