<!--nova-werun/pages/home/sport/sport-start/index.wxml-->
<!-- <view class="navbox" style="height: {{navheight}}px;">
  <view class="nav">
    <view class="nav-title">运动开始</view>
    <view class="nav-addbox" bindtap="goback">
      <van-icon name="arrow-left" size='44rpx' color='white' />
    </view>
  </view>
</view> -->
<nav type="back" title="运动开始" background-color="{{'#4F9AF7'}}" front-color="{{'#333333'}}"></nav>

<view class="all">
  <view class="map">
    <map style="width: 100% ;height: 100%;" enable-zoom="ture" enable-scroll="ture" id="map" longitude="{{longitude}}" latitude="{{latitude}}" scale="15" markers="{{markers}}"></map>
  </view>
  <view class="numberbox" style="height:calc( 40vh - {{navheight+'px'}} - 10px );">
    <view class="distance">
      <!-- <view class="dis-num">{{distance}}</view>
      <view class="dis-text">公里</view> -->
      <view class="dis-text">{{type=='run'?'跑步':'步行'}}：</view>
      <view class="dis-num">{{journey||0}}</view>
      <view class="dis-text">米</view>
      <view class="dis-num">{{step}}</view>
      <view class="dis-text">步</view>
    </view>
    <view class="number">
      <view class="num">
        <view class="num-num">{{pace}}</view>
        <view class="num-text">配速（min/km）</view>
      </view>
      <view class="num">
        <view class="num-num">{{formattedTime}}</view>
        <view class="num-text">时间</view>
      </view>
      <view class="num">
        <view class="num-num">{{calorie}}</view>
        <view class="num-text">千卡</view>
      </view>
    </view>



    <view class="btnBox">
      <!-- 未开始 -->
      <block wx:if="{{status=='noStart'}}">
        <view class="btn">
          <image class="pause" src="https://file-cloud.fmode.cn/qpFbRRSZrO/20250103/gu1592024214365.png?imageView2/1/w/200/h/200" bindtap="startInterval"></image>
          <view class="btn-text">开始</view>
        </view>
      </block>
      <!-- 运动中 -->
      <block wx:if="{{status=='inSports'}}">
        <view class="btn">
          <image class="pause" src="https://file-cloud.fmode.cn/qpFbRRSZrO/20250103/ot1nko024129224.png?imageView2/1/w/200/h/200" bindtap="pausedInterval"></image>
          <view class="btn-text">暂停</view>
        </view>
      </block>
      <!-- 暂停中 -->
      <block wx:if="{{status=='paused'}}">
        <view class="btn">
          <image class="pause" src="https://file-cloud.fmode.cn/qpFbRRSZrO/20250103/gu1592024214365.png?imageView2/1/w/200/h/200" bindtap="goOn"></image>
          <view class="btn-text">继续</view>
        </view>
        <view class="btn">
          <view class="btn-stop" style="background:{{percentage}}" bindtouchstart="onStart" bindtouchend="onEnd">
            <view class="btn-stop1">
              <view class="btn-stop2"></view>
            </view>
          </view>
          <view class="btn-text">长按结束</view>
        </view>
      </block>
    </view>
  </view>
</view>


<van-popup round show="{{ showPermissions }}">
  <view class="permissions">
    为正常记录运动状态，请授予本小程序位置、后台运行权限。 设置 -> 位置消息 -> 使用小程序期间和离开小程序后。
    <button bind:tap="openWxSetting">前往设置</button>
  </view>
</van-popup>

<van-popup round show="{{ isShowActDataList }}">
  <view class="actData">
    <view class="title">
      <text>未结束运动</text>
      <van-icon bind:tap="closeActDataList" name="cross" />
    </view>
    <!-- <view class="subtit">显示前20条未结束运动</view> -->
    <view class="listBox">
      <block wx:for="{{actDataList}}" wx:key="index">
        <view class="actDataItem" data-index="{{index}}" bind:tap="checkActEndDate">
          <view class="title2">
            <view class="text">
              {{item.title||'日常运动'}}
              <van-icon wx:if="{{item.title}}" color="#4F9AF7" name="medal-o" />
              <text class="startDate" style="color: gray;">{{item.sport_startDate}}</text>
            </view>
            <block wx:if="{{item.isAttend||!item.title}}">
              <view class="tag" style="background:#4F9AF7;color: white;">暂停中</view>
            </block>
            <block wx:else>
              <view class="tag" style="background:rgb(201, 200, 200);color: white;">已结束</view>
            </block>
          </view>
          <block wx:if="{{item.title}}">
            <view class="startDate">到期时间：{{item.booking.toDate}}</view>
          </block>

        </view>

      </block>
    </view>

    <button>全部结束</button>
  </view>
</van-popup>