<template>
    <div class="autoBox box" style="min-height: 900px; position: relative">
        <div class="crumbs">
            <div style="overflow: hidden">
                <el-breadcrumb
                    separator-class="el-icon-arrow-right"
                    style="float: left"
                >
                    <el-breadcrumb-item :to="{ path: 'home' }">{{
                            $t("common.Home")
                        }}
                    </el-breadcrumb-item>
                    <el-breadcrumb-item
                        :to="{ path: 'realTimeInfo1' }"
                        class="pointer"
                    >{{ $t("common.NewsData") }}
                    </el-breadcrumb-item
                    >
                    <el-breadcrumb-item>{{
                            $t("common.InfomationResults")
                        }}
                    </el-breadcrumb-item>
                </el-breadcrumb>
                <el-breadcrumb separator="/" style="float: right">
          <span
              :class="screenIndex == index ? 'secNavActive' : ''"
              class="pointer"
              @click="screenChange(item, index)"
              v-for="(item, index) in resourceSharingScreen"
          >
            &nbsp;&nbsp;{{ $t("common.InfomationResults") }} &nbsp;&nbsp;
              <!-- <span
                v-if="index + 1 !== resourceSharingScreen.length"
                style="color: #2c3e50"
                >/</span
              > -->
            </span
            >
                </el-breadcrumb>
            </div>
        </div>
        <div class="content">
            <!--<div class="abstract">
                      <div>
                          <h4 style="font-size: 30px;color: rgba(44, 85, 138, 1);font-weight: 600;margin: 0 0 15px 2px;">
                              {{bookContent.name}}
                              <div v-if="bookContent.informationVisibleStatus" style="display: inline-block; margin:6px 0  0 70px;padding:0 10px;height: 22px;line-height: 22px; background-color: rgba(255, 51, 0, 0.8);text-align: center;">
                                  <p style="margin: 0;height: 22px;line-height: 22px;font-size: 14px;">
                                      <span v-if="$i18n.locale=='zh'" style="line-height: 22px;color: white;font-size: 14px;">会员</span>
                                      <span v-if="$i18n.locale=='en'" style="line-height: 22px;color: white;font-size: 14px;">MEMBER</span>
                                  </p>
                              </div>
                          </h4>
                      </div>
                      <div style="width: 878px; height: 40px; background-color: rgba(96, 160, 244, 0.1);">
                          <div style="float: left">
                              <span style="margin-left: 30px;font-size: 16px;line-height: 40px;color: rgba(51, 51, 51, 1);">{{$t("common.resourceDetailsTheCategory")}}:{{bookContent.researchResultType}}</span>
                          </div>
                          <div style="float: left">
                              <span style="margin-left: 30px;font-size: 16px;line-height: 40px;color: rgba(51, 51, 51, 1);">{{$t("common.resourceDetailsReleaseTime")}}:{{bookContent.updateDate}}</span>
                          </div>
                          <div style="float: right">
                              <div style="float: left;line-height: 38px;color: rgba(51, 51, 51, 1);">
                                  &lt;!&ndash;下载&ndash;&gt;
                                  &lt;!&ndash;<i class="el-icon-download" style="margin-right: 3px;vertical-align: middle;cursor: pointer;" @click="downloads"></i>
                                  <span style="margin-right: 20px;vertical-align: middle;cursor: pointer;" @click="downloads">{{$t("common.resourceDetailsDownload")}}</span>&ndash;&gt;
                                  &lt;!&ndash; <i class="el-icon-star-off" style="margin-right: 3px;vertical-align: middle;cursor: pointer;"></i> &ndash;&gt;
      &lt;!&ndash;                            <img src="@/assets/img/ResourceSharing/heat.png" alt="" style="width: 16px;height: 16px;margin-right: 3px;vertical-align: middle;">&ndash;&gt;
      &lt;!&ndash;                            <img src="../../assets/img/ResourceSharing/collect.png" alt=""&ndash;&gt;
      &lt;!&ndash;                                 style="margin-right: 3px;vertical-align: middle;cursor: pointer;width: 16px;"&ndash;&gt;
      &lt;!&ndash;                                 :style="ifcommon?'color: #66b1ff;':''"&ndash;&gt;
      &lt;!&ndash;                                 @click="shareChange()"&ndash;&gt;
      &lt;!&ndash;                            >&ndash;&gt;
                                  <i class="el-icon-star-off" style="margin-right: 3px;vertical-align: middle;cursor: pointer;"
                                     :style="ifcommon?'color: #66b1ff;':''"
                                     @click="shareChange()"></i>
                                  <span style="margin-right: 30px;vertical-align: middle;cursor: pointer;"
                                        :style="ifcommon?'color: #66b1ff;':''"
                                        @click="shareChange()"
                                  >{{$i18n.locale=='zh'?ifcommon?"已收藏":"收藏":ifcommon?"Favorites":"Favorites"}}</span>
                                  &lt;!&ndash;<span class="share cursor"
                                      :style="ifcommon?'color: #66b1ff;':''"
                                      style="margin-right: 20px;float: right;"
                                      @click="shareChange()">
                                          <i class="el-icon-star-off" :style="ifcommon?'color: #66b1ff;':''"></i>
                                          {{$i18n.locale=='zh'?ifcommon?"已收藏":"收藏":ifcommon?"Favorites":"Favorites"}}
                                  </span>&ndash;&gt;
                              </div>
                              <div style="clear: both"></div>
                          </div>
                          <div style="clear: both"></div>
                      </div>
                      <div style="margin: 39px 0 0 0;">
                          <h4 style="font-size: 20px;color: rgba(44, 85, 138, 1);font-weight: 600;margin:0;">
                              {{$t("common.resourceDetailsAbstract")}}
                          </h4>
                          <p style="font-size: 16px; line-height: 32px;margin: 14px 0;color: rgba(51, 51, 51, 1);text-indent: 2em">
                              {{bookContent.researchResultAbstract}}
                          </p>
                      </div>
                  </div>
                  <div class="preview">
                      <div style="position: absolute;top:0;right: 0; width: 240px;height: 290px;">
                          <img v-if="bookContent['researchResultCover']==undefined||bookContent.researchResultCover==false||bookContent.researchResultCover==''" src="../../assets/img/ResourceSharing/baogao.png" alt="" style="width: 240px;  height: 290px;">
                          <img v-else :src="'api/file/pub/'+ bookContent.researchResultCover" alt="" style="width: 240px;height: 290px;">
                          <div style="position: absolute;bottom: 0;width: 100%; height: 49px;text-align: center;cursor: pointer;
                                      background: linear-gradient(180deg, rgba(255,255,255,0.64), rgba(0,0,0,0.64));"
                               @click="toPreview()">
                              <span style="color: white;font-size: 14px; font-weight: 600;line-height: 49px;opacity: 1;"
                                    @click="toPreview">{{$t("common.resourceDetailsPreview")}}</span>
                          </div>
                      </div>
                  </div>-->
            <div>
                <h4
                    style="
            font-size: 30px;
            color: rgba(44, 85, 138, 1);
            font-weight: 600;
            margin: 0 0 15px 2px;
            width: 878px;
          "
                >
                    <span style="margin-right: 70px">{{ bookContent.name }}</span>
                    <div
                        v-if="bookContent.informationVisibleStatus == 'Y'"
                        style="
              display: inline-block;
              margin: 6px 0 0 0;
              padding: 0 10px;
              height: 22px;
              line-height: 22px;
              background-color: rgba(255, 51, 0, 0.8);
              text-align: center;
            "
                    >
                        <p
                            style="
                margin: 0;
                height: 22px;
                line-height: 22px;
                font-size: 14px;
              "
                        >
              <span
                  v-if="$i18n.locale == 'zh'"
                  style="line-height: 22px; color: white; font-size: 14px"
              >会员</span
              >
                            <span
                                v-if="$i18n.locale == 'en'"
                                style="line-height: 22px; color: white; font-size: 14px"
                            >MEMBER</span
                            >
                        </p>
                    </div>
                </h4>
            </div>
            <div
                style="
          width: 878px;
          height: 40px;
          background-color: rgba(96, 160, 244, 0.1);
        "
            >
                <div style="float: left">
          <span
              style="
              margin-left: 30px;
              font-size: 16px;
              line-height: 40px;
              color: rgba(51, 51, 51, 1);
            "
          >{{ $t("common.resourceDetailsTheCategory") }}:{{
                  bookContent.researchResultType
              }}</span
          >
                </div>
                <div style="float: left">
          <span
              style="
              margin-left: 30px;
              font-size: 16px;
              line-height: 40px;
              color: rgba(51, 51, 51, 1);
            "
          >{{ $t("common.resourceDetailsReleaseTime") }}:{{
                  bookContent.updateDate
              }}</span
          >
                </div>
                <div style="float: right">
                    <div
                        style="float: left; line-height: 38px; color: rgba(51, 51, 51, 1)"
                    >
                        <!--              "integralExchange":"积分兑换",-->
                        <!--下载-->
                        <!--                        <i class="el-icon-download" style="margin-right: 3px;vertical-align: middle;cursor: pointer;" @click="downloads"></i>-->

                      <!--                        <img
                            src="../../assets/img/ResourceSharing/download.png"
                            @click="downloads"
                            alt=""
                            style="margin-right: 3px;vertical-align: middle;cursor: pointer;width: 16px;"/>
                        <span style="
                margin-right: 20px;
                vertical-align: middle;
                cursor: pointer;
              " @click="downloads">
                            {{ Object.is(bookContent.reserveThree, '1') ? $t("common.integralExchange") : $t("common.resourceDetailsDownload") }}
                        </span>-->


                        <!--                        <i class="el-icon-star-off" style="margin-right: 3px;vertical-align: middle;cursor: pointer;"></i>-->
                        <!--                        <img src="@/assets/img/ResourceSharing/heat.png" alt="" style="width: 16px;height: 16px;margin-right: 3px;vertical-align: middle;">-->
                        <!--                        <img src="../../assets/img/ResourceSharing/collect.png" alt=""-->
                        <!--                             style="margin-right: 3px;vertical-align: middle;cursor: pointer;width: 16px;"-->
                        <!--                             :style="ifcommon?'color: #66b1ff;':''"-->
                        <!--                             @click="shareChange()"-->
                        <!--                        >-->
                        <i
                            class="el-icon-star-off"
                            style="margin-right: 3px; vertical-align: middle; cursor: pointer"
                            :style="ifcommon ? 'color: #66b1ff;' : ''"
                            @click="shareChange()"
                        ></i>
                        <span
                            style="
                margin-right: 30px;
                vertical-align: middle;
                cursor: pointer;
              "
                            :style="ifcommon ? 'color: #66b1ff;' : ''"
                            @click="shareChange()"
                        >{{
                                $i18n.locale == "zh"
                                    ? ifcommon
                                        ? "已关注"
                                        : "关注"
                                    : ifcommon
                                        ? "Already collected"
                                        : " Collection"
                            }}</span
                        >
                        <!--<span class="share cursor"
                                        :style="ifcommon?'color: #66b1ff;':''"
                                        style="margin-right: 20px;float: right;"
                                        @click="shareChange()">
                                            <i class="el-icon-star-off" :style="ifcommon?'color: #66b1ff;':''"></i>
                                            {{$i18n.locale=='zh'?ifcommon?"已收藏":"收藏":ifcommon?"Favorites":"Favorites"}}
                                    </span>-->
                    </div>
                    <div style="clear: both"></div>
                </div>
                <div style="clear: both"></div>
            </div>
            <div class="abstract">
                <div style="margin: 39px 0 0 0">
                    <h4
                        style="
              font-size: 20px;
              color: rgba(44, 85, 138, 1);
              font-weight: 600;
              margin: 0;
            "
                    >
                        {{ $t("common.resourceDetailsAbstract") }}
                    </h4>
                    <p
                        style="
              font-size: 16px;
              line-height: 32px;
              margin: 14px 0;
              color: rgba(51, 51, 51, 1);
              text-indent: 2em;
            "
                    >
