yunshangxie/unpackage/dist/dev/.sourcemap/mp-weixin/tuniao-ui/components/tn-calendar/tn-calendar.js.map

1 line
36 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"sources":["webpack:///E:/云商会/云商会/tuniao-ui/components/tn-calendar/tn-calendar.vue?656a","webpack:///E:/云商会/云商会/tuniao-ui/components/tn-calendar/tn-calendar.vue?2a06","webpack:///E:/云商会/云商会/tuniao-ui/components/tn-calendar/tn-calendar.vue?2570","webpack:///E:/云商会/云商会/tuniao-ui/components/tn-calendar/tn-calendar.vue?1453","uni-app:///tuniao-ui/components/tn-calendar/tn-calendar.vue","webpack:///E:/云商会/云商会/tuniao-ui/components/tn-calendar/tn-calendar.vue?4a65","webpack:///E:/云商会/云商会/tuniao-ui/components/tn-calendar/tn-calendar.vue?f8ba"],"names":["name","props","value","type","default","mode","changeYear","changeMonth","maxYear","minYear","minDate","maxDate","monthArrowColor","yearArrowColor","color","activeBgColor","activeColor","rangeBgColor","rangeColor","startText","endText","btnColor","lunarColor","isActiveCurrent","isChange","showLunar","toolTips","borderRadius","safeAreaInsetBottom","maskCloseable","zIndex","closeBtn","computed","dateChange","elIndex","colorValue","data","weekday","weekdayArr","weekDayZh","days","daysArr","year","month","day","startYear","startMonth","startDay","endYear","endMonth","endDay","today","activeDate","startDate","endDate","min","max","dateTitle","chooseStart","watch","created","methods","init","changeMonthHandler","changeYearHandler","dateClick","changeData","handleBtnClick","isToday","week","date","switch","startWeek","endWeek","disabledChoose","flag","checkRange","uni","title","icon","overstep","initDate","handleDaysArr","bottomInfo","getMonthDay","getMonthFirstWeekDay","getWeekText","generateArray","formatNumber","close"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAoI;AACpI;AAC+D;AACL;AACsC;;;AAGhG;AAC+L;AAC/L,gBAAgB,wMAAU;AAC1B,EAAE,iFAAM;AACR,EAAE,kGAAM;AACR,EAAE,2GAAe;AACjB;AACA;AACA;AACA;AACA;AACA,EAAE,sGAAU;AACZ;AACA;;AAEA;AACe,gF;;;;;;;;;;;;ACvBf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA,aAAa,4QAEN;AACP,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,MAAM;AACN;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACrDA;AAAA;AAAA;AAAA;AAAuuB,CAAgB,4vBAAG,EAAC,C;;;;;;;;;;;;;;;;;;;AC4F3vB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAEA;EACAA;EACAC;IACA;IACAC;MACAC;MACAC;IACA;IACA;IACA;IACAC;MACAF;MACAC;IACA;IACA;IACAE;MACAH;MACAC;IACA;IACA;IACAG;MACAJ;MACAC;IACA;IACA;IACAI;MACAL;MACAC;IACA;IACA;IACAK;MACAN;MACAC;IACA;IACA;IACAM;MACAP;MACAC;IACA;IACA;IACAO;MACAR;MACAC;IACA;IACA;IACAQ;MACAT;MACAC;IACA;IACA;IACAS;MACAV;MACAC;IACA;IACA;IACAU;MACAX;MACAC;IACA;IACA;IACAW;MACAZ;MACAC;IACA;IACA;IACAY;MACAb;MACAC;IACA;IACA;IACAa;MACAd;MACAC;IACA;IACA;IACAc;MACAf;MACAC;IACA;IACA;IACAe;MACAhB;MACAC;IACA;IACA;IACAgB;MACAjB;MACAC;IACA;IACA;IACAiB;MACAlB;MACAC;IACA;IACA;IACAkB;MACAnB;MACAC;IACA;IACA;IACAmB;MACApB;MACAC;IACA;IACA;IACAoB;MACArB;MACAC;IACA;IACA;IACAqB;MACAtB;MACAC;IACA;IACA;IACAsB;MACAvB;MACAC;IACA;IACA;IACAuB;MACAxB;MACAC;IACA;IACA;IACAwB;MACAzB;MACAC;IACA;IACA;IACAyB;MACA1B;MACAC;IACA;IACA;IACA0B;MACA3B;MACAC;IACA;IACA;IACA2B;MACA5B;MACAC;IACA;EACA;EACA4B;IACAC;MACA;IACA;IACAC;MACA;IACA;IACAC;MAAA;MACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;UACArB;QACA;UACAA;QACA;QACA;MACA;IACA;EACA;EACAsB;IACA;MACA;MACAC;MACAC;MACA;MACAC;MACA;MACAC;MACAC;MACAC;MACAC;MACAC;MACAC;MACAC;MACAC;MACAC;MACAC;MACAC;MACAC;MACAC;MACAC;MACAC;MACAC;MACAC;MACA;MACAC;MACA;MACAC;IACA;EACA;EACAC;IACA1B;MACA;IACA;EACA;EACA2B;IACA;EACA;EACAC;IACA;IACAC;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;IACA;IACA;IACAC;MACA;QACA;QACA;QACA;UACA;UACA;UACA;QACA;MACA;QACA;QACA;QACA;UACA;UACA;UACA;QACA;MACA;IACA;IACA;IACAC;MACA;MACA;QACA;QACA;MACA;IACA;IACA;IACAC;MACArB;MACA;QACA;QACA;QACA;UACA;QACA;UACA;UACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;UACA;YACA;YACA;YACA;YACA;YACA;UACA;QACA;QACA;MACA;IACA;IACA;IACAsB;MACA;MACA;MACA;MACA;MACA;MACA;QACA;MACA;IACA;IACA;IACAC;MACA;QACA;MACA;MACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;UACAC;QACA;QACA;UACA1B;UACAC;UACAC;UACAJ;UACA6B;UACAD;UACAE;UACA;UACAC;QACA;MACA;QACA;QAEA;QACA;QACA;QACA;QAEA;QACA;QACA;QACA;QAEA;UACA1B;UACAC;UACAC;UACAM;UACAmB;UACAxB;UACAC;UACAC;UACAI;UACAmB;QACA;MACA;IACA;IACA;IACAC;MACA;MACA;MACA;MACA;MACA;MACA;QACAC;MACA;MACA;IACA;IACA;IACAC;MACA;MACA;QACAC;UACAC;UACAC;QACA;QACAC;MACA;MACA;IACA;IACA;IACAC;MACA;MACA;QACAvC;QACAC;QACAC;MACA;IACA;IACA;IACAsC;MAAA;MACA;MACA;QACA;QACA;QACA,IACA,gDACA,+EACA;UACApE;QACA;QACA;UACA;YACAqE;UACA;UACA;YACAA;UACA;QACA;QAEA;UACAvC;UACA9B;UACAqE;QACA;MACA;MACA;IACA;IACA;IACAC;MACA;IACA;IACA;IACAC;MACA;IACA;IACA;IACAC;MACAhB;MACA;MACA;IACA;IACA;IACAiB;MACA;IACA;IACA;IACAC;MACA;IACA;IACA;IACAC;MACA;IACA;EACA;AACA;AAAA,2B;;;;;;;;;;;;;AC3hBA;AAAA;AAAA;AAAA;AAAk5C,CAAgB,+2CAAG,EAAC,C;;;;;;;;;;;ACAt6C;AACA,OAAO,KAAU,EAAE,kBAKd","file":"tuniao-ui/components/tn-calendar/tn-calendar.js","sourcesContent":["import { render, staticRenderFns, recyclableRender, components } from \"./tn-calendar.vue?vue&type=template&id=26db8440&scoped=true&\"\nvar renderjs\nimport script from \"./tn-calendar.vue?vue&type=script&lang=js&\"\nexport * from \"./tn-calendar.vue?vue&type=script&lang=js&\"\nimport style0 from \"./tn-calendar.vue?vue&type=style&index=0&id=26db8440&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\runtime\\\\componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"26db8440\",\n null,\n false,\n components,\n renderjs\n)\n\ncomponent.options.__file = \"tuniao-ui/components/tn-calendar/tn-calendar.vue\"\nexport default component.exports","export * from \"-!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\loaders\\\\templateLoader.js??vue-loader-options!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--17-0!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\template.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-uni-app-loader\\\\page-meta.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./tn-calendar.vue?vue&type=template&id=26db8440&scoped=true&\"","var components\ntry {\n components = {\n tnPopup: function () {\n return import(\n /* webpackChunkName: \"tuniao-ui/components/tn-popup/tn-popup\" */ \"@/tuniao-ui/components/tn-popup/tn-popup.vue\"\n )\n },\n }\n} catch (e) {\n if (\n e.message.indexOf(\"Cannot find module\") !== -1 &&\n e.message.indexOf(\".vue\") !== -1\n ) {\n console.error(e.message)\n console.error(\"1. 排查组件名称拼写是否正确\")\n console.error(\n \"2. 排查组件是否符合 easycom 规范文档https://uniapp.dcloud.net.cn/collocation/pages?id=easycom\"\n )\n console.error(\n \"3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件\"\n )\n } else {\n throw e\n }\n}\nvar render = function () {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n var l0 = _vm.__map(_vm.daysArr, function (item, index) {\n var $orig = _vm.__get_orig(item)\n var m0 = _vm.disabledChoose(_vm.year, _vm.month, index + 1)\n var m1 = _vm.colorValue(index, \"bg\")\n var m2 = _vm.colorValue(index, \"text\")\n return {\n $orig: $orig,\n m0: m0,\n m1: m1,\n m2: m2,\n }\n })\n _vm.$mp.data = Object.assign(\n {},\n {\n $root: {\n l0: l0,\n },\n }\n )\n}\nvar recyclableRender = false\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns, recyclableRender, components }","import mod from \"-!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--13-1!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\script.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./tn-calendar.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--13-1!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\script.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./tn-calendar.vue?vue&type=script&lang=js&\"","<template>\r\n <tn-popup\r\n v-model=\"value\"\r\n mode=\"bottom\"\r\n :popup=\"false\"\r\n length=\"auto\"\r\n :borderRadius=\"borderRadius\"\r\n :safeAreaInsetBottom=\"safeAreaInsetBottom\"\r\n :maskCloseable=\"maskCloseable\"\r\n :closeBtn=\"closeBtn\"\r\n :zIndex=\"elIndex\"\r\n @close=\"close\"\r\n >\r\n <view class=\"tn-calendar-class tn-calendar\">\r\n <!-- 头部 -->\r\n <view class=\"tn-calendar__header\">\r\n <view v-if=\"!$slots.tooltip || !$slots.$tooltip\" class=\"tn-calendar__header__text\">\r\n {{ toolTips }}\r\n </view>\r\n <view v-else>\r\n <slot name=\"tooltip\"></slot>\r\n </view>\r\n </view>\r\n \r\n <!-- 操作提示信息 -->\r\n <view class=\"tn-calendar__action\">\r\n <view v-if=\"changeYear\" class=\"tn-calendar__action__icon\" :style=\"{backgroundColor: yearArrowColor}\" @tap.stop=\"changeYearHandler(false)\">\r\n <view><text class=\"tn-icon-left\"></text></view>\r\n </view>\r\n <view v-if=\"changeMonth\" class=\"tn-calendar__action__icon\" :style=\"{backgroundColor: monthArrowColor}\" @tap.stop=\"changeMonthHandler(false)\">\r\n <view><text class=\"tn-icon-left\"></text></view>\r\n </view>\r\n <view class=\"tn-calendar__action__text\">{{ dateTitle }}</view>\r\n <view v-if=\"changeMonth\" class=\"tn-calendar__action__icon\" :style=\"{backgroundColor: monthArrowColor}\" @tap.stop=\"changeMonthHandler(true)\">\r\n <view><text class=\"tn-icon-right\"></text></view>\r\n </view>\r\n <view v-if=\"changeYear\" class=\"tn-calendar__action__icon\" :style=\"{backgroundColor: yearArrowColor}\" @tap.stop=\"changeYearHandler(true)\">\r\n <view><text class=\"tn-icon-right\"></text></view>\r\n </view>\r\n </view>\r\n \r\n <!-- 星期中文标识 -->\r\n <view class=\"tn-calendar__week-day-zh\">\r\n <view v-for=\"(item,index) in weekDayZh\" :key=\"index\" class=\"tn-calendar__week-day-zh__text\">{{ item }}</view>\r\n </view>\r\n \r\n <!-- 日历主体 -->\r\n <view class=\"tn-calendar__content\">\r\n <!-- 前置空白部分 -->\r\n <block v-for=\"(item, index) in weekdayArr\" :key=\"index\">\r\n <view class=\"tn-calendar__content__item\"></view>\r\n </block>\r\n <view\r\n v-for=\"(item, index) in daysArr\"\r\n :key=\"index\"\r\n class=\"tn-calendar__content__item\"\r\n :class=\"{\r\n 'tn-hover': disabledChoose(year, month, index + 1),\r\n 'tn-calendar__content--start-date': (mode === 'range' && startDate == `${year}-${month}-${index+1}`) || mode === 'date',\r\n 'tn-calendar__content--end-date': (mode === 'range' && endDate == `${year}-${month}-${index+1}`) || mode === 'date'\r\n }\"\r\n :style=\"{\r\n backgroundColor: colorValue(index, 'bg')\r\n }\"\r\n @tap.stop=\"dateClick(index)\"\r\n >\r\n <view class=\"tn-calendar__content__item__text\" :style=\"{color: colorValue(index, 'text')}\">\r\n <view>{{ item.day }}</view>\r\n </view>\r\n <view class=\"tn-calendar__content__item__tips\" :style=\"{color: item.color}\">\r\n {{ item.bottomInfo }}\r\n </view>\r\n </view>\r\n \r\n <view class=\"tn-calendar__content__month--bg\">{{ month }}</view>\r\n </view>\r\n \r\n <!-- 底部 -->\r\n <view class=\"tn-calendar__bottom\">\r\n <view class=\"tn-calendar__bottom__choose\">\r\n <text>{{ mode === 'date' ? activeDate : startDate }}</text>\r\n <text v-if=\"endDate\">至{{ endDate }}</text>\r\n </view>\r\n <view class=\"tn-calendar__bottom__btn\" :style=\"{backgroundColor: btnColor}\" @click=\"handleBtnClick(false)\">\r\n <view class=\"tn-calendar__bottom__btn--text\">确定</view>\r\n </view>\r\n </view>\r\n </view>\r\n </tn-popup>\r\n</template>\r\n\r\n<script>\r\n import Calendar from '../../libs/utils/calendar.js'\r\n \r\n export default {\r\n name: 'tn-calendar',\r\n props: {\r\n // 双向绑定控制组件弹出与收起\r\n value: {\r\n type: Boolean,\r\n default: false\r\n },\r\n // 模式\r\n // date -> 单日期 range -> 日期范围\r\n mode: {\r\n type: String,\r\n default: 'date'\r\n },\r\n // 是否允许切换年份\r\n changeYear: {\r\n type: Boolean,\r\n default: true\r\n },\r\n // 是否允许切换月份\r\n changeMonth: {\r\n type: Boolean,\r\n default: true\r\n },\r\n // 可切换的最大年份\r\n maxYear: {\r\n type: [Number, String],\r\n default: 2100\r\n },\r\n // 可切换的最小年份\r\n minYear: {\r\n type: [Number, String],\r\n default: 1970\r\n },\r\n // 最小日期(不在范围被不允许选择)\r\n minDate: {\r\n type: String,\r\n default: '1970-01-01'\r\n },\r\n // 最大日期,如果为空则默认为今天\r\n maxDate: {\r\n type: String,\r\n default: ''\r\n },\r\n // 切换月份按钮的颜色\r\n monthArrowColor: {\r\n type: String,\r\n default: '#AAAAAA'\r\n },\r\n // 切换年份按钮的颜色\r\n yearArrowColor: {\r\n type: String,\r\n default: '#C8C8C8'\r\n },\r\n // 默认字体颜色\r\n color: {\r\n type: String,\r\n default: '#080808'\r\n },\r\n // 选中|起始结束日期背景颜色\r\n activeBgColor: {\r\n type: String,\r\n default: '#01BEFF'\r\n },\r\n // 选中|起始结束日期文字颜色\r\n activeColor: {\r\n type: String,\r\n default: '#FFFFFF'\r\n },\r\n // 范围日期内的背景颜色\r\n rangeBgColor: {\r\n type: String,\r\n default: '#E6E6E655'\r\n },\r\n // 范围日期内的文字颜色\r\n rangeColor: {\r\n type: String,\r\n default: '#01BEFF'\r\n },\r\n // 起始日期显示的文字mode=range时生效\r\n startText: {\r\n type: String,\r\n default: '开始'\r\n },\r\n // 结束日期显示的文字mode=range时生效\r\n endText: {\r\n type: String,\r\n default: '结束'\r\n },\r\n // 按钮背景颜色\r\n btnColor: {\r\n type: String,\r\n default: '#01BEFF'\r\n },\r\n // 农历文字的颜色\r\n lunarColor: {\r\n type: String,\r\n default: '#AAAAAA'\r\n },\r\n // 选中日期是否有选中效果\r\n isActiveCurrent: {\r\n type: Boolean,\r\n default: true\r\n },\r\n // 切换年月是否触发事件mode=date时生效\r\n isChange: {\r\n type: Boolean,\r\n default: false\r\n },\r\n // 是否显示农历\r\n showLunar: {\r\n type: Boolean,\r\n default: true\r\n },\r\n // 顶部提示文字\r\n toolTips: {\r\n type: String,\r\n default: '请选择日期'\r\n },\r\n // 显示圆角的大小\r\n borderRadius: {\r\n type: Number,\r\n default: 8\r\n },\r\n // 是否开启底部安全区适配开启的话会在iPhoneX机型底部添加一定的内边距\r\n safeAreaInsetBottom: {\r\n \ttype: Boolean,\r\n \tdefault: false\r\n },\r\n // 是否可以通过点击遮罩进行关闭\r\n maskCloseable: {\r\n \ttype: Boolean,\r\n \tdefault: true\r\n },\r\n // zIndex\r\n zIndex: {\r\n type: Number,\r\n default: 0\r\n },\r\n // 是否显示关闭按钮\r\n closeBtn: {\r\n type: Boolean,\r\n default: false\r\n },\r\n },\r\n computed: {\r\n dateChange() {\r\n return `${this.mode}-${this.minDate}-${this.maxDate}`\r\n },\r\n elIndex() {\r\n return this.zIndex ? this.zIndex : this.$tn.zIndex.popup\r\n },\r\n colorValue() {\r\n return (index, type) => {\r\n let color = type === 'bg' ? '' : this.color\r\n let day = index + 1\r\n let date = `${this.year}-${this.month}-${day}`\r\n let timestamp = new Date(date.replace(/\\-/g,'/')).getTime()\r\n let start = this.startDate.replace(/\\-/g,'/')\r\n let end = this.endDate.replace(/\\-/g,'/')\r\n if ((this.mode === 'date' && this.isActiveCurrent && this.activeDate == date) || this.startDate == date || this.endDate == date) {\r\n color = type === 'bg' ? this.activeBgColor : this.activeColor\r\n } else if (this.endDate && timestamp > new Date(start).getTime() && timestamp < new Date(end).getTime()) {\r\n color = type === 'bg' ? this.rangeBgColor : this.rangeColor\r\n }\r\n return color\r\n }\r\n }\r\n },\r\n data() {\r\n return {\r\n // 星期几1-7\r\n weekday: 1,\r\n weekdayArr: [],\r\n // 星期对应的中文\r\n weekDayZh: ['日','一','二','三','四','五','六'],\r\n // 当前月有多少天\r\n days: 0,\r\n daysArr: [],\r\n year: 2021,\r\n month: 0,\r\n day: 0,\r\n startYear: 0,\r\n startMonth: 0,\r\n startDay: 0,\r\n endYear: 0,\r\n endMonth: 0,\r\n endDay: 0,\r\n today: '',\r\n activeDate: '',\r\n startDate: '',\r\n endDate: '',\r\n min: null,\r\n max: null,\r\n // 日期标题\r\n dateTitle: '',\r\n // 标记是否已经选择了开始日期\r\n chooseStart: false\r\n }\r\n },\r\n watch: {\r\n dateChange() {\r\n this.init()\r\n }\r\n },\r\n created() {\r\n this.init()\r\n },\r\n methods: {\r\n // 初始化\r\n init() {\r\n let now = new Date()\r\n this.year = now.getFullYear()\r\n this.month = now.getMonth() + 1\r\n this.day = now.getDate()\r\n this.today = `${this.year}-${this.month}-${this.day}`\r\n this.activeDate = this.today\r\n this.min = this.initDate(this.minDate)\r\n this.max = this.initDate(this.maxDate || this.today)\r\n this.startDate = ''\r\n this.startYear = 0\r\n this.startMonth = 0\r\n this.startDay = 0\r\n this.endDate = ''\r\n this.endYear = 0\r\n this.endMonth = 0\r\n this.endDay = 0\r\n this.chooseStart = false\r\n this.changeData()\r\n },\r\n // 切换月份\r\n changeMonthHandler(add) {\r\n if (add) {\r\n let month = this.month + 1\r\n let year = month > 12 ? this.year + 1 : this.year\r\n if (!this.checkRange(year)) {\r\n this.month = month > 12 ? 1 : month\r\n this.year = year\r\n this.changeData()\r\n }\r\n } else {\r\n let month = this.month - 1\r\n let year = month < 1 ? this.year - 1 : this.year\r\n if (!this.checkRange(year)) {\r\n this.month = month < 1 ? 12 : month\r\n this.year = year\r\n this.changeData()\r\n }\r\n }\r\n },\r\n // 切换年份\r\n changeYearHandler(add) {\r\n let year = add ? this.year + 1 : this.year - 1\r\n if (!this.checkRange(year)) {\r\n this.year = year\r\n this.changeData()\r\n }\r\n },\r\n // 日期点击事件\r\n dateClick(day) {\r\n day += 1\r\n if (!this.disabledChoose(this.year, this.month, day)) {\r\n this.day = day\r\n let date = `${this.year}-${this.month}-${day}`\r\n if (this.mode === 'date') {\r\n this.activeDate = date\r\n } else {\r\n let startTimeCompare = new Date(date.replace(/\\-/g,'/')).getTime() < new Date(this.startDate.replace(/\\-/g,'/')).getTime()\r\n if (!this.chooseStart || startTimeCompare) {\r\n this.startDate = date\r\n this.startYear = this.year\r\n this.startMonth = this.month\r\n this.startDay = this.day\r\n this.endYear = 0\r\n this.endMonth = 0\r\n this.endDay = 0\r\n this.endDate = ''\r\n this.activeDate = ''\r\n this.chooseStart = true\r\n } else {\r\n this.endDate = date\r\n this.endYear = this.year\r\n this.endMonth = this.month\r\n this.endDay = this.day\r\n this.chooseStart = false\r\n }\r\n }\r\n this.daysArr = this.handleDaysArr()\r\n }\r\n },\r\n // 修改日期数据\r\n changeData() {\r\n this.days = this.getMonthDay(this.year, this.month)\r\n this.daysArr = this.handleDaysArr()\r\n this.weekday = this.getMonthFirstWeekDay(this.year, this.month)\r\n this.weekdayArr = this.generateArray(1, this.weekday)\r\n this.dateTitle = `${this.year}年${this.month}月`\r\n if (this.isChange && this.mode === 'date') {\r\n this.handleBtnClick(true)\r\n }\r\n },\r\n // 处理按钮点击\r\n handleBtnClick(show) {\r\n if (!show) {\r\n this.close()\r\n }\r\n if (this.mode === 'date') {\r\n let arr = this.activeDate.split('-')\r\n let year = this.isChange ? this.year : Number(arr[0])\r\n let month = this.isChange ? this.month : Number(arr[1])\r\n let day = this.isChange ? this.day : Number(arr[2])\r\n let days = this.getMonthDay(year, month)\r\n let result = `${year}-${this.formatNumber(month)}-${this.formatNumber(day)}`\r\n let weekText = this.getWeekText(result)\r\n let isToday = false\r\n if (`${year}-${month}-${day}` === this.today) {\r\n isToday = true\r\n }\r\n this.$emit('change', {\r\n year,\r\n month,\r\n day,\r\n days,\r\n week: weekText,\r\n isToday,\r\n date: result,\r\n // 是否为切换年月操作\r\n switch: show\r\n })\r\n } else {\r\n if (!this.startDate || !this.endDate) return\r\n \r\n let startMonth = this.formatNumber(this.startMonth)\r\n let startDay = this.formatNumber(this.startDay)\r\n let startDate = `${this.startYear}-${startMonth}-${startDay}`\r\n let startWeek = this.getWeekText(startDate)\r\n \r\n let endMonth = this.formatNumber(this.endMonth)\r\n let endDay = this.formatNumber(this.endDay)\r\n let endDate = `${this.endYear}-${endMonth}-${endDay}`\r\n let endWeek = this.getWeekText(endDate)\r\n \r\n this.$emit('change', {\r\n startYear: this.startYear,\r\n startMonth: this.startMonth,\r\n startDay: this.startDay,\r\n startDate,\r\n startWeek,\r\n endYear: this.endYear,\r\n endMonth: this.endMonth,\r\n endDay: this.endDay,\r\n endDate,\r\n endWeek\r\n })\r\n }\r\n },\r\n // 判断是否允许选择\r\n disabledChoose(year, month, day) {\r\n let flag = true\r\n let date = `${year}/${month}/${day}`\r\n let min = `${this.min.year}/${this.min.month}/${this.min.day}`\r\n let max = `${this.max.year}/${this.max.month}/${this.max.day}`\r\n let timestamp = new Date(date).getTime()\r\n if (timestamp >= new Date(min).getTime() && timestamp <= new Date(max).getTime()) {\r\n flag = false\r\n }\r\n return flag\r\n },\r\n // 检查是否在日期范围内\r\n checkRange(year) {\r\n let overstep = false\r\n if (year < this.minYear || year > this.maxYear) {\r\n uni.showToast({\r\n title: '所选日期超出范围',\r\n icon: 'none'\r\n })\r\n overstep = true\r\n }\r\n return overstep\r\n },\r\n // 处理日期\r\n initDate(date) {\r\n let fdate = date.split('-')\r\n return {\r\n year: Number(fdate[0] || 1970),\r\n month: Number(fdate[1] || 1),\r\n day: Number(fdate[2] || 1)\r\n }\r\n },\r\n // 处理日期数组\r\n handleDaysArr() {\r\n let days = this.generateArray(1, this.days)\r\n let daysArr = days.map((item) => {\r\n let bottomInfo = this.showLunar ? Calendar.solar2lunar(this.year, this.month, item).IDayCn : ''\r\n let color = this.showLunar ? this.lunarColor : this.activeColor\r\n if (\r\n (this.mode === 'date' && this.day == item) || \r\n (this.mode === 'range' && (this.startDay == item || this.endDay == item))\r\n ) {\r\n color = this.activeColor\r\n }\r\n if (this.mode === 'range') {\r\n if (this.startDay == item && this.startDay != this.endDay) {\r\n bottomInfo = this.startText\r\n }\r\n if (this.endDay == item) {\r\n bottomInfo = this.endText\r\n }\r\n }\r\n \r\n return {\r\n day: item,\r\n color: color,\r\n bottomInfo: bottomInfo\r\n }\r\n })\r\n return daysArr\r\n },\r\n // 获取对应月有多少天\r\n getMonthDay(year, month) {\r\n return new Date(year, month, 0).getDate()\r\n },\r\n // 获取对应月的第一天时星期几\r\n getMonthFirstWeekDay(year, month) {\r\n return new Date(`${year}/${month}/01 00:00:00`).getDay()\r\n },\r\n // 获取对应星期的文本\r\n getWeekText(date) {\r\n date = new Date(`${date.replace(/\\-/g, '/')} 00:00:00`)\r\n let week = date.getDay()\r\n return '星期' + this.weekDayZh[week]\r\n },\r\n // 生成日期天数数组\r\n generateArray(start, end) {\r\n return Array.from(new Array(end + 1).keys()).slice(start)\r\n },\r\n // 格式化数字\r\n formatNumber(num) {\r\n return num < 10 ? '0' + num : num + ''\r\n },\r\n // 关闭窗口\r\n close() {\r\n this.$emit('input', false)\r\n }\r\n }\r\n }\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n \r\n .tn-calendar {\r\n color: $tn-font-color;\r\n \r\n &__header {\r\n width: 100%;\r\n box-sizing: border-box;\r\n font-size: 30rpx;\r\n background-color: #FFFFFF;\r\n color: $tn-main-color;\r\n \r\n &__text {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: center;\r\n margin-top: 30rpx;\r\n padding: 0 60rpx;\r\n }\r\n }\r\n \r\n &__action {\r\n display: flex;\r\n flex-direction: row;\r\n justify-content: center;\r\n align-items: center;\r\n padding: 40rpx 0 40rpx 0;\r\n \r\n &__icon {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n margin: 0 16rpx;\r\n width: 32rpx;\r\n height: 32rpx;\r\n font-size: 20rpx;\r\n // line-height: 32rpx;\r\n border-radius: 50%;\r\n color: #FFFFFF;\r\n }\r\n \r\n &__text {\r\n padding: 0 16rpx;\r\n color: $tn-font-color;\r\n font-size: 32rpx;\r\n font-weight: bold;\r\n }\r\n }\r\n \r\n &__week-day-zh {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: center;\r\n justify-content: center;\r\n padding: 12rpx 0;\r\n overflow: hidden;\r\n box-shadow: 16rpx 6rpx 8rpx 0 #E6E6E6;\r\n margin-bottom: 2rpx;\r\n \r\n &__text {\r\n flex: 1;\r\n text-align: center;\r\n }\r\n }\r\n \r\n &__content {\r\n display: flex;\r\n flex-direction: row;\r\n flex-wrap: wrap;\r\n width: 100%;\r\n padding: 12rpx 0;\r\n box-sizing: border-box;\r\n background-color: #F7F7F7;\r\n position: relative;\r\n \r\n &__item {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n width: 14.2857%;\r\n padding: 12rpx 0;\r\n margin: 6rpx 0;\r\n overflow: hidden;\r\n position: relative;\r\n z-index: 2;\r\n // box-shadow: inset 0rpx 0rpx 22rpx 4rpx rgba(255,255,255, 0.52);\r\n \r\n &__text {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n height: 80rpx;\r\n font-size: 32rpx;\r\n position: relative;\r\n }\r\n \r\n &__tips {\r\n position: absolute;\r\n width: 100%;\r\n line-height: 24rpx;\r\n left: 0;\r\n bottom: 8rpx;\r\n text-align: center;\r\n z-index: 2;\r\n transform-origin: center center;\r\n transform: scale(0.8);\r\n }\r\n }\r\n \r\n &--start-date {\r\n border-top-left-radius: 8rpx;\r\n border-bottom-left-radius: 8rpx;\r\n }\r\n \r\n &--end-date {\r\n border-top-right-radius: 8rpx;\r\n border-bottom-right-radius: 8rpx;\r\n }\r\n \r\n &__month {\r\n &--bg {\r\n position: absolute;\r\n font-size: 200rpx;\r\n line-height: 200rpx;\r\n left: 50%;\r\n top: 50%;\r\n transform: translate(-50%, -50%);\r\n color: $tn-font-holder-color;\r\n z-index: 1;\r\n }\r\n }\r\n }\r\n \r\n &__bottom {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n width: 100%;\r\n background-color: #F7F7F7;\r\n padding: 0 40rpx 30rpx;\r\n box-sizing: border-box;\r\n font-size: 24rpx;\r\n color: $tn-font-sub-color;\r\n \r\n &__choose {\r\n height: 50rpx;\r\n }\r\n \r\n &__btn {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: 100%;\r\n height: 60rpx;\r\n border-radius: 40rpx;\r\n color: #FFFFFF;\r\n font-size: 28rpx;\r\n }\r\n }\r\n }\r\n</style>\r\n","import mod from \"-!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\mini-css-extract-plugin\\\\dist\\\\loader.js??ref--8-oneOf-1-0!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\css-loader\\\\dist\\\\cjs.js??ref--8-oneOf-1-1!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\loaders\\\\stylePostLoader.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--8-oneOf-1-2!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\postcss-loader\\\\src\\\\index.js??ref--8-oneOf-1-3!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\sass-loader\\\\dist\\\\cjs.js??ref--8-oneOf-1-4!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--8-oneOf-1-5!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./tn-calendar.vue?vue&type=style&index=0&id=26db8440&lang=scss&scoped=true&\"; export default mod; export * from \"-!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\mini-css-extract-plugin\\\\dist\\\\loader.js??ref--8-oneOf-1-0!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\css-loader\\\\dist\\\\cjs.js??ref--8-oneOf-1-1!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\loaders\\\\stylePostLoader.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--8-oneOf-1-2!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\postcss-loader\\\\src\\\\index.js??ref--8-oneOf-1-3!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\sass-loader\\\\dist\\\\cjs.js??ref--8-oneOf-1-4!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--8-oneOf-1-5!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./tn-calendar.vue?vue&type=style&index=0&id=26db8440&lang=scss&scoped=true&\"","// extracted by mini-css-extract-plugin\n if(module.hot) {\n // 1715416714274\n var cssReload = require(\"F:/HBuilderX.3.5.3.20220729/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js\")(module.id, {\"hmr\":true,\"publicPath\":\"/\",\"locals\":false});\n module.hot.dispose(cssReload);\n module.hot.accept(undefined, cssReload);\n }\n "],"sourceRoot":""}