<template>
    <div>
        <div class="autoBox box">
            <div class="crumbs">
                <el-breadcrumb separator="/">
                    <el-breadcrumb-item :to="{ path: 'home' }">{{$t('common.Home')}}</el-breadcrumb-item>
                    <el-breadcrumb-item :to="{ path: 'projectPresentation' }">{{$t('common.ProjectResources')}}
                    </el-breadcrumb-item>
                    <el-breadcrumb-item>{{$t('common.ProjectDetails')}}</el-breadcrumb-item>
                </el-breadcrumb>
            </div>
            <div style="width: 100%;height: 480px;position: relative;">
                <div class="swipers">
                    <div class="swiper-container gallery-top">
                        <div class="swiper-wrapper">
                            <div
                                    class="swiper-slide"
                                    v-for="(i,index) in initData.bannerList"
                                    :data-swiper-slide-index="i+index">
                                <img :src="'api/fileextend/pub/' + i + '?custom=550_352'" alt style="width: 100%;height: 100%;"/>
                            </div>
                        </div>
                        <div class="swiper-button-next swiper-button-white"></div>
                        <div class="swiper-button-prev swiper-button-white"></div>
                    </div>
                    <div class="swiper-container gallery-thumbs">
                        <div class="swiper-wrapper">
                            <div
                                    class="swiper-slide"
                                    :key="i"
                                    :data-swiper-slide-index="index"
                                    v-for="(i,index) in initData.bannerList"
                            >
                                <img :src="'api/fileextend/pub/' + i + '?custom=130_67'" alt style="width: 100%;height: 100%;"/>
                            </div>
                            <!--  -->
                            <!--  -->
                        </div>
                    </div>

                </div>
                <!-- 项目详情 -->
                <div class="details">
                    <div style="width: 100%; font-size: 16px;color: #333;">
                        <div>
                            <span
                                    class="initData_label cursor"
                                    :alt="initData.projectName"
                            > {{initData.projectName}}
                            </span>
                            <span>
                                <img src="@/assets/img/projectPresentation/project-recommended.png" v-if="initData.recommendFlag=='y'" alt="" style="margin-left: 20px;">
                            </span>
                            <!-- 最新发布 -->
                            <span
                                    v-if="releaseView()"
                                    style="font-size: 12px;padding:5px 10px;background: #d53c3d;color: #fff;font-weight: 700;float:right;">
                                    {{$t('common.LatestRelease')}}

                            </span>
                            <!-- 推荐项目 -->
                            <!-- <span style="font-size: 12px;margin-right: 20px;padding:5px 10px;background: #82ab5b;color: #fff;font-weight: 700;float:right;"
                            >{{$t('common.RecommendedProject')}}</span> -->

                        </div>
                        <div style="line-height: 35px;">
                            <div >
                              <span >
                                <i class="el-icon-location-outline"></i>
                                  {{initData.bannerFour}}
                              </span>
                            </div>
                            <!-- <div style="overflow:hidden;white-space:nowrap; text-overflow:ellipsis; width: 450px">-->
                            <div>
                              <span>
                                <i class="el-icon-place"></i>
                                  {{initData.unitCountry}}
                              </span>
                            </div>
                            <div>
                    <span>
                        <i class="el-icon-office-building" aria-hidden="true"></i>
                        {{initData.technicalCategories}} | {{initData.technicalScope}}
                    </span>
                                </div>
                                <div>
                    <span>
                        <i class="el-icon-time"></i>
                        {{$t('common.Releasedate')}} : {{handlePublishTimeDesc(toDate,initData.createDate,$i18n.locale)}} {{$t('common.release')}}
                    </span>
                                </div>
                                <!--                <div>-->
                                <!--                  <span>-->
                                <!--                    <i class="el-icon-time"></i>-->
                                <!--                    {{$t('common.Deadline')}}:{{initData.setDownDate ||$t('common.NoDeadline')}}-->
                                <!--                  </span>-->
                                <!--                </div>-->
                                <div>
                    <span>
                        <i class="el-icon-tickets"></i>
                        {{$t('common.ProjectNumber')}}：
                        <span
                                style="color:#62b605"
                        >{{initData.projectNum || $t('common.NoProjectNumber')}}</span>
                    </span>
                    <!--当前阶段-->
                    <div>
                        <span>
                            {{$t('common.CurrentStage')}}：
                        </span>
                        <span>
                            {{initData.phaseType}}
                        </span>
                    </div>
                            </div>
                            <!-- <div>
                                <span>
                                  <i class="el-icon-office-building"></i>
                                  {{$t('common.ProjectAmount')}}：
                                  <span
                                    style="color:#62b605"
                                  >{{initData.amount}}{{$t('common.TenThousandYuan')}}</span>
                                </span>
                              </div> -->
                            <!--                  <div style="display: -webkit-box;-->
                            <!--                  -webkit-box-orient: vertical;-->
                            <!--                  -webkit-line-clamp: 5;-->
                            <!--                  overflow: hidden;cursor: pointer;"  @click="dialogVisibleChange">-->
                            <!--                  -->
                            <!--                  <span style="line-height:30px">-->
                            <!--                    <i class="el-icon-tickets"></i>-->
                            <!--                    {{$t('common.ProjectScales')}}:-->
                            <!--                    <span v-if="flag == true">{{initData.projectScale}}:</span>-->
                            <!--                  </span>-->
                            <!--                </div>-->

                            <!--                <el-dialog-->
                            <!--                v-if="flag == true"-->
                            <!--                :title="$t('common.ProjectScale')"-->
                            <!--                :visible.sync="dialogVisible"-->
                            <!--                width="30%">-->
                            <!--                <span style="line-height: 29px;font-size: 18px;">{{initData.projectScale}}</span>-->
                            <!--              </el-dialog>-->
                            <!--              <img-->
                            <!--              v-if="flag == false && this.$i18n.locale == 'zh'"-->
                            <!--              ref="photoImg"-->
                            <!--              alt-->
                            <!--              src="@/assets/zhong.png"-->
                            <!--              class="img-responsive"-->
                            <!--              style="display: inline-block; vertical-align: middle;height: 100px;width: 400px;"-->
                            <!--              />-->
                            <!--              <img-->
                            <!--              v-if="flag == false && this.$i18n.locale == 'en'"-->
                            <!--              ref="photoImg"-->
                            <!--              alt-->
                            <!--              src="@/assets/ying.png"-->
                            <!--              class="img-responsive"-->
                            <!--              style="display: inline-block; vertical-align: middle;height: 100px;width: 400px;"-->
                            <!--              />-->
                            <!-- 项目关注和分享 -->
