index.wxml 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <view class="flex b tb ac" wx:if="{{calendar}}">
  2. <view class="calendar b tb">
  3. <!-- 头部操作栏 -->
  4. <view
  5. wx:if="{{!config.hideHeader}}"
  6. class="handle {{config.theme}}_handle-color fs28 b lr ac pc">
  7. <view class="prev fs36" wx:if="{{!config.weekMode}}">
  8. <text class="prev-handle iconfont icon-doubleleft" bindtap="changeDate" data-type="prev_year"></text>
  9. <text class="prev-handle iconfont icon-left" bindtap="changeDate" data-type="prev_month"></text>
  10. </view>
  11. <view class="flex date-in-handle b lr cc" bindtap="doubleClickJumpToToday">{{calendar.curYear || "--"}} 年 {{calendar.curMonth || "--"}} 月</view>
  12. <view class="next fs36" wx:if="{{!config.weekMode}}">
  13. <text class="next-handle iconfont icon-right" bindtap="changeDate" data-type="next_month"></text>
  14. <text class="next-handle iconfont icon-doubleright" bindtap="changeDate" data-type="next_year"></text>
  15. </view>
  16. </view>
  17. <!-- 星期栏 -->
  18. <view class="weeks b lr ac {{config.theme}}_week-color">
  19. <view class="week fs28" wx:for="{{calendar.weeksCh}}" wx:key="index" data-idx="{{index}}">{{item}}</view>
  20. </view>
  21. <!-- 日历面板主体 -->
  22. <view class="b lr wrap" bindtouchstart="calendarTouchstart" catchtouchmove="calendarTouchmove" catchtouchend="calendarTouchend">
  23. <!-- 上月日期格子 -->
  24. <view class="grid b ac pc {{config.theme}}_prev-month-date" wx:for="{{calendar.prevMonthGrids}}" wx:key="index" data-idx="{{index}}">
  25. <view class="date-wrap b cc">
  26. <view class="date">
  27. {{item.date}}
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 本月日期格子 -->
  32. <view wx:for="{{calendar.dates}}" wx:key="index" data-idx="{{index}}" data-info="{{item}}" bindtap="tapDate" class="grid {{item.class ? item.class : ''}} {{config.theme}}_normal-date b ac pc">
  33. <view class="date-wrap b cc {{config.emphasisWeek && (item.week === 0 || item.week === 6) ? config.theme + '_weekend-color' : ''}}">
  34. <view class="date b ac pc {{item.class ? item.class : ''}} {{item.isToday && config.highlightToday ? config.theme + '_today' : ''}} {{item.choosed ? config.theme + '_choosed' : ''}} {{item.disable ? config.theme + '_date-disable' : ''}} {{config.chooseAreaMode ? 'date-area-mode' : ''}} {{calendar.todoLabelCircle && item.showTodoLabel && !item.choosed ? config.theme + '_todo-circle todo-circle' : '' }}">
  35. {{config.markToday && item.isToday ? config.markToday : item.date}}
  36. <view
  37. wx:if="{{(config.showLunar && item.lunar && !item.showTodoLabel) || (item.showTodoLabel && calendar.todoLabelPos !== 'bottom') || config.showHolidays}}"
  38. class="date-desc {{config.theme}}_date-desc date-desc-bottom {{(item.choosed || item.isToday) ? 'date-desc-bottom-always' : ''}} {{item.disable ? config.theme + '_date-desc-disable' : ''}}">
  39. <text class="{{config.showHolidays && !item.showTodoLabel && item.label && !item.choosed ? config.theme + '_date-desc-lunar' : ''}} {{item.type === 'festival' ? config.theme + '_festival' : ''}}">{{item.label || item.lunar.Term || item.lunar.IDayCn}}</text>
  40. </view>
  41. <view
  42. wx:if="{{item.showTodoLabel && !calendar.todoLabelCircle}}"
  43. class="{{item.todoText ? 'date-desc' : config.theme + '_todo-dot todo-dot'}} {{config.showLunar ? config.theme + '_date-desc-lunar' : ''}} {{calendar.todoLabelPos === 'bottom' ? 'date-desc-bottom todo-dot-bottom' : 'date-desc-top todo-dot-top'}} {{calendar.showLabelAlways && item.choosed && calendar.todoLabelPos === 'bottom' ? 'date-desc-bottom-always todo-dot-bottom-always' : ''}} {{calendar.showLabelAlways && item.choosed && calendar.todoLabelPos === 'top' ? 'date-desc-top-always todo-dot-top-always' : ''}}"
  44. style="background-color: {{item.todoText ? '' : item.color || calendar.todoLabelColor}}; color: {{item.color}}">
  45. {{item.todoText}}
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- 下月日期格子 -->
  51. <view class="grid b ac pc {{config.theme}}_next-month-date" wx:for="{{calendar.nextMonthGrids}}" wx:key="index" data-idx="{{index}}">
  52. <view class="date-wrap b cc">
  53. <view class="date">
  54. {{item.date}}
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>