<template>
  <block>
    <view v-if="sourceType == '微信分享' && mixinIsSceneNumber == 1154" class="share-line-content">
      <view class="share-content-box">
        <view class="share-content">
          <text class="share-title"> {{ detailDataShare.title }}</text>
          <view class="share-item" v-if="detailDataShare.time">
            <text>活动时间</text>
            <rich-text :nodes="detailDataShare.time"></rich-text>
          </view>
          <view class="share-item" v-if="detailDataShare.speaker">
            <text>主讲人</text>
            <rich-text :nodes="detailDataShare.speaker"></rich-text>
          </view>
          <view class="share-item" v-if="detailDataShare.host">
            <text>主持人</text>
            <rich-text :nodes="detailDataShare.host"></rich-text>
          </view>
          <view class="share-item" v-if="detailDataShare.expert">
            <text>专家背景</text>
            <rich-text :nodes="detailDataShare.expert"></rich-text>
          </view>
          <view class="share-item" v-if="detailDataShare.guest">
            <text>嘉宾</text>
            <rich-text :nodes="detailDataShare.guest"></rich-text>
          </view>
          <view class="share-item" v-if="detailDataShare.highlights">
            <text>活动亮点</text>
            <rich-text :nodes="detailDataShare.highlights"></rich-text>
          </view>
          <view class="share-item" v-if="detailDataShare.theme">
            <text>主题</text>
            <rich-text :nodes="detailDataShare.theme"></rich-text>
          </view>
        </view>
      </view>
      <image class="share-report-go_cygx_xcx" src="https://hzstatic.hzinsights.com/new_cygx/go_cygx_xcx.png"></image>
    </view>
    <view class="container activity-detail" v-else>
      <is-track-follow :isShowFollowButton.sync="detailData.IsShowFollowButton" source="activity" :sourceId="detailData.ActivityId" :isFollowData.sync="detailData.IsFollowButton" />
      <view class="" v-if="haveAuth == 1 || (haveAuth != 1 && jurisdictionList.IsResearch)">
        <block v-if="detailData.YidongActivityUrl">
          <web-view :src="detailData.YidongActivityUrl"></web-view>
        </block>
        <block v-else>
          <block v-if="detailData.FileType == 1">
            <!-- 音频模块 -->
            <view class="audio-card-activity" v-if="detailData.VoiceList && detailData.VoiceList.Url">
              <view class="slider-paly">
                <view style="flex: 1; padding-top: 20rpx">
                  <slider
                    activeColor="#376CBB"
                    :max="detailData.VoiceList.PlaySeconds"
                    :value="curTime"
                    @touchstart="touchstartHandler"
                    @change="handleAudioSliderChange($event)"
                    @changing="handleAudioSliderChangeing($event)"
                    block-size="16"
                    class="slider"
                  />
                  <view class="card-time">
                    <view class="time">{{ curTime | formatVoiceTime }}</view>
                    <view class="time">{{ detailData.VoiceList.PlaySeconds | formatVoiceTime }}</view>
                  </view>
                </view>
                <view class="is-paly-card">
                  <image
                    @click.stop="audioPlayBack"
                    class=""
                    :src="
                      curVoiceId === detailData.ActivityId && !curAudioPaused
                        ? 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/play_icon.gif'
                        : 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/pause_icon.png'
                    "
                  ></image>
                </view>
              </view>
              <view class="fast-reverse">
                <image @click="speedReverseHandler('reverse')" class="speed-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/fastReverse_icon.png"></image>
                <block v-for="(item, index) in timesTheSpeed" :key="item.value">
                  <view class="speed-button" v-if="isTimes == item.value" @click="isTimesHandler(index)">
                    {{ item.name }}
                  </view>
                </block>
                <image @click="speedReverseHandler('speed')" class="speed-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/speed_icon.png"></image>
              </view>
              <text class="card-title global_title text_twoLine">
                {{ detailData.VoiceList.Name }}
              </text>
              <view class="title-image">
                <image @click="myLeavingMessageHandler" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/leaving_message.png"></image>
                <image
                  @click="isCollectionHandeler"
                  :src="detailData.IsCollect ? 'https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/collected_icon.png' : 'https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/not_collected.png'"
                ></image>
              </view>
            </view>
          </block>
          <!-- 视频模块 -->
          <block v-if="detailData.FileType == 2">
            <view class="audio-card-activity video-play" v-if="detailData.VideoDetail && detailData.VideoDetail.ResourceUrl">
              <video
                :id="detailData.ActivityId"
                :src="detailData.VideoDetail.ResourceUrl"
                enable-play-gesture
                :custom-cache="false"
                object-fit="contain"
                show-mute-btn
                @ended="handleVideoEnd"
                @play="handelVideoPlay"
                @loadedmetadata="loadedmetadataHandle"
                @timeupdate="handleVideoTimeUpdate"
              ></video>
              <view class="card-title global_title text_twoLine">
                {{ detailData.VideoDetail.Title }}
              </view>
              <view class="title-image">
                <image @click="myLeavingMessageHandler" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/leaving_message.png"></image>
                <image
                  @click="isCollectionHandeler"
                  :src="detailData.IsCollect ? 'https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/collected_icon.png' : 'https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/not_collected.png'"
                ></image>
              </view>
            </view>
          </block>

          <!-- 内容部分 -->
          <view class="activity-content">
            <image class="top-img-box" v-if="detailData.IsResearchPoints" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/research_points.png"></image>
            <image class="top-img-box" v-else-if="detailData.IsResearch" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/Research_normal.png"></image>
            <!-- 头部滚动显示 -->
            <view class="notice" v-if="detailData.IsLimitPeople">
              <van-notice-bar
                custom-class="custom-class-notice"
                color="#E37318"
                background="#FFF1E9"
                text="该活动参与名额有限，报名客户请按时参加，若不能按时参加请及时取消报名，爽约会影响您的后续报名资格"
              />
            </view>
            <view v-if="detailData.ActivityName" class="global_title content-title">
              {{ detailData.ActivityName }}
            </view>
            <!-- 活动类型  -->
            <view class="content-item">
              <text class="item-left" v-if="detailData.ActivityTypeName">活动类型：</text>
              <view class="city">
                <text style="color: #333">
                  <block v-if="detailData.ChartPermissionName !== '买方研选'">（{{ detailData.ChartPermissionName }}）</block>
                  {{ detailData.ActivityTypeName }}
                </text>
                <image v-if="detailData.City" style="margin-left: 15rpx" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/position.png" mode=""></image>
                <text v-if="detailData.City">{{ detailData.City }}</text>
              </view>
            </view>
            <!-- 产业标签 -->
            <view v-if="detailData.Listndustrial.length" class="content-item">
              <view class="item-left">产业标签：</view>
              <view class="item-right dustrial-content">
                <view class="item" v-for="item in detailData.Listndustrial" :key="item.IndustrialManagementId">
                  <view :class="['dustrial-li', item.IsJump && 'dustrial-item']" @click="goDustrialHandler(item)">{{ item.IndustryName }} </view>
                  <image v-if="item.IndustryNewLabel" class="new_icon" src="https://hzstatic.hzinsights.com/cygx/icon/new_report.png" mode=""></image>
                </view>
              </view>
            </view>
            <view v-if="detailData.ActivityTimeText" class="content-item">
              <view class="item-left">活动时间：</view>
              <view class="item-right">{{ detailData.ActivityTimeText }}</view>
            </view>
            <view v-if="detailData.DistinguishedGuest" class="content-item">
              <view class="item-left">嘉&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;宾：</view>
              <view class="item-right">{{ detailData.DistinguishedGuest }}</view>
            </view>
            <view v-if="detailData.Host" class="content-item">
              <view class="item-left">主&nbsp;&nbsp;持&nbsp;人：</view>
              <view class="item-right">{{ detailData.Host }}</view>
            </view>
            <view v-if="detailData.Speaker" class="content-item">
              <view class="item-left">主&nbsp;&nbsp;讲&nbsp;人：</view>
              <view class="item-right">{{ detailData.Speaker }}</view>
            </view>
            <view v-if="detailData.Expert" class="content-item">
              <view class="item-left">专家背景：</view>
              <view class="item-right">
                <rich-text :nodes="detailData.Expert"></rich-text>
              </view>
            </view>
            <view v-if="detailData.MainlandTell" class="content-item">
              <view class="item-left">大陆拨入：</view>
              <view class="item-right" style="color: #376cbb" @click="phonebtn(detailData.MainlandTell)">{{ detailData.MainlandTell }}</view>
            </view>
            <view v-if="detailData.HongKongTell" class="content-item">
              <view class="item-left">香港拨入：</view>
              <view class="item-right" style="color: #376cbb" @click="phonebtn(detailData.HongKongTell)">{{ detailData.HongKongTell }}</view>
            </view>
            <view v-if="detailData.TaiwanTell" class="content-item">
              <view class="item-left">台湾拨入：</view>
              <view class="item-right" style="color: #376cbb" @click="phonebtn(detailData.TaiwanTell)">{{ detailData.TaiwanTell }}</view>
            </view>
            <view v-if="detailData.AmericaTell" class="content-item">
              <view class="item-left">美国拨入：</view>
              <view class="item-right" style="color: #376cbb" @click="phonebtn(detailData.AmericaTell)">{{ detailData.AmericaTell }}</view>
            </view>
            <view v-if="detailData.ParticipationCode && isUserBindingPhoneNumber && haveAuth == 1" class="content-item">
              <view class="item-left">拨入密码：</view>
              <view class="item-right">{{ [1, 2, 3].includes(detailData.ActivityTypeId) && detailData.IsLimitPeople && !detailData.IsSignup ? "请报名获取" : detailData.ParticipationCode }}</view>
            </view>
            <view class="content-item" v-if="detailData.OnlineParticipation && isUserBindingPhoneNumber && haveAuth == 1">
              <view class="item-left">网络参会：</view>
              <view class="item-right content-item-link" v-if="[1, 2].includes(detailData.ActivityTypeId) && detailData.IsLimitPeople && !detailData.IsSignup"> 请报名获取 </view>
              <view class="item-right content-item-link" style="color: #376cbb" v-else>
                <view class="text_oneLine" @click="networkBtn">{{ detailData.OnlineParticipation }}</view>
                <view class="copy-link" @click="copyLink(1)">复制链接</view>
              </view>
            </view>
            <view class="content-item" v-if="detailData.LinkParticipants && isUserBindingPhoneNumber && haveAuth == 1">
              <view class="item-left">链接参会：</view>
              <view class="item-right content-item-zoom" style="color: #376cbb">
                <view>
                  <view class="default text_zoom" v-if="!detailData.IsSignup && detailData.ActivityTypeName == '公司调研电话会' && detailData.IsLimitPeople && detailData.IsZoom != 1"
                    >请报名获取
                  </view>
                  <blcok v-else>
                    <text class="default text_zoom" :style="{ color: detailData.IsZoom != 1 ? '#376cbb' : '#333' }">{{ detailData.LinkParticipants }}</text>
                    <view class="click-copy"> 点击<view class="default copy-link copy-zoom" @click="copyLink(1)">复制链接</view> <view>在手机浏览器打开</view> </view>
                  </blcok>
                </view>
              </view>
            </view>
            <view v-if="detailData.AppAttendance" class="content-item">
              <view class="item-left">App参会： </view>
              <view class="item-right">
                <rich-text :nodes="detailData.AppAttendance"></rich-text>
              </view>
            </view>
            <view v-if="detailData.MeetingId && isUserBindingPhoneNumber && haveAuth == 1 && detailData.IsZoom == 1" class="content-item">
              <view class="item-left">会议 ID&nbsp;：</view>
              <view class="item-right">{{ detailData.ActivityTypeName == "公司调研电话会" && detailData.IsLimitPeople && !detailData.IsSignup ? "请报名获取" : detailData.MeetingId }}</view>
            </view>
            <view v-if="detailData.ConferencePassword && isUserBindingPhoneNumber && haveAuth == 1" class="content-item">
              <view class="item-left">{{detailData.IsZoom == 1?'会议密码' :'拨入密码'}}：</view>
              <view class="item-right">{{ detailData.ActivityTypeName == "公司调研电话会" && detailData.IsLimitPeople && !detailData.IsSignup ? "请报名获取" : detailData.ConferencePassword }}</view>
            </view>
            <view v-if="detailData.Address && isUserBindingPhoneNumber && haveAuth == 1" class="content-item">
              <view class="item-left">活动地址：</view>
              <view class="item-right" v-if="!detailData.IsSignup && detailData.ActivityTypeName == '公司线下调研' && detailData.IsLimitPeople">请报名获取 </view>
              <text class="item-right text-copy" user-select v-else>{{ detailData.Address }}</text>
            </view>
            <view v-if="detailData.Highlights" class="content-item">
              <view class="item-left">活动亮点： </view>
              <view class="item-right">
                <rich-text :nodes="detailData.Highlights"></rich-text>
              </view>
            </view>
            <view class="content-item" v-if="detailData.ArticleList.length">
              <view class="item-left">相关报告：</view>
              <view class="item-right look-link" style="color: #376cbb" @click="articleLinkHandler"> 点击查看 </view>
            </view>
            <view class="content-item" v-if="detailData.TencentConferenceNumber">
              <view class="item-left" style="width: 170rpx">腾讯会议号：</view>
              <view class="item-right content-item-link" v-if="!detailData.IsSignup && (detailData.IsYidongConduct || detailData.IsLimitPeople)">请报名获取</view>
              <view class="item-right content-item-link" style="color: #376cbb" v-else>
                <view class="">
                  <text class="default tencent text_oneLine">{{ detailData.TencentConferenceNumber }}</text>
                  <text class="default copy-link" @click="copyLink(2)">复制会议号</text>
                </view>
              </view>
            </view>
            <view v-if="detailData.Theme" class="content-item">
              <view class="item-left">主&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题： </view>
              <view class="item-right">
                <rich-text :nodes="detailData.Theme"></rich-text>
              </view>
            </view>
            <view v-if="detailData.Remarks" class="content-item">
              <view class="item-left">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注： </view>
              <view class="item-right">
                <rich-text :nodes="detailData.Remarks"></rich-text>
              </view>
            </view>
            <!-- 操作按钮部分 -->
            <view class="content-bottom" v-if="isUserBindingPhoneNumber && haveAuth == 1">
              <block v-if="detailData.ActiveState == 1">
                <view class="make-outbound global_content_center" @click="signupIsAddOfCancel(1)" v-if="detailData.IsShowOutboundCall">
                  {{ detailData.LimitPeopleNum > 0 ? `${showOutboundCall}(${detailData.SignupNum}/${detailData.LimitPeopleNum})` : showOutboundCall }}
                </view>
                <view @click="meetingReminderCancel" class="make-conference make-conference-remind" v-if="detailData.IsShowMeetingReminder">
                  {{ detailData.IsCancelMeetingReminder == 1 ? "取消会议提醒" : "会议提醒" }}

                  <view>(会前15分钟推送微信消息提醒)</view>
                </view>
                <view v-if="detailData.IsShowAppointment" @click="summaryIsHandel" class="make-conference global_content_center">{{ detailData.IsAppointment == 1 ? "取消纪要" : "预约纪要" }}</view>
                <view v-if="detailData.IsShowHelpSsk" class="make-conference global_content_center" @click="askingGo"> 帮我带问 </view>
                <view class="make-outbound global_content_center" @click="wanttosignup" v-if="!detailData.IsSignup && detailData.IsShowSignup">
                  {{ detailData.LimitPeopleNum > 0 ? `我要报名(${detailData.SignupNum}/${detailData.LimitPeopleNum})` : "我要报名" }}
                </view>
                <view v-if="detailData.IsSignup && detailData.IsShowSignup" class="make-outbound global_content_center" @click="signupIsAddOfCancel(2)">
                  {{ detailData.LimitPeopleNum > 0 ? `${showWay}(${detailData.SignupNum}/${detailData.LimitPeopleNum})` : showWay }}
                </view>
              </block>
              <view class="content-bottom" v-if="detailData.ActiveState == 2 && detailData.ActivityTypeId == 1">
                <view class="make-conference make-conference-remind" @click="askingGo('提问')">
                  实时提问
                  <text>会议过程中，分析师可替您提问专家</text>
                </view>
              </view>
            </view>
            <view class="content-bottom" v-if="!isUserBindingPhoneNumber">
              <view class="make-outbound global_content_center" @click="pleaseGoLogin"> 请登录后报名 </view>
            </view>
            <view class="research-special-content" v-if="jurisdictionList.IsResearch && haveAuth != 1">
              <view class="text" v-if="jurisdictionList.IsResearchSpecial">签约研选扣点包才可参与此活动，请联系对口销售</view>
              <block v-else>
                <view class="no-text">暂无权限</view>
                <view v-if="haveAuth == 2" class="text">点击提交申请，提醒对口销售为你开通试用</view>
                <view v-else class="text">您可申请开通试用</view>
                <view v-if="haveAuth === 3 && !detailData.IsResearchPoints" class="btn-cont" @click="sellerApplyAuth"> 提交申请 </view>
                <view class="btn-cont" @click="applyAuth" v-else> 提交申请 </view>
              </block>
              <view class="btn-cont back-btn" @click="backIndex"> 返回</view>
            </view>
          </view>
        </block>
        <!-- 参会方式的弹出层 -->
        <SelectPopup :selectShow.sync="selectShow" @signupIsAddOfCancel="signupIsAddOfCancel" :selectYdong="selectYdong" />
        <view class="select-box">
          <u-popup v-model="selectShowLink" mode="bottom">
            <view style="color: #376cbb" class="text_oneLine article-title" @click="goDetail(item.ArticleId)" v-for="item in detailData.ArticleList" :key="item.ArticleId"> {{ item.Title }}</view>
            <view style="color: #a9afb8" @click="selectShowLink = false">取消</view>
          </u-popup>
        </view>
        <!-- 各种弹框部分 -->
        <modalDialog
          :isShow="isShow"
          :signupType="signupType"
          :goFollow="goFollow"
          :isCancelShow="isCancelShow"
          :idTypeCancel="idTypeCancel"
          :editIsShow="editIsShow"
          :countryCode="countryCode"
          :mobileEdit="mobileEdit"
          :goOnNextStep="goOnNextStep"
          :jurisdictionList="jurisdictionList"
          :mailboxBinding="mailboxBinding"
        />

        <view class="product-introduction-box" v-if="jurisdictionList.IsResearch && haveAuth != 1">
          <view class="product-introduction">
            <view class="introduction-header">
              <view class="introduction-header-left"></view>
              <view class="introduction-header-right">
                <view class="introduction-title-CN"> 产品介绍 </view>
                <view class="introduction-title-US"> Product Introduction </view>
              </view>
            </view>
            <view class="introduction-body">
              <view class="introduction-body-box">
                <view class="body-box-title"> 独家亮点 </view>
                <view class="introduction-body-row"><span class="highHight-text">市场低价访谈优质专家 </span></view>
                <view class="introduction-body-row">重点公司小范围交流<span class="highHight-text">破圈</span>参加</view>
                <view class="introduction-body-row"><span class="highHight-text">海量</span>调研过程及纪要共享</view>
              </view>
              <view class="introduction-body-box">
                <view class="body-box-title"> 优质资源 </view>
                <view class="introduction-body-row"><span class="highHight-text">500+</span>篇/年调研纪要更新</view>
                <view class="introduction-body-row"><span class="highHight-text">300+</span>场/年海内外重点公司小范围交流</view>
                <view class="introduction-body-row"><span class="highHight-text">100+</span>场/年热点线下调研</view>
                <view class="introduction-body-row"><span class="highHight-text">30000+</span>名优质行业专家长期合作</view>
              </view>
              <view class="introduction-body-box">
                <view class="body-box-title" style="margin-bottom: 18rpx"> 服务报价 </view>
                <view class="body-row-content">
                  <view class="body-row-title"> 订阅包：3万/年 </view>
                  <view class="introduction-body-row">无限量调研纪要及常规研选专栏查阅，公开活动参与</view>
                </view>
                <view class="body-row-content">
                  <view class="body-row-title"> 扣点包：5万/年 </view>
                  <view class="introduction-body-row">低至2000元/场专家、同业访谈</view>
                  <view class="introduction-body-row">1000元/场重点公司小范围交流</view>
                </view>
                <view style="font-size: 26rpx">欢迎联系买方研选，了解更多服务详情，获取试用体验</view>
              </view>
            </view>
          </view>
        </view>
      </view>
      <!-- 权限部分 -->
      <view v-else>
        <jurisdiction :idAct="id" :jurisdictionList="jurisdictionList"></jurisdiction>
      </view>
      <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
      <view v-show="false">
        <audioModule ref="childrenAudio" :showAudioPop="showAudioPop" />
      </view>
      <suspenButton v-if="showSingInImg" :showSingInImg.sync="showSingInImg" type="活动详情">
        <template slot="center">
          <image mode="widthFix" style="height: 120rpx; width: 120rpx" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/sing_in_icon.png"> </image>
        </template>
        <template slot="top">
          <image @click.stop="isDlgImg = true" mode="widthFix" style="height: 120rpx; width: 120rpx" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/sign_in_img.png"> </image>
        </template>
        <template slot="left">
          <image @click.stop="goSingUpDetail" mode="widthFix" style="height: 120rpx; width: 120rpx" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/sing_up_details.png"> </image>
        </template>
      </suspenButton>
      <van-popup custom-class="custom-class-popup" :show="isDlgImg" @close="onCloseHandler">
        <view class="sign-in-img-box">
          <image :src="detailData.SigninImg"></image>
          <view class="button-box">
            <text @click="onCloseHandler">关闭</text>
            <text @click="downloadImage">保存图片</text>
          </view>
        </view>
      </van-popup>
      <!-- 各种弹框部分 -->
      <ShowResearchDlg :isResearchModalShow.sync="isResearchModalShow" :jurisdictionList="jurisdictionList" :checkResearchList.sync="checkResearchList" />
    </view>
    <Loading />
  </block>
