-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
124 lines (89 loc) · 1.92 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/**
* Created by zhouchao on 16/12/8.
*/
import React from 'react'
import ReactDOM from 'react-dom'
import MultiMonthView,{DatePicker} from './src'
import './index.less'
const days = [
{
key:20161201,
text:'¥ 3000'
},
{
key:20161202,
text:'¥ 1000'
},
{
key:20161203,
text:'¥ 1000'
},
{
key:20161204,
text:'¥ 2000'
},
{
key:20161205,
text:'¥ 2000'
},
{
key:20161206,
text:'¥ 2000'
},
{
key:20161209,
text:'¥ 3000'
},
{
key:20161231,
text:'¥ 3000'
},
{
key:20170101,
text:'¥ 3000'
},
];
const onDayClick = (day,rangeDays,is_complete)=>{
for (var value of rangeDays) {
if(value.disable==false) {
console.log(value.moment.format('YYYY-MM-DD')+'不可以订');
return false;
}
}
if(is_complete){
console.log('选择完毕');
}else{
console.log('选择退房时间')
}
return true;
};
const onDateDayClick = (day)=>{
console.log(day);
return true;
};
const rendDay = (day,props)=>{
let day_my;
days.forEach(function (value,index) {
if(value.key==day.number){
return day_my;
}
});
// let day_my = days.find((value)=>{
// return value.key==day.number
// });
if(day_my==undefined){
day.disable = false;
day.money = '暂无';
}else{
day.money = day_my.text;
day.disable = true;
}
props.children = <div className="day"><span className="textNum">{day.text}</span><span className="textMoney">{day.money}</span></div>;
};
ReactDOM.render(
<div>
<DatePicker defaultDay="2016-12-03" onDayClick={onDateDayClick} />
<MultiMonthView isShowWeek="true" startMoment="2016-12-03" endMoment="2016-12-06" startText="入住" endText="退房" monthNumber="5" viewMoment="2016-12" onDayClick={onDayClick} rendDay={rendDay}/>
</div>,
document.getElementById('root')
);