index.wxml 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 fsnd b lr ac pc fsnd">
  7. <view class="prev fsnd" wx:if="{{!config.weekMode}}">
  8. <text class="prev-handle iconfont icon-doubleleft fsnd" 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 fsnd" bindtap="doubleClickJumpToToday">
  12. {{calendar.curYear || "--"}} 年 {{calendar.curMonth || "--"}} 月
  13. </view>
  14. <view class="next fsnd" wx:if="{{!config.weekMode}}">
  15. <text class="next-handle iconfont icon-right" bindtap="changeDate" data-type="next_month"></text>
  16. <text class="next-handle iconfont icon-doubleright" bindtap="changeDate" data-type="next_year"></text>
  17. </view>
  18. </view>
  19. <!-- 星期栏 -->
  20. <view class="weeks b lr ac {{config.theme}}_week-color mt10">
  21. <view class="week fsnd" wx:for="{{calendar.weeksCh}}" wx:key="index" data-idx="{{index}}">{{item}}</view>
  22. </view>
  23. <!-- 日历面板主体 -->
  24. <view class="b lr wrap" bindtouchstart="calendarTouchstart" catchtouchmove="calendarTouchmove" catchtouchend="calendarTouchend">
  25. <!-- 上月日期格子 -->
  26. <view class="grid b ac pc {{config.theme}}_prev-month-date" wx:for="{{calendar.prevMonthGrids}}" wx:key="index" data-idx="{{index}}">
  27. <view class="date-wrap b cc">
  28. <view class="date">
  29. {{item.date}}
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 本月日期格子 -->
  34. <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">
  35. <view class="date-wrap b cc {{config.emphasisWeek && (item.week === 0 || item.week === 6) ? config.theme + '_weekend-color' : ''}}">
  36. <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' : '' }}">
  37. {{config.markToday && item.isToday ? config.markToday : item.date}}
  38. <view
  39. wx:if="{{(config.showLunar && item.lunar && !item.showTodoLabel) || (item.showTodoLabel && calendar.todoLabelPos !== 'bottom') || config.showHolidays}}"
  40. 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' : ''}}">
  41. <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>
  42. </view>
  43. <view
  44. wx:if="{{item.showTodoLabel && !calendar.todoLabelCircle}}"
  45. 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' : ''}}"
  46. style="background-color: {{item.todoText ? '' : item.color || calendar.todoLabelColor}}; color: {{item.color}}">
  47. {{item.todoText}}
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <!-- 下月日期格子 -->
  53. <view class="grid b ac pc {{config.theme}}_next-month-date" wx:for="{{calendar.nextMonthGrids}}" wx:key="index" data-idx="{{index}}">
  54. <view class="date-wrap b cc">
  55. <view class="date">
  56. {{item.date}}
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>