<!--                        {{ bookContent.name }}-->
                      {{bookContent.researchResultAbstract}}
                    </p>
                  <video v-if="bookContent.researchResultCatalog" :src="bookContent.researchResultCatalog" style="height: 300px;width: 400px"></video>
                </div>

            </div>
            <div class="preview">
                <div
                    style="
            position: absolute;
            top: 0;
            right: 0;
            width: 240px;
            height: 290px;
          "
                >
                    <div
                        v-if="
              bookContent['researchResultCover'] == undefined ||
              bookContent.researchResultCover == false ||
              bookContent.researchResultCover == 'null' ||
              bookContent.researchResultCover == null
            "
                        style="width: 240px; height: 290px; margin: auto"
                    >
                        <!--                                                    <div style="width: 240px;  height: 290  px; margin: auto;">-->
                        <div style="width: 240px; height: 290px; position: relative">
                            <img
                                src="@/assets/img/ResourceSharing/backImage.png"
                                alt=""
                                style="
                  width: 100%;
                  height: 100%;
                  position: absolute;
                  top: 0;
                  left: 0;
                "
                            />
                            <p
                                style="
                  padding: 50px 9px 0 9px;
                  width: 100%;
                  height: 95px;
                  box-sizing: border-box;
                  margin: 0;
                  text-align: center;
                  position: absolute;
                  top: 0;
                  left: 0;
                  color: #ffffff;
                  font-size: 14px;
                "
                            >
                                {{ bookContent.name }}
                            </p>
                            <p
                                style="
                  padding: 102px 7px 0 7px;
                  width: 100%;
                  height: 150px;
                  box-sizing: border-box;
                  margin: 0;
                  text-align: center;
                  position: absolute;
                  top: 115px;
                  left: 0;
                  color: #002c6c;
                  font-size: 12px;
                "
                            >
                                {{ bookContent.affiliatedUnitName }}
                            </p>
                        </div>
                    </div>
                    <!--                    <img v-if="bookContent['researchResultCover']==undefined||bookContent.researchResultCover==false||bookContent.researchResultCover==''" src="../../assets/img/ResourceSharing/baogao.png" alt="" style="width: 240px;  height: 290px;">-->
                    <img
                        v-else
                        :src="'api/file/pub/' + bookContent.researchResultCover"
                        alt=""
                        style="width: 240px; height: 290px"
                    />
                    <div
                        style="
              position: absolute;
              bottom: 0;
              width: 100%;
              height: 49px;
              text-align: center;
              cursor: pointer;
              background: linear-gradient(
                180deg,
                rgba(255, 255, 255, 0.64),
                rgba(0, 0, 0, 0.64)
              );
            "
                        @click="toPreview()"
                    >
            <span
                class="active"
                style="
                color: #0079ef;
                font-size: 14px;
                font-weight: 600;
                line-height: 49px;
                opacity: 1;
              "
            >{{ $t("common.resourceDetailsPreview") }}</span
            >
                    </div>
                </div>
            </div>
            <div style="clear: both"></div>
        </div>
        <!--目录-->
        <!--<div class="bookCatalog">
                <div class="catalog">
                    <span style="color: white;font-size: 20px;line-height: 250px;">目录</span>
                </div>
                <div class="catalogList">
                    <div
                            class="catalogText"
                            v-for="(item,index) in bookCatalog"
                            :style="{'border':index==bookCatalog.length-1?'none':''}">
                        <h4 style="font-size: 18px; font-weight: 600; margin: 0 0 16px 0;">
                            {{item.title}}
                        </h4>
                        <ul>
                            <li
                                    style="font-size: 14px; font-weight: 400; color: rgba(0,0,0,0.6);margin-top: 14px;"
                                    v-for="ele in item.text"
                            >
                                {{ele}}
                            </li>
                        </ul>
                    </div>
                </div>
                <div style="clear: both"></div>
            </div>-->
        <!--目录  图片-->
        <!--<div style="width: 100%; margin: 60px 0;">
                <h4 style="font-size: 20px;color: rgba(44, 85, 138, 1);font-weight: 600;margin:0;">
                    {{$t("common.resourceDetailsDirectory")}}
                </h4>
                <div class="bookCatalog" style="margin: 15px 0 60px 0;">
                    <img :src="'api/file/pub/'+ bookContent.researchResultCatalog" alt="" style="width: 100%;min-height: 250px; max-height: 600px;">
                </div>
            </div>-->
        <!--推荐-->
        <div class="recommend" v-show="cursorList[0]">
            <div
                style="border-bottom: 1px solid rgba(44, 85, 138, 1); margin: 20px 4px"
            >
                <div
                    style="
            float: left;
            width: 6px;
            height: 22px;
            background-color: #6bc13b;
            margin-top: 2px;
          "
                >
                    <div
                        style="background-color: #1b6ace; width: 6px; height: 16px"
                    ></div>
                </div>
                <div style="float: left; height: 24px; padding-bottom: 14px">
          <span
              style="
              color: #2c558a;
              font-size: 20px;
              margin-left: 10px;
              font-weight: 700;
              line-height: 24px;
            "
          >
            {{ $t("common.resourceDetailsResearchFindingsRecommendation") }}
          </span>
                </div>
                <div style="float: right; height: 30px">
                    <!--<span style="color: #2C558A; font-size: 16px; margin-right:30px;font-weight: 700;line-height: 30px;cursor:pointer;" @click="getCursorList()">{{$t('common.ChangeTheBatch')}}</span>-->
                    <span
                        @click="getCursorList()"
                        style="float: right; cursor: pointer; margin-right: 30px"
                    >
            <div style="width: 12px; height: 12px; float: left">
              <img
                  src="@/assets/img/helpCenter/change1.png"
                  alt=""
                  style="width: 100%"
              />
            </div>
            <div
                style="
                float: left;
                margin-left: 5px;
                font-size: 16px;
                color: #778aa4;
              "
            >
              {{ $t("common.ChangeTheBatch") }}
            </div>
          </span>
                </div>
                <div style="clear: both"></div>
            </div>
            <div style="margin: 20px 0">
                <div
                    v-for="(item, index) in cursorList"
                    v-show="index < 5"
                    @click="toDetails(item, index)"
                    :style="{ float: 'Left', marginLeft: index == 0 ? '0' : '15px' }"
                    style="cursor: pointer"
                >
                    <div style="width: 220px; height: 250px">
                        <div
                            v-if="
                item['researchResultCover'] == undefined ||
                item.researchResultCover == false ||
                item.researchResultCover == 'null' ||
                item.researchResultCover == null
              "
                            style="width: 220px; height: 250px; margin: auto"
                        >
                            <!--                        <div style="width: 220px;  height: 220px; margin: auto;">-->
                            <div style="width: 220px; height: 250px; position: relative">
                                <img
                                    src="@/assets/img/ResourceSharing/backImage.png"
                                    alt=""
                                    style="
                    width: 100%;
                    height: 100%;
                    position: absolute;
                    top: 0;
                    left: 0;
                  "
                                />
                                <p
                                    style="
                    padding: 40px 9px 0 9px;
                    width: 100%;
                    height: 95px;
                    box-sizing: border-box;
                    margin: 0;
                    text-align: center;
                    position: absolute;
                    top: 0;
                    left: 0;
                    color: #ffffff;
                    font-size: 14px;
                  "
                                >
                                    {{ item.name }}
                                </p>
                                <p
                                    style="
                    padding: 102px 7px 0 7px;
                    width: 100%;
                    height: 140px;
                    box-sizing: border-box;
                    margin: 0;
                    text-align: center;
                    position: absolute;
                    top: 115px;
                    left: 0;
                    color: #002c6c;
                    font-size: 12px;
                  "
                                >
                                    {{ item.affiliatedUnitName }}
                                </p>
                            </div>
                        </div>
                        <!--                        <img v-if="item['researchResultCover']==undefined||item.researchResultCover==false||item.researchResultCover==''||item.researchResultCover==null" src="../../assets/img/ResourceSharing/baogao.png" alt="" style="width: 220px;  height: 250px;">-->
                        <img
                            v-else
                            :src="'api/file/pub/' + item.researchResultCover"
                            alt=""
                            style="width: 220px; height: 250px"
                        />
                    </div>
                    <!--<p style="padding: 0 6px;box-sizing: border-box;width: 220px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;text-align: center">
                                  <span style="color: #333333;font-size: 16px;font-weight: 600;">
                                      {{item.name}}
                                  </span>
                              </p>-->
                    <p
                        style="
              padding: 0 6px;
              box-sizing: border-box;
              width: 220px;
              text-align: center;
            "
                    >
            <span
                style="
                display: inline-block;
                width: 100%;
                color: #333333;
                font-size: 16px;
                font-weight: 600;
                word-break: break-all;
              "
            >
              {{ item.name }}
            </span>
                    </p>
                </div>
                <div style="clear: both"></div>
            </div>
        </div>
        <!--<div style="width: 100%;position: relative;height: 100px;margin-bottom: 30px;">
                <el-pagination
                        background
                        style="height: 80px;position: absolute;left: 50%;top: 100px;transform: translate(-50%,-50%);"
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="currentPage"
                        :page-sizes="[100, 200, 300, 400]"
                        :page-size="9"
                        layout="prev, pager, next, sizes, jumper"
                        :total="400"
                ></el-pagination>
            </div>-->
        <!--    登录提示-->
        <el-dialog
            :title="$i18n.locale == 'zh' ? '提示' : 'Reminder'"
            :visible.sync="toViewLogin"
            :width="$i18n.locale == 'zh' ? '500px' : '750px'"
            :height="$i18n.locale == 'zh' ? '300px' : '386px'"
            :before-close="toViewLoginChange"
        >
            <div style="width: 100%; height: 100%">
                <img
                    src="@/assets/img/loginTips.png"
                    alt=""
                    style="width: 180px; height: 180px; margin-left: 20px"
                />
                <div
                    style="float: right; margin-right: 20px"
                    :style="
            $i18n.locale == 'zh'
              ? 'width: 49%;margin-top: 10px;'
              : 'width: 453px;margin-top: -25px;'
          "
                >
                    <div
                        style="
              font-size: 20px;
              font-weight: normal;
              color: #333333;
              font-family: HiraginoSansGB-W3, HiraginoSansGB;
              line-height: 40px;
            "
                    >
                        {{ $t("common.ReminderFirst") }}
                    </div>
                    <div
                        style="
              font-size: 16px;
              font-family: HiraginoSansGB-W3, HiraginoSansGB;
              font-weight: normal;
              color: #666666;
              line-height: 30px;
            "
                    >
                        {{ $t("common.ReminderSecond") }}
                        <span style="color: #0091ff; font-size: 18px">{{ num }}</span>
                        {{ $t("common.ReminderThird") }}
                    </div>
                    <div
                        style="
              font-size: 14px;
              font-family: HiraginoSansGB-W3, HiraginoSansGB;
              font-weight: normal;
              color: #666666;
              line-height: 30px;
            "
                    >
                        {{ $t("common.ReminderForth") }}
                    </div>
                    <div
                        style="
              font-size: 14px;
              font-family: HiraginoSansGB-W3, HiraginoSansGB;
              height: 33px;
              line-height: 60px;
              font-weight: normal;
              color: #0091ff;
            "
                    >
            <span
                style="margin-left: 40px"
                class="cursor"
                @click="toView('login')"
            >
              {{ $t("common.ReminderFifth") }}
            </span>
                        <span
                            style="margin-left: 10px"
                            class="cursor"
                            @click="toView('Register')"
                        >
              {{ $t("common.ReminderSixth") }}
            </span>
                    </div>
                </div>
            </div>
        </el-dialog>
    </div>
