let info;
let currentPage = {};
const app = getApp();
function getSystemInfo() {
if (info) return info;
info = wx.getSystemInfoSync();
return info;
}
function isIos() {
const sys = getSystemInfo();
return /iphone|ios/i.test(sys.platform);
}
/**
* 获取当前页面实例
*/
function getCurrentPage() {
const pages = getCurrentPages();
const last = pages.length - 1;
return pages[last];
}
/**
* new Date 区分平台
* @param {number} year
* @param {number} month
* @param {number} day
*/
function newDate(year, month, day) {
let cur = `${year}-${month}-${day}`;
if (isIos()) {
cur = `${year}/${month}/${day}`;
}
return new Date(cur);
}
/**
* todo 数组去重
* @param {array} array todo 数组
*/
function uniqueTodoLabels(array = []) {
let uniqueObject = {};
let uniqueArray = [];
array.forEach(item => {
uniqueObject[`${item.year}-${item.month}-${item.day}`] = item;
});
for (let i in uniqueObject) {
uniqueArray.push(uniqueObject[i]);
}
return uniqueArray;
}
/**
* 上滑
* @param {object} e 事件对象
* @returns {boolean} 布尔值
*/
export function isUpSlide(e) {
const { startX, startY } = this.data.gesture;
if (this.slideLock) {
const t = e.touches[0];
const deltaX = t.clientX - startX;
const deltaY = t.clientY - startY;
if (deltaY < -60 && deltaX < 20 && deltaX > -20) {
this.slideLock = false;
return true;
} else {
return false;
}
}
}
/**
* 下滑
* @param {object} e 事件对象
* @returns {boolean} 布尔值
*/
export function isDownSlide(e) {
const { startX, startY } = this.data.gesture;
if (this.slideLock) {
const t = e.touches[0];
const deltaX = t.clientX - startX;
const deltaY = t.clientY - startY;
if (deltaY > 60 && deltaX < 20 && deltaX > -20) {
this.slideLock = false;
return true;
} else {
return false;
}
}
}
/**
* 左滑
* @param {object} e 事件对象
* @returns {boolean} 布尔值
*/
export function isLeftSlide(e) {
const { startX, startY } = this.data.gesture;
if (this.slideLock) {
const t = e.touches[0];
const deltaX = t.clientX - startX;
const deltaY = t.clientY - startY;
if (deltaX < -60 && deltaY < 20 && deltaY > -20) {
this.slideLock = false;
return true;
} else {
return false;
}
}
}
/**
* 右滑
* @param {object} e 事件对象
* @returns {boolean} 布尔值
*/
export function isRightSlide(e) {
const { startX, startY } = this.data.gesture;
if (this.slideLock) {
const t = e.touches[0];
const deltaX = t.clientX - startX;
const deltaY = t.clientY - startY;
if (deltaX > 60 && deltaY < 20 && deltaY > -20) {
this.slideLock = false;
return true;
} else {
return false;
}
}
}
// function info(msg) {
// console.log('%cInfo: %c' + msg, 'color:#FF0080;font-weight:bold', 'color: #FF509B');
// }
function warn(msg) {
console.log(
'%cWarn: %c' + msg,
'color:#FF6600;font-weight:bold',
'color: #FF9933'
);
}
function tips(msg) {
console.log(
'%cTips: %c' + msg,
'color:#00B200;font-weight:bold',
'color: #00CC33'
);
}
const conf = {
/**
* 计算指定月份共多少天
* @param {number} year 年份
* @param {number} month 月份
*/
getThisMonthDays(year, month) {
return new Date(year, month, 0).getDate();
},
/**
* 计算指定月份第一天星期几
* @param {number} year 年份
* @param {number} month 月份
*/
getFirstDayOfWeek(year, month) {
return new Date(Date.UTC(year, month - 1, 1)).getDay();
},
/**
* 计算指定日期星期几
* @param {number} year 年份
* @param {number} month 月份
* @param {number} date 日期
*/
getDayOfWeek(year, month, date) {
return new Date(Date.UTC(year, month - 1, date)).getDay();
},
/**
* 渲染日历
* @param {number} curYear
* @param {number} curMonth
* @param {number} curDate
*/
renderCalendar(curYear, curMonth, curDate) {
conf.calculateEmptyGrids.call(this, curYear, curMonth);
conf.calculateDays.call(this, curYear, curMonth, curDate);
const { todoLabels } = this.data.calendar || {};
const { afterCalendarRender } = this.config;
if (todoLabels && todoLabels instanceof Array) {
conf.setTodoLabels.call(this);
}
if (
afterCalendarRender &&
typeof afterCalendarRender === 'function' &&
!this.firstRender
) {
afterCalendarRender();
this.firstRender = true;
}
},
/**
* 计算当前月份前后两月应占的格子
* @param {number} year 年份
* @param {number} month 月份
*/
calculateEmptyGrids(year, month) {
conf.calculatePrevMonthGrids.call(this, year, month);
conf.calculateNextMonthGrids.call(this, year, month);
},
/**
* 计算上月应占的格子
* @param {number} year 年份
* @param {number} month 月份
*/
calculatePrevMonthGrids(year, month) {
let empytGrids = [];
const prevMonthDays = conf.getThisMonthDays(year, month - 1);
const firstDayOfWeek = conf.getFirstDayOfWeek(year, month);
if (firstDayOfWeek > 0) {
const len = prevMonthDays - firstDayOfWeek;
for (let i = prevMonthDays; i > len; i--) {
empytGrids.push(i);
}
this.setData({
'calendar.empytGrids': empytGrids.reverse()
});
} else {
this.setData({
'calendar.empytGrids': null
});
}
},
/**
* 计算下月应占的格子
* @param {number} year 年份
* @param {number} month 月份
*/
calculateNextMonthGrids(year, month) {
let lastEmptyGrids = [];
const thisMonthDays = conf.getThisMonthDays(year, month);
const lastDayWeek = conf.getDayOfWeek(year, month, thisMonthDays);
if (+lastDayWeek !== 6) {
const len = 7 - (lastDayWeek + 1);
for (let i = 1; i <= len; i++) {
lastEmptyGrids.push(i);
}
this.setData({
'calendar.lastEmptyGrids': lastEmptyGrids
});
} else {
this.setData({
'calendar.lastEmptyGrids': null
});
}
},
/**
* 设置日历面板数据
* @param {number} year 年份
* @param {number} month 月份
*/
calculateDays(year, month, curDate) {
let days = [];
const {
todayTimestamp,
disableDays = [],
enableArea = [],
enableDays = [],
enableAreaTimestamp = []
} = this.data.calendar;
const thisMonthDays = conf.getThisMonthDays(year, month);
let expectEnableDaysTimestamp = converEnableDaysToTimestamp(enableDays);
if (enableArea.length) {
expectEnableDaysTimestamp = delRepeatedEnableDay(enableDays, enableArea);
}
let selectedDay = [];
if (this.config.defaultDay !== undefined && !this.config.defaultDay) {
selectedDay = [];
this.config.defaultDay = undefined;
} else {
selectedDay = curDate
? [
{
day: curDate,
choosed: true,
year,
month
}
]
: this.data.calendar.selectedDay;
}
for (let i = 1; i <= thisMonthDays; i++) {
days.push({
day: i,
choosed: false,
year,
month
});
}
const selectedDayCol = selectedDay.map(
d => `${d.year}-${d.month}-${d.day}`
);
const disableDaysCol = disableDays.map(
d => `${d.year}-${d.month}-${d.day}`
);
days.forEach(item => {
const cur = `${item.year}-${item.month}-${item.day}`;
if (selectedDayCol.indexOf(cur) !== -1) item.choosed = true;
if (disableDaysCol.indexOf(cur) !== -1) item.disable = true;
const timestamp = newDate(item.year, item.month, item.day).getTime();
let setDisable = false;
if (enableAreaTimestamp.length) {
if (
(+enableAreaTimestamp[0] > +timestamp ||
+timestamp > +enableAreaTimestamp[1]) &&
!expectEnableDaysTimestamp.includes(+timestamp)
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
医院预约挂号小程序源码.zip (799个子文件)
0066039fcc8f6a2101a4bb6bad442b538d06ff 384B
00a81e45f70796b78f71fc78fc208fae207f15 249B
00ebafbf9417a5ac4d74e917f5ba051f16c056 140B
01b5254af1b2656735ddb9ec35a5dfd7aa293c 1KB
01bef53dcf69368b11f7eb510ea1e70f3be7af 109B
022fcd89d2d6f29009590c6a1077ca9c93a96e 63B
024778dcbd27c5fa471aab23b58d37c7b1e0b1 2KB
024f2c449c2c9f9fd1d0bca9713c2eba4d9dba 192B
027ccc4c8020b6fb12eb3128a079796188d83d 135B
02add20b581be471b8d17f887b8e8337070546 194B
02fe43ea00b6694560c77e35469551551ac144 549B
06b23fe00e8910c516a1b8001bc769632cf859 135B
071c3dc2d6ecbc7bc866c7b67cb45337de7e5b 134B
0a68f9f612db0ad3b5806bda4b6f038bcdd8b9 134B
0ab2be4b0525d8cf2553f1e1765ec0b0281c3b 2KB
0bc8157105576c0868b6267432bffa77265da2 610B
0bd2532598f87c031b21d4f4287e222defc21d 501B
0c107b1b18ca35f4ae49bce4f3e62f425fa921 609B
0e44849c55771f61149f29c9d4536fab84489d 195B
0e74db436e560353a3e7ae549e54fa3fc1bda9 134B
0fd75901cb7ced360f95e2261ccd7abd159dba 2KB
0fea0d97a95ed517887586a8eb2ebf1c0d3cc8 232B
111d3e99c31761a1fcaadd3c52eb4f0199c55a 298B
13179d29f6387778fb7d412de29841d845fd44 134B
133cd64d80551ebfd1349df463f2bb3a676593 83B
136b8c83cf4604ae37eb2168bc282cda9c5b54 136B
13cc3533f5888f066cd5fe97e7e2abaf1f0c46 251B
14d8531852fe4a98611ced6cac668e54b1ec26 66B
14f8acae49ad24d072d6a78cabdeee2076d308 45B
151850ed08365f649e5c517f697fd59ea27d72 125B
153c2d8782e213e881155d710d769798ab94f1 134B
162e2b94e83421e5eb38681531386f8ff91386 56B
1658f09392eecd5e220e0b4a44870f9a763f00 381B
177c6b28231d1e9973be08c81fbe05d220e0d5 132B
178e541a1769c71e152062e9471feabcabc8a6 476B
19ec3c6465cfc1df1bd04561e384454cd051dd 660B
1a1282cbe958ac72d9ecd9e0043bfa810ca814 85B
1a25e2454ee37126598f713c80a51228560df5 140B
1b67d7b7dcbdc03ff1f90f151a6f9d221c033b 302B
1be735a435757cf5fdbc9c06f2a895b85dca41 135B
1c1bfe81ac8f5fe70ec521ac7994fc4e1947a4 2KB
1d51b8f8d5d40b8afbbae3f1191667d7af3697 134B
1d6e3a5d58ab9dd852f8e4678fb05bd49c5c73 143B
1da6723532143888ab49d3369b836f5d885e1c 683B
1dcae447281d37eb270789ad17a03aef16aa1f 136B
1df875f29f23e6c0fd62765f308e1f503dbc84 107B
1e67d260928641a96238f8bc0980f932ab6e48 97B
1f817928c22d3020aa6db4cc539ac90d5b1a24 513B
20b218db2eb9665c42a86f679f39ab1e6116b7 87B
20b791946c11913290cf83db7406423a76db76 191B
217adc35c596ff3b55c00eda87f51f1e33705b 3KB
22b0af797b53750e71d3fd141cc3405aa0e204 231B
22cb15c2148d92e805529e49cceab5d3e627d9 881B
24713619c4b86fee5a25177b0dd57b0db0e26d 303B
24b42acd9c36b8ca1579f8a0401ce75e1db89e 378B
24baa5a83a9387eaa82dfb8a6758e707ee0e2f 63B
24c1a43b052080d9fb2a5249d7b327db9de333 384B
25439f5902f82a53f8299b0d22d687f3121433 165B
25b4e16b6d1f19cf5eecf1c7f89234c99cc2fd 137B
2747d094612be75b52a1dee428823d50f2037d 83KB
283878937b6ad6ca1849320069167b913ca599 118B
287ea2489fcfe9bd085eac39a7f73810350d41 134B
28a597cc2bc11338c6fd63606503330209d4c1 136B
28f0fc8942543760b5cca717687c94b2883ba3 164B
29d0aa1b9763ee8157837dd89e9c7ee1bbcfa0 135B
2a67bac69e740c73045d1e339f6ca6abd1a3db 134B
2b21189705c2616f176e1f29ebbf01434b5c2a 116B
2b69f9d30b3cb01ce9a2f6df8923b50d4fc66a 591B
2c675217e731ce2536a39b7fe882bd632de48c 388B
2d65d1275edbdf357700cc26d79835ee696663 171B
2ec165ede8efd0579d4964d6f35b6ceb7c5b0d 135B
2f393d274cf12e1f98abcb6b2fc485edd6d5c7 448B
2f413e3e6b7670239f74b61055f97c0bd88deb 63B
2fc980ee687559c93c93f09350c4d2499af2a0 78B
2fccf1781bee9dc1b9e89c79f5da608bcc872e 136B
2fd7fe647de279f39172f1f42dbfcd4ccf9652 137B
309b150b9b89202db547ef84797a125a2a68bf 83B
30de019b216310ab4ef9ae5c3e6c954ee0a1b2 187B
311128ef81d082660100903bd08b9ae67e3a54 111B
3333dc8fd1aa2a51ddc882b0f81ef75240b7f9 244B
33d78911f8c4c74c47bd65f4562133ef479f95 331B
34cafabcf29020c84c942f7277144a91372d53 516B
36baad3f69ccb444bc28ed246febbb6114ecc0 307B
3748cc854e9a87c05b65b84eae0b439bbbdc4f 2KB
37793e7d922450fcea39b47a05e60f37046ad3 4KB
379bcccf2403038e6fb164929101726967fed3 71B
379f7f70f5910760b0e71233cb0249228afd83 82B
380d9e632498d44edf50183b0e763cb4eba37e 173B
39a2716b9c91ea21e5dc9af616d761d8390def 135B
3a5c07ca063c8f984d4bf8117d85844a40b57f 166B
3af0359bd8e35bc038043a42d665abe7d4e929 208B
3afc0fe1c73ccb52b7e03f1a348d50fd4e8a78 84B
3bd7f42732f25ec6668ef8a03312e29ac4a713 420B
3c079963b5461e3bc15190b8ccc57c825b2658 852B
3c67395628aede0146eda858f590eb81596abd 105B
3c725575978a6d4008016704fe216d80343252 63B
3c982bb18c6992438a256a4f42723a4af4e540 669B
3d847b513f1d8a8da49cfe4c9be0adad318b8d 540B
3e17b7fa2f01546c9f9da3a32416c06ed306d9 2KB
3e581e729b25a537acbc89983d1864e50ef086 417B
共 799 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
- 愛你無聲2021-12-08骗人的不要下
微毫米
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功