Commit 10b4ef9b15fda21af1ee921f65a9ba3269b3f45f

Authored by wangfan
1 parent f2a37b5f

日历插件

@@ -61,10 +61,6 @@ @@ -61,10 +61,6 @@
61 ] 61 ]
62 }, 62 },
63 "plugins": { 63 "plugins": {
64 - "calendar": {  
65 - "version": "1.1.3",  
66 - "provider": "wx92c68dae5a8bb046"  
67 - },  
68 "bmCalendar": { 64 "bmCalendar": {
69 "version": "1.2.0", 65 "version": "1.2.0",
70 "provider": "wx23a9cef3522e4f7c" 66 "provider": "wx23a9cef3522e4f7c"
@@ -224,60 +224,8 @@ @@ -224,60 +224,8 @@
224 opacity:1; 224 opacity:1;
225 } 225 }
226 226
227 -/**  
228 - */  
229 -.calendar-mask{  
230 - position: fixed;  
231 - z-index: 99;  
232 - width: 100%;  
233 - height: 100%;  
234 - left:0;  
235 - top:0;  
236 - background-color: rgba(0,0,0,.5);  
237 -}  
238 -.calendar {  
239 - background-color: #fefefe;  
240 - position: absolute;  
241 - bottom: 0;  
242 - width: 100%;  
243 - height: 720rpx;  
244 -}  
245 -.calendar-header{  
246 - background: #199095 ;  
247 - color: #fff;  
248 -}  
249 -.weektitle-style {  
250 - background-color: #199095;  
251 - color: #4fcfcf;  
252 -}  
253 -.restcolor-style{  
254 - color:orange !important;  
255 -}  
256 -.active-coloro {  
257 - color: #fff!important;  
258 - background: #199095;  
259 -}  
260 -.active-colort {  
261 - color: #fff!important;  
262 - background: #b8d5eb;  
263 -}  
264 -.txt-style{  
265 - margin-top: -24rpx;  
266 - color: #199095;  
267 -}  
268 -.datefont-style{  
269 - color: #199095;  
270 -}  
271 -.todaybtn-style{  
272 - line-height: 30rpx!important;  
273 - width: 60rpx!important;  
274 - height: 60rpx!important;  
275 - padding: 20rpx;  
276 - color: #fff!important;  
277 - background-color: #199095!important;  
278 - position: absolute;  
279 - bottom: 10rpx; right: 60rpx;  
280 -} 227 +
  228 +@import "common/calendar.wxss";
281 229
282 230
283 231
@@ -45,11 +45,10 @@ Page({ @@ -45,11 +45,10 @@ Page({
45 } 45 }
46 //this.sellerid=opt.seller_id ? opt.seller_id : util.cache('sellerid'); 46 //this.sellerid=opt.seller_id ? opt.seller_id : util.cache('sellerid');
47 let timePickerArray= await bookOrder.getDayTimeSpace(); 47 let timePickerArray= await bookOrder.getDayTimeSpace();
48 - let nt=new Date()/1000;  
49 let speciallist=[ 48 let speciallist=[
50 - { date: util.unixtoTime(nt,'YYYY-MM-DD'), background: '', text:'今 天' },  
51 - { date: util.unixtoTime(nt+86400,'YYYY-MM-DD'), background: '', text: '明 天' },  
52 - { date: util.unixtoTime(nt+86400*2,'YYYY-MM-DD'), background: '', text: '后 天' }, 49 + { date: util.unixtoTime(d,'YYYY-MM-DD'), background: '', text:'今 天' },
  50 + { date: util.unixtoTime(d+86400,'YYYY-MM-DD'), background: '', text: '明 天' },
  51 + { date: util.unixtoTime(d+86400*2,'YYYY-MM-DD'), background: '', text: '后 天' },
53 ]; 52 ];
54 this.setData({ 53 this.setData({
55 sellerid:this.sellerid, 54 sellerid:this.sellerid,
@@ -104,17 +104,6 @@ page{ @@ -104,17 +104,6 @@ page{
104 background-color:#199095; 104 background-color:#199095;
105 color: #FEFEFE; 105 color: #FEFEFE;
106 } 106 }
107 -  
108 -  
109 -.calendar-mask{  
110 - position: fixed;  
111 - z-index: 99;  
112 - width: 100%;  
113 - height: 100%;  
114 - left:0;  
115 - top:0;  
116 - background-color: rgba(0,0,0,.5);  
117 -}  
118 .exportFile{ 107 .exportFile{
119 font-size: 26rpx; 108 font-size: 26rpx;
120 color:#353535; 109 color:#353535;
@@ -125,46 +114,5 @@ page{ @@ -125,46 +114,5 @@ page{
125 margin: 0 auto 8rpx; 114 margin: 0 auto 8rpx;
126 } 115 }
127 116
128 -.calendar {  
129 - background-color: #fefefe;  
130 - position: absolute;  
131 - bottom: 0;  
132 - width: 100%;  
133 - height: 720rpx;  
134 -}  
135 -.calendar-header{  
136 - background: #199095 ;  
137 - color: #fff;  
138 -}  
139 -.weektitle-style {  
140 - background-color: #199095;  
141 - color: #4fcfcf;  
142 -}  
143 -.restcolor-style{  
144 - color:orange !important;  
145 -}  
146 -.active-coloro {  
147 - color: #fff!important;  
148 - background: #199095;  
149 -}  
150 -.active-colort {  
151 - color: #fff!important;  
152 - background: #b8d5eb;  
153 -}  
154 -.txt-style{  
155 - margin-top: -24rpx;  
156 - color: #199095;  
157 -}  
158 -.datefont-style{  
159 - color: #199095;  
160 -}  
161 -.todaybtn-style{  
162 - line-height: 30rpx!important;  
163 - width: 60rpx!important;  
164 - height: 60rpx!important;  
165 - padding: 20rpx;  
166 - color: #fff!important;  
167 - background-color: #199095!important;  
168 - position: absolute;  
169 - bottom: 10rpx; right: 60rpx;  
170 -}  
  117 +
  118 +@import "common/calendar.wxss";
@@ -20,6 +20,10 @@ Page({ @@ -20,6 +20,10 @@ Page({
20 regions:[], 20 regions:[],
21 regions_active:'', 21 regions_active:'',
22 time:-1, 22 time:-1,
  23 + speciallist:[],
  24 + calendar:{
  25 + nextNum:0,
  26 + },
23 }, 27 },
24 regions:[], 28 regions:[],
25 sellerid:0, 29 sellerid:0,
@@ -35,9 +39,15 @@ Page({ @@ -35,9 +39,15 @@ Page({
35 let d=new Date()/1000; 39 let d=new Date()/1000;
36 let dateStr=util.unixtoTime(d,'MM-DD DAY'); 40 let dateStr=util.unixtoTime(d,'MM-DD DAY');
37 let timePickerArray= await bookOrder.getDayTimeSpace(); 41 let timePickerArray= await bookOrder.getDayTimeSpace();
  42 + let speciallist=[
  43 + { date: util.unixtoTime(d,'YYYY-MM-DD'), background: '', text:'今 天' },
  44 + { date: util.unixtoTime(d+86400,'YYYY-MM-DD'), background: '', text: '明 天' },
  45 + { date: util.unixtoTime(d+86400*2,'YYYY-MM-DD'), background: '', text: '后 天' },
  46 + ];
38 this.setData({ 47 this.setData({
39 dateStr:dateStr, 48 dateStr:dateStr,
40 timePickerArray:timePickerArray, 49 timePickerArray:timePickerArray,
  50 + speciallist:speciallist,
41 }) 51 })
42 }, 52 },
43 53
@@ -91,13 +101,13 @@ Page({ @@ -91,13 +101,13 @@ Page({
91 console.log(this.data.calendarMask) 101 console.log(this.data.calendarMask)
92 }, 102 },
93 dateChange(event){ 103 dateChange(event){
94 - let cktime=util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day) 104 + let cktime=util.timetouUnix(event.detail.date)
95 let day0=parseInt(new Date(new Date().setHours(0, 0, 0, 0)) / 1000); 105 let day0=parseInt(new Date(new Date().setHours(0, 0, 0, 0)) / 1000);
96 if(cktime<day0){ 106 if(cktime<day0){
97 util.toast('请选择今天之后的日期','none'); 107 util.toast('请选择今天之后的日期','none');
98 return; 108 return;
99 } 109 }
100 - let clickDay = event.detail.day; 110 + let clickDay = event.detail.date.substr(8,2);
101 let changeDay = `dayStyle[1].day`; 111 let changeDay = `dayStyle[1].day`;
102 let changeBg = `dayStyle[1].background`; 112 let changeBg = `dayStyle[1].background`;
103 this.setData({ 113 this.setData({
@@ -208,5 +218,20 @@ Page({ @@ -208,5 +218,20 @@ Page({
208 this.regions=res.data[0]; 218 this.regions=res.data[0];
209 this.getbooklist(); 219 this.getbooklist();
210 }) 220 })
211 - } 221 + },
  222 + gotoday(e){
  223 + this.setData({
  224 + [`calendar.nextNum`]:0
  225 + })
  226 + },
  227 + nextMonth(e){
  228 + this.setData({
  229 + [`calendar.nextNum`]:this.data.calendar.nextNum+1
  230 + })
  231 + },
  232 + prevMonth(e){
  233 + this.setData({
  234 + [`calendar.nextNum`]:this.data.calendar.nextNum-1
  235 + })
  236 + },
212 }) 237 })
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 "usingComponents": { 5 "usingComponents": {
6 "nav":"/components/nav/nav", 6 "nav":"/components/nav/nav",
7 "tabBar":"/components/book/tabBar/tabBar", 7 "tabBar":"/components/book/tabBar/tabBar",
8 - "calendar": "plugin://calendar/calendar", 8 + "calendar": "plugin://bmCalendar/calendar",
9 "board":"/components/book/board/board", 9 "board":"/components/book/board/board",
10 "formids":"/components/formids/formids" 10 "formids":"/components/formids/formids"
11 } 11 }
@@ -54,13 +54,29 @@ @@ -54,13 +54,29 @@
54 <view class="calendar-mask" bindtap="calendarClose" 54 <view class="calendar-mask" bindtap="calendarClose"
55 style="height:{{calendarMask?'100%':0}};" wx:if="{{calendarMaskLoad}}"> 55 style="height:{{calendarMask?'100%':0}};" wx:if="{{calendarMaskLoad}}">
56 <view style="width: 100%; height:{{calendarMask?'100%':0}};overflow: hidden;position: relative;"> 56 <view style="width: 100%; height:{{calendarMask?'100%':0}};overflow: hidden;position: relative;">
57 - <calendar weeks-type="cn" catchtap="catchtap"  
58 - start-date="2018-09"  
59 - days-color="{{dayStyle}}"  
60 - binddayClick="dateChange"  
61 - active-type="rounded" 57 + <calendar catchtap="catchtap"
  58 + isTodaybtn="{{false}}" todaybtn_txt="回到今天"
  59 + custom="{{false}}"
  60 + switchover="{{['上一月','下个月']}}"
  61 + active-coloro="active-coloro"
  62 + active-colort="active-colort"
  63 + speciallist="{{speciallist}}"
  64 + txt_style="txt-style"
62 calendar-style="calendar" 65 calendar-style="calendar"
63 header-style="calendar-header" 66 header-style="calendar-header"
64 - board-style="calendar-board"></calendar> 67 + weektitle-style="weektitle-style"
  68 + restcolor-style="restcolor-style"
  69 + txt_type="cn-d"
  70 +
  71 + datefont-style="datefont-style"
  72 + todaybtn-style="todaybtn-style"
  73 +
  74 + bindnextMonth="nextMonth"
  75 + bindprevMonth="prevMonth"
  76 + bindselectDate="dateChange"
  77 + bindgotoday="gotoday"
  78 +
  79 + prev="{{calendar.nextNum>0}}"
  80 + ></calendar>
65 </view> 81 </view>
66 </view> 82 </view>
@@ -38,31 +38,9 @@ @@ -38,31 +38,9 @@
38 } 38 }
39 39
40 40
41 -.calendar-mask{  
42 - position: fixed;  
43 - z-index: 99;  
44 - width: 100%;  
45 - height: 100%;  
46 - left:0;  
47 - top:0;  
48 - background-color: rgba(0,0,0,.5);  
49 -}  
50 -.calendar {  
51 - background-color: #eeedff;  
52 - padding-top: 10px;  
53 - position: absolute;  
54 - bottom: 0;  
55 - width: 100%;  
56 - z-index: 999;  
57 -}  
58 -.calendar-header{  
59 - font-size: large; /*修改了标题文字和按钮的大小*/  
60 - color: #605eac; /*修改了标题文字和按钮的颜色*/  
61 -}  
62 -.calendar-board {  
63 - background-color: #dddcff;  
64 - color: white;  
65 -} 41 +@import "common/calendar.wxss";
  42 +
  43 +
66 44
67 .disks{ 45 .disks{
68 width: 100%; 46 width: 100%;
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 "newFeature": true 8 "newFeature": true
9 }, 9 },
10 "compileType": "miniprogram", 10 "compileType": "miniprogram",
11 - "libVersion": "2.3.2", 11 + "libVersion": "2.4.0",
12 "appid": "wxd3dc4206c76f14fc", 12 "appid": "wxd3dc4206c76f14fc",
13 "projectname": "xcx-book", 13 "projectname": "xcx-book",
14 "isGameTourist": false, 14 "isGameTourist": false,