Commit 2812ffcc06d4171a2ad3d763437a3837f0fb0391

Authored by wangfan
1 parent 298cb520

日历插件

@@ -64,6 +64,10 @@ @@ -64,6 +64,10 @@
64 "calendar": { 64 "calendar": {
65 "version": "1.1.3", 65 "version": "1.1.3",
66 "provider": "wx92c68dae5a8bb046" 66 "provider": "wx92c68dae5a8bb046"
  67 + },
  68 + "bmCalendar": {
  69 + "version": "1.2.0",
  70 + "provider": "wx23a9cef3522e4f7c"
67 } 71 }
68 }, 72 },
69 "debug": true 73 "debug": true
@@ -59,6 +59,14 @@ Page({ @@ -59,6 +59,14 @@ Page({
59 timePickerMask:false, 59 timePickerMask:false,
60 pnumInputFocus:false, 60 pnumInputFocus:false,
61 pageMarginBottom:0, 61 pageMarginBottom:0,
  62 + speciallist:[
  63 + { date: '2018-11-21', background: '', text:'今 天' },
  64 + { date: '2018-11-22', background: '', text: '明 天' },
  65 + { date: '2018-11-23', background: '', text: '后 天' },
  66 + ],
  67 + calendar:{
  68 + nextNum:0,
  69 + },
62 }, 70 },
63 /** 71 /**
64 * 生命周期函数--监听页面加载 72 * 生命周期函数--监听页面加载
@@ -390,13 +398,14 @@ Page({ @@ -390,13 +398,14 @@ Page({
390 }, 398 },
391 dateChange(event){ 399 dateChange(event){
392 console.log(event); 400 console.log(event);
393 - let cktime=util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day) 401 + //let cktime=util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day)
  402 + let cktime=util.timetouUnix(event.detail.date)
394 let day0=parseInt(new Date(new Date().setHours(0, 0, 0, 0)) / 1000); 403 let day0=parseInt(new Date(new Date().setHours(0, 0, 0, 0)) / 1000);
395 if(cktime<day0){ 404 if(cktime<day0){
396 util.toast('请选择有效日期','none'); 405 util.toast('请选择有效日期','none');
397 return; 406 return;
398 } 407 }
399 - let clickDay = event.detail.day; 408 + let clickDay = event.detail.date.substr(8,2);
400 let changeDay = `dayStyle[1].day`; 409 let changeDay = `dayStyle[1].day`;
401 let changeBg = `dayStyle[1].background`; 410 let changeBg = `dayStyle[1].background`;
402 this.setData({ 411 this.setData({
@@ -542,5 +551,20 @@ Page({ @@ -542,5 +551,20 @@ Page({
542 scrollTop: rect.bottom 551 scrollTop: rect.bottom
543 }) 552 })
544 }).exec() 553 }).exec()
545 - } 554 + },
  555 + gotoday(e){
  556 + this.setData({
  557 + [`calendar.nextNum`]:0
  558 + })
  559 + },
  560 + nextMonth(e){
  561 + this.setData({
  562 + [`calendar.nextNum`]:this.data.calendar.nextNum+1
  563 + })
  564 + },
  565 + prevMonth(e){
  566 + this.setData({
  567 + [`calendar.nextNum`]:this.data.calendar.nextNum-1
  568 + })
  569 + },
546 }) 570 })
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 "nav":"/components/nav/nav", 8 "nav":"/components/nav/nav",
9 "tabBar":"/components/book/tabBar/tabBar", 9 "tabBar":"/components/book/tabBar/tabBar",
10 "searchList":"/components/searchlist/searchlist", 10 "searchList":"/components/searchlist/searchlist",
11 - "calendar": "plugin://calendar/calendar", 11 + "calendar": "plugin://bmCalendar/calendar",
12 "board":"/components/book/board/board", 12 "board":"/components/book/board/board",
13 "formids":"/components/formids/formids" 13 "formids":"/components/formids/formids"
14 } 14 }
@@ -203,14 +203,30 @@ @@ -203,14 +203,30 @@
203 <view class="calendar-mask" bindtap="calendarClose" 203 <view class="calendar-mask" bindtap="calendarClose"
204 style="height:{{calendarMask?'100%':0}};" wx:if="{{calendarMaskLoad}}"> 204 style="height:{{calendarMask?'100%':0}};" wx:if="{{calendarMaskLoad}}">
205 <view style="width: 100%; height:{{calendarMask?'100%':0}};overflow: hidden;position: relative;"> 205 <view style="width: 100%; height:{{calendarMask?'100%':0}};overflow: hidden;position: relative;">
206 - <calendar weeks-type="cn" catchtap="catchtap"  
207 - start-date="2018-09"  
208 - days-color="{{dayStyle}}"  
209 - binddayClick="dateChange"  
210 - active-type="rounded" 206 + <calendar catchtap="catchtap"
  207 + isTodaybtn="{{false}}" todaybtn_txt="回到今天"
  208 + custom switchover="{{['◀上一月','下一月▶']}}"
  209 + active-coloro="active-coloro"
  210 + active-colort="active-colort"
  211 + speciallist="{{speciallist}}"
  212 + txt_style="txt-style"
211 calendar-style="calendar" 213 calendar-style="calendar"
212 header-style="calendar-header" 214 header-style="calendar-header"
213 - board-style="calendar-board"></calendar> 215 + weektitle-style="weektitle-style"
  216 + restcolor-style="restcolor-style"
  217 + appear
  218 + txt_type="cn-d"
  219 +
  220 + datefont-style="datefont-style"
  221 + todaybtn-style="todaybtn-style"
  222 +
  223 + bindnextMonth="nextMonth"
  224 + bindprevMonth="prevMonth"
  225 + bindselectDate="dateChange"
  226 + bindgotoday="gotoday"
  227 +
  228 + prev="{{calendar.nextNum>0}}"
  229 + ></calendar>
214 </view> 230 </view>
215 </view> 231 </view>
216 <view class="calendar-mask" bindtap="calendarClose" 232 <view class="calendar-mask" bindtap="calendarClose"
@@ -236,20 +236,49 @@ @@ -236,20 +236,49 @@
236 background-color: rgba(0,0,0,.5); 236 background-color: rgba(0,0,0,.5);
237 } 237 }
238 .calendar { 238 .calendar {
239 - background-color: #eeedff;  
240 - padding-top: 10px; 239 + background-color: #fefefe;
241 position: absolute; 240 position: absolute;
242 bottom: 0; 241 bottom: 0;
243 width: 100%; 242 width: 100%;
244 } 243 }
245 .calendar-header{ 244 .calendar-header{
246 - font-size: large; /*修改了标题文字和按钮的大小*/  
247 - color: #605eac; /*修改了标题文字和按钮的颜色*/ 245 + background: #199095 ;
  246 + color: #fff;
248 } 247 }
249 -.calendar-board {  
250 - background-color: #dddcff;  
251 - color: white; 248 +.weektitle-style {
  249 + background-color: #199095;
  250 + color: #4fcfcf;
  251 +}
  252 +.restcolor-style{
  253 + color:orange !important;
  254 +}
  255 +.active-coloro {
  256 + color: #fff!important;
  257 + background: #199095;
  258 +}
  259 +.active-colort {
  260 + color: #fff!important;
  261 + background: #b8d5eb;
252 } 262 }
  263 +.txt-style{
  264 + margin-top: -24rpx;
  265 + color: #199095;
  266 +}
  267 +.datefont-style{
  268 + color: #199095;
  269 +}
  270 +.todaybtn-style{
  271 + line-height: 30rpx!important;
  272 + width: 60rpx!important;
  273 + height: 60rpx!important;
  274 + padding: 20rpx;
  275 + color: #fff!important;
  276 + background-color: #199095!important;
  277 +}
  278 +
  279 +
  280 +
  281 +
253 .placeholder-class-pnum{ 282 .placeholder-class-pnum{
254 color:#199095; 283 color:#199095;
255 font-size: 34rpx; 284 font-size: 34rpx;