<!--/*
 * 
 * WordPres版微信小程序
 * author: jianbo
 * organization: 守望轩  www.watch-life.net
 * github:    https://github.com/iamxjb/winxin-app-watch-life.net
 * 技术支持微信号：iamxjb
 * 开源协议：MIT
 *Copyright (c) 2017 https://www.watch-life.net All rights reserved.
 * 星尘 基于微慕开源小程序二开
 * author：yinfegrui
 * organization：枫瑞博客网 www.frbkw.coms
 *  *星尘 技术维护微信号：qaz449275996
 */-->

<import src="../../wxParse/wxParse.wxml" />
<import src="../../templates/copyright.wxml" />
<import src="../../templates/loading.wxml" />
<import src="../../templates/modal-view/modal-view.wxml" />
<import src="../../templates/login-popup.wxml" />


<!-- 小程序广告 -->
<view class="ad-box" wx:if="{{detail.detailAdId !='' && detail.detailAd=='1' && detailTopAdsuccess}}">
  <ad unit-id="{{detail.detailAdId}}" ad-intervals="30" ad-type="video" binderror="adTopbinderror"></ad>
</view>
<!-- 星尘 -->

<view style="display:{{display}}">

  <!-- 标题 -->
  <view class="data-h">{{detail.title.rendered}}</view>

  <!-- 信息 -->
  <view class="cent-wz-icon">
    <!--时间 评论 阅读 点赞-->
    <view class="entry-data">
      <image src="../../images/calendar.png"></image>
      <text>{{detailDate}}</text>
      <image src="../../images/comments.png"></image>
      <text>{{total_comments}}</text>
      <image src="../../images/pageviews.png"></image>
      <text>{{detail.pageviews}}</text>
      <image src="../../images/home-like.png"></image>
      <text>{{likeCount}}</text>
    </view>
  </view>

  <!-- 正文 -->
  <view class="dta-cent">
    <!-- 文章正文 -->
    <view class="entry-summary" id="entry-summary" style="height:{{detailSummaryHeight}}">

      <!-- 音频 -->
      <view class='audioPlayer' style="display:{{displayAudio}}">
        <view class='player'>
          <view class='audioControls'>
            <view class='flex'>
              <view class='audio_left'>
                <image src='{{detail.post_medium_image}}' class='audio_img' mode="aspectFill"></image>
                <view class='audio_btn' catchtap='playAudio'>
                  <!-- 按钮 -->
                  <view wx:if="{{isPlayAudio}}">
                    <image src='../../images/pause.png' class='audio_btn_icon' />
                  </view>
                  <view wx:else>
                    <image src='../../images/play.png' class='audio_btn_icon' />
                  </view>
                </view>
              </view>

              <view class='audio_right'>
                <view class='audio_title'>{{detail.audios[0].title}}</view>
                <view class='audio_singer'>{{detail.audios[0].singer}}</view>
                <view class='slider'>
                  <slider bindchange='sliderChange' activeColor='red' block-size="12" value='{{audioTime}}' />
                </view>
                <view class='time_box'>
                  <view class='time'>
                    {{showTime1}}
                  </view>
                  <view class='time'>
                    {{showTime2}}
                  </view>
                </view>
              </view>

            </view>
          </view>
        </view>
      </view>


      <template is="wxParse" data="{{wxParseData:article.nodes}}" />

      <!-- 阅读更多 -->
      <view class="detail-read-more" wx:if="{{detailSummaryHeight != ''}}">
        <view class="detail-readmore-mask">
          <view class="detail-readmore-btn" bindtap="readMore">观看视频，阅读更多...</view>
        </view>
      </view>

    </view>
  </view>

  <!-- 上下篇 -->
  <view class="data-sw" wx:if="{{detail.previous_post_id || detail.next_post_id}}">
    <view class="d-l" wx:if="{{detail.previous_post_id}}">
      <view class="d-d-m">
        <navigator url="../detail/detail?id={{detail.previous_post_id}}" open-type="redirect" hover-class="relatedNavigator">上一篇：
          <span class="d-n">{{detail.previous_post_title}}</span>
        </navigator>
      </view>
    </view>
    <view class="d-l2" wx:if="{{detail.next_post_id}}">
      <view class="d-d-m">
        <navigator url="../detail/detail?id={{detail.next_post_id}}" open-type="redirect" hover-class="relatedNavigator">下一篇：
          <span class="d-n">{{detail.next_post_title}}</span>
        </navigator>
      </view>
    </view>
  </view>

  <!-- 小程序广告 -->
  <view class="ad-box-video" wx:if="{{detail.videoAdId !='' && detail.detailAd=='1' && detailAdsuccess}}">
    <ad unit-id="{{detail.videoAdId}}" ad-intervals="30" ad-type="video" binderror="adbinderror"></ad>
  </view>

  <!-- 点赞 喜欢 海报等功能 -->
  <block style="display:{{displayLike}}">
    <view class="menu-box emoji-move-in ">
      <view class="iconList">
        <view class="iconLine">
          <view class="fr-liset" catchtap="clickLike" id="likebottom">
            <view>
              <image src="../../static/data/dianz.png" class="img-menu" ></image>
            </view>
            <view class="img-menu-t">
              <text>点赞</text>
            </view>
          </view>
          <view class="fr-liset" catchtap="onCreatePoster">
            <view>
              <image src="../../static/data/haib.png" class="img-menu" ></image>
            </view>
            <view class="img-menu-t">
              <text>海报</text>
            </view>
          </view>
          <view class="fr-liset">
            <view>
              <image src="../../static/data/zhuanfa.png" class="img-menu" ></image>
            </view>
            <view class="img-menu-t">
              <text>转发</text>
            </view>
            <button class="share-button touch-active" open-type="share"></button>
          </view>
          <view class="fr-liset" catchtap="gotowebpage">
            <view>
              <image src="../../static/data/yuawen.png" class="img-menu"></image>
            </view>
            <view class="img-menu-t">
              <text>阅读原文</text>
            </view>
          </view>
          <view class="fr-liset" catchtap="praise">
            <view>
              <image src="../../static/data/xihuan.png" class="img-menu" ></image>
            </view>
            <view class="img-menu-t">
              <text>{{detail.praiseWord}}</text>
            </view>
          </view>
        </view>
      </view>
    </view>
    <!-- 点赞头像 -->
    <view class="data-fx-user">
      <view class="data-user-i" wx:key="id" wx:for="{{likeList}}">
        <image src="{{item}}" class="fr-swiper-img"></image>
      </view>
    </view>
  </block>

  


  <!-- 评论列表 -->
  <view style="display:{{display}}">
    <!-- 标题 -->
    <view class="index-h ma-60 ma-b-40">
      <font>
        <span class="index-h-blue">评</span>论交流</font>
      <font class="index-h-all" id="relatedTitle">{{commentCount}}</font>
    </view>
    <view class="subTitle" id="relatedTitle">
			<view class="comment-num">{{commentCount}}</view>
		</view>
    <view class="subTitle_line subTitle_line_comment"></view>

    <!-- 列表 -->
    <block wx:key="id" wx:for="{{commentsList}}" style="margin: 0rpx 28rpx;">
      <view class="comment">
        <view class="comment-user">
          <image src="{{item.author_url}}" class="comment-gravatar"></image>
          <view class="comment-user-right">
            <view bindtap="replay" data-id="{{item.id}}" data-name="{{item.author_name}}" data-userid="{{item.userid}}" data-formId="{{item.formId}}" data-commentdate="{{item.date}}">{{item.author_name}}</view>
            <view class="time" bindtap="replay" data-id="{{item.id}}" data-name="{{item.author_name}}" data-userid="{{item.userid}}" data-formId="{{item.formId}}" data-commentdate="{{item.date}}">{{item.date}}</view>
          </view>
        </view>
        <view class="comment-summary" bindtap="replay" data-id="{{item.id}}" data-name="{{item.author_name}}" data-userid="{{item.userid}}" data-formId="{{item.formId}}" data-commentdate="{{item.date}}"> {{item.content}}</view>

        <!-- 一级回复-->
        <view wx:for="{{item.child}}" wx:key="itemid1" wx:for-index="idx" wx:for-item="item1">
          <view class="replay-user" bindtap="replay" data-id="{{item1.id}}" data-name="{{item1.author_name}}" data-userid="{{item1.userid}}" data-formId="{{item1.formId}}" data-commentdate="{{item1.date}}">
            <text class="comment-username">{{item1.author_name}} ：</text>
            <!-- <text style="margin: 0 6rpx; color: #959595;">回复</text> -->
            <!-- <text class="comment-username">{{item.author_name}}</text>-->
            <text class="replay-color">{{item1.content}}</text>
          </view>


          <!-- 二级回复-->
          <view wx:for="{{item1.child}}" wx:key="itemid2" wx:for-index="idx" wx:for-item="item2">
            <view class="replay-user" bindtap="replay" data-id="{{item2.id}}" data-name="{{item2.author_name}}" data-userid="{{item2.userid}}" data-formId="{{item2.formId}}" data-commentdate="{{item2.date}}">
              <text class="comment-username">{{item2.author_name}} ：</text>
              <!-- <text style="margin: 0 6rpx; color: #959595;">回复</text> -->
              <!-- <text class="comment-username">{{item1.author_name}}</text>-->
              <text class="replay-color">{{item2.content}}</text>
            </view>

            <!-- 三级回复-->
            <view wx:for="{{item2.child}}" wx:key="itemid3" wx:for-index="idx" wx:for-item="item3">
              <view class="replay-user" bindtap="replay" data-id="{{item3.id}}" data-name="{{item3.author_name}}" data-userid="{{item3.userid}}" data-formId="{{item3.formId}}" data-commentdate="{{item3.date}}">
                <text class="comment-username">{{item3.author_name}} ：</text>
                <!-- <text style="margin: 0 6rpx; color: #959595;">回复</text> -->
                <!-- <text class="comment-username">{{item2.author_name}}</text>-->
                <text class="replay-color">{{item3.content}}</text>
              </view>

              <!-- 四级回复-->
              <view wx:for="{{item3.child}}" wx:key="itemid4" wx:for-index="idx" wx:for-item="item4">
                <view class="replay-user">
                  <text class="comment-username">{{item4.author_name}} ：</text>
                  <!-- <text style="margin: 0 6rpx; color: #959595;">回复</text> -->
                  <!-- <text class="comment-username">{{item3.author_name}}</text>-->
                  <text class="replay-color">{{item4.content}}</text>
                </view>
              </view>
              <!-- 四级回复-->

            </view>
            <!-- 三级回复-->

          </view>
          <!-- 二级回复-->

        </view>
        <!-- 一级回复-->

      </view>
    </block>


    <view style="display:{{display}}">
      <view style='display:{{isLoading?"block":"none"}}'>
        <template is="tempLoading" />
      </view>
      <view style="display:{{isLastPage?'block':'none'}}">
        <view class="no-more">- 无更多评论 -</view>
      </view>
    </view>
    <modal title="{{dialog.title}}" hidden="{{dialog.hidden}}" no-cancel bindconfirm="confirm">{{dialog.content}}</modal>
  </view>
  <template is="modalView" data="{{...__modalView__}}" />

  <poster id="poster" hide-loading="{{false}}" preload="{{false}}" config="{{posterConfig}}" bind:success="onPosterSuccess" bind:fail="onPosterFail">
  </poster>

  <template is="login-popup" data="{{show: isLoginPopup, userInfo: userInfo}}"></template>

  <!--评论区-->
  <view style="display:{{enableComment?'block':'none'}}">
    <view class="menuBackground" catchtap="hiddenMenubox" style="display:{{menuBackgroup ? 'block' : 'none'}}"></view>
    <view style="display:{{display}}">

      <view class="comment-fixed">

        <form catchsubmit="formSubmit" report-submit="true">
          <view class="comment-respond">
            <input class="comment-input" maxlength="200" name="inputPostID" value="{{detail.id}}" style="display:none" />

            <view class="comment-box">

              <!-- 返回首页 -->
              <image src="../../images/entry-home.png" class="comment_icon_home" catchtap="goHome"></image>

              <!-- 评论输入框和发送按钮 -->
              <view class="comment_input_box">
                <input class="comment-input" type='text' confirm-type="send" cursor-spacing="10" maxlength="100" name="inputComment" value="{{content}}" placeholder="{{placeholder}}" focus="{{focus}}" bindblur="onReplyBlur" bindfocus="onRepleyFocus" />
                <button class="comment-button touch-active" formType="submit">发送</button>
              </view>
              <!-- 更多按钮 -->
              <!-- <image src="../../images/entry-more.png" class="comment_icon_more" catchtap="ShowHideMenu" mode=""></image> -->

            </view>



          </view>
        </form>
      </view>

    </view>
  </view>

  <!-- 无法访问网络时 -->
  <view class="showerror" style="display:{{showerror}}">
    <image src="../../images/cry80.png" style="height:100rpx;width:100rpx"></image>
    <view class="errortext">{{errMessage}}</view>
  </view>
</view>
<!-- 星尘 -->