index.wxml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <wxs module="calendar_wxs" src="./index.wxs"></wxs>
  2. <view class="wd-calendar-container {{ darkmode ? 'darkmode' : '' }} {{ checkedShow ? '' : 'sel-hidden' }}" style="{{ style }}">
  3. <view
  4. id="calendar"
  5. class="wd-calendar {{ !loading ? 'load' : '' }}"
  6. style="height: {{ view == 'week' ? minHeight : calendarHeight }}px;"
  7. catchtransitionend="handleCalendarTransEnd"
  8. mark:panel="{{ panelHeight }}"
  9. mark:calendar="{{ calendarHeight }}"
  10. mark:max="{{ maxHeight }}"
  11. mark:min="{{ minHeight }}"
  12. mark:view="{{ currView }}"
  13. data-panel="{{ panelHeight }}"
  14. data-calendar="{{ calendarHeight }}"
  15. data-min="{{ minHeight }}">
  16. <view class="wd-calendar-bar">
  17. <view class="wd-calendar-title" data-info="{{ titleInfo }}" bindtap="{{ calendar_wxs.handleYearPanelShow }}">
  18. <text >{{ months[currTab].year }}</text><text class="wd-calendar-title-cn">{{language['年']?',':'年'}}</text>
  19. <text >{{ months[currTab].month }}</text>
  20. <text class="wd-calendar-title-cn">{{language['月']?'':'月'}}</text>
  21. </view>
  22. <view class="wd-calendar-options">
  23. <view class="wd-calendar-option">
  24. <view class="wd-calendar-option-it ">
  25. <view class="wd-calendar-option-views today {{ tdOpShow ? 'show' : '' }}" catchtap="toToday">
  26. <view class="wd-calendar-option-view">{{language['现在']||'今'}}</view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="wd-calendar-option">
  31. <view class="wd-calendar-option-it">
  32. <view class="wd-calendar-option-views" catchtap="{{ calendar_wxs.toggleView }}">
  33. <view catchtransitionend="handleOpBarTransEnd" class="wd-calendar-option-view {{ (currView == 1 || currView == 3)? 'curr' : '' }}">{{language['月']||'月'}}</view>
  34. <view catchtransitionend="handleOpBarTransEnd" class="wd-calendar-option-view {{ currView == 2 ? 'curr' : '' }}">{{language['周']||'周'}}</view>
  35. <view class="wd-calendar-option-view-bar" style="transform: translateX({{ currView == 2 ? '70rpx' : 0 }}) translateZ(0px);"></view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="wd-calendar-week-bar">
  42. <view class="wd-calendar-week-item" wx:for="{{ Weeks }}">{{language['周' + item] || item}}</view>
  43. </view>
  44. <view
  45. class="wd-calendar-month-body {{ solidDay ? '' : 'solid' }}"
  46. change:weektabchange="{{ calendar_wxs.handleWeekSwiperChange }}" weektabchange="{{ weektabchange }}"
  47. change:monthchange="{{ calendar_wxs.handleMonthChange }}" monthchange="{{ monthchange }}"
  48. change:needInitTrans="{{ calendar_wxs.handleInitTrans }}" needInitTrans="{{ needInitTrans }}"
  49. change:viewchange="{{ calendar_wxs.handleViewChange }}" viewchange="{{ viewchange }}"
  50. bindtouchstart="{{ calendar_wxs.touchStart }}"
  51. catchtouchmove="{{ calendar_wxs.touchMove }}"
  52. catchtouchend="{{ calendar_wxs.touchEnd }}">
  53. <swiper circular duration="{{ 300 }}" current="{{ currTab }}" class="wd-calendar-swiper" bindanimationfinish="handleSwiperAniEnd">
  54. <swiper-item
  55. wx:for="{{ months }}"
  56. wx:for-item="month"
  57. wx:for-index="mdx"
  58. skip-hidden-item-layout
  59. class="wd-calendar-swiper-item" >
  60. <view
  61. class="wd-calendar-month-panel {{ currTab === mdx ? 'curr' : 'other' }}"
  62. style="height: {{ panelHeight }}px;min-height: {{ panelHeight }}px;"
  63. data-trans="{{ month.trans }}">
  64. <view
  65. wx:if="{{ month.bar.s && currTab === mdx && checkedShow }}"
  66. class="wd-calendar-day-sel {{ barAni ? '' : 'no-ani' }} {{ month.bar.t ? 'today' : '' }} "
  67. style="top: {{ month.bar.y }};left: {{ month.bar.x }}px;" >
  68. <view class="wd-calendar-day-sel-bar {{ month.bar.a ? 'animation' : '' }}" bindanimationend="handleSelBarAniEnd"></view>
  69. </view>
  70. <view
  71. class="wd-calendar-week-row l-{{ month.days.length }}"
  72. wx:for="{{ month.days }}"
  73. wx:for-item="w"
  74. wx:for-index="wdx" >
  75. <view
  76. wx:for="{{ w.days }}"
  77. wx:for-item="d"
  78. wx:for-index="ddx"
  79. class="wd-calendar-day {{ d.type }} {{ d.isToday ? 'today' : '' }} {{ ((wdx * 7 + ddx) == month.bar.i && currTab === mdx) ? 'curr' : '' }}"
  80. catchtap="selDate"
  81. data-wdx="{{ wdx }}"
  82. data-ddx="{{ ddx }}">
  83. <view class="wd-calendar-gregorian {{ (currView != 3 && d.marker && d.marker.schedule.length > 0) ? 'dot' : '' }}">
  84. <text>{{ d.day }}</text>
  85. <view
  86. class="wd-calendar-gregorian-corner"
  87. wx:if="{{ d.marker && d.marker.corner.length > 0 }}"
  88. style="{{ d.marker.corner[0].color ? 'color:' + d.marker.corner[0].color + ';' : '' }}"
  89. >{{ d.marker.corner[0].mark }}</view>
  90. </view>
  91. <view class="wd-calendar-solar {{ d.lunar_type }}">
  92. <text
  93. wx:if="{{ d.marker && d.marker.holiday.length > 0 }}"
  94. style="color: {{ d.marker.corner[0].color ? d.marker.corner[0].color : '#2a97ff' }};">{{ d.marker.holiday[0].mark }}</text>
  95. <text wx:elif="{{languagecode == 'ZH'}}">{{d.lunar_day}}</text>
  96. <view class="wd-calendar-schedules" wx:if="{{ d.marker && d.marker.schedule.length > 0 }}">
  97. <view
  98. class="wd-calendar-schedule"
  99. style="{{ d.marker.schedule[0].color ? 'color:' + d.marker.schedule[0].color + ';' : '' }}{{ d.marker.schedule[0].bgColor ? 'background-color:' + d.marker.schedule[0].bgColor + ';' : '' }}">{{ d.marker.schedule[0].mark }}</view>
  100. <view class="wd-calendar-schedule-more" wx:if="{{ d.marker.schedule.length - 1 > 0 }}">+{{ d.marker.schedule.length - 1 }}</view>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. </swiper-item>
  107. </swiper>
  108. </view>
  109. <view
  110. class="wd-calendar-bt-bar"
  111. bindtouchstart="{{ calendar_wxs.touchStart }}"
  112. catchtouchmove="{{ calendar_wxs.touchMove }}"
  113. catchtouchend="{{ calendar_wxs.touchEnd }}">
  114. <view class="wd-calendar-bt-control">
  115. <view class="wd-calendar-bt-control-item" >
  116. <view class="wd-calendar-bt-control-bar" id="control_1"></view>
  117. </view>
  118. <view class="wd-calendar-bt-control-item" >
  119. <view class="wd-calendar-bt-control-bar" id="control_2"></view>
  120. </view>
  121. </view>
  122. </view>
  123. <view class="wd-calendar-years-panel {{ yearPanelShow ? 'show' : '' }}">
  124. <view class="wd-calendar-bar">
  125. <view class="wd-calendar-title show ym" data-info="{{languagecode=='ZH' ? yearMs[currYmTab].lunar_year : '' }}">
  126. <text >{{ yearMs[currYmTab].year }}</text><text wx:if="{{languagecode=='ZH'}}" class="wd-calendar-title-cn margin-left">年</text>
  127. </view>
  128. </view>
  129. <view class="wd-calendar-years-panel-body">
  130. <swiper
  131. circular
  132. duration="{{ 300 }}"
  133. current="{{ currYmTab }}"
  134. class="wd-calendar-ym-swiper"
  135. bindanimationfinish="handleYmSwiperAniEnd">
  136. <swiper-item
  137. wx:for="{{ yearMs }}"
  138. wx:for-item="year"
  139. wx:for-index="ydx"
  140. skip-hidden-item-layout
  141. class="wd-calendar-ym-swiper-item" >
  142. <view class="wd-calendar-ym-months">
  143. <view class="wd-calendar-ym-row" wx:for="{{ 3 }}" wx:for-item="mr" wx:for-index="mrdx" >
  144. <view
  145. wx:for="{{ 4 }}"
  146. wx:for-item="m"
  147. wx:for-index="mdx"
  148. class="wd-calendar-ym-month {{ year.months[mrdx * 4 + mdx].curr ? 'curr' : '' }}"
  149. bindtap="handleYearPanelDayClick"
  150. data-year="{{ year.year }}"
  151. data-month="{{ year.months[mrdx * 4 + mdx].month }}">
  152. <view class="wd-calendar-ym-month-contaner">
  153. <view class="wd-calendar-ym-m-r">
  154. <view class="wd-calendar-ym-m {{languagecode=='ZH'?'':'wd-calendar-ym-m-EN'}}">{{ year.months[mrdx * 4 + mdx].month }}</view>
  155. </view>
  156. <view wx:for="{{ year.months[mrdx * 4 + mdx].lunar }}" wx:for-item="l" wx:for-index="idx" class="wd-calendar-ym-l" >
  157. <view class="wd-calendar-ym-l-i"><text data-order="{{ l.order }}">{{ l.day }}</text></view>
  158. <view class="wd-calendar-ym-l-i"><text >{{ l.lunar }}</text></view>
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. </view>
  164. </swiper-item>
  165. </swiper>
  166. </view>
  167. </view>
  168. </view>
  169. <view class="wd-calendar-content">
  170. <slot></slot>
  171. </view>
  172. </view>