<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="mainBody">
            <h4 style="color: #2C558A;font-size: 30px;margin: 64px 20px 30px 20px ">{{bookContent.name}}</h4>
            <div style="margin: 0 20px;background-color: #eff5fd;height: 40px;vertical-align: middle;">
                <div style="float: left">
                    <span style="margin-left: 30px;font-size: 16px;line-height: 40px;color: #333333;">{{$t('common.resourceDetailsTheCategory')}}:{{bookContent.researchResultType}}</span>
                </div>
                <div style="float: right">
                    <span style="margin-right: 30px;font-size: 16px;line-height: 40px;color: #333333;">{{$t('common.resourceDetailsReleaseTime')}}:{{bookContent.updateDate}}</span>
                </div>
                <div style="clear: both"></div>
            </div>
<!--            显示pdf-->
<!--            <iframe :src="srcPdf" scrolling="no" frameborder="0" style="width: 100%;height: 1000px"></iframe>-->
<!--            显示图片-->
            <div v-if="bookImg['fileAddress']==undefined||bookImg.fileAddress==false||bookImg.fileAddress==''||bookImg.fileAddress=='null'||bookImg.fileAddress==null">
                <div style="text-align: center;height: 100px;border-bottom: 1px solid #eee;border-top: 1px solid #eee;">
                    <span v-show="$i18n.locale=='en'" style="line-height: 100px;">no data</span>
                    <span v-show="$i18n.locale=='zh'" style="line-height: 100px;">暂无数据</span>
                </div>
            </div>
            <div v-else>
                <div style="width: 100%;margin: 30px 0 0 0;text-align: center;">
                    <img v-show="currentPage<=fileVisiblePages" :src="'api/file/pub/'+ bookImg.fileAddress + '\\' + currentPage +'.png'" alt="" style="min-width: 600px;max-width:900px;">
                    <img v-show="currentPage>fileVisiblePages && isVip==true && isLogin==true" :src="'api/file/pub/'+ bookImg.fileAddress + '\\' + currentPage +'.png'" alt="" style="min-width: 600px;max-width:900px;">
                    <div v-show="currentPage>=fileVisiblePages && isLogin==false && currentPage!=pageTotal" style="width: 100%;height: 100%">
                        <span style="font-size: 20px;font-weight: 700">{{$t('common.resourceDetailsTryRead')}}</span>
                        <div style="width: 190px;height: 37px;background-color: rgba(24, 144, 255, 1);margin: 15px auto;cursor: pointer;" @click="toLogin">
                            <span style="font-size: 18px;font-weight: 400;color: #FFFFFF;line-height: 38px;" >{{$t('common.resourceLogIn')}}</span>
                        </div>
                    </div>
                    <div v-show="currentPage>=fileVisiblePages && isVip==false && isLogin==true && currentPage!=pageTotal" style="width: 100%;height: 100%">
                        <span style="font-size: 20px;font-weight: 700">{{$t('common.resourceDetailsTryRead')}}</span>
                        <div style="width: 190px;height: 37px;background-color: rgba(24, 144, 255, 1);margin: 15px auto;">
                            <span style="font-size: 18px;font-weight: 400;color: #FFFFFF;line-height: 38px;">{{$t('common.resourceDetailsVIP')}}</span>
                        </div>
                    </div>
                    <div v-show="currentPage>=fileVisiblePages && currentPage==pageTotal" style="width: 100%;height: 100%;cursor: pointer;" @click="toDevelopmentCooperation">
                        <span style="font-size: 20px;font-weight: 700">
                            {{$i18n.locale=='zh'?'本文浏览结束，如需了解更多信息，请联系平台管理人员':'You have finished the reading of this  article. For more information, please contact the customer manager.'}}
                        </span>
                    </div>
                </div>
                <div style="height: 100px;overflow: hidden;vertical-align: middle;margin: 0 auto 30px;">
                    <div style="overflow:hidden;padding: 50px 400px 0; height: 100px;">
                        <div style="min-width:30%; float: left;color: #333333;height: 100%;padding-top: 2px;box-sizing: border-box;">
                            <!--下载-->
