<!--subpages/textStep/textStep.wxml-->


<view>
  <van-nav-bar title="" left-text="" leftArrow custom-class="nav-bar" bind:click-left="leftBack"></van-nav-bar>
  <text class="page-title">{{testTitle}}</text>

  <view class="progressBar-box">
    <view class="progressBar-bg">
      <view class="progressBar-progress" style="{{'width:calc(100% / '+stepTotal+' * '+step+');'}}"></view>
    </view>
    <text class="progressBar-progressText">{{step}}</text>
    <text class="progressBar-progressTotal">/{{stepTotal}}</text>
  </view>
  <!-- 报告第一步 确认基本信息 -->
  <view wx:if="{{step == 1}}" class="w-card">
    <view class="base-title-view">
      <view class="base-title-line" />
      <text class="base-title">您的性别</text>
    </view>
    <view class="v1">
      <view data-id="1" bindtap="checkGender">
        <image wx:if="{{gender == 1}}" src="/subpages/images//testRes/ic_test_man_check.png"></image>
        <image wx:else src="/subpages/images//testRes/ic_test_man.png"></image>
      </view>
      <view data-id="2" bindtap="checkGender">
        <image wx:if="{{gender == 2}}" src="/subpages/images//testRes/ic_test_women_check.png"></image>
        <image wx:else src="/subpages/images//testRes/ic_test_women.png"></image>
      </view>
    </view>
    <view class="v2">
      <view class="v3">
        <text class="t1">您的年龄</text>
        <view class="v4">
          <van-field model:value="{{ age }}" placeholder="" inputAlign="center" type="number" maxlength="4"
            custom-style="border-bottom:2rpx solid #EEEEEE;font-size:40rpx;font-weight:600;" />
          <text class="t2">岁</text>
        </view>
      </view>
      <view class="v3">
        <text class="t1">您的身高</text>
        <view class="v4">
          <van-field model:value="{{ height }}" placeholder="" inputAlign="center" type="number" maxlength="4"
            custom-style="border-bottom:2rpx solid #EEEEEE;font-size:40rpx;font-weight:600;" />
          <text class="t2">厘米</text>
        </view>
      </view>
      <view class="v3" style="margin-bottom: 20rpx;">
        <text class="t1">您的体重</text>
        <view class="v4">
          <van-field model:value="{{ weight }}" placeholder="" inputAlign="center" type="number" maxlength="4"
            custom-style="border-bottom:2rpx solid #EEEEEE;font-size:40rpx;font-weight:600;" />
          <text class="t2">公斤</text>
        </view>
      </view>
      <view class="v3">
      </view>
    </view>
  </view>
  <!-- 报告其他步骤 -->
  <view wx:else>
    <wxs module="jstools" src="/subpages/wxs/includes.wxs"></wxs>
    <view class="w-card" wx:for="{{type == 'sleep' ? sleepData : physiqueData}}" wx:key="index"
      wx:if="{{index == step - 2}}">
      <view class="base-title-view">
        <view class="base-title-line" />
        <text class="base-title">{{item.title}}</text>
      </view>
      <scroll-view type="list" scroll-y style="max-height: calc(100vh - 670rpx)">
        <view>
          <view wx:if="{{item.type == 'checkbox'}}" class="options">
            <text wx:for="{{item.options}}" wx:for-item="subItem" wx:for-index="subIndex" wx:key="subIndex"
              class="{{jstools.includes(item.value,subItem.value) ?   'option option.active' :'option' }}"
              data-index="{{index}}" data-subindex="{{subIndex}}" bindtap="handleCheckBox">{{subItem.label}}</text>
          </view>
          <view wx:elif="{{item.type == 'date'}}" class="options-date">
            <view wx:for="{{item.options}}" wx:for-item="subItem" wx:for-index="subIndex" wx:key="subIndex"
              class="{{item.value.length ?   'option option-date option.active' :'option option-date' }}"
              data-index="{{index}}" data-subindex="{{subIndex}}" data-item="{{item}}" bindtap="handleSelectDate">
              <text style="flex: 1;">{{subItem.label}}</text>
              <text>{{item.value}}</text>
              <van-icon name="arrow" />
            </view>
          </view>
          <view wx:if="{{item.type == 'radio'}}" class="options">
            <view wx:if="{{item.subTitle}}"
              style="display: flex;flex-direction: row;margin-left: 40rpx;margin-top: 10rpx;margin-bottom: 10rpx;">
              <text class="t1">{{item.subTitle}}</text>
            </view>
            <text wx:for="{{item.options}}" wx:for-item="subItem" wx:for-index="subIndex" wx:key="subIndex"
              class="{{item.value == subItem.value ?   'option option.active' :'option' }}" data-index="{{index}}"
              data-subindex="{{subIndex}}" bindtap="handleRadioBox">{{subItem.label}}</text>
          </view>
          <view wx:if="{{item.type == 'radio&input'}}" class="options">
            <text wx:for="{{item.options}}" wx:for-item="subItem" wx:for-index="subIndex" wx:key="subIndex"
              class="{{item.value == subItem.value ?   'option option.active' :'option' }}" data-index="{{index}}"
              data-subindex="{{subIndex}}" bindtap="handleRadioBox">{{subItem.label}}</text>
            <view wx:if="{{item.subTitle}}"
              style="display: flex;flex-direction: row;margin-left: 40rpx;margin-top: 20rpx;margin-bottom: 10rpx;align-items: center;">
              <text class="t1">{{item.subTitle}}</text>
              <van-field model:value="{{ inputValue }}" placeholder="请输入" inputAlign="left"
                custom-style="border-bottom:2rpx solid #EEEEEE;font-size:28rpx;margin-left: 30rpx;" />
            </view>
          </view>
        </view>
      </scroll-view>
    </view>
  </view>
  <view class="bottom-btn-view">
    <text class="view-res-btn" bindtap="toNext">{{step == stepTotal ? '提交' : '下一步'}}</text>
  </view>
  <van-popup wx:if="{{currentDateItem}}" show="{{ showDateDialog }}" close-on-click-overlay z-index="10086" overlay
    position="bottom" bind:close="onCloseDateDialog" custom-class="custom-date-class"
    bind:click-overlay="onCloseDateDialog">
    <van-datetime-picker type="time" formatter="{{ formatter }}" title="{{currentDateItem.label}}"
      value="{{ currentDate }}" min-hour="0" max-hour="23" bind:confirm="onDateInput" bind:cancel="onCloseDateDialog"
      toolbar-class="toolbar-class" />
  </van-popup>
</view>