<!--                            <div style="color: #666;font-size: 14px;margin-right: 20px;color: #333;">-->
<!--                                  <span class="share cursor"-->
<!--                                        :style="ifcommon?'color: #66b1ff;':''"-->
<!--                                        style="margin-right: 20px;"-->
<!--                                        @click="shareChange()">-->
<!--                                    <i class="el-icon-star-off" :style="ifcommon?'color: #66b1ff;':''"></i>-->
<!--                                    {{ifcommon?$t('common.ProjectAttentioned'):$t('common.AttentionProject')}}-->
<!--                                  </span>-->
<!--                                &lt;!&ndash; <span class="share cursor btn" :data-clipboard-text="url" @click="copy">-->
<!--                                  <i class="el-icon-share"></i>-->
<!--                                  {{$t('common.ShareProject')}}-->
<!--                                </span> &ndash;&gt;-->
<!--                            </div>-->
                            <div>
                                <el-button type="" style="margin-left: 10px;margin-top: 10px;height: 40px;width: 170px;"
                                     icon="el-icon-star-off" :style="ifcommon?'color: #fff;border:1px solid #66b1ff;background:#66b1ff;':''" @click="shareChange()">
                                    {{ifcommon?$t('common.ProjectAttentioned'):$t('common.AttentionProject')}}
                                </el-button>
                                <el-button type="success" style="margin-left: 10px;margin-top: 10px;height: 40px;width: 170px;" icon="el-icon-chat-dot-round" @click="olineConsultingOpen">
                                    {{$t('common.OlineConsulting')}}
                                </el-button>
                            </div>
                            <div style="line-height: 32px;color: #333;width: 581px;height: 256px;overflow: hidden;text-overflow:ellipsis;"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div style="width: 100%;position: relative;">
                <div class="enterprise_style">
            <span
                    :class="indexTo==1?'enterprise_screen cursor':'enterprise_screen2 cursor'"
                    @click="indexTo=1"
                    style="display: inline-block;"
            >{{$t('common.ProjectPresentation')}}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <span
                            :class="indexTo==2?'enterprise_screen cursor':'enterprise_screen2 cursor'"
                            @click="indexTo=2"
                    >{{$t('common.AnalysisReport')}}</span>
                </div>
                <div style="margin-top: 5px;margin-bottom: 15px; overflow: hidden;">
            <!-- 项目介绍-->
            <span v-if="indexTo == 1" style="margin-top: 16px;display: inline-block;
            color: #333;margin-left: 30px;line-height: 32px;width: 90%;word-break:break-all;">
                <!--当前阶段-->
                <!-- <div>
                    <div style="color: #0079ef;font-size: 18px;">
                        {{$t('common.CurrentStage')}}
                    </div>
                    <div style="text-indent: 30px;">
                        {{initData.phaseType}}
                    </div>
                </div> -->
                <!--项目描述-->
                <div>
                    <!-- <div style="color: #0079ef;font-size: 18px;">
                        {{$t('common.Description')}}
                    </div> -->
                    <div style="text-indent: 30px;word-break: keep-all;" v-html='initData.projectDescription'>