<!--                            <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">{{$t('common.resourceDetailsDownload')}}</span>-->
                            <!--                        <img src="@/assets/img/ResourceSharing/heat.png" alt="" style="width: 16px;height: 16px;margin-right: 3px;vertical-align: middle;">-->
                            <!--                        <i class="el-icon-star-off" style="margin-right: 3px;vertical-align: middle;cursor: pointer;"></i>-->
                            <!--                        <img src="../../assets/img/ResourceSharing/collect.png" alt=""-->
                            <!--                             style="margin-right: 3px;vertical-align: middle;cursor: pointer;width: 16px;"-->
                            <!--                             :style="ifcommon?'backfround-color: #66b1ff;':''"-->
                            <!--                             @click="shareChange()"-->
                            <!--                        >-->
                            <i class="el-icon-star-off" style="margin-right: 3px;vertical-align: middle;cursor: pointer;font-size: 18px"
                               :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="display: inline-block;width:154px; height: 100%;text-align: center;position: relative;" class="bottomPage">
                            <button style="display: inline-block;width: 32px;height: 32px;background-color: white;border: 1px solid #ddd;position: absolute;top: 0;left: 0;cursor: pointer"
                                    @click="handleCurrentChangeLeft"><</button>
                            <div style="display: inline-block;border: 1px solid #ddd;width: 86px;height: 30px;line-height: 30px;position: absolute;top: 0;left: 33px;">
                                <!--                            <span style="display: inline-block;width: 23px;height: 23px;text-align: center;line-height: 23px;background-color: #0091FF;border-radius: 6px;color: white">-->
                                <!--                                {{currentPage}}-->
                                <!--                            </span>-->
                                <span style="display: inline-block;width: 23px;height: 23px;">
<!--                            <span style="display: inline-block;width: 23px;height: 23px;text-align: center;line-height: 23px;background-color: #0091FF;border-radius: 6px;color: white">-->
                                    <!--                                {{currentPage}}-->
                                <input type="text" v-model="inputPage" @change="inputPageChange()"
                                       style="width: 23px;height: 23px;border: none;padding: 0;background-color: #0091FF;text-align: center;line-height: 23px;border-radius: 6px;color: white"></input>
                            </span>
                                <span style="display: inline-block;width: 23px;height: 23px;text-align: center;line-height: 23px;">/</span>
                                <span style="display: inline-block;width: 23px;height: 23px;text-align: center;line-height: 23px;">{{pageTotal}}</span>
                            </div>
                            <button style="display: inline-block;width: 32px;height: 32px;background-color: white;border: 1px solid #ddd;position: absolute;top: 0;left: 121px;cursor: pointer"
                                    @click="handleCurrentChangeRight">></button>
                        </div>
                        <!--<el-pagination
                                background
                                style="width:60%;float: left;height: 80px;margin-top:25px;"
                                @current-change="handleCurrentChange"
                                :current-page="currentPage"
                                :page-size="1"
                                layout="prev, pager, next"
                                :total="pageTotal-0"
                        ></el-pagination>-->
                    </div>
                </div>
            </div>
        </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 { downloadDeductingIntegral } from "@/api/user";
