From fef109e3924901f69eec3ada24b02789dc0abeb1 Mon Sep 17 00:00:00 2001 From: caill <815519168@qq.com> Date: Wed, 27 Sep 2023 14:38:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BC=BA=E5=88=B6=E9=9D=99=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/modules/forced-rest.vue | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/pages/modules/forced-rest.vue b/pages/modules/forced-rest.vue index e85dde6..c6223a4 100644 --- a/pages/modules/forced-rest.vue +++ b/pages/modules/forced-rest.vue @@ -6,7 +6,7 @@ 设备号 - + @@ -27,9 +27,8 @@ {{e.point_code}} {{e.device_code}} {{e.standing_time}} - {{e.plan_start_date}} {{e.timeDifferenceMinutes}} - {{e.estimatedCompletionTimeString}}> + {{e.estimatedCompletionTimeString}} @@ -40,14 +39,6 @@ - @@ -61,7 +52,7 @@ }, data() { return { - val1: dateTimeFtt(new Date()), + val1: '', dataList: [], pkId: '', pkObj: {}, @@ -72,12 +63,6 @@ this._forcedRestingShow() }, methods: { - changeLog(e) { - // console.log('----change事件:', e); - if (!e) { - this.val1 = '' - } - }, /** grid查询 */ async _forcedRestingShow () { let res = await forcedRestingShow() @@ -95,7 +80,7 @@ this.disabled = false this.pkId = '' this.pkObj = {} - this.val1 = dateTimeFtt(new Date()) + this.val1 = '' this._forcedRestingShow() uni.showToast({ title: res.message, From 829aa4cc7a005e277bba638dfbbb1f6a10294efc Mon Sep 17 00:00:00 2001 From: caill <815519168@qq.com> Date: Wed, 27 Sep 2023 14:39:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uni-datetime-picker/changelog.md | 140 --- .../uni-datetime-picker/calendar-item.vue | 177 --- .../uni-datetime-picker/calendar.vue | 929 --------------- .../uni-datetime-picker/i18n/en.json | 22 - .../uni-datetime-picker/i18n/index.js | 8 - .../uni-datetime-picker/i18n/zh-Hans.json | 22 - .../uni-datetime-picker/i18n/zh-Hant.json | 22 - .../uni-datetime-picker/time-picker.vue | 934 --------------- .../uni-datetime-picker.vue | 1032 ----------------- .../components/uni-datetime-picker/util.js | 453 -------- uni_modules/uni-datetime-picker/package.json | 87 -- uni_modules/uni-datetime-picker/readme.md | 21 - 12 files changed, 3847 deletions(-) delete mode 100644 uni_modules/uni-datetime-picker/changelog.md delete mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue delete mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue delete mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json delete mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js delete mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json delete mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json delete mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue delete mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue delete mode 100644 uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js delete mode 100644 uni_modules/uni-datetime-picker/package.json delete mode 100644 uni_modules/uni-datetime-picker/readme.md diff --git a/uni_modules/uni-datetime-picker/changelog.md b/uni_modules/uni-datetime-picker/changelog.md deleted file mode 100644 index 1e82f46..0000000 --- a/uni_modules/uni-datetime-picker/changelog.md +++ /dev/null @@ -1,140 +0,0 @@ -## 2.2.24(2023-06-02) -- 修复 部分情况修改时间,开始、结束时间显示异常的Bug [详情](https://ask.dcloud.net.cn/question/171146) -- 优化 当前月可以选择上月、下月的日期 -## 2.2.23(2023-05-02) -- 修复 部分情况修改时间,开始时间未更新 [详情](https://github.com/dcloudio/uni-ui/issues/737) -- 修复 部分平台及设备第一次点击无法显示弹框 -- 修复 ios 日期格式未补零显示及使用异常 [详情](https://ask.dcloud.net.cn/question/162979) -## 2.2.22(2023-03-30) -- 修复 日历 picker 修改年月后,自动选中当月1日 [详情](https://ask.dcloud.net.cn/question/165937) -- 修复 小程序端 低版本 ios NaN [详情](https://ask.dcloud.net.cn/question/162979) -## 2.2.21(2023-02-20) -- 修复 firefox 浏览器显示区域点击无法拉起日历弹框的Bug [详情](https://ask.dcloud.net.cn/question/163362) -## 2.2.20(2023-02-17) -- 优化 值为空依然选中当天问题 -- 优化 提供 default-value 属性支持配置选择器打开时默认显示的时间 -- 优化 非范围选择未选择日期时间,点击确认按钮选中当前日期时间 -- 优化 字节小程序日期时间范围选择,底部日期换行问题 -## 2.2.19(2023-02-09) -- 修复 2.2.18 引起范围选择配置 end 选择无效的Bug [详情](https://github.com/dcloudio/uni-ui/issues/686) -## 2.2.18(2023-02-08) -- 修复 移动端范围选择change事件触发异常的Bug [详情](https://github.com/dcloudio/uni-ui/issues/684) -- 优化 PC端输入日期格式错误时返回当前日期时间 -- 优化 PC端输入日期时间超出 start、end 限制的Bug -- 优化 移动端日期时间范围用法时间展示不完整问题 -## 2.2.17(2023-02-04) -- 修复 小程序端绑定 Date 类型报错的Bug [详情](https://github.com/dcloudio/uni-ui/issues/679) -- 修复 vue3 time-picker 无法显示绑定时分秒的Bug -## 2.2.16(2023-02-02) -- 修复 字节小程序报错的Bug -## 2.2.15(2023-02-02) -- 修复 某些情况切换月份错误的Bug -## 2.2.14(2023-01-30) -- 修复 某些情况切换月份错误的Bug [详情](https://ask.dcloud.net.cn/question/162033) -## 2.2.13(2023-01-10) -- 修复 多次加载组件造成内存占用的Bug -## 2.2.12(2022-12-01) -- 修复 vue3 下 i18n 国际化初始值不正确的Bug -## 2.2.11(2022-09-19) -- 修复 支付宝小程序样式错乱的Bug [详情](https://github.com/dcloudio/uni-app/issues/3861) -## 2.2.10(2022-09-19) -- 修复 反向选择日期范围,日期显示异常的Bug [详情](https://ask.dcloud.net.cn/question/153401?item_id=212892&rf=false) -## 2.2.9(2022-09-16) -- 可以使用 uni-scss 控制主题色 -## 2.2.8(2022-09-08) -- 修复 close事件无效的Bug -## 2.2.7(2022-09-05) -- 修复 移动端 maskClick 无效的Bug [详情](https://ask.dcloud.net.cn/question/140824) -## 2.2.6(2022-06-30) -- 优化 组件样式,调整了组件图标大小、高度、颜色等,与uni-ui风格保持一致 -## 2.2.5(2022-06-24) -- 修复 日历顶部年月及底部确认未国际化的Bug -## 2.2.4(2022-03-31) -- 修复 Vue3 下动态赋值,单选类型未响应的Bug -## 2.2.3(2022-03-28) -- 修复 Vue3 下动态赋值未响应的Bug -## 2.2.2(2021-12-10) -- 修复 clear-icon 属性在小程序平台不生效的Bug -## 2.2.1(2021-12-10) -- 修复 日期范围选在小程序平台,必须多点击一次才能取消选中状态的Bug -## 2.2.0(2021-11-19) -- 优化 组件UI,并提供设计资源 [详情](https://uniapp.dcloud.io/component/uniui/resource) -- 文档迁移 [https://uniapp.dcloud.io/component/uniui/uni-datetime-picker](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker) -## 2.1.5(2021-11-09) -- 新增 提供组件设计资源,组件样式调整 -## 2.1.4(2021-09-10) -- 修复 hide-second 在移动端的Bug -- 修复 单选赋默认值时,赋值日期未高亮的Bug -- 修复 赋默认值时,移动端未正确显示时间的Bug -## 2.1.3(2021-09-09) -- 新增 hide-second 属性,支持只使用时分,隐藏秒 -## 2.1.2(2021-09-03) -- 优化 取消选中时(范围选)直接开始下一次选择, 避免多点一次 -- 优化 移动端支持清除按钮,同时支持通过 ref 调用组件的 clear 方法 -- 优化 调整字号大小,美化日历界面 -- 修复 因国际化导致的 placeholder 失效的Bug -## 2.1.1(2021-08-24) -- 新增 支持国际化 -- 优化 范围选择器在 pc 端过宽的问题 -## 2.1.0(2021-08-09) -- 新增 适配 vue3 -## 2.0.19(2021-08-09) -- 新增 支持作为 uni-forms 子组件相关功能 -- 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的Bug -## 2.0.18(2021-08-05) -- 修复 type 属性动态赋值无效的Bug -- 修复 ‘确认’按钮被 tabbar 遮盖 bug -- 修复 组件未赋值时范围选左、右日历相同的Bug -## 2.0.17(2021-08-04) -- 修复 范围选未正确显示当前值的Bug -- 修复 h5 平台(移动端)报错 'cale' of undefined 的Bug -## 2.0.16(2021-07-21) -- 新增 return-type 属性支持返回 date 日期对象 -## 2.0.15(2021-07-14) -- 修复 单选日期类型,初始赋值后不在当前日历的Bug -- 新增 clearIcon 属性,显示框的清空按钮可配置显示隐藏(仅 pc 有效) -- 优化 移动端移除显示框的清空按钮,无实际用途 -## 2.0.14(2021-07-14) -- 修复 组件赋值为空,界面未更新的Bug -- 修复 start 和 end 不能动态赋值的Bug -- 修复 范围选类型,用户选择后再次选择右侧日历(结束日期)显示不正确的Bug -## 2.0.13(2021-07-08) -- 修复 范围选择不能动态赋值的Bug -## 2.0.12(2021-07-08) -- 修复 范围选择的初始时间在一个月内时,造成无法选择的bug -## 2.0.11(2021-07-08) -- 优化 弹出层在超出视窗边缘定位不准确的问题 -## 2.0.10(2021-07-08) -- 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的Bug -- 优化 弹出层在超出视窗边缘被遮盖的问题 -## 2.0.9(2021-07-07) -- 新增 maskClick 事件 -- 修复 特殊情况日历 rpx 布局错误的Bug,rpx -> px -- 修复 范围选择时清空返回值不合理的bug,['', ''] -> [] -## 2.0.8(2021-07-07) -- 新增 日期时间显示框支持插槽 -## 2.0.7(2021-07-01) -- 优化 添加 uni-icons 依赖 -## 2.0.6(2021-05-22) -- 修复 图标在小程序上不显示的Bug -- 优化 重命名引用组件,避免潜在组件命名冲突 -## 2.0.5(2021-05-20) -- 优化 代码目录扁平化 -## 2.0.4(2021-05-12) -- 新增 组件示例地址 -## 2.0.3(2021-05-10) -- 修复 ios 下不识别 '-' 日期格式的Bug -- 优化 pc 下弹出层添加边框和阴影 -## 2.0.2(2021-05-08) -- 修复 在 admin 中获取弹出层定位错误的bug -## 2.0.1(2021-05-08) -- 修复 type 属性向下兼容,默认值从 date 变更为 datetime -## 2.0.0(2021-04-30) -- 支持日历形式的日期+时间的范围选择 - > 注意:此版本不向后兼容,不再支持单独时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker) -## 1.0.6(2021-03-18) -- 新增 hide-second 属性,时间支持仅选择时、分 -- 修复 选择跟显示的日期不一样的Bug -- 修复 chang事件触发2次的Bug -- 修复 分、秒 end 范围错误的Bug -- 优化 更好的 nvue 适配 diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue deleted file mode 100644 index 8f3c461..0000000 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue +++ /dev/null @@ -1,177 +0,0 @@ - - - - - diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue deleted file mode 100644 index 7924606..0000000 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue +++ /dev/null @@ -1,929 +0,0 @@ - - - - - diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json deleted file mode 100644 index 56cd0a6..0000000 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "uni-datetime-picker.selectDate": "select date", - "uni-datetime-picker.selectTime": "select time", - "uni-datetime-picker.selectDateTime": "select date and time", - "uni-datetime-picker.startDate": "start date", - "uni-datetime-picker.endDate": "end date", - "uni-datetime-picker.startTime": "start time", - "uni-datetime-picker.endTime": "end time", - "uni-datetime-picker.ok": "ok", - "uni-datetime-picker.clear": "clear", - "uni-datetime-picker.cancel": "cancel", - "uni-datetime-picker.year": "-", - "uni-datetime-picker.month": "", - "uni-calender.MON": "MON", - "uni-calender.TUE": "TUE", - "uni-calender.WED": "WED", - "uni-calender.THU": "THU", - "uni-calender.FRI": "FRI", - "uni-calender.SAT": "SAT", - "uni-calender.SUN": "SUN", - "uni-calender.confirm": "confirm" -} diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js deleted file mode 100644 index fa8f0f3..0000000 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import en from './en.json' -import zhHans from './zh-Hans.json' -import zhHant from './zh-Hant.json' -export default { - en, - 'zh-Hans': zhHans, - 'zh-Hant': zhHant -} diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json deleted file mode 100644 index d2df5e7..0000000 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "uni-datetime-picker.selectDate": "选择日期", - "uni-datetime-picker.selectTime": "选择时间", - "uni-datetime-picker.selectDateTime": "选择日期时间", - "uni-datetime-picker.startDate": "开始日期", - "uni-datetime-picker.endDate": "结束日期", - "uni-datetime-picker.startTime": "开始时间", - "uni-datetime-picker.endTime": "结束时间", - "uni-datetime-picker.ok": "确定", - "uni-datetime-picker.clear": "清除", - "uni-datetime-picker.cancel": "取消", - "uni-datetime-picker.year": "年", - "uni-datetime-picker.month": "月", - "uni-calender.SUN": "日", - "uni-calender.MON": "一", - "uni-calender.TUE": "二", - "uni-calender.WED": "三", - "uni-calender.THU": "四", - "uni-calender.FRI": "五", - "uni-calender.SAT": "六", - "uni-calender.confirm": "确认" -} \ No newline at end of file diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json deleted file mode 100644 index d23fa3c..0000000 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "uni-datetime-picker.selectDate": "選擇日期", - "uni-datetime-picker.selectTime": "選擇時間", - "uni-datetime-picker.selectDateTime": "選擇日期時間", - "uni-datetime-picker.startDate": "開始日期", - "uni-datetime-picker.endDate": "結束日期", - "uni-datetime-picker.startTime": "開始时间", - "uni-datetime-picker.endTime": "結束时间", - "uni-datetime-picker.ok": "確定", - "uni-datetime-picker.clear": "清除", - "uni-datetime-picker.cancel": "取消", - "uni-datetime-picker.year": "年", - "uni-datetime-picker.month": "月", - "uni-calender.SUN": "日", - "uni-calender.MON": "一", - "uni-calender.TUE": "二", - "uni-calender.WED": "三", - "uni-calender.THU": "四", - "uni-calender.FRI": "五", - "uni-calender.SAT": "六", - "uni-calender.confirm": "確認" -} \ No newline at end of file diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue deleted file mode 100644 index f03dff6..0000000 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue +++ /dev/null @@ -1,934 +0,0 @@ - - - - - diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue deleted file mode 100644 index 7650d0f..0000000 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue +++ /dev/null @@ -1,1032 +0,0 @@ - - - - diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js deleted file mode 100644 index 3ea5bb1..0000000 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js +++ /dev/null @@ -1,453 +0,0 @@ -class Calendar { - constructor({ - selected, - startDate, - endDate, - range, - } = {}) { - // 当前日期 - this.date = this.getDateObj(new Date()) // 当前初入日期 - // 打点信息 - this.selected = selected || []; - // 起始时间 - this.startDate = startDate - // 终止时间 - this.endDate = endDate - // 是否范围选择 - this.range = range - // 多选状态 - this.cleanMultipleStatus() - // 每周日期 - this.weeks = {} - this.lastHover = false - } - /** - * 设置日期 - * @param {Object} date - */ - setDate(date) { - const selectDate = this.getDateObj(date) - this.getWeeks(selectDate.fullDate) - } - - /** - * 清理多选状态 - */ - cleanMultipleStatus() { - this.multipleStatus = { - before: '', - after: '', - data: [] - } - } - - setStartDate(startDate) { - this.startDate = startDate - } - - setEndDate(endDate) { - this.endDate = endDate - } - - getPreMonthObj(date){ - date = fixIosDateFormat(date) - date = new Date(date) - - const oldMonth = date.getMonth() - date.setMonth(oldMonth - 1) - const newMonth = date.getMonth() - if(oldMonth !== 0 && newMonth - oldMonth === 0){ - date.setMonth(newMonth - 1) - } - return this.getDateObj(date) - } - getNextMonthObj(date){ - date = fixIosDateFormat(date) - date = new Date(date) - - const oldMonth = date.getMonth() - date.setMonth(oldMonth + 1) - const newMonth = date.getMonth() - if(newMonth - oldMonth > 1){ - date.setMonth(newMonth - 1) - } - return this.getDateObj(date) - } - - /** - * 获取指定格式Date对象 - */ - getDateObj(date) { - date = fixIosDateFormat(date) - date = new Date(date) - - return { - fullDate: getDate(date), - year: date.getFullYear(), - month: addZero(date.getMonth() + 1), - date: addZero(date.getDate()), - day: date.getDay() - } - } - - /** - * 获取上一个月日期集合 - */ - getPreMonthDays(amount, dateObj) { - const result = [] - for (let i = amount - 1; i >= 0; i--) { - const month = dateObj.month > 1 ? dateObj.month -1 : 12 - const year = month === 12 ? dateObj.year - 1 : dateObj.year - const date = new Date(year,month,-i).getDate() - const fullDate = `${year}-${addZero(month)}-${addZero(date)}` - let multiples = this.multipleStatus.data - let multiplesStatus = -1 - if (this.range && multiples) { - multiplesStatus = multiples.findIndex((item) => { - return this.dateEqual(item, fullDate) - }) - } - const checked = multiplesStatus !== -1 - // 获取打点信息 - const extraInfo = this.selected && this.selected.find((item) => { - if (this.dateEqual(fullDate, item.date)) { - return item - } - }) - result.push({ - fullDate, - year, - month, - date, - multiple: this.range ? checked : false, - beforeMultiple: this.isLogicBefore(fullDate, this.multipleStatus.before, this.multipleStatus.after), - afterMultiple: this.isLogicAfter(fullDate, this.multipleStatus.before, this.multipleStatus.after), - disable: (this.startDate && !dateCompare(this.startDate, fullDate)) || (this.endDate && !dateCompare(fullDate,this.endDate)), - isToday: fullDate === this.date.fullDate, - userChecked: false, - extraInfo - }) - } - return result - } - /** - * 获取本月日期集合 - */ - getCurrentMonthDays(amount, dateObj) { - const result = [] - const fullDate = this.date.fullDate - for (let i = 1; i <= amount; i++) { - const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i)}` - const isToday = fullDate === currentDate - // 获取打点信息 - const extraInfo = this.selected && this.selected.find((item) => { - if (this.dateEqual(currentDate, item.date)) { - return item - } - }) - - // 日期禁用 - let disableBefore = true - let disableAfter = true - if (this.startDate) { - disableBefore = dateCompare(this.startDate, currentDate) - } - - if (this.endDate) { - disableAfter = dateCompare(currentDate, this.endDate) - } - - let multiples = this.multipleStatus.data - let multiplesStatus = -1 - if (this.range && multiples) { - multiplesStatus = multiples.findIndex((item) => { - return this.dateEqual(item, currentDate) - }) - } - const checked = multiplesStatus !== -1 - - result.push({ - fullDate: currentDate, - year: dateObj.year, - month: dateObj.month, - date: i, - multiple: this.range ? checked : false, - beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after), - afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after), - disable: (this.startDate && !dateCompare(this.startDate, currentDate)) || (this.endDate && !dateCompare(currentDate,this.endDate)), - isToday, - userChecked: false, - extraInfo - }) - } - return result - } - /** - * 获取下一个月日期集合 - */ - _getNextMonthDays(amount, dateObj) { - const result = [] - const month = dateObj.month + 1 - for (let i = 1; i <= amount; i++) { - const month = dateObj.month === 12 ? 1 : dateObj.month*1 + 1 - const year = month === 1 ? dateObj.year + 1 : dateObj.year - const fullDate = `${year}-${addZero(month)}-${addZero(i)}` - let multiples = this.multipleStatus.data - let multiplesStatus = -1 - if (this.range && multiples) { - multiplesStatus = multiples.findIndex((item) => { - return this.dateEqual(item, fullDate) - }) - } - const checked = multiplesStatus !== -1 - // 获取打点信息 - const extraInfo = this.selected && this.selected.find((item) => { - if (this.dateEqual(fullDate, item.date)) { - return item - } - }) - result.push({ - fullDate, - year, - date: i, - month, - multiple: this.range ? checked : false, - beforeMultiple: this.isLogicBefore(fullDate, this.multipleStatus.before, this.multipleStatus.after), - afterMultiple: this.isLogicAfter(fullDate, this.multipleStatus.before, this.multipleStatus.after), - disable: (this.startDate && !dateCompare(this.startDate, fullDate)) || (this.endDate && !dateCompare(fullDate,this.endDate)), - isToday: fullDate === this.date.fullDate, - userChecked: false, - extraInfo - }) - } - return result - } - - /** - * 获取当前日期详情 - * @param {Object} date - */ - getInfo(date) { - if (!date) { - date = new Date() - } - - return this.calendar.find(item => item.fullDate === this.getDateObj(date).fullDate) - } - - /** - * 比较时间是否相等 - */ - dateEqual(before, after) { - before = new Date(fixIosDateFormat(before)) - after = new Date(fixIosDateFormat(after)) - return before.valueOf() === after.valueOf() - } - - /** - * 比较真实起始日期 - */ - - isLogicBefore(currentDate, before, after) { - let logicBefore = before - if (before && after) { - logicBefore = dateCompare(before, after) ? before : after - } - return this.dateEqual(logicBefore, currentDate) - } - - isLogicAfter(currentDate, before, after) { - let logicAfter = after - if (before && after) { - logicAfter = dateCompare(before, after) ? after : before - } - return this.dateEqual(logicAfter, currentDate) - } - - /** - * 获取日期范围内所有日期 - * @param {Object} begin - * @param {Object} end - */ - geDateAll(begin, end) { - var arr = [] - var ab = begin.split('-') - var ae = end.split('-') - var db = new Date() - db.setFullYear(ab[0], ab[1] - 1, ab[2]) - var de = new Date() - de.setFullYear(ae[0], ae[1] - 1, ae[2]) - var unixDb = db.getTime() - 24 * 60 * 60 * 1000 - var unixDe = de.getTime() - 24 * 60 * 60 * 1000 - for (var k = unixDb; k <= unixDe;) { - k = k + 24 * 60 * 60 * 1000 - arr.push(this.getDateObj(new Date(parseInt(k))).fullDate) - } - return arr - } - - /** - * 获取多选状态 - */ - setMultiple(fullDate) { - if (!this.range) return - - let { - before, - after - } = this.multipleStatus - if (before && after) { - if (!this.lastHover) { - this.lastHover = true - return - } - this.multipleStatus.before = fullDate - this.multipleStatus.after = '' - this.multipleStatus.data = [] - this.multipleStatus.fulldate = '' - this.lastHover = false - } else { - if (!before) { - this.multipleStatus.before = fullDate - this.lastHover = false - } else { - this.multipleStatus.after = fullDate - if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { - this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus - .after); - } else { - this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus - .before); - } - this.lastHover = true - } - } - this.getWeeks(fullDate) - } - - /** - * 鼠标 hover 更新多选状态 - */ - setHoverMultiple(fullDate) { - if (!this.range || this.lastHover) return - - const { before } = this.multipleStatus - - if (!before) { - this.multipleStatus.before = fullDate - } else { - this.multipleStatus.after = fullDate - if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { - this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after); - } else { - this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before); - } - } - this.getWeeks(fullDate) - } - - /** - * 更新默认值多选状态 - */ - setDefaultMultiple(before, after) { - this.multipleStatus.before = before - this.multipleStatus.after = after - if (before && after) { - if (dateCompare(before, after)) { - this.multipleStatus.data = this.geDateAll(before, after); - this.getWeeks(after) - } else { - this.multipleStatus.data = this.geDateAll(after, before); - this.getWeeks(before) - } - } - } - - /** - * 获取每周数据 - * @param {Object} dateData - */ - getWeeks(dateData) { - const { - year, - month, - } = this.getDateObj(dateData) - - const preMonthDayAmount = new Date(year, month - 1, 1).getDay() - const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData)) - - const currentMonthDayAmount = new Date(year, month, 0).getDate() - const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData)) - - const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount - const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData)) - - const calendarDays = [...preMonthDays, ...currentMonthDays, ...nextMonthDays] - - const weeks = new Array(6) - for (let i = 0; i < calendarDays.length; i++) { - const index = Math.floor(i / 7) - if(!weeks[index]){ - weeks[index] = new Array(7) - } - weeks[index][i % 7] = calendarDays[i] - } - - this.calendar = calendarDays - this.weeks = weeks - } -} - -function getDateTime(date, hideSecond){ - return `${getDate(date)} ${getTime(date, hideSecond)}` -} - -function getDate(date) { - date = fixIosDateFormat(date) - date = new Date(date) - const year = date.getFullYear() - const month = date.getMonth()+1 - const day = date.getDate() - return `${year}-${addZero(month)}-${addZero(day)}` -} - -function getTime(date, hideSecond){ - date = fixIosDateFormat(date) - date = new Date(date) - const hour = date.getHours() - const minute = date.getMinutes() - const second = date.getSeconds() - return hideSecond ? `${addZero(hour)}:${addZero(minute)}` : `${addZero(hour)}:${addZero(minute)}:${addZero(second)}` -} - -function addZero(num) { - if(num < 10){ - num = `0${num}` - } - return num -} - -function getDefaultSecond(hideSecond) { - return hideSecond ? '00:00' : '00:00:00' -} - -function dateCompare(startDate, endDate) { - startDate = new Date(fixIosDateFormat(startDate)) - endDate = new Date(fixIosDateFormat(endDate)) - return startDate <= endDate -} - -function checkDate(date){ - const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g - return date.match(dateReg) -} - -const dateTimeReg = /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])( [0-5]?[0-9]:[0-5]?[0-9]:[0-5]?[0-9])?$/ -function fixIosDateFormat(value) { - if (typeof value === 'string' && dateTimeReg.test(value)) { - value = value.replace(/-/g, '/') - } - return value -} - -export {Calendar, getDateTime, getDate, getTime, addZero, getDefaultSecond, dateCompare, checkDate, fixIosDateFormat} \ No newline at end of file diff --git a/uni_modules/uni-datetime-picker/package.json b/uni_modules/uni-datetime-picker/package.json deleted file mode 100644 index cabb668..0000000 --- a/uni_modules/uni-datetime-picker/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "id": "uni-datetime-picker", - "displayName": "uni-datetime-picker 日期选择器", - "version": "2.2.24", - "description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择", - "keywords": [ - "uni-datetime-picker", - "uni-ui", - "uniui", - "日期时间选择器", - "日期时间" -], - "repository": "https://github.com/dcloudio/uni-ui", - "engines": { - "HBuilderX": "" - }, - "directories": { - "example": "../../temps/example_temps" - }, -"dcloudext": { - "sale": { - "regular": { - "price": "0.00" - }, - "sourcecode": { - "price": "0.00" - } - }, - "contact": { - "qq": "" - }, - "declaration": { - "ads": "无", - "data": "无", - "permissions": "无" - }, - "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", - "type": "component-vue" - }, - "uni_modules": { - "dependencies": [ - "uni-scss", - "uni-icons" - ], - "encrypt": [], - "platforms": { - "cloud": { - "tcb": "y", - "aliyun": "y" - }, - "client": { - "App": { - "app-vue": "y", - "app-nvue": "n" - }, - "H5-mobile": { - "Safari": "y", - "Android Browser": "y", - "微信浏览器(Android)": "y", - "QQ浏览器(Android)": "y" - }, - "H5-pc": { - "Chrome": "y", - "IE": "y", - "Edge": "y", - "Firefox": "y", - "Safari": "y" - }, - "小程序": { - "微信": "y", - "阿里": "y", - "百度": "y", - "字节跳动": "y", - "QQ": "y" - }, - "快应用": { - "华为": "u", - "联盟": "u" - }, - "Vue": { - "vue2": "y", - "vue3": "y" - } - } - } - } -} diff --git a/uni_modules/uni-datetime-picker/readme.md b/uni_modules/uni-datetime-picker/readme.md deleted file mode 100644 index 162fbef..0000000 --- a/uni_modules/uni-datetime-picker/readme.md +++ /dev/null @@ -1,21 +0,0 @@ - - -> `重要通知:组件升级更新 2.0.0 后,支持日期+时间范围选择,组件 ui 将使用日历选择日期,ui 变化较大,同时支持 PC 和 移动端。此版本不向后兼容,不再支持单独的时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker)。若仍需使用旧版本,可在插件市场下载*非uni_modules版本*,旧版本将不再维护` - -## DatetimePicker 时间选择器 - -> **组件名:uni-datetime-picker** -> 代码块: `uDatetimePicker` - - -该组件的优势是,支持**时间戳**输入和输出(起始时间、终止时间也支持时间戳),可**同时选择**日期和时间。 - -若只是需要单独选择日期和时间,不需要时间戳输入和输出,可使用原生的 picker 组件。 - -**_点击 picker 默认值规则:_** - -- 若设置初始值 value, 会显示在 picker 显示框中 -- 若无初始值 value,则初始值 value 为当前本地时间 Date.now(), 但不会显示在 picker 显示框中 - -### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker) -#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file