-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
350 lines (297 loc) · 10.1 KB
/
index.html
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="ITRClub">
<meta name="keywords" content="ITRClub,聚会小日历">
<meta charset="UTF-8">
<title>聚会专用小日历 / Powered By ITRClub</title>
<!-- include JS File -->
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/amazeui/2.7.2/js/amazeui.min.js"></script>
<script src="https://cdn.bootcss.com/html2canvas/0.5.0-beta4/html2canvas.min.js"></script>
<!-- include CSS File -->
<link rel="stylesheet" href="https://cdn.bootcss.com/amazeui/2.7.2/css/amazeui.min.css">
<style>
*{margin:0;padding:0;}
body{
background:white;
}
#calendar{
width:358px;
margin:0 auto;
margin-top:2%;
margin-bottom:2%;
border-radius:5px;
font-family:'Open Sans',sans-serif;
text-align:center;
color:#555;
box-shadow:0 0 50px -14px rgba(0,0,0,.8);
background-color: white;
}
#calendar h1{
margin-bottom: 0px;
background:#ee3333;
border-radius:5px 5px 0 0;
padding:20px;
text-transform:uppercase;
letter-spacing:1px;
color:#fff;
cursor:default;
text-shadow:0 0 7px rgba(0,0,0,.8);
}
#calendar table{
width: 358px;
border-top:1px solid #ddd;
border-left:1px solid #ddd;
border-spacing:0;
border-radius:0 0 5px 5px;
}
#calendar td{
width:38px;
height:38px;
background:#eee;
border-right:1px solid #ddd;
border-bottom:1px solid #ddd;
padding:6px;
cursor:pointer;
transition:background .3s;
-webkit-transition:background .3s;
}
#calendar td:hover:not(.today){
background:#ddd;
}
#calendar .otherMonth{
background:#fff;
color:#999;
}
#calendar .today{
background:#ee3333;
font-weight:700;
color:#fff;
text-shadow:0 0 10px rgba(0,0,0,.5);
}
#calendar .haveTask{
font-size:14px;
font-weight:bold;
color: #9C27B0;
}
#calendar tr:last-of-type td:first-of-type{border-radius:0 0 0 5px;}
#calendar tr:last-of-type td:last-of-type{border-radius:0 0 5px 0;}
}
</style>
</head>
<body>
<!-- 日历框 -->
<div id="calendar">
<h1 style="font-family: '微软雅黑';">
<p id="month"></p>
</h1>
<table id="table">
<tr>
<td>日</td>
<td>一</td>
<td>二</td>
<td>三</td>
<td>四</td>
<td>五</td>
<td>六</td>
</tr>
</table>
<p style="text-align:right;font-weight:bold;font-size:17px;color:#9C27B0;">(紫色代表没空哦~)</p>
<!-- 邀请词 -->
<div id="invite" style="display: none;text-align: center;">
<font style="font-size:27px;font-weight:bold;color:#99CCCC;background-color: white;">
<font id="name_show" color="#003366"></font>在这些天有空哦~<br>
快来找我玩吧!
</font>
</div>
<!-- ./邀请词 -->
<!-- 项目二维码 -->
<div id="qrcode" class="am-g" style="display: none;">
<div class="am-u-sm-6">
<img style="width:179px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARgAAAEYCAIAAAAI7H7bAAAHXUlEQVR4nO3da27jOBCF0c5g9r/lzAKsBgjq4yOZc342bImyc0Ggulz8+v7+/gO888/pBcBvIEgQECQICBIEBAkC/37+09fX1/51PPqsKL5Z22B98vMWj28cXMnqR3i82vSTtjfd8KRHPH68diQICBIEBAkCggQBQYKAIEHgofz9aHVv6z3FzWmDH9GbYvqRT6m96ZH/0pg2vjY7EgQECQKCBAFBgoAgQWC0avfp5mJLe/03jaGDV1ttuj/18b1v6pPTLxt06s/SjgQBQYKAIEFAkCAgSBAQJAjMl7+PeFOgXF3GfVNinnZkLsKbmQ2/dbKvHQkCggQBQYKAIEFAkCDww6p2j1YPPW07Pge1Ja976pPTtdPL2ZEgIEgQECQICBIEBAkCggSB+fL3karlmx7N6RPENhw09vmyDQNZV5+89viy1b2tp4rpdiQICBIEBAkCggQBQYLAaNXu5vOL2vPrV79s0Ia1HbnpPb+0b9mRICBIEBAkCAgSBAQJAoIEga+f9Yv5I+MTxm8xYkPFdrr83bbnDvodA1ntSBAQJAgIEgQECQKCBIH5qt2Gk3mmq09Hbtqe3TR4iw2lyOlbbKidDt60XcbjLexIEBAkCAgSBAQJAoIEAUGCwC2TVjdMM13tnkkGq692c9/tqbmtdiQICBIEBAkCggQBQYLAfNXu0ZGfc7cnGk1rm1Y3PMKR2uZgOW7wAwmX8beVDLIjQUCQICBIEBAkCAgSBAQJAqMzG6bLkW+aCI/M+By8/pFJBkfO/Gor0e13Ov3fBvlfrx0JAoIEAUGCgCBBQJAg8NC0uqHONv3GDcfmrL7Fkdmobx5q9a/l3zzCPYcy2ZEgIEgQECQICBIEBAkCggSBuGn15kOpLnnSRz9rmumpxtCbr2ZHgoAgQUCQICBIEBAkCMxX7R5tOJz92pvecz7SoE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UECQKCBAFBgoAgQeChandzE+GbytglR+78f7pRVy9jfCXTjzD+pHYkCAgSBAQJAoIEAUGCgCBBYPSgsUtmNgy+93G17SNM92humNvaWv2k08vIvSn025EgIEgQECQICBIEBAkCo1W7T0eOa98wBXawSDXdArthWOy0tpXzza++V7f25h+vHQkCggQBQYKAIEFAkCAgSBCYL3/f7OaxE2/e2I6dWP2fEBuaVtthDG8+NzsSBAQJAoIEAUGCgCBB4DdU7Y40hn6+tz2Z59GGptLp668eyPrmRKNPJq3CjQQJAoIEAUGCgCBBQJAgMF/+PnLa1IaDxkbe+GhDu+TqMaVvPt7pW7Qf75FZF3/sSJAQJAgIEgQECQKCBIHRqt09P96edsn5SG1va/tz7kft79s/bTgJasMJWnYkCAgSBAQJAoIEAUGCgCBB4OtI7yn8MnYkCAgSBAQJAoIEAUGCgCBB4D8k3sctX8QmTgAAAABJRU5ErkJggg==">
</div>
<div class="am-u-sm-6" style="padding-top: 45px;font-weight: bold;">
一款聚会专用的日历<br><br>
<-- 长按制作你的日历
</div>
</div>
<!-- ./项目二维码 -->
</div>
<!-- ./日历框 -->
<center>
<div class="am-input-group" style="width: 95%;">
<input class="am-form-field" id="name" style="border-radius:5px;">
<span id="sure1" class="am-input-group-btn">
<button class="am-btn am-btn-primary" id="sureInfo_btn" onclick='sureInfo()' style="border-radius:5px;">确认信息</button>
</span>
<span id="sure2" class="am-input-group-btn" style="display:none;">
<button class="am-btn am-btn-success" id="sureHaveTaskDay_btn" onclick='sureHaveTaskDay();' style="border-radius:5px;">立即生成照片</button>
</span>
</div>
</center>
<script>
var date=new Date();
var month=date.getMonth()+1;
var days=[29,30,31,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,1,2,3,4];
var haveTaskDays=[];
var showOtherMonth=1;
var nextIsOtherMonth=0;// 明天是下个月
window.onload=function(){
initTable();
showMonth(month);
$("#sureHaveTaskDay_btn").removeAttr("disabled");
$("#name").removeAttr("disabled");
}
function chooseHaveTaskDay(loc){
style=$("#td_"+loc).attr("class");
dayNum=days[loc];
if(style=="haveTask"){
// 选中的日子之前有任务,当前反选
$("#td_"+loc).attr("class","");
haveTaskDays.splice($.inArray(dayNum,haveTaskDays),1);
}else if(style=="" || style==undefined){
// 新选中当前日子有任务
$("#td_"+loc).attr("class","haveTask");
haveTaskDays.push(dayNum);
}
}
function sureInfo(){
$("#name").blur();
name=$("#name").val();
if(name==""){
alert("请输入姓名/昵称!");
$("#name").focus();
return false;
}
$("#name").attr("disabled","disabled");
$("#sure1").attr("style","display:none");
$("#sure2").attr("style","")
}
function sureHaveTaskDay(){
name=$("#name").val();
if(name==""){
alert("请输入姓名/昵称!");
$("#name").focus();
$("#sure1").attr("style","");
$("#sure2").attr("style","display:none")
return false;
}
$("#name_show").html(name);
for(i=0;i<42;i++){
// 清除日历单元格的onClick事件
$("#td_"+i).attr("onclick","");
}
// 显示邀请词和二维码
$("#invite").attr("style","text-align: center;");
$("#qrcode").attr("style","");
// 修改确认按钮样式
$("#sureHaveTaskDay_btn").attr("disabled","disabled");
$("#sureHaveTaskDay_btn").attr("class","am-btn am-btn-default");
alert("您已成功确定有任务的日子。\n系统正在生成照片,请稍后!");
// 生成日历照片
html2canvas(document.getElementById("calendar"), {
allowTaint: true,
taintTest: false,
onrendered:function(canvas){
canvas.id = "mycanvas";
//生成base64图片数据
var dataUrl = canvas.toDataURL();
var newImg = document.createElement("img");
newImg.src = dataUrl;
document.body.appendChild(newImg);
alert("生成成功!!!\n请长按下图以保存照片!");
}
});
// 隐藏邀请词和二维码
$("#invite").attr("style","display:none;text-align: center;");
$("#qrcode").attr("style","display:none;");
}
function initTable(){
content="";
for(i=0;i<5;i++){
content+="<tr>";
for(j=0;j<7;j++){
loc=i*7+j;
// 获取日期数字
dayNum=days[loc];
lastDayNum=days[loc-1];
nextDayNum=days[loc+1];
// 月份单元格样式判断
if(showOtherMonth==1 && dayNum>1){
// 上个月的几天
monthStyle=1;
}else if(nextIsOtherMonth==1){
// 今天是下个月
monthStyle=1;
}else if(nextDayNum<dayNum){
// 明天是下个月
nextIsOtherMonth=1;
monthStyle=0;
}else{
// 这个月内
showOtherMonth=0;
monthStyle=0;
}
// 月份单元格样式显示
if(monthStyle==1){
content+='<td id="td_'+loc+'" class="otherMonth">';
}else if(haveTaskDays.indexOf(dayNum)!=-1){
content+='<td id="td_'+loc+'" class="haveTask" onclick="chooseHaveTaskDay('+loc+')">';
}else if(date.getDate()==dayNum){
content+='<td id="td_'+loc+'" class="today" onclick="chooseHaveTaskDay('+loc+')">';
}else{
content+='<td id="td_'+loc+'" onclick="chooseHaveTaskDay('+loc+')">';
}
content+=dayNum+"</td>";
}
content+="</tr>";
}
$("#table").append(content);
}
function showMonth(month){
ret="";
switch(month){
case 1:
ret="一月";
break;
case 2:
ret="二月";
break;
case 3:
ret="三月";
break;
case 4:
ret="四月";
break;
case 5:
ret="五月";
break;
case 6:
ret="六月";
break;
case 7:
ret="七月";
break;
case 8:
ret="八月";
break;
case 9:
ret="九月";
break;
case 10:
ret="十月";
break;
case 11:
ret="十一月";
break;
case 12:
ret="十二月";
break;
}
$("#month").html(ret);
}
</script>
</body>
</html>