import Base from "@/views/base/Base";
import { getDicts, getDictByTypeValue } from "@/api/dict";
import {
  getBaseResearchResultViews,
  gateResearchResultViewById,
  gateResearchResultFileById,
} from "@/api/research/baseResearchResultView";
import { formatDate } from "@/utils/formatUtils";
import { getToken, resetToken } from "@/utils/auth";
import { getFollowModeNumlByModelIdAndUserId } from "@/api/operation/basePortalModelFollowInfo";
import {
  getFollowModeNumlByModelId,
  getFollowModelNumByUser,
  saveFollowModel,
} from "@/api/operation/basePortalModelFollowInfo";
export default {
  name: "resourceSharingDetailsPreview",
  extends: Base,
  data() {
    return {
      ifcommon: false,
      isVip: false,
      isLogin: false,
      num: 5,
      timer: "",
      toViewLogin: false,
      currentPage: 1,
      inputPage: 1,
      pageTotal: "",
      fileVisiblePages: 0,
      params: {
        pageNo: 1,
        pageSize: 1,
        language: "",
      },
      screenIndex: 0, //研究成果、调研资源选中
      resourceSharingScreen: [
        {
          lable: "common.resource",
          value: "0",
        },
        // {
        //   lable: "common.researchResource",
        //   value: "1",
        // },
      ],
      bookContent: {},
      bookImg: {},
    };
  },
  mounted() {
    if (this.$route.query.key) {
      this.initData();
    } else {
      this.toView("resourceSharing", 0);
    }
  },
  watch: {
    "$i18n.locale"() {
      this.initData();
    },
  },
  methods: {
    initData() {
      this.getData();
      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) => {
              // 此处你的业务代码
            });
        });
      }
    },
    /*handleCurrentChange(val) {
                const that = this;
                that.currentPage = val;
                // if(that.bookImg.fileVisibleStatus == 'Y'){
                //     that.pageTotal = that.bookImg.fileVisiblePages;
                // }
            },*/
    handleCurrentChangeLeft() {
      const that = this;
      if (that.currentPage > 1) {
        --that.currentPage;
        --that.inputPage;
      }
    },
    handleCurrentChangeRight() {
      const that = this;
      if (
        that.currentPage < that.pageTotal &&
        that.currentPage < that.fileVisiblePages
      ) {
        ++that.currentPage;
        ++that.inputPage;
      }
    },
    inputPageChange() {
      if (0 < this.inputPage - 0 < this.fileVisiblePages - 0) {
        this.currentPage = this.inputPage - 0;
      } else {
        this.inputPage = this.currentPage + "";
      }
    },
    screenChange(item, index) {
      this.toView("resourceSharing", item.value);
    },
    toDevelopmentCooperation() {
      this.toView("developmentCooperation");
    },
    toView(router, json) {
      if (router == "login" || router == "Register") {
        clearInterval(this.timer);
      }
      this.$router.push({ name: router, params: { key: json } });
    },
    getData() {
      let that = this;
      let param1 = {
        pageNo: 1,
        pageSize: 1,
        language: "",
      };
      let param2 = {
        pageNo: 1,
        pageSize: 1,
        language: "",
      };
      if (this.$i18n.locale.toUpperCase() == "ZH") {
        param1.language = "ZH";
        param2.language = "ZH";
      } else if (this.$i18n.locale.toUpperCase() == "EN") {
        param1.language = "EN";
        param2.language = "EN";
      }
      if (that.$route.query.key) {
        param1.entityId = JSON.parse(that.$route.query.key).entityId;
        param2.entityId = JSON.parse(that.$route.query.key).entityId;
      }
      gateResearchResultViewById(param1).then((resulet) => {
        let data = resulet.data;
        if (data.baseResearchResultView) {
          that.bookContent = data.baseResearchResultView;
          that.bookContent.updateDate = that.bookContent.updateDate
            ? formatDate(that.bookContent.updateDate, "YYYY-MM-DD")
            : "";
          that.getDictValue();
        }
      });
      if (that.$route.query.key) {
        param2.researchResultFileId = JSON.parse(
          that.$route.query.key
        ).researchResultFileId;
      }
      gateResearchResultFileById(param2).then((resulet) => {
        let that = this;
        let data = resulet.data;
        if (data.baseResearchResultFile) {
          that.bookImg = data.baseResearchResultFile;
          that.bookImg.updateDate = that.bookImg.updateDate
            ? formatDate(that.bookContent.updateDate, "YYYY-MM-DD")
            : "";
          // if(that.bookImg.fileVisibleStatus == 'Y'){
          //     that.pageTotal = that.bookImg.filePages;
          // }else{
          //     that.pageTotal = that.bookImg.fileVisiblePages;
          // }
          that.pageTotal = that.bookImg.filePages;
          if (that.bookImg.fileVisibleStatus == "Y") {
            if (that.bookImg.fileVisiblePages == 0) {
              that.fileVisiblePages = that.pageTotal;
            } else {
              that.fileVisiblePages = that.bookImg.fileVisiblePages;
              if (this.$Cookies.get("token")) {
                that.isLogin = true;
                // let userType = JSON.parse(window.localStorage.getItem('user')).umsUser.userUsertype
                // if(userType == "普通用户账号"){
                //     that.isVip = false;
                //     console.log(that.bookImg.fileVisiblePages)
                //     that.fileVisiblePages = that.bookImg.fileVisiblePages;
                // }else{
                that.isVip = true;
                that.fileVisiblePages = that.pageTotal;
                // }
              } else {
                that.isLogin = false;
              }
            }
          } else if (that.bookImg.fileVisibleStatus == "N") {
            that.fileVisiblePages = that.pageTotal;
          }
        }
      });
      if (this.$Cookies.get("token")) {
        that.isLogin = true;
        // let userType = JSON.parse(window.localStorage.getItem('user')).umsUser.userUsertype
        // if(userType == "普通用户账号"){
        //     that.isVip = false;
        //     console.log(that.bookImg.fileVisiblePages)
        //     that.fileVisiblePages = that.bookImg.fileVisiblePages;
        // }else{
        that.isVip = true;
        that.fileVisiblePages = that.pageTotal;
        // }
      } else {
        that.isLogin = false;
      }
    },
    getDictValue() {
      const that = this;
      let aa = {
        typeCode:
          this.$i18n.locale == "zh"
            ? "RESEARCH_RESULT_TYPE_DICT"
            : "RESEARCH_RESULT_TYPE_DICT_EN",
        value: that.bookContent.researchResultType,
      };
      getDictByTypeValue(aa.typeCode, aa.value).then((resulet) => {
        // if (!resulet.data){
        //     that.getDictValue()
        // }
        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");
                        var users = JSON.parse(user);
                        var userId = users.userId;
                        if(that.bookContent.informationVisibleStatus=='Y'){
                            if(users.umsUser.userUsertype=="普通用户账号"){
                                if (this.$i18n.locale.toUpperCase() == 'ZH') {
                                    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{
                                const link = document.createElement('a');
                                link.href = "api/file/pub/" + this.bookContent.researchResultFile;
                                link.download = this.bookContent.name; //下载的文件名
                                link.click();
                            }
                        }else{
                            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: '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);
          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",
            });
          }
        }
      } 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",
          });
        }
      }
        this.downloadMinusIntegral()
    },
    
    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'
      //         });
      //     }
      // }
    },
    toLogin() {
      this.toView("login");
    },
    toView(router, json) {
      this.$router.push({ name: router, params: { key: json } });
    },
    // 判断未登录跳转是否关闭
    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>
.pointer:hover {
  cursor: pointer;
}
.box {
  margin-top: 10px;
  background: #fff;
  /* height: 500px; */
  padding: 20px 0;
}
.crumbs {
  margin: 0 20px;
}
.secNavActive {
  color: #0091ff;
}
.mainBody {
  width: 100%;
  margin-top: 10px;
  box-sizing: border-box;
}
.bottomPage button:active {
  border-color: #0ab8ed;
  outline: 1px solid #0ab8ed;
}
.bottomPage button:focus {
  border-color: #0ab8ed;
  outline: 1px solid #0ab8ed;
}
.bottomPage input:focus {
  outline: none;
  border: none;
  box-shadow: none;
}
</style>