</template>
<script>
import Base from "@/views/base/Base";
import {getPersonalOrder} from "@/api/user";
import {getDicts, getDictByTypeValue} from "@/api/dict";
import {
    getBaseResearchResultViews,
    gateResearchResultViewById,
    gateResearchResultFileById,
} from "@/api/research/baseResearchResultView";
import {
    getFollowModeNumlByModelId,
    getFollowModelNumByUser,
    saveFollowModel,
} from "@/api/operation/basePortalModelFollowInfo";
import {getFollowModeNumlByModelIdAndUserId} from "@/api/operation/basePortalModelFollowInfo";
import {formatDate} from "@/utils/formatUtils";
import {getToken, resetToken} from "@/utils/auth";
// import { getToken } from "@/api/token";
import {reductionIntegral} from "@/utils/toCompleteTask";

export default {
    name: "resourceSharingDetails",
    extends: Base,
    data() {
        return {
            ifcommon: false,
            params: {
                pageNo: "",
                pageSize: "",
                language: "",
                id: "",
                researchResultFileId: "",
            },
            num: 5,
            timer: "",
            toViewLogin: false,
            screenIndex: 0, //研究成果、调研资源选中
            resourceSharingScreen: [
                {
                    lable: "common.resource",
                    value: "0",
                },
                // {
                //   lable: "common.researchResource",
                //   value: "1",
                // },
            ],
            bookContent: "",
            bookCatalog: [],
            cursorList: [],
            downloadStatus: false,
            params: {
                pageNo: 1,
                pageSize: 5,
                totalPage: "",
            },
            showExchange:false,
        };
    },
    mounted() {
        if (this.$route.query.key) {
            let rpath = {
                name: "resourceSharingDetails",
                query: {key: this.$route.query.key},
            };
            sessionStorage.setItem("pathReminder", JSON.stringify(rpath));
            this.initData();
        } else {
            this.toView("resourceSharing", 0);
        }
    },
    watch: {
        "$i18n.locale"() {
            this.initData();
        },
    },
    methods: {
        initData() {
            this.getData();
            // this.getCursorList();
            this.getMyCollecModel(); // 获取用户是否收藏
        },
        getMyCollecModel() {
            const that = this;
            if (this.$Cookies.get("token")) {
                let user = window.localStorage.getItem("user");
                var users = JSON.parse(user);
                let MyCollecModel = {
                    modelType: "researchResult",
                    userId: users.userId,
                    modelEntityId: JSON.parse(that.$route.query.key).entityId,
                };
                getFollowModeNumlByModelIdAndUserId(
                    JSON.parse(that.$route.query.key).entityId,
                    "researchResult",
                    this.userId
                ).then((res) => {
                    this.ifcommon = res.data;
                });
            }
        },
        //收藏
        shareChange() {
            // if (this.ifcommon) {
            //     this.Collection("uncollect");
            // } else {
            //     this.Collection("collect");
            // }
            if (this.ifcommon) {
                this.saveFollowModelDo("unfollow");
            } else {
                this.saveFollowModelDo("follow");
            }
        },

        //关注操作方法
        saveFollowModelDo: function (followType) {
            let user = window.localStorage.getItem("user");
            if (!this.$Cookies.get("token")) {
                // this.$message.warning("请先登录");
                // this.$confirm('检测到您未登录，是否登录')
                // .then(_ => {
                //  this.toView('login');
                // })
                // .catch(_ => {});
                this.toViewLogin = true;
            } else {
                var users = JSON.parse(user);
                var token = "" + getToken();
                var projectId = JSON.parse(this.$route.query.key).entityId;
                var userId = users.userId;
                // 接口逻辑
                this.submitHandler((token) => {
                    saveFollowModel(
                        projectId,
                        "researchResult",
                        userId,
                        followType,
                        token
                    )
                        .then((result) => {
                            // console.log(result);
                            /*if(followType=='unfollow'){
                                                  if(this.$i18n.locale=='zh'){
                                                      this.$message({
                                                          message: '取消收藏',
                                                          type: "success",
                                                      });
                                                  }else{
                                                      this.$message({
                                                          message: 'cancel coilection',
                                                          type: "success",
                                                      });
                                                  }
                                              }else{
                                                  if(this.$i18n.locale=='zh'){
                                                      this.$message({
                                                          message: '已收藏',
                                                          type: "success",
                                                      });
                                                  }else{
                                                      this.$message({
                                                          message: 'Already collected',
                                                          type: "success",
                                                      });
                                                  }
                                              }*/
                            if (followType == "unfollow") {
                                if (this.$i18n.locale == "zh") {
                                    this.$message({
                                        message: "取消关注",
                                        type: "success",
                                    });
                                } else {
                                    this.$message({
                                        message: "Cancel concerned",
                                        type: "success",
                                    });
                                }
                            } else {
                                if (this.$i18n.locale == "zh") {
                                    this.$message({
                                        message: "已关注",
                                        type: "success",
                                    });
                                } else {
                                    this.$message({
                                        message: "Already concerned",
                                        type: "success",
                                    });
                                }
                            }
                            this.ifcommon = !this.ifcommon;
                            this.resetToken();
                        })
                        .catch((error) => {
                            // 此处你的业务代码
                        });
                });
            }
        },
        screenChange(item, index) {
            this.toView("resourceSharing", item.value);
        },
        toDetails(item, index) {
            let params = {
                entityId: item.entityId,
                researchResultFileId: this.bookContent.researchResultFileId,
            };
            this.toDetailsNewPage("resourceSharingDetails", params);
        },
        toPreview() {
            const that = this;
                if (that.bookContent.securityStatus == "Y") {
                    if (this.$i18n.locale.toUpperCase() == "ZH") {
                        this.$message({
                            type: "warning",
                            message: "保密文件，禁止预览！",
                        });
                    } else {
                        this.$message({
                            type: "warning",
                            message: "Confidential documents, do not preview!",
                        });
                    }
                } else {
                    let params = {
                        entityId: this.bookContent.entityId,
                        researchResultFileId: this.bookContent.researchResultFileId,
                    };
                    if(that.$Cookies.get('token')){
                        let user = window.localStorage.getItem("user");
                        let users = JSON.parse(user);
                        if(users.umsUser.userUsertype=="普通用户账号" && Object.is(that.bookContent.reserveThree, '1')){
                            if(that.showExchange){
                                this.toViewQuery("resourceSharingDetailsPreview", params);
                                return;
                            }
                            window.localStorage.setItem("detailID", that.bookContent.reserveFour);
                            that.$router.push({name: 'userCenterIntegralExchangeDetail', query: {}});
                            return;
                        }
                        this.toViewQuery("resourceSharingDetailsPreview", params);
                    }else{
                        if(Object.is(that.bookContent.reserveThree, '1')){
                            window.localStorage.setItem("detailID", that.bookContent.reserveFour);
                            that.$router.push({name: 'userCenterIntegralExchangeDetail', query: {}});
                            return;
                        }
                        this.toViewQuery("resourceSharingDetailsPreview", params);
                    }
                }
        },
        // toPreview() {
        //     const that = this;
        //     if (Object.is(this.bookContent.reserveThree, '1')) {
        //         window.localStorage.setItem("detailID", this.bookContent.reserveFour);
        //         this.$router.push({name: 'userCenterIntegralExchangeDetail', query: {}});
        //     } else {
        //         if (that.bookContent.securityStatus == "Y") {
        //             if (this.$i18n.locale.toUpperCase() == "ZH") {
        //                 this.$message({
        //                     type: "warning",
        //                     message: "保密文件，禁止预览！",
        //                 });
        //             } else {
        //                 this.$message({
        //                     type: "warning",
        //                     message: "Confidential documents, do not preview!",
        //                 });
        //             }
        //         } else {
        //             let params = {
        //                 entityId: this.bookContent.entityId,
        //                 researchResultFileId: this.bookContent.researchResultFileId,
        //             };
        //             this.toViewQuery("resourceSharingDetailsPreview", params);
        //         }
        //     }
        // },
        toDetailsNewPage(router, json) {
            // this.$store.commit('modify', router);
            window.localStorage.setItem("router", router);
            localStorage.setItem("conferenceId", json);
            const {href} = this.$router.resolve({
                name: router,
                query: {
                    key: JSON.stringify(json),
                },
            });
            window.open(href, "_blank");
        },
        toView(router, json) {
            if (router == "login" || router == "Register") {
                clearInterval(this.timer);
            }
            this.$router.push({name: router, params: {key: json}});
        },
        toViewQuery(router, json) {
            let rpath = {name: router, query: {key: JSON.stringify(json)}};
            sessionStorage.setItem("pathReminder", JSON.stringify(rpath));
            this.$router.push({name: router, query: {key: JSON.stringify(json)}});
        },
        getData(entityId, researchResultFileId) {
            const that = this;
            let param = {
                pageNo: "",
                pageSize: "",
                language: "",
                entityId: "",
                researchResultFileId: "",
                reserveTwo: "Y",
            };
            if (this.$i18n.locale.toUpperCase() == "ZH") {
                param.language = "ZH";
            } else if (this.$i18n.locale.toUpperCase() == "EN") {
                param.language = "EN";
            }
            if (that.$route.query.key) {
                param.entityId = JSON.parse(that.$route.query.key).entityId;
            }
            if (entityId) {
                param.entityId = entityId;
            }
            gateResearchResultViewById(param).then((resulet) => {
                let data = resulet.data;
                if (data.baseResearchResultView) {
                    that.bookContent = data.baseResearchResultView;
                    console.log("that.bookContent.researchResultCatalog"+that.bookContent.researchResultCatalog)
                    that.bookContent.updateDate = that.bookContent.updateDate
                        ? formatDate(that.bookContent.updateDate, "YYYY-MM-DD")
                        : "";
                    that.getDictValue();
                    that.getCursorList();
                    if(that.bookContent.reserveFour && this.$Cookies.get('token')){
                        that.getPersonalOrder(that.bookContent.reserveFour);
                    }
                }
            });
        },
        getPersonalOrder(val){ //获取是否已经兑换
            getPersonalOrder(val).then((res) => {
              if(res.data.length){
                  this.showExchange = true
              }
            });
        },
        getCursorList() {
            let that = this;
            if (++that.params.pageNo > that.params.totalPage) {
                that.params.pageNo = 1;
            }
            let param = {
                pageNo: that.params.pageNo,
                pageSize: that.params.pageSize,
                language: "",
                status: 0,
                descStatus: 1,
                id: that.bookContent.id,
            };
            if (this.$i18n.locale.toUpperCase() == "ZH") {
                param.language = "ZH";
            } else if (this.$i18n.locale.toUpperCase() == "EN") {
                param.language = "EN";
            }

            getBaseResearchResultViews(param).then((resulet) => {
                let that = this;
                let data = resulet.data;
                if (data.baseResearchResultViews) {
                    that.cursorList = data.baseResearchResultViews;
                    that.cursorList.forEach((i) => {
                        i.createDate = i.createDate
                            ? formatDate(i.createDate, "YYYY-MM-DD")
                            : "";
                    });
                    /*let flag = false;
                                  for(let j=0;j<that.cursorList.length;j++){
                                      if(that.cursorList[j].name == that.bookContent.name){
                                          flag = j;
                                      }
                                  }
                                  if(flag==0||flag!=false) {
                                      that.cursorList.splice(flag,1)
                                  }else{
                                      if(that.cursorList.length>4){
                                          that.cursorList.pop()
                                      }
                                  }*/
                }
                if (data.page) {
                    that.params.totalPage = data.page.totalPage;
                }
            });
        },
        getDictValue() {
            const that = this;
            let params = {
                typeCode:
                    this.$i18n.locale == "zh"
                        ? "RESEARCH_RESULT_TYPE_DICT"
                        : "RESEARCH_RESULT_TYPE_DICT_EN",
                value: that.bookContent.researchResultType,
            };
            getDictByTypeValue(params.typeCode, params.value).then((resulet) => {
                that.bookContent.researchResultType = resulet.data[0].label;
            });
        },
        /*downloads(path,fileName){
                    const that = this;
                    //资源是否保密
                    if(that.bookContent.securityStatus == 'N'){
                        if(this.$Cookies.get('token')){
                            let user = window.localStorage.getItem("user");
                            let users = JSON.parse(user);
                            let userId = users.userId;
                            if(that.bookContent.informationVisibleStatus=='Y'){
                                const link = document.createElement('a');
                                console.log('pdf')
                                console.log(that.bookContent.researchResultFile)
                                link.href = "api/file/pub/" + this.bookContent.researchResultFile;
                                link.download = this.bookContent.name; //下载的文件名
                                link.click();
                                /!*if(users.umsUser.userUsertype=="普通用户账号"){
                                    const link = document.createElement('a');
                                    link.href = "api/file/pub/" + this.bookContent.researchResultFile;
                                    link.download = this.bookContent.name; //下载的文件名
                                    link.click();
                                }else{
                                    if (this.$i18n.locale.toUpperCase() == 'ZH') {
                                        // alert('该文件暂不支持下载');
                                        this.$message({
                                            message: '该文件仅供会员可下载',
                                            type: 'warning'
                                        });
                                    } else {
                                        // alert('This file is not supported for download');
                                        this.$message({
                                            message: 'This document is downloadable by members only',
                                            type: 'warning'
                                        });
                                    }
                                }*!/
                            }
                        }else{
                            if (this.$i18n.locale.toUpperCase() == 'ZH') {
                                this.$message({
                                    message: '请登录后下载',
                                    type: 'warning'
                                });
                            } else {
                                // alert('This file is not supported for download');
                                this.$message({
                                    message: 'Please log in and download',
                                    type: 'warning'
                                });
                            }
                        }
                    }else{
                        if (this.$i18n.locale.toUpperCase() == 'ZH') {
                            // alert('该文件暂不支持下载');
                            this.$message({
                                message: '该文件暂不支持下载',
                                type: 'warning'
                            });
                        } else {
                            // alert('This file is not supported for download');
                            this.$message({
                                message: 'This file is not supported for download',
                                type: 'warning'
                            });
                        }
                    }
                },*/
        downloads(path, fileName) {
            const that = this;
                //资源是否保密
                if (that.bookContent.securityStatus == "N") {
                    /*if(that.bookContent.fileVisibleStatus == 'N'){
                                    that.downfile();
                                }else{
                                    if(this.$Cookies.get('token')){
                                        let user = window.localStorage.getItem("user");
                                        let users = JSON.parse(user);
                                        let userId = users.userId;
                                        that.downfile();
                                    }else{
                                        if (this.$i18n.locale.toUpperCase() == 'ZH') {
                                            this.$message({
                                                message: '请登录后下载',
                                                type: 'warning'
                                            });
                                        } else {
                                            // alert('This file is not supported for download');
                                            this.$message({
                                                message: 'Please log in and download',
                                                type: 'warning'
                                            });
                                        }
                                    }
                                }*/

                    if (this.$Cookies.get("token")) {
                        let user = window.localStorage.getItem("user");
                        let users = JSON.parse(user);
                        if(users.umsUser.userUsertype=="普通用户账号" && Object.is(that.bookContent.reserveThree, '1')){
                            if(that.showExchange){
                                if (that.$i18n.locale.toUpperCase() == "ZH") {
                                    that.$message({
                                        message: "已经兑换过了",
                                        type: "warning",
                                    });
                                } else {
                                    that.$message({
                                        message: "Has been exchanged",
                                        type: "warning",
                                    });
                                }
                                return;
                            }
                            window.localStorage.setItem("detailID", that.bookContent.reserveFour);
                            that.$router.push({name: 'userCenterIntegralExchangeDetail', query: {}});
                            return;
                        }
                        that.downfile();
                    } else {
                        if (this.$i18n.locale.toUpperCase() == "ZH") {
                            this.$message({
                                message: "请登录后下载",
                                type: "warning",
                            });
                        } else {
                            // alert('This file is not supported for download');
                            this.$message({
                                message: "Please login and download",
                                type: "warning",
                            });
                        }
                    }
                } else {
                    if (this.$i18n.locale.toUpperCase() == "ZH") {
                        // alert('该文件暂不支持下载');
                        this.$message({
                            message: "该文件暂不支持下载",
                            type: "warning",
                        });
                    } else {
                        // alert('This file is not supported for download');
                        this.$message({
                            message: "This file is not supported for download",
                            type: "warning",
                        });
                    }
                }
            // }

        },

        // 下载减积分
        // downloadMinusIntegral() {
        //   let params = {
        //     title: "下载资讯",
        //     titleEn: "updateJournal",
        //     point: 3,
        //   };
        //   this.submitHandler((token) => {
        //     console.log(token)
        //     downloadDeductingIntegral({params, token})
        //       .then((res) => {
        //         if (res) {
        //           console.log(res);
        //         }
        //       })
        //       .catch((error) => {
        //         console.log(error);
        //       });
        //   });
        // },

        downfile() {
            const that = this;
            // if(that.bookContent.researchResultFile){
            const link = document.createElement("a");
            console.log("pdf");
            console.log(that.bookContent.researchResultFile);
            link.href = "api/file/pub/" + this.bookContent.researchResultFile;
            link.download = this.bookContent.name; //下载的文件名
            link.click();
            /*if(users.umsUser.userUsertype=="普通用户账号"){
                              const link = document.createElement('a');
                              link.href = "api/file/pub/" + this.bookContent.researchResultFile;
                              link.download = this.bookContent.name; //下载的文件名
                              link.click();
                          }else{
                              if (this.$i18n.locale.toUpperCase() == 'ZH') {
                                  // alert('该文件暂不支持下载');
                                  this.$message({
                                      message: '该文件仅供会员可下载',
                                      type: 'warning'
                                  });
                              } else {
                                  // alert('This file is not supported for download');
                                  this.$message({
                                      message: 'This document is downloadable by members only',
                                      type: 'warning'
                                  });
                              }
                          }*/
            // }else{
            //     if (this.$i18n.locale.toUpperCase() == 'ZH') {
            //         this.$message({
            //             message: '暂无文件',
            //             type: 'warning'
            //         });
            //     } else {
            //         // alert('This file is not supported for download');
            //         this.$message({
            //             message: 'No file',
            //             type: 'warning'
            //         });
            //     }
            // }


        },
        // 判断未登录跳转是否关闭
        toViewLoginChange(done) {
            this.toViewLogin = false;
            this.num = 5;
            clearInterval(this.timer);
        },
        loginTipsChange() {
            const that = this;
            this.num = 5;
            // clearInterval(timer_interval);

            this.timer = setInterval(function () {
                if (that.num > 0) {
                    that.num--;
                } else {
                    if (that.toViewLogin == true) {
                        clearInterval(that.timer);
                        that.toView("login");
                    } else {
                        clearInterval(that.timer);
                    }
                }
            }, 1000);
        },
    },
};
</script>
<style scoped>
.oneLine {
    /* 隐藏溢出元素 */
    overflow: hidden;
    /* 单行显示 */
    white-space: nowrap;
    /* 溢出显示省略号 */
    text-overflow: ellipsis;
}

