<template>
  <view class="container theme-hot-content">
    <view class="tab-bar-ul">
      <view class="item-content">
        <view @click="tabBarSwitchHandel(item)" :class="['item', tabBarActive === item.value && 'item-act']" v-for="item in tabBarList" :key="item.value">{{ item.name }}</view>
      </view>
    </view>
    <view class="content-ul">
      <view class="global_card_content kol-li" :style="{ 'padding-top': item.IsHot ? '50rpx' : '' }" v-for="item in dataList" :key="item.DepartmentId">
        <image class="hot-icon" v-if="item.IsHot" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/hot_report.png" mode=""></image>
        <image @click="authorDetails(item)" :src="item.ImgUrl" v-if="item.ImgUrl"></image>
        <view class="li-item kol-item">
          <view class="item-top">
            <view class="hot-item global_title" @click="authorDetails(item)">
              {{ item.NickName }}
            </view>
            <view :class="['follw', 'global_content_center', item.IsFollw && 'cancel-follw']" @click="isAttention(item, '专家')">
              {{ item.IsFollw ? "取消关注" : "+ 关注" }}
            </view>
          </view>
          <text @click="themeDetails(val, 'KOL榜')" class="kol-text text_oneLine" v-for="val in item.List" :key="val.IndustrialManagementId"> # {{ val.IndustryName }} </text>
        </view>
      </view>
    </view>
    <u-loadmore :status="status" :load-text="loadText" v-if="page_no > 1" />
    <u-modal
      v-model="goFollowShow"
      :content-style="{ fontSize: '32rpx' }"
      @confirm="goFollowShowBtn"
      :show-cancel-button="isCancelBtn"
      :confirm-text="confirmText"
      @cancel="isCancelBtn = false"
      :show-title="false"
      :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
      :confirm-style="{ fontWeight: '700' }"
    >
      <view class="slot-content">
        <rich-text :nodes="accounts"></rich-text>
      </view>
    </u-modal>
    <Loading />
  </view>
</template>

<script>
import { Reports, Research, Report } from "@/config/api.js";
import mixinsAuthorTheme from "../components/mixinsAuthorTheme";
export default {
  data() {
    return {
      tabBarList: [
        {
          name: "更新时间",
          value: 2,
        },
        {
          name: "关注度",
          value: 1,
        },
      ],
    };
  },
  mixins: [mixinsAuthorTheme],
  methods: {
    //kol
    async getDataList() {
      const res = await Research.researchKolList({
        PageSize: this.pageSize,
        CurrentIndex: this.page_no,
        ThemeType: this.tabBarActive,
      });
      if (res.Ret === 200) {
        this.status = res.Data.Paging.IsEnd ? "nomore" : "loadmore";
        if (this.refresh) {
          uni.stopPullDownRefresh();
          this.refresh = false;
        }
        this.dataList = this.page_no === 1 ? res.Data.List || [] : [...this.dataList, ...res.Data.List];
      }
    },
    //去往作者详情
    authorDetails(item) {
      uni.navigateTo({
        url: "/reportPages/authorPages/authorPages?id=" + item.DepartmentId,
      });
    },
  },
};
</script>

<style lang="scss" scope>
.theme-hot-content {
  padding-bottom: 30rpx;
  background: $uni-bg-color;
  .tab-bar-ul {
    position: sticky;
    top: 0;
    left: 0;
    height: 111rpx;
    align-items: center;
    display: flex;
    justify-content: flex-end;
    padding: 10px 20rpx;
    background-color: #fff;
    border-bottom: 2rpx solid #f6f6f6;

    .item-content {
      display: flex;
      height: 48rpx;
      background: #dcdfe6;
      width: 288rpx;
      font-size: 24rpx;
      font-weight: 600;
      border-radius: 150rpx;
      color: #666;
    }

    .item {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 144rpx;
      height: 48rpx;
      border-radius: 150rpx;
    }

    .item-act {
      background-color: $uni-color-new;
      color: #fff;
    }
  }

  .content-ul {
    padding: 0 30rpx;
    .kol-li {
      position: relative;
      display: flex;
      align-items: center;
      padding-bottom: 30rpx;
      margin-bottom: 20rpx;
      background-color: #fff;
      image {
        width: 120rpx;
        height: 120rpx;
        border-radius: 8rpx;
        margin: 0 20rpx 0 15rpx;
        overflow: hidden;
        flex-shrink: 0;
      }
    }

    .kol-item {
      display: flex;
      flex-wrap: wrap;
      width: 480rpx;
      height: 120rpx;
      align-items: baseline;
      margin-bottom: 20rpx;

      .item-top {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 29rpx;
        font-weight: 700;
      }

      .kol-text {
        width: 50%;
        margin-top: 10rpx;
        flex-shrink: 0;
        font-size: 24rpx;
        font-weight: 400;
        color: #333;
      }
    }

    .li-item {
      display: flex;

      .title {
        font-size: 28rpx;
        line-height: 39rpx;
        font-weight: 500;
        color: #333;
      }
    }

    .hot-item {
      justify-content: space-between;
      align-items: center;

      .hot-new {
        align-items: center;
        flex: 1;
        padding-right: 20rpx;
      }

      .new-img {
        width: 60rpx;
        height: 30rpx;
        margin-left: 15rpx;
        flex-shrink: 0;
      }
    }
    .follw {
      color: #fff;
      border-radius: 4rpx;
      font-size: 24rpx;
      width: 110rpx;
      height: 42rpx;
      background-color: $uni-color-new;
    }
    .cancel-follw {
      background-color: #e5efff;
      color: $uni-color-new;
    }
    .hot-icon {
      position: absolute;
      width: 106rpx !important;
      height: 48rpx !important;
      top: 0 !important;
      left: 0 !important;
      margin: 0 !important;
      padding: 0 !important;
      border-radius: 0!important;
    }
  }
}
</style>