</template>

<script>
import { activity, User, Home } from "@/config/api.js";
import modalDialog from "@/components/modalDialog.vue";
import jurisdiction from "./jurisdiction/components.vue";
import freeCharge from "@/components/freeCharge";
import audioModule from "@/components/audioModule/index";
import manageMixin from "./manageMixin";
import IsTrackFollow from "@/components/isTrackFollow.vue";
import SelectPopup from "@/components/activity/selectPopup";
import NotHaveLogin from "@/components/notHaveLogin.vue";
import suspenButton from "@/components/suspen_button.vue";
import ShowResearchDlg from "@/components/activity/showResearchDlg.vue";
let app = getApp({ allowDefault: true });
export default {
  filters: {
    formatVoiceTime(e) {
      let m = parseInt(e / 60);
      let s = parseInt(e % 60);
      return `${m > 9 ? m : "0" + m}:${s > 9 ? s : "0" + s}`;
    },
  },
  data() {
    return {
      id: "",
      detailData: {},
      isShowJurisdiction: false,
      isGain: true,
      signupType: "", //关注类型
      goFollow: false, //是否关注公众号
      isShow: false, //弹框
      isCancelShow: false,
      idTypeCancel: {
        id: "",
        type: 1,
        cutId: "",
        state: "",
      },
      selectShow: false, // 参会方式的隐藏显示
      selectYdong: false, // 参会方式展示的文案
      haveAuth: "",
      jurisdictionList: {},
      editIsShow: false, //外呼莫泰框
      countryCode: "", //外呼区号
      mobileEdit: "", //外呼手机号
      goOnNextStep: "", //设置外呼号后弹出哪个
      mailboxBinding: false, //是否绑定邮箱
      play: false,
      timesTheSpeed: [
        { name: "倍速", value: 1 },
        { name: "1.25倍", value: 1.25 },
        { name: "1.5倍", value: 1.5 },
        { name: "2倍", value: 2 },
      ],
      curTime: 0,
      videoContext: null,
      isVideoPlay: false,
      selectShowLink: false,
      isSendWx: "",
      isDlgImg: false,
      showSingInImg: false,
      isResearchModalShow: false,
      checkResearchList: {},
      sourceType: "",
      detailDataShare: {},
    };
  },
  mixins: [manageMixin],
  computed: {
    curVoiceId() {
      //当前正在播放的音频id
      return this.$store.state.audioBg.indexId;
    },
    curAudioPaused() {
      //当前音频是否暂停状态
      return this.$store.state.audioBg.paused;
    },
    //视频的id
    activityVideoId() {
      return this.$store.state.videoPlay.playVideoActId;
    },
    //报名的显示
    showWay() {
      let text = this.detailData.SignupType == 1 ? "取消外呼" : "取消报名";
      return text;
    },
    showOutboundCall() {
      let text = this.detailData.IsSignup ? "取消外呼" : "预约外呼";
      return text;
    },
    //几倍的播放数度
    isTimes() {
      let isMultiple = this.curVoiceId === this.detailData.ActivityId ? this.$store.state.audioBg.multiple : 1;
      return isMultiple;
    },
    showAudioPop() {
      return this.$store.state.audioBg.show;
    },
  },
  components: {
    modalDialog,
    jurisdiction,
    freeCharge,
    audioModule,
    IsTrackFollow,
    SelectPopup,
    NotHaveLogin,
    suspenButton,
    ShowResearchDlg,
  },
  watch: {
    haveAuth: {
      handler() {
        if (this.haveAuth == 1) {
          this.$store.dispatch("statistics", { PageType: "ActivitParticulars", DetailId: this.id });
        }
      },
      immediate: true,
    },
    "$store.state.audioBg.curTime": {
      handler(newVal) {
        this.curTime = this.curVoiceId === this.detailData.ActivityId ? newVal : 0;
      },
      immediate: true,
      deep: true,
    },
  },
  methods: {
    downloadImage() {
      wx.downloadFile({
        url: this.detailData.SigninImg,
        success(res) {
          wx.saveImageToPhotosAlbum({
            filePath: res.tempFilePath,
            success(data) {
              wx.showModal({
                title: "提示",
                content: "保存成功",
                modalType: false,
              });
            },
            fail(err) {
              if (
                err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" ||
                err.errMsg === "saveImageToPhotosAlbum:fail auth deny" ||
                err.errMsg === "saveImageToPhotosAlbum:fail authorize no response"
              ) {
                wx.showModal({
                  title: "提示",
                  content: "需要您授权保存相册",
                  modalType: false,
                  success: (modalSuccess) => {
                    wx.openSetting({
                      success(settingdata) {
                        if (settingdata.authSetting["scope.writePhotosAlbum"]) {
                          wx.showModal({
                            title: "提示",
                            content: "获取权限成功,再次点击图片即可保存",
                            modalType: false,
                          });
                        } else {
                          wx.showModal({
                            title: "提示",
                            content: "获取权限失败，将无法保存到相册哦~",
                            modalType: false,
                          });
                        }
                      },
                    });
                  },
                });
              }
            },
          });
        },
      });
    },
    onCloseHandler() {
      this.isDlgImg = false;
    },
    // 获取详情
    getActivityDetail() {
      activity
        .getActivityDetail({
          ActivityId: this.id,
          PageRouter: this.$store.state.pageRouterActivity,
          IsSendWx: this.isSendWx,
        })
        .then((res) => {
          if (res.Ret == 200) {
            this.$store.commit("setRouterActivity", "活动详情");
            this.haveAuth = res.Data.HasPermission;
            this.jurisdictionList = res.Data;
            this.detailData = res.Data.Detail;
            if (res.Data.HasPermission == 1) {
              this.showSingInImg = this.detailData.IsShowSigninButton;
              this.synchronization();
            }
          }
        });
    },
    // 同步数据
    synchronization() {
      let pages = getCurrentPages();
      let prevPage = pages[pages.length - 2];
      let path = prevPage ? prevPage.$page.fullPath : "";
      if (path.includes("/activityPages/themeActivity/themeActivity") || path.includes("/pages-search/indedxSearch/indedxSearch?source=活动详情页面")) {
        const index = prevPage.$vm.collectList.findIndex((item) => item.ActivityId == this.id);
        prevPage.$vm.collectList[index].IsSignup = this.detailData.IsSignup;
        prevPage.$vm.collectList[index].SignupNum = this.detailData.SignupNum;
        prevPage.$vm.collectList[index].SignupType = this.detailData.SignupType;
        prevPage.$vm.collectList[index].IsAppointment = this.detailData.IsAppointment;
        prevPage.$vm.collectList[index].IsCancelMeetingReminder = this.detailData.IsCancelMeetingReminder;
      }
    },
    // 拨打电话
    phonebtn(phone) {
      uni.makePhoneCall({
        phoneNumber: phone,
      });
    },

    // 跳转新的小程序
    networkBtn() {
      if (this.detailData.OnlineParticipation.includes("http")) {
        uni.navigateTo({
          url: "/activityPages/networkAttend/networkAttend?url=" + this.detailData.OnlineParticipation,
        });
      } else {
        uni.navigateToMiniProgram({
          appId: "wxade30ff0c4ee757d",
          path: this.detailData.OnlineParticipation,
        });
      }
    },

    // 弹框的回调事件
    cancelEnsure() {
      this.getActivityDetail();
    },

    // 跳转
    goDetail(id) {
      uni.navigateTo({
        url: "/pageMy/reportDetail/reportDetail?id=" + id,
      });
    },
    // 提问
    async askingGo(type = "") {
      const res = await activity.checkAskActivity({ ActivityId: Number(this.id), PageRouter: this.$store.state.pageRouterActivity });
      if (res.Ret === 200) {
        if (res.Data.SignupStatus === "Success") {
          uni.navigateTo({
            url: "/activityPages/generationAsk/generationAsk?id=" + this.id + "&type=" + type,
          });
        } else {
          uni.showModal({
            confirmText: "知道了",
            confirmColor: "#376cbb",
            content: res.Msg || res.Data.PopupMsg,
            showCancel: false,
            success: (res) => {
              if (res.confirm) {
                this.getActivityDetail();
              }
            },
          });
        }
      }
    },

    // 复制的操作
    copyLink(type) {
      console.log(11);
      
      uni.setClipboardData({
        data: type == 1 ? this.detailData.LinkParticipants || this.detailData.OnlineParticipation : this.detailData.TencentConferenceNumber,
        success: function () {
          uni.showToast({
            title: `复制成功${type == 1 ? ",可在浏览器打开" : ""}`,
            icon: "none",
            duration: 2000,
          });
        },
      });
    },
    // 跳转产业标签
    goDustrialHandler(item) {
      if (!item.IsJump) return;
      if (item.IsResearch) {
        //严选
        uni.navigateTo({ url: "/reportPages/researchTheme/researchTheme?id=" + item.IndustrialManagementId });
      } else {
        //非严选
        uni.navigateTo({ url: "/reportPages/IndustryReport/IndustryReport?id=" + item.IndustrialManagementId });
      }
    },
    // 音频点击暂停播放
    audioPlayBack() {
      if (this.$store.state.audioBg.indexId == this.detailData.ActivityId) {
        if (this.globalBgAudioManager.paused) {
          this.globalBgAudioManager.play();
        } else {
          this.globalBgAudioManager.pause();
        }
      } else {
        this.$store.commit("audioBg/addAudio", {
          list: this.detailData.VoiceList,
          indexId: this.detailData.ActivityId,
          activityId: this.detailData.ActivityId,
          activityTitle: this.detailData.ActivityName,
          recordList: {
            SourceId: this.detailData.ActivityId,
            Type: 1,
          },
        });
      }
    },

    // 拖动进度条
    handleAudioSliderChangeing(e) {
      this.curTime = e.detail.value;
    },
    // 拖动进度条
    handleAudioSliderChange(e) {
      const value = e.detail.value;
      this.globalBgAudioManager.seek(value);
      this.$refs.childrenAudio.isRecord = false;
      setTimeout(() => {
        this.$store.commit("audioBg/setSlide", false);
      }, 300);
    },
    // 手指离开拖动进度条
    touchstartHandler() {
      this.$store.commit("audioBg/setSlide", true);
    },
    //倍速播放
    isTimesHandler(i) {
      if (this.$store.state.audioBg.activityId == this.detailData.ActivityId) {
        let index = i == 3 ? 0 : i + 1;
        this.$store.commit("audioBg/setMultiple", this.timesTheSpeed[index].value);
        this.globalBgAudioManager.playbackRate = this.isTimes;
        this.globalBgAudioManager.startTime = this.curTime;
        if (this.globalBgAudioManager.paused) {
          this.globalBgAudioManager.play();
        }
      } else {
        this.$store.commit("audioBg/removeAudio");
        this.$store.commit("audioBg/addAudio", {
          list: this.detailData.VoiceList,
          indexId: this.detailData.ActivityId,
          activityId: this.detailData.ActivityId,
          activityTitle: this.detailData.ActivityName,
          recordList: {
            SourceId: this.detailData.ActivityId,
            Type: 1,
          },
        });
      }
      this.$refs.childrenAudio.isRecord = false;
    },

    //快进 快退
    speedReverseHandler(type) {
      let isTime = type == "reverse" ? this.curTime - 15 : this.curTime + 15;
      isTime = isTime <= 0 ? 0 : isTime >= this.detailData.VoiceList.PlaySeconds ? this.detailData.VoiceList.PlaySeconds - 1 : isTime;
      this.globalBgAudioManager.seek(isTime);
      this.$refs.childrenAudio.isRecord = false;
    },

    //视频元数据加载完成时触发
    loadedmetadataHandle() {
      this.videoContext = wx.createVideoContext(this.detailData.ActivityId.toString(), this);
      let curVideoTime = 0;
      if (this.activityVideoId == this.detailData.ActivityId) {
        curVideoTime = this.$store.state.videoPlay.palyCurrentTime;
      } else {
        this.$store.commit("videoPlay/playVideoActivity", this.detailData.ActivityId);
      }
      this.videoContext.seek(curVideoTime);
    },
    //视频播放结束
    handleVideoEnd() {
      // 此处因为如果不调用退出全屏方法 安卓和ios页面均会表现异常，安卓横屏不恢复竖屏，ios底部tabbar渲染异常
      this.videoContext.exitFullScreen();
    },
    //视频时间的更新
    handleVideoTimeUpdate(e) {
      let time = parseInt(e.detail.currentTime);
      this.$store.commit("videoPlay/palyTimeUpdate", time);
    },
    //视频的播放事件
    handelVideoPlay() {
      if (!this.isVideoPlay) {
        Home.microAideoHistoryAdd({ SourceId: this.detailData.ActivityId, SourceType: 2 });
      }
      this.isVideoPlay = true;
    },

    // 微路演留言
    myLeavingMessageHandler() {
      let title = this.detailData.FileType == 1 ? this.detailData.VoiceList.Name : this.detailData.VideoDetail.Title;
      uni.navigateTo({
        url: "/activityPages/generationAsk/generationAsk?id=" + this.detailData.ActivityId + "&type=文章&roadshow=" + this.detailData.FileType + "&roadshowTitle=" + title,
      });
    },

    // 微路演收藏
    async isCollectionHandeler() {
      await this.$store.dispatch("showLoginModal");
      const res = await Home.microRoadshowCollect({
        SourceId: this.detailData.FileType == 1 ? this.detailData.VoiceList.ActivityVoiceId : this.detailData.VideoDetail.Id,
        SourceType: this.detailData.FileType,
        PageRouter: this.$store.state.pageRouterReport,
      });
      if (res.Ret === 200) {
        uni.showToast({
          title: res.Msg,
          duration: 2000,
        });
        this.detailData.IsCollect = !this.detailData.IsCollect;
      }
    },
    articleLinkHandler() {
      if (this.detailData.ArticleList.length === 1) {
        uni.navigateTo({
          url: "/pageMy/reportDetail/reportDetail?id=" + this.detailData.ArticleList[0].ArticleId,
        });
      } else {
        this.selectShowLink = true;
      }
    },
    // 去往报名详情
    goSingUpDetail() {
      uni.navigateTo({
        url: "/pages-message/activityTemplate/activityTemplate?id=" + this.id,
      });
    },
  },
  onLoad(option) {
    this.id = option.id || "";
    this.isSendWx = option.IsSendWx || "";
    this.sourceType = option.sourceType || "";
    console.log(option.detailDataShare);

    this.detailDataShare = option.detailDataShare ? JSON.parse(decodeURIComponent(option.detailDataShare) || {}) : "";
    // 详情页面不写路径
  },
  onShow() {
    if (this.mixinIsSceneNumber == 1154) return;
    this.getActivityDetail();
    this.$store.commit("audioBg/parseIntAudio", false);
    this.$store.commit("setRouterReport", "活动详情");
  },
  /**
   * 用户点击分享
   */
  onShareAppMessage: function (res) {
    return {
      title: this.isHorzMobile ? "好友向您推荐此内容，上传名片享查研观向免费月卡！" : "活动详情",
      path: "/activityPages/activityDetail/activityDetail?id=" + this.id,
      success: (res) => {},
      fail: (err) => {},
    };
  },
  /**
   * 用户点击分享朋友圈
   */
  onShareTimeline() {
    let shaerObj = {
      title: this.detailData.ActivityName,
      time: this.detailData.ActivityTimeText,
      speaker: this.detailData.Speaker,
      host: this.detailData.Host,
      expert: this.detailData.ExpertText,
      guest: this.detailData.DistinguishedGuest,
      highlights: this.detailData.HighlightsText,
      theme: this.detailData.ThemeText,
    };
    let detailDataShare = JSON.stringify(shaerObj).replace(/%/g, "%25");
    console.log(detailDataShare, "--");

    return {
      title: this.detailData.ActivityName,
      query: "id=" + this.id + "&sourceType=微信分享&shareImag=" + this.detailData.MomentsImg + "&detailDataShare=" + encodeURIComponent(detailDataShare),
      imageUrl: this.detailData.ImgUrl,
    };
  },
};
</script>