.threeLine {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.pointer:hover {
    cursor: pointer;
}

.box {
    margin-top: 10px;
    background: #fff;
    /* height: 500px; */
    padding: 20px;
    box-sizing: border-box;
}

.crumbs {
    /*margin:0 20px;*/
}

.secNavActive {
    color: #0091ff;
}

.content {
    width: 100%;
    min-height: 290px;
    margin: 52px 0 60px;
    overflow: hidden;
}

.content .abstract {
    float: left;
    width: 76%;
    height: 100%;
}

.content .preview {
    float: right;
    width: 24%;
    /*height: 100%;*/
    /*margin-top: 100px;*/
    height: 290px;
    position: relative;
}

.bookCatalog {
    width: 100%;
    /*height: 250px;*/
    min-height: 250px;
    max-height: 600px;
    background-color: #eff5fd;
    margin: 60px 0;
}

.bookCatalog .catalog {
    float: left;
    width: 6.5%;
    height: 100%;
    background-color: #60a0f4ff;
    text-align: center;
}

.bookCatalog .catalogList {
    float: right;
    width: 93.5%;
    height: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.bookCatalog .catalogList .catalogText {
    /*width: 228px;*/
    /*height:160px;*/
    width: auto;
    height: auto;
    border-right: 2px solid rgba(44, 85, 138, 0.4);
    padding-right: 80px;
}

.recommend {
}

.active:hover {
    color: red;
}
</style>