diff --git a/components/patched-calendar/header.vue b/components/patched-calendar/header.vue new file mode 100644 index 0000000..afb9f76 --- /dev/null +++ b/components/patched-calendar/header.vue @@ -0,0 +1,109 @@ + + + + + diff --git a/components/patched-calendar/month.vue b/components/patched-calendar/month.vue new file mode 100644 index 0000000..aafaaba --- /dev/null +++ b/components/patched-calendar/month.vue @@ -0,0 +1,632 @@ + + + + + diff --git a/components/patched-calendar/props.js b/components/patched-calendar/props.js new file mode 100644 index 0000000..87f019b --- /dev/null +++ b/components/patched-calendar/props.js @@ -0,0 +1,169 @@ +import { defineMixin } from 'uview-plus/libs/vue' +import defProps from 'uview-plus/libs/config/props.js' + +export const props = defineMixin({ + props: { + // 日历顶部标题 + title: { + type: String, + default: () => defProps.calendar.title + }, + // 是否显示标题 + showTitle: { + type: Boolean, + default: () => defProps.calendar.showTitle + }, + // 是否显示副标题 + showSubtitle: { + type: Boolean, + default: () => defProps.calendar.showSubtitle + }, + // 日期类型选择,single-选择单个日期,multiple-可以选择多个日期,range-选择日期范围 + mode: { + type: String, + default: () => defProps.calendar.mode + }, + // mode=range时,第一个日期底部的提示文字 + startText: { + type: String, + default: () => defProps.calendar.startText + }, + // mode=range时,最后一个日期底部的提示文字 + endText: { + type: String, + default: () => defProps.calendar.endText + }, + // 自定义列表 + customList: { + type: Array, + default: () => defProps.calendar.customList + }, + // 主题色,对底部按钮和选中日期有效 + color: { + type: String, + default: () => defProps.calendar.color + }, + // 最小的可选日期 + minDate: { + type: [String, Number], + default: () => defProps.calendar.minDate + }, + // 最大可选日期 + maxDate: { + type: [String, Number], + default: () => defProps.calendar.maxDate + }, + // 默认选中的日期,mode为multiple或range是必须为数组格式 + defaultDate: { + type: [Array, String, Date, null], + default: () => defProps.calendar.defaultDate + }, + // mode=multiple时,最多可选多少个日期 + maxCount: { + type: [String, Number], + default: () => defProps.calendar.maxCount + }, + // 日期行高 + rowHeight: { + type: [String, Number], + default: () => defProps.calendar.rowHeight + }, + // 日期格式化函数 + formatter: { + type: [Function, null], + default: () => defProps.calendar.formatter + }, + // 是否显示农历 + showLunar: { + type: Boolean, + default: () => defProps.calendar.showLunar + }, + // 是否显示月份背景色 + showMark: { + type: Boolean, + default: () => defProps.calendar.showMark + }, + // 确定按钮的文字 + confirmText: { + type: String, + default: () => defProps.calendar.confirmText + }, + // 确认按钮处于禁用状态时的文字 + confirmDisabledText: { + type: String, + default: () => defProps.calendar.confirmDisabledText + }, + // 是否显示日历弹窗 + show: { + type: Boolean, + default: () => defProps.calendar.show + }, + // 是否允许点击遮罩关闭日历 + closeOnClickOverlay: { + type: Boolean, + default: () => defProps.calendar.closeOnClickOverlay + }, + // 是否为只读状态,只读状态下禁止选择日期 + readonly: { + type: Boolean, + default: () => defProps.calendar.readonly + }, + // 是否展示确认按钮 + showConfirm: { + type: Boolean, + default: () => defProps.calendar.showConfirm + }, + // 日期区间最多可选天数,默认无限制,mode = range时有效 + maxRange: { + type: [Number, String], + default: () => defProps.calendar.maxRange + }, + // 范围选择超过最多可选天数时的提示文案,mode = range时有效 + rangePrompt: { + type: String, + default: () => defProps.calendar.rangePrompt + }, + // 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效 + showRangePrompt: { + type: Boolean, + default: () => defProps.calendar.showRangePrompt + }, + // 是否允许日期范围的起止时间为同一天,mode = range时有效 + allowSameDay: { + type: Boolean, + default: () => defProps.calendar.allowSameDay + }, + // 圆角值 + round: { + type: [Boolean, String, Number], + default: () => defProps.calendar.round + }, + // 最多展示月份数量 + monthNum: { + type: [Number, String], + default: 3 + }, + // 星期文案 + weekText: { + type: Array, + default: defProps.calendar.weekText + }, + forbidDays: { + type: Array, + default: defProps.calendar.forbidDays + }, + forbidDaysToast:{ + type: String, + default: defProps.calendar.forbidDaysToast + }, + monthFormat:{ + type: String, + default: defProps.calendar.monthFormat + }, + // 是否页面内展示 + pageInline:{ + type: Boolean, + default: defProps.calendar.pageInline + } + } +}) diff --git a/components/patched-calendar/u-calendar.vue b/components/patched-calendar/u-calendar.vue new file mode 100644 index 0000000..5a88a9c --- /dev/null +++ b/components/patched-calendar/u-calendar.vue @@ -0,0 +1,421 @@ + + + + + diff --git a/components/patched-calendar/util.js b/components/patched-calendar/util.js new file mode 100644 index 0000000..6303319 --- /dev/null +++ b/components/patched-calendar/util.js @@ -0,0 +1,86 @@ +import dayjs from 'uview-plus/components/u-datetime-picker/dayjs.esm.min.js'; +export default { + methods: { + // 设置月份数据 + setMonth() { + // 月初是周几 + const day = dayjs(this.date).date(1).day() + const start = day == 0 ? 6 : day - 1 + + // 本月天数 + const days = dayjs(this.date).endOf('month').format('D') + + // 上个月天数 + const prevDays = dayjs(this.date).endOf('month').subtract(1, 'month').format('D') + + // 日期数据 + const arr = [] + // 清空表格 + this.month = [] + + // 添加上月数据 + arr.push( + ...new Array(start).fill(1).map((e, i) => { + const day = prevDays - start + i + 1 + + return { + value: day, + disabled: true, + date: dayjs(this.date).subtract(1, 'month').date(day).format('YYYY-MM-DD') + } + }) + ) + + // 添加本月数据 + arr.push( + ...new Array(days - 0).fill(1).map((e, i) => { + const day = i + 1 + + return { + value: day, + date: dayjs(this.date).date(day).format('YYYY-MM-DD') + } + }) + ) + + // 添加下个月 + arr.push( + ...new Array(42 - days - start).fill(1).map((e, i) => { + const day = i + 1 + + return { + value: day, + disabled: true, + date: dayjs(this.date).add(1, 'month').date(day).format('YYYY-MM-DD') + } + }) + ) + + // 分割数组 + for (let n = 0; n < arr.length; n += 7) { + this.month.push( + arr.slice(n, n + 7).map((e, i) => { + e.index = i + n + + // 自定义信息 + const custom = this.customList.find((c) => c.date == e.date) + + // 农历 + if (this.lunar) { + const { + IDayCn, + IMonthCn + } = this.getLunar(e.date) + e.lunar = IDayCn == '初一' ? IMonthCn : IDayCn + } + + return { + ...e, + ...custom + } + }) + ) + } + } + } +} diff --git a/manifest.json b/manifest.json index 7cbd19c..a9d70ab 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "name" : "smarthome", + "name" : "SEC_Warehouse", "appid" : "", "description" : "", "versionName" : "1.0.0", diff --git a/pages.json b/pages.json index 445e240..a1c2ab3 100644 --- a/pages.json +++ b/pages.json @@ -57,15 +57,21 @@ "list": [ { "pagePath": "pages/index/index", - "text": "首页" + "text": "首页", + "iconPath": "static/tabbar/home.png", + "selectedIconPath": "static/tabbar/home-active.png" }, { "pagePath": "pages/event/index", - "text": "事件" + "text": "事件", + "iconPath": "static/tabbar/event.png", + "selectedIconPath": "static/tabbar/event-active.png" }, { "pagePath": "pages/mine/index", - "text": "我的" + "text": "我的", + "iconPath": "static/tabbar/mine.png", + "selectedIconPath": "static/tabbar/mine-active.png" } ] }, @@ -73,6 +79,7 @@ "easycom": { "autoscan": true, "custom": { + "^up-calendar$": "@/components/patched-calendar/u-calendar.vue", "^u-(.*)": "uview-plus/components/u-$1/u-$1.vue", "^up-(.*)": "uview-plus/components/u-$1/u-$1.vue" } diff --git a/pages/event/index.vue b/pages/event/index.vue index 0458dd1..b2df4bd 100644 --- a/pages/event/index.vue +++ b/pages/event/index.vue @@ -4,41 +4,554 @@ - - - + + + {{ sceneLabel }} + + + + + + {{ statusLabel }} + + + + + + {{ filters.timeText || '时间' }} + + + + + 调整筛选条件后的事件列表将在此展示 + + + + + + + 选择场所 + + + + + + + {{ opt.name }} + + + + + + + + + + + 选择状态 + + + + + + + {{ opt.name }} + + + + + + + + + + + + 选择时间范围 + + + + + + + + + + + + - diff --git a/pages/mine/index.vue b/pages/mine/index.vue index 805e80d..2625ae9 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -14,11 +14,8 @@ - - - diff --git a/static/tabbar/event-active.png b/static/tabbar/event-active.png new file mode 100644 index 0000000..7fff556 Binary files /dev/null and b/static/tabbar/event-active.png differ diff --git a/static/tabbar/event.png b/static/tabbar/event.png new file mode 100644 index 0000000..bcf343b Binary files /dev/null and b/static/tabbar/event.png differ diff --git a/static/tabbar/home-active.png b/static/tabbar/home-active.png new file mode 100644 index 0000000..20e780c Binary files /dev/null and b/static/tabbar/home-active.png differ diff --git a/static/tabbar/home.png b/static/tabbar/home.png new file mode 100644 index 0000000..a60c046 Binary files /dev/null and b/static/tabbar/home.png differ diff --git a/static/tabbar/mine-active.png b/static/tabbar/mine-active.png new file mode 100644 index 0000000..e2b9626 Binary files /dev/null and b/static/tabbar/mine-active.png differ diff --git a/static/tabbar/mine.png b/static/tabbar/mine.png new file mode 100644 index 0000000..a164689 Binary files /dev/null and b/static/tabbar/mine.png differ