index.wxml 3.51 KB
<!--template/operate_btn/index.wxml-->
<!-- 通用的操作按钮 -->
<template name="operate_btn">
  <view style='position:fixed;bottom: 0rpx;height:140rpx;background-color:white;'>
    <view class='kg-separater' style='height:4rpx;'></view>
    <view class='kg-operate-btn-bg'>
      <button class='kg-operate-btn kg-btn-no-border' bindtap='operateTap'>{{title}}</button>
    </view>
  </view>
</template>

<!--通用的分区标题-->
<template name='section_header'>
  <view class='kg-section-header'>
    <view class='kg-flex-row'>
      <view style='width:10rpx; height:33rpx;background-color:#f9aa76; margin-left:20rpx'></view>
      <view class='kg-text-normal-gray' style='margin-left:16rpx'>{{title}}</view>
    </view>
    <view style='margin-right:20rpx;font-size:30rpx;color:#1e9bfa;' bindtap='headerBtnTap'>{{rightTitle}}</view>
  </view>
</template>

<!-- 添加记录的cell -->
<template name='quantity_cell'>
  <view class='kg-flex-row '>
    <view class='kg-text-normal-dark'>{{title}}</view>
    <view wx:if="{{type == 'input'}}">
      <!-- 输入型cell -->
      <view class='kg-flex-row'>
        <input class='kg-border' style='width:140rpx;margin-right:10rpx;' bindinput="bindKeyInput" data-cellIndex='{{cellIndex}}' value="{{inputValue}}" type='number'></input>
        <view class='kg-text-normal-gray'>{{unit}}</view>
      </view>
    </view>

    <view wx:if="{{type == 'select'}}">
      <!-- 选择型cell -->
      <view class='kg-flex-row'>
        <view wx:for="{{options}}" wx:for-index="optionIndex" wx:key="{{item}}">
          <view class="eat_category_btn {{selectOptionIndex == optionIndex ? 'selected' : ''}}" bindtap='quantityCellTap' data-optionIndex='{{optionIndex}}' data-cellIndex='{{cellIndex}}' style='width: 120rpx;margin-right: 0rpx;margin-bottom: 0rpx;margin-left:20rpx;'>{{item}}</view>
        </view>
      </view>
    </view>

    <view wx:if="{{type == 'check'}}">
      <!-- 选择型cell -->
      <image src="{{checked == true ? '/src/img/btn_selected.png' : '/src/img/btn_unselected.jpg'}}" style="height:20px; width:20px;margin-right:4px;" bindtap='tapBox' data-cellIndex="{{cellIndex}}" data-check='{{checked}}'></image>
    </view>

  </view>
</template>

<!-- 
用户信息
输入参数:
userImg:用户图片
sex:性别 f/m (女性/男性)
title:标题
subTitle:副标题

-->
<template name='userInfo'>
  <view class='kg-flex-row'>
    <image class='kg-user-icon' src='{{userImg}}' bindtap='tapUserInfoImg'></image>
    <view class='kg-flex-column' style='margin-left: 16rpx;height: 120rpx;'>
      <view class='kg-flex-row' style='justify-content:flex-start;'>
        <view class='kg-text-title'>{{title}}</view>
        <template is="sex" data="{{sex:sex}}"></template>
      </view>
      <view class='kg-text-normal-gray'>{{subTitle}}</view>
    </view>
  </view>
</template>

<!-- 
性别
sex:性别 f/m (女性/男性)
 -->
<template name='sex'>
  <view class='kg-flex-row'>
    <view wx:if="{{sex == 'female'}}">
      <image class='kg-sex-icon' src='/src/img/female.png' mode='aspectFit'></image>
    </view>
    <view wx:elif="{{sex == 'male'}}">
      <image class='kg-sex-icon' src='/src/img/male.png' mode='aspectFit'></image>
    </view>
  </view>
</template>

<!-- 图片+文字 -->
<template name='imgTextView'>
  <view class='kg-flex-row' style='justify-content: flex-start;height:80rpx;'>
    <image src='/src/img/{{img}}.png' style='width: 44rpx;height: 44rpx;'></image>
    <text class='kg-text-normal-dark' style='margin-left:16rpx;font-weight:bold;'>{{text != null ? text : ""}}</text>
  </view>
</template>