<style scoped lang="scss">
.activity-detail {
  background-color: $uni-color-new;
  padding: 25rpx 34rpx 150rpx;
  .audio-card-activity {
    width: 100%;
    padding: 25rpx;
    background-color: #fff;
    border-radius: 16rpx;
    margin-bottom: 25rpx;
    .slider {
      width: 100%;
      margin: 0;
    }
    .slider-paly {
      display: flex;
      height: 80rpx;
      align-items: center;
      padding-left: 20rpx;
    }
    .card-title {
      word-break: break-all;
      margin: 40rpx 0 20rpx;
    }
    .card-time {
      display: flex;
      justify-content: space-between;
      color: #999999;
      font-size: 20rpx;
    }
    .title-image {
      display: flex;
      justify-content: flex-end;
      image {
        width: 48rpx;
        height: 48rpx;
        margin-left: 48rpx;
      }
    }
    .is-paly-card {
      width: 70rpx;
      height: 70rpx;
      flex-shrink: 0;
      margin-left: 30rpx;
      image {
        width: 70rpx;
        height: 70rpx;
      }
    }
    .fast-reverse {
      display: flex;
      align-items: center;
      justify-content: center;
      margin-top: 30rpx;
      .speed-button {
        width: 96rpx;
        height: 47rpx;
        background: #eaeaea;
        border-radius: 8rpx;
        text-align: center;
        line-height: 47rpx;
        margin: 0 70rpx;
        padding-left: 0;
      }
      .speed-img {
        width: 50rpx;
        height: 50rpx;
      }
    }
  }
  .video-play {
    width: 100%;
    video {
      width: 100%;
      height: 318rpx;
    }
  }
  .new_icon {
    width: 60rpx;
    height: 30rpx;
    margin: 0 20rpx 0rpx 0;
    display: inline-block;
    vertical-align: middle;
  }
  .activity-content {
    width: 100%;
    padding: 20rpx 30rpx 100rpx;
    background-color: #fff;
    border-radius: 16rpx;
    overflow: hidden;
    .notice {
      margin-bottom: 20rpx;
    }
    /deep/ .van-notice-bar {
      height: 62rpx;
    }
    .content-title {
      margin: 10rpx 0 30rpx;
    }
    .content-item {
      display: flex;
      font-size: 28rpx;
      line-height: 40rpx;
      color: #333;
      margin-bottom: 20rpx;
      align-items: flex-start;
      vertical-align: text-top;
      .city {
        display: flex;
        align-items: center;
        image {
          width: 28rpx;
          height: 28rpx;
        }
      }

      .item-left {
        width: 140rpx;
        flex-shrink: 0;
      }
      .item-right {
        color: #333;
      }
      .dustrial-content {
        display: flex;
        flex-wrap: wrap;
        .item {
          display: flex;
          align-items: center;
          padding-left: 0;
          margin-left: 0;
        }
        .dustrial-li {
          display: flex;
          align-items: center;
          font-size: 22rpx;
          height: 40rpx;
          padding: 0 13rpx;
          margin: 0 20rpx 10rpx 0;
          background-color: #f0f1f3;
        }
        .dustrial-item {
          padding: 0 20rpx;
          background: #e5efff;
          border-radius: 4rpx;
          color: $uni-color-new;
          border-radius: 4rpx;
          font-weight: 600;
        }
      }
      .content-item-link {
        display: flex;
        .copy-link {
          flex-shrink: 0;
          margin-left: 20rpx;
        }
      }
    }
    .content-bottom {
      margin-top: 100rpx;
      font-size: 24rpx;
      font-weight: 600;
      .make-outbound {
        color: #fff;
        margin: 0 auto;
        width: 504rpx;
        height: 60rpx;
        border-radius: 8rpx;
        background-color: $uni-color-new;
      }
      .make-conference {
        margin: 20rpx auto;
        width: 504rpx;
        padding: 12rpx;
        line-height: 36rpx;
        background-color: #e5efff;
        color: $uni-color-new;
        border-radius: 8rpx;
        view {
          font-weight: 400;
          font-size: 20rpx;
        }
      }
      .make-conference-remind {
        text-align: center;
      }
    }
  }
  .top-img-box {
    width: 160rpx;
    height: 48rpx;
    margin: -20rpx 0 0 -30rpx;
  }
  .sign-in-img-box {
    width: 704rpx;
    height: 1121rpx;
    background-color: #fff;
    border-radius: 8rpx;
    overflow: hidden;
    image {
      width: 100%;
      height: calc(100% - 108rpx);
    }
    .button-box {
      display: flex;
      align-items: center;
      height: 102rpx;
      border-top: 1rpx solid #f0f0f0;
      text {
        flex: 1;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
      }
      text:last-child {
        border-left: 1rpx solid #f0f0f0;
        color: #3385ff;
      }
    }
  }
  .custom-class-popup {
    border-radius: 8rpx;
    overflow: hidden;
  }
}
.product-introduction-box {
  background-color: #f7f7f7;
  padding: 10rpx 0;
  margin-top: 60rpx;
  border-radius: 16rpx;
  .product-introduction {
    padding: 60rpx 0 0 25rpx;
    background-color: white;
    .introduction-header {
      margin-bottom: 40rpx;
      display: flex;
      .introduction-header-left {
        background-color: #caaf8b;
        height: 90rpx;
        width: 14rpx;
        margin-right: 20rpx;
      }
      .introduction-header-right {
        text-align: left;
        .introduction-title-CN {
          font-weight: 500;
          font-size: 34rpx;
          color: #333333;
          line-height: 42rpx;
          margin-bottom: 8rpx;
        }
        .introduction-title-US {
          font-weight: 400;
          font-size: 28rpx;
          color: #c0c4cc;
          line-height: 42rpx;
        }
      }
    }
    .introduction-body {
      .introduction-body-box {
        text-align: left;
        margin-bottom: 40rpx;
        .body-row-content {
          margin-bottom: 40rpx;
          font-size: 34rpx;
          line-height: 48rpx;
          font-weight: 600;
          color: #caaf8b;
          .body-row-title {
            margin-left: 40rpx;
          }
        }
        .body-box-title {
          font-weight: 600;
          font-size: 34rpx;
          line-height: 48rpx;
          padding-left: 40rpx;
          position: relative;
          margin-bottom: 22rpx;
          &::before {
            content: "";
            height: 20rpx;
            width: 20rpx;
            background-color: #caaf8b;
            border-radius: 20rpx;
            position: absolute;
            left: 0;
            top: 16rpx;
          }
        }
        .introduction-body-row {
          margin-left: 40rpx;
          font-weight: 400;
          font-size: 26rpx;
          color: #333333;
          line-height: 36rpx;
        }
        .highHight-text {
          color: #caaf8b;
        }
      }
    }
  }
}
.btn-cont {
  width: 500rpx;
  height: 52rpx;
  background: $uni-color-new;
  color: #fff;
  font-size: 24rpx;
  font-weight: 600;
  border-radius: 8rpx;
  margin: 0 auto;
  text-align: center;
  line-height: 52rpx;

  &.back-btn {
    background: #e5efff !important;
    color: $uni-color-new;
    margin-top: 30rpx;
  }

  .btn_bg {
    width: 100%;
    height: 80rpx;
    position: absolute;
    left: 0;
    top: 0;
  }

  .btn-txt {
    width: 100%;
    position: absolute;
    z-index: 1;
  }
}
.research-special-content {
  padding: 30rpx;
  text-align: center;
  .text {
    color: #999;
    font-size: 28rpx;
    margin-bottom: 35rpx;
  }

  .no-text {
    font-size: 36rpx;
    color: #333333;
    margin-bottom: 20rpx;
  }
}
.click-copy {
  display: flex;
  flex-wrap: wrap;
  view {
    margin-left: 10rpx;
    display: inline-block !important;
  }
}
</style>