<!--                        {{initData.projectDescription}}-->
                    </div>
                </div>
            </span>
            <span v-if="indexTo == 2" style="margin-top: 16px;display: inline-block;
            color: #333;margin-left: 30px;line-height: 32px;width: 90%;word-break:break-all;">
             <div>
                    <!-- <div style="color: #0079ef;font-size: 18px;">
                        {{$t('common.Description')}}
                    </div> -->
                    <div style="text-indent: 30px;word-break: keep-all;" v-html='initData.projectRequirements'>
<!--                        {{initData.projectDescription}}-->
                    </div>
                </div>
            </span>
                    <!-- <div style="width: 600px;float: right;height: 190px;"> -->
                        <!--              <div-->
                        <!--                style="height: 30px;line-height: 30px;background: rgba(44,85,138,.1); margin-top: 20px;width: 100%;"-->
                        <!--              >-->
                        <!--                <span-->
                        <!--                  style="float: left;font-size: 12px;margin-left: 10px;font-weight: 700;color: rgba(44,85,138,1);"-->
                        <!--                >{{$t('common.ProjectConsultant')}}</span>-->
                        <!--                <span-->
                        <!--                  style="float: right;font-size: 12px;margin-right: 10px; color: rgba(44,85,138,1);"-->
                        <!--                >{{$t('common.ResourcesProgram')}}</span>-->
                        <!--              </div>-->
                        <!--              <div style="margin-top: 20px;height: 176px;">-->
                        <!--                <div style="width: 80px;height: 100px;float: left;">-->
                        <!--                  &lt;!&ndash; <img-->
                        <!--                    :src="'api/file/pub/' + ProjectConsultant.pictureAddress"-->
                        <!--                    alt-->
                        <!--                    style="width: 100%;height: 100%;"-->
                        <!--                    v-if="ProjectConsultant.pictureAddress"-->
                        <!--                  /> &ndash;&gt;-->
                        <!--                  <img src="@/assets/img/projectPresentation/user.png" alt=""  style="width: 100%;height: 100%;">-->
                        <!--                </div>-->
                        <!--                <div style="float: left;">-->
                        <!--                  <div>-->
                        <!--                    <span-->
                        <!--                      v-if="$i18n.locale == 'zh'"-->
                        <!--                      style="font-size: 17px;font-weight: 600;margin-left: 10px;"-->
                        <!--                    >{{ProjectConsultant.consultantName}}</span>-->
                        <!--                  </div>-->
                        <!--                  <div>-->
                        <!--                    <span-->
                        <!--                      v-if="$i18n.locale == 'en'"-->
                        <!--                      style="font-size: 17px;font-weight: 600;margin-left: 10px;"-->
                        <!--                    >{{ProjectConsultant.consultantNameEn}}</span>-->
                        <!--                  </div>-->
                        <!--                  <div style="width:500px;line-height:24px;margin-top: 5px;">-->
                        <!--                    <span-->
                        <!--                      style="font-size: 14px;margin-left: 10px;color:rgba(102,102,102,1);"-->
                        <!--                    >{{$t('common.AnyConsulting')}}</span>-->
                        <!--                  </div>-->

                        <!--                </div>-->
                        <!--              </div>-->
                    <!-- </div> -->
                </div>
            </div>
            <!-- 留言数据 -->
            <div class="enterprise_style" style="font-size: 18px;color: #333;display: block">
<!--                <span>{{$t('common.ProjectMessage')}}（{{ProjectMessageNum}}）  |    {{$t('common.MyMessage')}}（{{MyMessageNum}}）</span>-->
                <span @click="toUserCenterCommunication()">{{$t('common.ProjectMessage')}}  |    {{$t('common.MyMessage')}}（{{MyMessageNum}}）</span>
            </div>
            <!-- 留言框 -->
            <div style="margin-left: 30px;width:650px;">
                <el-input
                        type="textarea"
                        :rows="2"
                        :placeholder="tokenLogin?
                               $t('common.Pleasefillinthemessage'): $t('common.AccordingtotheProject')"
                        v-model="textarea"
                ></el-input>
            </div>
            <!-- 发布 取消按钮 -->
            <div style="width:650px;margin-top: 20px;height: 50px;">
                <div style="float: right;">
                    <el-button type="danger" @click="publish()">{{$t('common.releases')}}</el-button>
                    <el-button type="reset">{{$t('common.Cancel')}}</el-button>
                </div>
            </div>
            <!-- <div style="width: 100%;height: 250px;">
                <div class="enterprise_style">
                    <span class="enterprise_style_span">{{$t('common.GuessProjects')}}</span>
                </div>
                <div class="recommend">
                    <ul>
                        <li v-for="(item,index) in recommend" v-if="index<5" :key="index + 2" style="margin-left: 20px;"
                        >
                            <img @click="toViewChange(item.projectId,index)" :src="'api/file/pub/' + item.bannerList[0]" alt style="width: 100%;height: 115px;cursor: pointer;" />
                            <img @click="toViewNew('projectPresentationDetails',item.projectId,index)"
                                 :src="'api/file/pub/' + item.bannerList[0]" alt
                                 style="width: 100%;height: 115px;cursor: pointer;"/>
                            <div
                                    style="color: #bcbcbc;font-size: 14px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;"

                            >{{item.projectName}}
                            </div>
                        </li>
                    </ul>
                </div>
            </div> -->
            <el-dialog
                :title="$t('common.ConsultingBar')"
                :visible.sync="isOnlineConsultation"
                width="50%"
                center>
                <div style="font-size: 21px">
                    <i class="el-icon-office-building" aria-hidden="true"></i>
                    {{$t('common.projectName')}}：
                    <span
                            :alt="initData.projectName"
                    > {{initData.projectName}}
                            </span>
                </div>
                <div style="font-size: 21px">
                    <span>
                        <i class="el-icon-office-building" aria-hidden="true"></i>
                        {{initData.technicalCategories}} | {{initData.technicalScope}}
                    </span>
                </div>
                <div style="font-size: 21px">
                    <span>
                        <i class="el-icon-tickets"></i>
                        {{$t('common.ProjectNumber')}}：
                        <span
                                style="color:#62b605"
                        >{{initData.projectNum || $t('common.NoProjectNumber')}}</span>
                    </span>
                    </div>
                <div>
                    <el-input
                            type="textarea"
                            :rows="2"
                            style="margin-top: 30px;min-height:300px"
                            :placeholder="$t('common.EnterContent')"
                            v-model="consultMessageInfo.content"
                    ></el-input>
                </div>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="isOnlineConsultation = false">{{$t('common.Cancel')}}</el-button>
                    <el-button type="primary" @click="consultMessage">{{$t('common.OK')}}</el-button>
                </span>
            </el-dialog>
            <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>
    </div>
</template>

<script>
    import Base from "@/views/base/Base";
    import {getDicts} from "@/api/dict";
    import { Swiper, SwiperSlide, directive } from 'vue-awesome-swiper'
    import 'vue-awesome-swiper/node_modules/swiper/dist/css/swiper.css'
    import Clipboard from "clipboard";
    import {saveOrUpdate as saveConsultMessageInfo} from "@/api/operation/consultMessageInfo";
    import {getFollowModeNumlByModelIdAndUserId} from "@/api/operation/basePortalModelFollowInfo";

    import {saveInteractiveMessage} from "@/api/operation/interactiveMessage";
    import {saveOrUpdate as clickSave} from "@/api/operation/basePortalModelClickInfo";
    import {
        get,
        getBannerPaths,
        gateGetProjectViewInfo,
        getBaseProjectViews,
        getBaseProjectViewsm,
        getInteractiveMessageCount,
        gateGetArchiveFilePath,
        getBaseProjectViewsRecommend
    } from "@/api/project/baseProjectView";
    import {getToken, resetToken} from "@/utils/auth";
    import {gateGetProjectConsultant} from "@/api/project/baseProjectConsultantInfo";
    import {getBaseProjectArchivesFiles} from "@/api/baseProjectArchivesFile";
    import {getBaseProjectArchivesInfos} from "@/api/baseProjectArchivesInfo";
    import {downloadFile, downloadAttachment} from "@/api/file";
    import {
        getFollowModeNumlByModelId,
        getFollowModelNumByUser,
        saveFollowModel,
    } from "@/api/operation/basePortalModelFollowInfo";

    export default {
        name: "projectPresentationDetails",
        extends: Base,
        data() {
            return {
                flag: false,
                dialogVisible: false,
                num: 0,
                toViewLogin: false,
                timer: '',
                indexTo: 1,
                num:5,
                tokenLogin:null,
                toDate: 0,
                attaments: [],
                attachmentId: "",
                attamentParams: {
                    attachmentBusinessId: "",
                    attachmentBusinessType: "base_project_archives_file",
                },

                infoParams: {
                    pageNo: 0,
                    pageSize: 1,
                    language: "",
                    projectId: "",
                    screenId: this.$route.params.screenId,
                    dataIndex: this.$route.params.dataIndex,
                    cruPage: this.$route.params.cruPage,

                },
                //   parentIndex:this.$parent.params.descStatus,
                parames: {
                    columnCode: "", //项目id
                    scrennid: "",

                },
                ProjectMessageNum: 0,
                MyMessageNum: 0,
                ReplyMyNum: 0,
                enterpriseDetails: "",
                textarea: "",
                url: "",
                isOnlineConsultation: false,
                id: this.$route.params.key,
                ProjectConsultant: {},
                clickModel:{
                    modelType:"project",
                    modelEntityId:"",
                    userId:"",
                    clickTime:"",
                },
                consultMessageInfo: {},
                interactiveMessageInfo: {
                    title: "",
                    content: "",
                    senderId: "",
                    receiverId: "",
                    replyStatus: "",
                    replyStatusDict: "",
                    approveStatus: "",
                    approveStatusDict: "",
                    columnName: "",
                    columnCode: "",
                    bizObjectId: "",
                    bizObjectType: "",
                    createBy: "",
                    createDate: "",
                    updateBy: "",
                    updateDate: "",
                },
                img: [],
                imgs: [
                    {
                        src: "u6668.png",
                    },
                    {
                        src: "u6676.png",
                    },
                    {
                        src: "u6720.png",
                    },
                    {
                        src: "u6763.png",
                    },
                    {
                        src: "u6668.png",
                    },
                    {
                        src: "u6720.png",
                    },
                ],
                recommend: [],
                ifcommon: false,
                initData: {},
                enterprise: {
                    label1: {
                        label:
                            "经营范围包括三峡工程建设和经营管理，住宿经营的管理；长江中上游水资源开发；水利水电技术服务；水利水电工程所需物资、设备的销售（国家有专营专项的除外）；与上述业务有关的咨询服务；经营或代理公司所属企业自产产品（国家组织统一联合经营的16种出口商品除外）的出口业务；经营或代理公司及所属产业所需设备和材料（国家指定公司经营的12种进口商品除外）的进口业务；经营或代理技术进出口业务；承办中外合资经营、合作生产、来料加工、来样加工、来件装配、补偿贸易及易货贸易业务。（企依法自主选择经营项目，开展经营活动；依法需批准的项目；经相关部门批准后依批准的内容开展经营活动；不得从事本市产业政策禁止和限制类的经营活动。",
                        src: "u6668.png",
                    },
                },
                user: {}
            };
        },
        created() {
            this.enterpriseDetails = this.$route.params.key;
           
            this.url = window.location.href;
            this.tokenLogin=this.$Cookies.get('token');
        },
        updated() {
            this.Swiper();
        },
        mounted() {
            let lang = this.$route.query.lang;
            this.$18n.locale = lang;
            this.$store.commit('modify', 'projectPresentationDetails');
            window.localStorage.setItem('router', 'projectPresentationDetails');
            // 项目查询
            this.toDate = Date.parse(new Date());
            this.getProjextList();
            this.getMessageNum();
            //   debugger;
        },

        watch: {
            "$i18n.locale"() {
                this.getProjextList();
            },
            "toViewLogin"() {
                if (this.toViewLogin == true) {

                    this.loginTipsChange()
                }
            }
        },
        methods: {
            toUserCenterCommunication(){
                var router = 'communication';
                var json = '/communication';
                var index = null;
                    window.localStorage.setItem('router', router);
                    this.$store.commit('modify', router);
                    const { href } =this.$router.resolve({
                        name: router,
                        query: {
                            key: json,
                            dataIndex:index,
                        }
                    });
                    window.open(href, '_blank');
            },
            //跳到一个新的页面
            toViewNew(router, json, index) {
                console.log(router, json, index, '---------- ----')
                this.index = this.params ? this.params.descStatus : '0';
                window.localStorage.setItem('router', router);
                this.dataIndex = this.params
                this.cruPage = this.params ? this.params.pageNo : '0';
                this.$store.commit('modify', router);
                console.log(this.cruPage)
                this.$store.commit('modify', router);
                window.localStorage.setItem('router', router);
                const { href } = this.$router.resolve({
                    name: router,
                    params: {
                      key: json,
                      screenId:this.index,
                      dataIndex:index,
                      cruPage:this.cruPage
                    }
                });
                window.open(href, '_blank');
            },
            //项目顾问在线咨询打开方法
            olineConsultingOpen() {
                // alert("项目顾问在线咨询");
                //检测是否为登陆用户
                let user = window.localStorage.getItem("user");
                if (!this.$Cookies.get('token')) {
                    this.toViewLogin = true;
                } else {
                    this.isOnlineConsultation = true
                }
            },
            dialogVisibleChange() {
                this.dialogVisible = true;
            },
            // 推荐数据切换
            toViewChange(id, index) {
                this.infoParams.projectId = id;
                this.getList();
            },
            // 未登录跳转
            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)
            },
            // 判断未登录跳转是否关闭
            toViewLoginChange(done) {
                this.toViewLogin = false;
                this.num = 5;
                clearInterval(this.timer);
            },
            //关注操作方法
            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 = this.initData.projectId;
                    var userId = users.userId;
                    // 接口逻辑
                    this.submitHandler((token) => {
                        saveFollowModel(projectId, "project", userId, followType, token)
                            .then((result) => {
                                if(followType=='unfollow'){
                                    if(this.$i18n.locale=='zh'){
                                        this.$message({
                                            message: '取消关注成功',
                                            type: "success",
                                        });
                                    }else{
                                        this.$message({
                                            message: 'Cancel the follow successfully',
                                            type: "success",
                                        });
                                    }
                                }else{
                                    if(this.$i18n.locale=='zh'){
                                        this.$message({
                                            message: '关注成功',
                                            type: "success",
                                        });
                                    }else{
                                        this.$message({
                                            message: 'Follow of success',
                                            type: "success",
                                        });
                                    }

                                }
                                // console.log(result);
                                // this.$message({
                                //     message: result.data,
                                //     type: "success",
                                // });
                                this.ifcommon = !this.ifcommon;
                                this.resetToken();
                            })
                            .catch((error) => {
                                // 此处你的业务代码
                            });
                    });
                }
            },
            // 留言操作方法
            publish: function () {
                if (!this.$Cookies.get('token')) {
                    // this.$message.warning("请先登录");
                    // this.$confirm('检测到您未登录，是否登录')
                    // .then(_ => {
                    //  this.toView('login');
                    // })
                    // .catch(_ => {});
                    this.toViewLogin = true;
                } else {
                    this.interactiveMessageInfo.content = this.textarea;
                    // let user = window.localStorage.getItem("user");
                    // var users = JSON.parse(user);
                    // this.interactiveMessageInfo.senderId = users.userId;
                    // this.interactiveMessageInfo.senderName = users.username;
                    this.interactiveMessageInfo.replyStatus = "否";
                    this.interactiveMessageInfo.replyStatusDict = "N";
                    this.interactiveMessageInfo.approveStatusDict = "0";
                    this.interactiveMessageInfo.bizObjectType = "0";
                    this.interactiveMessageInfo.columnCode = this.initData.projectId;
                    let token = getToken();
                    if (this.textarea) {
                        this.submitHandler((token) => {
                            saveInteractiveMessage(
                                JSON.stringify(this.interactiveMessageInfo),
                                token
                            ).then((res) => {
                                if(this.$i18n.locale=='zh'){
                                    this.$message({
                                        message: '已发送成功，请等待回复',
                                        type: "success",
                                    });
                                }else{
                                    this.$message({
                                        message: 'It has been sent successfully. Please wait for your reply',
                                        type: "success",
                                    });
                                }
                                // alert(res.msg);
                                // this.$message({
                                //     message: "已发送成功，请等待回复",
                                //     type: "success",
                                // });
                                this.getMessageNum();
                            });
                            this.interactiveMessageInfo = {};
                            this.textarea = "";
                            this.resetToken();
                        });
                    } else {
                        this.$message(this.$t("common.Pleasefillinthecontentfirst"));
                    }

                }
            },

            downLoad: function () {
                gateGetArchiveFilePath(this.id).then((res) => {
                    downloadAttachment(res.data.paths[0])
                        .then((res) => {
                            this.download(res);
                        })
                        .catch((err) => {
                            if (err.msg) {
                                alert(err.msg);
                            }
                            console.log(err);
                        });
                }).catch((err) => {
                    if (err.msg) {
                        alert(err.msg);
                    }
                    console.log(err);
                });

            },
            getProjextList() {
                this.infoParams.projectId = this.$route.query.key !== undefined ? this.$route.query.key :
                this.$route.params.key !== undefined ? this.$route.params.key : '';
                this.getList();
            },
            getList() {
                // 判断是否是会员显示项目规模
                let user = window.localStorage.getItem("user");
                var users = JSON.parse(user);
                if (null != users && null != users.userId && users.umsUser.userUsertypeDict == "2") {
                    this.flag = true;
                }

                this.infoParams.language = this.$i18n.locale.toUpperCase();
                const that = this;
                gateGetProjectViewInfo(this.infoParams).then((res) => {
                    // res.data.baseProjectView.setUpDate=this.handlePublishTimeDesc(new Date, res.data.baseProjectView.setUpDate)
                    if (JSON.stringify(res.data) == '{}') {
                        this.$message({
                            message: this.$t('common.Projecthasnocurrentversion'),
                            type: "error",
                        });
                        return this.toView('enterprise');
                    } else {
                        res.data.baseProjectView.setDownDate = that.formatDate(
                            res.data.baseProjectView.setDownDate,
                            "YYYY-MM-DD"
                        );
                        that.initData = res.data.baseProjectView || [];
                        that.interactiveMessageInfo.columnCode =
                            res.data.baseProjectView.projectId;
                        if (!that.initData.bannerList[0]) {
                            that.initData.bannerList[0] = '',
                                that.initData.bannerList[0] = "/def/projectdefault.png";
                        }
                        if(that.initData.updateDate){
                            that.initData.createDate = that.initData.updateDate
                        }

                        gateGetProjectConsultant(this.initData.projectConsultantId).then(
                            (res) => {
                                if(res.data != undefined){
                                    this.ProjectConsultant = res.data.baseProjectConsultantInfo;
                                }
                            }
                        );
                        console.log('----------------____________-----------------', that.initData.bannerList)
                        this.$forceUpdate();
                        that.getRecommended();

                        // 获取字典值
                        if (this.$i18n.locale == 'zh') {
                            getDicts("PROJECT_CATEGORIES_DICT").then((res) => {
                                res.data[0].forEach((i) => {
                                    if (i.value == this.initData.technicalCategories) {
                                        this.initData.technicalCategories = i.label;
                                    }
                                });
                            });
                            getDicts("TECHNICAL_SCOPE_DICT").then((res) => {
                                res.data[0].forEach((i) => {
                                    if (i.value == this.initData.technicalScope) {
                                        this.initData.technicalScope = i.label;
                                    }
                                });
                            });
                            getDicts("PHASE_TYPE_DICT").then((res) => {
                                res.data[0].forEach((i) => {
                                    if (i.value == this.initData.phaseType) {
                                        this.initData.phaseType = i.label;
                                    }
                                });
                            });
                        } else {
                            getDicts("PROJECT_CATEGORIES_DICT_EN").then((res) => {
                                res.data[0].forEach((i) => {
                                    if (i.value == this.initData.technicalCategories) {
                                        this.initData.technicalCategories = i.label;
                                    }
                                });
                            });
                            getDicts("TECHNICAL_SCOPE_DICT_EN").then((res) => {
                                res.data[0].forEach((i) => {
                                    if (i.value == this.initData.technicalScope) {
                                        this.initData.technicalScope = i.label;
                                    }
                                });
                            });
                            getDicts("PHASE_TYPE_DICT_EN").then((res) => {
                                res.data[0].forEach((i) => {
                                    if (i.value == this.initData.phaseType) {
                                        this.initData.phaseType = i.label;
                                    }
                                });
                            });
                        }

                        let user = window.localStorage.getItem("user");
                        if (user) {
                            var users = JSON.parse(user);
                            var token = "" + getToken();
                            var projectId = this.initData.projectId;
                            this.userId = users.userId;
                            getFollowModeNumlByModelIdAndUserId(
                                projectId,
                                "project",
                                this.userId
                            ).then((res) => {
                                this.ifcommon = res.data;
                                console.log(
                                    res.data,
                                    "---------------------------------------------------------------------------"
                                );
                            });
                            this.clickModel.modelEntityId = this.infoParams.projectId
                            this.clickModel.userId = users.userId;
                            this.clickModel.clickTime = (new Date()).getTime();
                            //如果存在用户则对用户进行点击保存操作
                            this.submitHandler((token) => {
                                clickSave(JSON.stringify(this.consultMessageInfo), token);
                                this.resetToken();
                            });

                        }
                    }

                });
            },
            //获取留言信息
            getMessageNum() {
                //2020年12月8日 11:09:36 取消项目留言数量
                //获取项目id
                this.parames.columnCode = this.infoParams.projectId;
                //获取用户id
                let token = getToken();
                // console.log(JSON.parse(JSON.stringify(this.parames)));
                getInteractiveMessageCount(this.parames,token).then(
                    (result) => {
                        var data = result.data;

                        // this.ProjectMessageNum = data.projectNum;
                        this.MyMessageNum = data.senderNum;
                        this.ReplyMyNum = data.reciverNum;
                        this.resetToken();
                    }
                );
            },

            Swiper() {
                var galleryThumbs = new Swiper(".gallery-thumbs", {
                    spaceBetween: 10,
                    slidesPerView: 4,
                    freeMode: true,
                    watchSlidesVisibility: true,
                    watchSlidesProgress: true,
                    autoplay: {//自动播放
                        delay: 4000,
                        disableOnInteraction: false,//用户操作后是否停止 默认停止（true）
                    },
                });

                var galleryTop = new Swiper(".gallery-top", {
                    spaceBetween: 10,
                    navigation: {
                        nextEl: ".swiper-button-next",
                        prevEl: ".swiper-button-prev"
                    },
                    autoplay: {//自动播放
                        delay: 4000,
                        disableOnInteraction: false,//用户操作后是否停止 默认停止（true）
                    },
                    thumbs: {
                        swiper: galleryThumbs
                    }
                });
            },
            getRecommended() {
                let params = {
                    pageNo: 0,
                    pageSize: 5,
                    language: this.$i18n.locale.toUpperCase(),
                    recommendFlag: "y",
                    status: "1",
                    descStatus: 0,
                    id: this.infoParams.projectId
                };
                const that = this;
                getBaseProjectViews(params).then((res) => {
                    if (res.data.baseProjectViews) {
                        that.recommend = [];
                        res.data.baseProjectViews.forEach((item) => {
                            if (item.bannerList.length > 0) {
                                that.recommend.push(item);
                            }
                        });
                        console.log(res.data.baseUnitViews, that.init);
                    } else {
                        // this.$message("当前推荐企业暂无信息");
                    }
                    this.loading = false;
                });
            },
            // 项目收藏改变
            shareChange() {
                if (this.ifcommon) {
                    this.saveFollowModelDo("unfollow");
                } else {
                    this.saveFollowModelDo("follow");
                }
            },
            handleClose(done) {
                this.isOnlineConsultation = false;
            },
            consultMessage() {
                //   debugger
                // 人员信息
                    this.consultMessageInfo.replyStatusDict = "N";
                    this.consultMessageInfo.senderDate = new Date();
                    this.consultMessageInfo.bizObjectType = "0";
                    this.consultMessageInfo.columnCode = this.initData.projectId;
                    let token = getToken();
                    this.submitHandler((token) => {
                        saveConsultMessageInfo(JSON.stringify(this.consultMessageInfo), token)
                            .then((result) => {
                                // alert(result.msg);
                                this.$message({
                                    message: this.$t('common.Sentsuccessfullypleasewaitforreply'),//已发送成功，请等待回复
                                    type: "success",
                                });
                                this.consultMessageInfo = {};
                                this.isOnlineConsultation = false;
                                this.resetToken();
                            })
                            .catch((error) => {
                                this.consultMessageInfo = {};
                                this.resetToken();
                            });
                        this.resetToken();
                    });
            },
            getIconUrl(url) {
                return require("@/assets/img/realTimeInfo/" + url);
            },
            toView(router, json) {
                clearInterval(this.timer);
                this.$router.push({
                    name: router,
                    params: json,

                });

            },
            screenBack(data) {
                console.log(data, "screenBackscreenBackscreenBackscreenBack");
            },
            //最新发布标志是否展示
            releaseView() {
                // console.log(this.infoParams.dataIndex);
                //   console.log(this.infoParams.screenId);
                //   console.log(this.infoParams.dataIndex);

                if (this.infoParams.screenId == 0 && this.infoParams.dataIndex < 5 && this.infoParams.cruPage == 1) {
                    return true
                } else {
                    return false
                }

            }
        },
    };
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
    .box {
        margin-top: 10px;
        background: #fff;
        /* height: 500px; */
        padding: 20px 0;
    }

    .crumbs {
        margin-left: 20px;
    }

    body {
        margin: 0;
    }

    .swipers {
        position: absolute;
        top: 30px;
        left: 30px;
        width: 550px;
        height: 439px;
    }

    .details {
        position: absolute;
        top: 30px;
        left: 600px;
        width: 460px;
        height: 390px;
    }

    .swiper-container {
        width: 100%;
        height: 300px;
        margin-left: auto;
        margin-right: auto;
    }

    .swiper-slide {
        background-size: cover;
        background-position: center;
    }

    .gallery-top {
        height: 80%;
        width: 100%;
    }

    .gallery-thumbs {
        height: 20%;
        box-sizing: border-box;
        padding: 10px 0;
    }

    .gallery-thumbs .swiper-slide {
        width: 25%;
        height: 100%;
        opacity: 0.4;
    }

    .gallery-thumbs .swiper-slide-thumb-active {
        opacity: 1;
    }

    .initData_label {
        color: #2c558a;
        font-weight: 700;
        font-size: 18px;
        line-height: 42px;
        width: 500px;
        display: inline-block;
        /*overflow: hidden;*/
        /*white-space: nowrap;*/
        text-overflow: ellipsis;
    }

    .enterprise_style {
        line-height: 50px;
        height: 50px;
        color: #333;
        padding-left: 30px;
        font-size: 18px;
        font-weight: 700;
        margin-top: 5px;
    }

    .enterprise_style_span {
        display: inline-block;
        /* width: 82px; */
        padding: 0 5px;
        text-align: center;
        height: 100%;
        border-bottom: 2px solid #6699ff;
    }

    .enterprise_style_product tr {
        line-height: 30px;
        width: 100%;
        display: inline-block;
        border-bottom: 1px dashed #ccc;
        font-size: 14px;
        color: #6c819d;
        margin-bottom: 5px;
    }

    .recommend {
        margin-top: 16px;
        /* margin-left: 30px; */
    }

    .recommend li {
        display: inline-block;
        width: 170px;
        /* height: 130px; */
        text-align: center;
        margin-right: 16px;
    }

    .share:hover {
        color: #66b1ff;
    }

    .box >>> .el-textarea__inner {
        height: 85px;
    }

    .enterprise_screen,
    .enterprise_screen2 {
        height: 50px;
        /* padding: 0 10px; */
        width:150px;
        line-height: 50px;
        float: left;
        text-align: center;
        font-family: HiraginoSansGB-W3, HiraginoSansGB;
        font-weight: normal;
        color: rgba(51, 51, 51, 1);
        font-size: 16px;
    }

    .enterprise_screen {
        background: #2c558a;
        color: #fff;
        border: 1px solid #2c558a;
        /* border-top: 2px #2c558a solid; */
        /* width: 124px; */
    }
    .box >>>.el-textarea__inner {
        min-height: 220px !important;
        /* max-height: 220px !important; */
    }
    .enterprise_screen2 {
        /* background: linear-gradient(
                180deg,
                rgba(253, 253, 253, 1) 0%,
                rgba(197, 208, 222, 1) 100%
        ); */
        border: 1px solid rgba(214, 225, 238, 1);
    }
</style>
