calendar.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899
  1. <template>
  2. <view class="uni-calendar" @mouseleave="leaveCale">
  3. <view v-if="!insert&&show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}"
  4. @click="clean"></view>
  5. <view v-if="insert || show" class="uni-calendar__content"
  6. :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow, 'uni-calendar__content-mobile': aniMaskShow}">
  7. <view class="uni-calendar__header" :class="{'uni-calendar__header-mobile' :!insert}">
  8. <view v-if="left" class="uni-calendar__header-btn-box" @click.stop="pre">
  9. <view class="uni-calendar__header-btn uni-calendar--left"></view>
  10. </view>
  11. <picker mode="date" :value="date" fields="month" @change="bindDateChange">
  12. <text
  13. class="uni-calendar__header-text">{{ (nowDate.year||'') + ' 年 ' + ( nowDate.month||'') +' 月'}}</text>
  14. </picker>
  15. <view v-if="right" class="uni-calendar__header-btn-box" @click.stop="next">
  16. <view class="uni-calendar__header-btn uni-calendar--right"></view>
  17. </view>
  18. <view v-if="!insert" class="dialog-close" @click="clean">
  19. <view class="dialog-close-plus" data-id="close"></view>
  20. <view class="dialog-close-plus dialog-close-rotate" data-id="close"></view>
  21. </view>
  22. <!-- <text class="uni-calendar__backtoday" @click="backtoday">回到今天</text> -->
  23. </view>
  24. <view class="uni-calendar__box">
  25. <view v-if="showMonth" class="uni-calendar__box-bg">
  26. <text class="uni-calendar__box-bg-text">{{nowDate.month}}</text>
  27. </view>
  28. <view class="uni-calendar__weeks" style="padding-bottom: 0.07rem;">
  29. <view class="uni-calendar__weeks-day">
  30. <text class="uni-calendar__weeks-day-text">{{SUNText}}</text>
  31. </view>
  32. <view class="uni-calendar__weeks-day">
  33. <text class="uni-calendar__weeks-day-text">{{monText}}</text>
  34. </view>
  35. <view class="uni-calendar__weeks-day">
  36. <text class="uni-calendar__weeks-day-text">{{TUEText}}</text>
  37. </view>
  38. <view class="uni-calendar__weeks-day">
  39. <text class="uni-calendar__weeks-day-text">{{WEDText}}</text>
  40. </view>
  41. <view class="uni-calendar__weeks-day">
  42. <text class="uni-calendar__weeks-day-text">{{THUText}}</text>
  43. </view>
  44. <view class="uni-calendar__weeks-day">
  45. <text class="uni-calendar__weeks-day-text">{{FRIText}}</text>
  46. </view>
  47. <view class="uni-calendar__weeks-day">
  48. <text class="uni-calendar__weeks-day-text">{{SATText}}</text>
  49. </view>
  50. </view>
  51. <view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
  52. <view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
  53. <calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar"
  54. :selected="selected" :lunar="lunar" :checkHover="range" @change="choiceDate"
  55. @handleMouse="handleMouse">
  56. </calendar-item>
  57. </view>
  58. </view>
  59. </view>
  60. <view v-if="!insert && !range && typeHasTime" class="uni-date-changed uni-calendar--fixed-top"
  61. style="padding: 0 0.8rem;">
  62. <view class="uni-date-changed--time-date">{{tempSingleDate ? tempSingleDate : selectDateText}}</view>
  63. <time-picker type="time" :start="reactStartTime" :end="reactEndTime" v-model="time"
  64. :disabled="!tempSingleDate" :border="false" :hide-second="hideSecond" class="time-picker-style">
  65. </time-picker>
  66. </view>
  67. <view v-if="!insert && range && typeHasTime" class="uni-date-changed uni-calendar--fixed-top">
  68. <view class="uni-date-changed--time-start">
  69. <view class="uni-date-changed--time-date">{{tempRange.before ? tempRange.before : startDateText}}
  70. </view>
  71. <time-picker type="time" :start="reactStartTime" v-model="timeRange.startTime" :border="false"
  72. :hide-second="hideSecond" :disabled="!tempRange.before" class="time-picker-style">
  73. </time-picker>
  74. </view>
  75. <uni-icons type="arrowthinright" color="#999" style="line-height: 0.5rem;"></uni-icons>
  76. <view class="uni-date-changed--time-end">
  77. <view class="uni-date-changed--time-date">{{tempRange.after ? tempRange.after : endDateText}}</view>
  78. <time-picker type="time" :end="reactEndTime" v-model="timeRange.endTime" :border="false"
  79. :hide-second="hideSecond" :disabled="!tempRange.after" class="time-picker-style">
  80. </time-picker>
  81. </view>
  82. </view>
  83. <view v-if="!insert" class="uni-date-changed uni-date-btn--ok">
  84. <!-- <view class="uni-calendar__header-btn-box">
  85. <text class="uni-calendar__button-text uni-calendar--fixed-width">{{okText}}</text>
  86. </view> -->
  87. <view class="uni-datetime-picker--btn" @click="confirm">确认</view>
  88. </view>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. import Calendar from './util.js';
  94. import calendarItem from './calendar-item.vue'
  95. import timePicker from './time-picker.vue'
  96. import uniIcons from '@/components/uni-icons/uni-icons';
  97. import {
  98. initVueI18n
  99. } from '@dcloudio/uni-i18n'
  100. import messages from './i18n/index.js'
  101. const {
  102. t
  103. } = initVueI18n(messages)
  104. /**
  105. * Calendar 日历
  106. * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
  107. * @tutorial https://ext.dcloud.net.cn/plugin?id=56
  108. * @property {String} date 自定义当前时间,默认为今天
  109. * @property {Boolean} lunar 显示农历
  110. * @property {String} startDate 日期选择范围-开始日期
  111. * @property {String} endDate 日期选择范围-结束日期
  112. * @property {Boolean} range 范围选择
  113. * @property {Boolean} insert = [true|false] 插入模式,默认为false
  114. * @value true 弹窗模式
  115. * @value false 插入模式
  116. * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
  117. * @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
  118. * @property {Boolean} showMonth 是否选择月份为背景
  119. * @event {Function} change 日期改变,`insert :ture` 时生效
  120. * @event {Function} confirm 确认选择`insert :false` 时生效
  121. * @event {Function} monthSwitch 切换月份时触发
  122. * @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
  123. */
  124. export default {
  125. components: {
  126. uniIcons,
  127. calendarItem,
  128. timePicker
  129. },
  130. props: {
  131. date: {
  132. type: String,
  133. default: ''
  134. },
  135. defTime: {
  136. type: [String, Object],
  137. default: ''
  138. },
  139. selectableTimes: {
  140. type: [Object],
  141. default () {
  142. return {}
  143. }
  144. },
  145. selected: {
  146. type: Array,
  147. default () {
  148. return []
  149. }
  150. },
  151. lunar: {
  152. type: Boolean,
  153. default: false
  154. },
  155. startDate: {
  156. type: String,
  157. default: ''
  158. },
  159. endDate: {
  160. type: String,
  161. default: ''
  162. },
  163. range: {
  164. type: Boolean,
  165. default: false
  166. },
  167. typeHasTime: {
  168. type: Boolean,
  169. default: false
  170. },
  171. insert: {
  172. type: Boolean,
  173. default: true
  174. },
  175. showMonth: {
  176. type: Boolean,
  177. default: true
  178. },
  179. clearDate: {
  180. type: Boolean,
  181. default: true
  182. },
  183. left: {
  184. type: Boolean,
  185. default: true
  186. },
  187. right: {
  188. type: Boolean,
  189. default: true
  190. },
  191. checkHover: {
  192. type: Boolean,
  193. default: true
  194. },
  195. hideSecond: {
  196. type: [Boolean],
  197. default: false
  198. },
  199. pleStatus: {
  200. type: Object,
  201. default () {
  202. return {
  203. before: '',
  204. after: '',
  205. data: [],
  206. fulldate: ''
  207. }
  208. }
  209. }
  210. },
  211. data() {
  212. return {
  213. show: false,
  214. weeks: [],
  215. calendar: {},
  216. nowDate: '',
  217. aniMaskShow: false,
  218. firstEnter: true,
  219. time: '',
  220. timeRange: {
  221. startTime: '',
  222. endTime: ''
  223. },
  224. tempSingleDate: '',
  225. tempRange: {
  226. before: '',
  227. after: ''
  228. }
  229. }
  230. },
  231. watch: {
  232. date: {
  233. immediate: true,
  234. handler(newVal, oldVal) {
  235. if (!this.range) {
  236. this.tempSingleDate = newVal
  237. setTimeout(() => {
  238. this.init(newVal)
  239. }, 100)
  240. }
  241. }
  242. },
  243. defTime: {
  244. immediate: true,
  245. handler(newVal, oldVal) {
  246. if (!this.range) {
  247. this.time = newVal
  248. } else {
  249. this.timeRange.startTime = newVal.start
  250. this.timeRange.endTime = newVal.end
  251. }
  252. }
  253. },
  254. startDate(val) {
  255. this.cale.resetSatrtDate(val)
  256. this.cale.setDate(this.nowDate.fullDate)
  257. this.weeks = this.cale.weeks
  258. },
  259. endDate(val) {
  260. this.cale.resetEndDate(val)
  261. this.cale.setDate(this.nowDate.fullDate)
  262. this.weeks = this.cale.weeks
  263. },
  264. selected(newVal) {
  265. this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
  266. this.weeks = this.cale.weeks
  267. },
  268. pleStatus: {
  269. immediate: true,
  270. handler(newVal, oldVal) {
  271. const {
  272. before,
  273. after,
  274. fulldate,
  275. which
  276. } = newVal
  277. this.tempRange.before = before
  278. this.tempRange.after = after
  279. setTimeout(() => {
  280. if (fulldate) {
  281. this.cale.setHoverMultiple(fulldate)
  282. if (before && after) {
  283. this.cale.lastHover = true
  284. if (this.rangeWithinMonth(after, before)) return
  285. this.setDate(before)
  286. } else {
  287. this.cale.setMultiple(fulldate)
  288. this.setDate(this.nowDate.fullDate)
  289. this.calendar.fullDate = ''
  290. this.cale.lastHover = false
  291. }
  292. } else {
  293. this.cale.setDefaultMultiple(before, after)
  294. if (which === 'left') {
  295. this.setDate(before)
  296. this.weeks = this.cale.weeks
  297. } else {
  298. this.setDate(after)
  299. this.weeks = this.cale.weeks
  300. }
  301. this.cale.lastHover = true
  302. }
  303. }, 16)
  304. }
  305. }
  306. },
  307. computed: {
  308. reactStartTime() {
  309. const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate
  310. const res = activeDate === this.startDate ? this.selectableTimes.start : ''
  311. return res
  312. },
  313. reactEndTime() {
  314. const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate
  315. const res = activeDate === this.endDate ? this.selectableTimes.end : ''
  316. return res
  317. },
  318. /**
  319. * for i18n
  320. */
  321. selectDateText() {
  322. return t("uni-datetime-picker.selectDate")
  323. },
  324. startDateText() {
  325. return this.startPlaceholder || t("uni-datetime-picker.startDate")
  326. },
  327. endDateText() {
  328. return this.endPlaceholder || t("uni-datetime-picker.endDate")
  329. },
  330. okText() {
  331. return t("uni-datetime-picker.ok")
  332. },
  333. monText() {
  334. return t("uni-calender.MON")
  335. },
  336. TUEText() {
  337. return t("uni-calender.TUE")
  338. },
  339. WEDText() {
  340. return t("uni-calender.WED")
  341. },
  342. THUText() {
  343. return t("uni-calender.THU")
  344. },
  345. FRIText() {
  346. return t("uni-calender.FRI")
  347. },
  348. SATText() {
  349. return t("uni-calender.SAT")
  350. },
  351. SUNText() {
  352. return t("uni-calender.SUN")
  353. },
  354. },
  355. created() {
  356. // 获取日历方法实例
  357. this.cale = new Calendar({
  358. // date: new Date(),
  359. selected: this.selected,
  360. startDate: this.startDate,
  361. endDate: this.endDate,
  362. range: this.range,
  363. // multipleStatus: this.pleStatus
  364. })
  365. // 选中某一天
  366. // this.cale.setDate(this.date)
  367. this.init(this.date)
  368. // this.setDay
  369. },
  370. methods: {
  371. leaveCale() {
  372. this.firstEnter = true
  373. },
  374. handleMouse(weeks) {
  375. if (weeks.disable) return
  376. if (this.cale.lastHover) return
  377. let {
  378. before,
  379. after
  380. } = this.cale.multipleStatus
  381. if (!before) return
  382. this.calendar = weeks
  383. // 设置范围选
  384. this.cale.setHoverMultiple(this.calendar.fullDate)
  385. this.weeks = this.cale.weeks
  386. // hover时,进入一个日历,更新另一个
  387. if (this.firstEnter) {
  388. this.$emit('firstEnterCale', this.cale.multipleStatus)
  389. this.firstEnter = false
  390. }
  391. },
  392. rangeWithinMonth(A, B) {
  393. const [yearA, monthA] = A.split('-')
  394. const [yearB, monthB] = B.split('-')
  395. return yearA === yearB && monthA === monthB
  396. },
  397. // 取消穿透
  398. clean() {
  399. this.close()
  400. },
  401. clearCalender() {
  402. if (this.range) {
  403. this.timeRange.startTime = ''
  404. this.timeRange.endTime = ''
  405. this.tempRange.before = ''
  406. this.tempRange.after = ''
  407. this.cale.multipleStatus.before = ''
  408. this.cale.multipleStatus.after = ''
  409. this.cale.multipleStatus.data = []
  410. this.cale.lastHover = false
  411. } else {
  412. this.time = ''
  413. this.tempSingleDate = ''
  414. }
  415. this.calendar.fullDate = ''
  416. this.setDate()
  417. },
  418. bindDateChange(e) {
  419. const value = e.detail.value + '-1'
  420. this.init(value)
  421. },
  422. /**
  423. * 初始化日期显示
  424. * @param {Object} date
  425. */
  426. init(date) {
  427. this.cale.setDate(date)
  428. this.weeks = this.cale.weeks
  429. this.nowDate = this.calendar = this.cale.getInfo(date)
  430. },
  431. // choiceDate(weeks) {
  432. // if (weeks.disable) return
  433. // this.calendar = weeks
  434. // // 设置多选
  435. // this.cale.setMultiple(this.calendar.fullDate, true)
  436. // this.weeks = this.cale.weeks
  437. // this.tempSingleDate = this.calendar.fullDate
  438. // this.tempRange.before = this.cale.multipleStatus.before
  439. // this.tempRange.after = this.cale.multipleStatus.after
  440. // this.change()
  441. // },
  442. /**
  443. * 打开日历弹窗
  444. */
  445. open() {
  446. // 弹窗模式并且清理数据
  447. if (this.clearDate && !this.insert) {
  448. this.cale.cleanMultipleStatus()
  449. // this.cale.setDate(this.date)
  450. this.init(this.date)
  451. }
  452. this.show = true
  453. this.$nextTick(() => {
  454. setTimeout(() => {
  455. this.aniMaskShow = true
  456. }, 50)
  457. })
  458. },
  459. /**
  460. * 关闭日历弹窗
  461. */
  462. close() {
  463. this.aniMaskShow = false
  464. this.$nextTick(() => {
  465. setTimeout(() => {
  466. this.show = false
  467. this.$emit('close')
  468. }, 300)
  469. })
  470. },
  471. /**
  472. * 确认按钮
  473. */
  474. confirm() {
  475. this.setEmit('confirm')
  476. this.close()
  477. },
  478. /**
  479. * 变化触发
  480. */
  481. change() {
  482. if (!this.insert) return
  483. this.setEmit('change')
  484. },
  485. /**
  486. * 选择月份触发
  487. */
  488. monthSwitch() {
  489. let {
  490. year,
  491. month
  492. } = this.nowDate
  493. this.$emit('monthSwitch', {
  494. year,
  495. month: Number(month)
  496. })
  497. },
  498. /**
  499. * 派发事件
  500. * @param {Object} name
  501. */
  502. setEmit(name) {
  503. let {
  504. year,
  505. month,
  506. date,
  507. fullDate,
  508. lunar,
  509. extraInfo
  510. } = this.calendar
  511. this.$emit(name, {
  512. range: this.cale.multipleStatus,
  513. year,
  514. month,
  515. date,
  516. time: this.time,
  517. timeRange: this.timeRange,
  518. fulldate: fullDate,
  519. lunar,
  520. extraInfo: extraInfo || {}
  521. })
  522. },
  523. /**
  524. * 选择天触发
  525. * @param {Object} weeks
  526. */
  527. choiceDate(weeks) {
  528. if (weeks.disable) return
  529. this.calendar = weeks
  530. this.calendar.userChecked = true
  531. // 设置多选
  532. this.cale.setMultiple(this.calendar.fullDate, true)
  533. this.weeks = this.cale.weeks
  534. this.tempSingleDate = this.calendar.fullDate
  535. this.tempRange.before = this.cale.multipleStatus.before
  536. this.tempRange.after = this.cale.multipleStatus.after
  537. this.change()
  538. },
  539. /**
  540. * 回到今天
  541. */
  542. backtoday() {
  543. let date = this.cale.getDate(new Date()).fullDate
  544. // this.cale.setDate(date)
  545. this.init(date)
  546. this.change()
  547. },
  548. /**
  549. * 比较时间大小
  550. */
  551. dateCompare(startDate, endDate) {
  552. // 计算截止时间
  553. startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
  554. // 计算详细项的截止时间
  555. endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
  556. if (startDate <= endDate) {
  557. return true
  558. } else {
  559. return false
  560. }
  561. },
  562. /**
  563. * 上个月
  564. */
  565. pre() {
  566. const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate
  567. this.setDate(preDate)
  568. this.monthSwitch()
  569. },
  570. /**
  571. * 下个月
  572. */
  573. next() {
  574. const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate
  575. this.setDate(nextDate)
  576. this.monthSwitch()
  577. },
  578. /**
  579. * 设置日期
  580. * @param {Object} date
  581. */
  582. setDate(date) {
  583. this.cale.setDate(date)
  584. this.weeks = this.cale.weeks
  585. this.nowDate = this.cale.getInfo(date)
  586. }
  587. }
  588. }
  589. </script>
  590. <style lang="scss" scoped>
  591. .uni-calendar {
  592. /* #ifndef APP-NVUE */
  593. display: flex;
  594. /* #endif */
  595. flex-direction: column;
  596. }
  597. .uni-calendar__mask {
  598. position: fixed;
  599. bottom: 0;
  600. top: 0;
  601. left: 0;
  602. right: 0;
  603. background-color: rgba(0, 0, 0, 0.4);
  604. transition-property: opacity;
  605. transition-duration: 0.3s;
  606. opacity: 0;
  607. /* #ifndef APP-NVUE */
  608. z-index: 99;
  609. /* #endif */
  610. }
  611. .uni-calendar--mask-show {
  612. opacity: 1
  613. }
  614. .uni-calendar--fixed {
  615. position: fixed;
  616. bottom: calc(var(--window-bottom));
  617. left: 0;
  618. right: 0;
  619. transition-property: transform;
  620. transition-duration: 0.3s;
  621. transform: translateY(4.6rem);
  622. /* #ifndef APP-NVUE */
  623. z-index: 99;
  624. /* #endif */
  625. }
  626. .uni-calendar--ani-show {
  627. transform: translateY(0);
  628. }
  629. .uni-calendar__content {
  630. background-color: #fff;
  631. }
  632. .uni-calendar__content-mobile {
  633. border-top-left-radius: 0.1rem;
  634. border-top-right-radius: 0.1rem;
  635. box-shadow: 0rem 0rem 0.05rem 0.03rem rgba(0, 0, 0, 0.1);
  636. }
  637. .uni-calendar__header {
  638. position: relative;
  639. /* #ifndef APP-NVUE */
  640. display: flex;
  641. /* #endif */
  642. flex-direction: row;
  643. justify-content: center;
  644. align-items: center;
  645. height: 0.5rem;
  646. }
  647. .uni-calendar__header-mobile {
  648. padding: 0.1rem;
  649. padding-bottom: 0;
  650. }
  651. .uni-calendar--fixed-top {
  652. /* #ifndef APP-NVUE */
  653. display: flex;
  654. /* #endif */
  655. flex-direction: row;
  656. justify-content: space-between;
  657. border-top-color: rgba(0, 0, 0, 0.4);
  658. border-top-style: solid;
  659. border-top-width: 0.01rem;
  660. }
  661. .uni-calendar--fixed-width {
  662. width: 0.5rem;
  663. }
  664. .uni-calendar__backtoday {
  665. position: absolute;
  666. right: 0;
  667. top: 0.125rem;
  668. padding: 0 0.05rem;
  669. padding-left: 0.1rem;
  670. height: 0.25rem;
  671. line-height: 0.25rem;
  672. font-size: 0.2rem;
  673. border-top-left-radius: 0.25rem;
  674. border-bottom-left-radius: 0.25rem;
  675. color: #fff;
  676. background-color: #f1f1f1;
  677. }
  678. .uni-calendar__header-text {
  679. text-align: center;
  680. width: 1rem;
  681. font-size: 0.15rem;
  682. color: #666;
  683. }
  684. .uni-calendar__button-text {
  685. text-align: center;
  686. width: 1rem;
  687. font-size: 0.14rem;
  688. color: #007aff;
  689. /* #ifndef APP-NVUE */
  690. letter-spacing: 0.03rem;
  691. /* #endif */
  692. }
  693. .uni-calendar__header-btn-box {
  694. /* #ifndef APP-NVUE */
  695. display: flex;
  696. /* #endif */
  697. flex-direction: row;
  698. align-items: center;
  699. justify-content: center;
  700. width: 0.5rem;
  701. height: 0.5rem;
  702. }
  703. .uni-calendar__header-btn {
  704. width: 0.09rem;
  705. height: 0.09rem;
  706. border-left-color: #808080;
  707. border-left-style: solid;
  708. border-left-width: 0.01rem;
  709. border-top-color: #555555;
  710. border-top-style: solid;
  711. border-top-width: 0.01rem;
  712. }
  713. .uni-calendar--left {
  714. transform: rotate(-45deg);
  715. }
  716. .uni-calendar--right {
  717. transform: rotate(135deg);
  718. }
  719. .uni-calendar__weeks {
  720. position: relative;
  721. /* #ifndef APP-NVUE */
  722. display: flex;
  723. /* #endif */
  724. flex-direction: row;
  725. }
  726. .uni-calendar__weeks-item {
  727. flex: 1;
  728. }
  729. .uni-calendar__weeks-day {
  730. flex: 1;
  731. /* #ifndef APP-NVUE */
  732. display: flex;
  733. /* #endif */
  734. flex-direction: column;
  735. justify-content: center;
  736. align-items: center;
  737. height: 0.4rem;
  738. border-bottom-color: #F5F5F5;
  739. border-bottom-style: solid;
  740. border-bottom-width: 0.01rem;
  741. }
  742. .uni-calendar__weeks-day-text {
  743. font-size: 0.2rem;
  744. color: #B2B2B2;
  745. }
  746. .uni-calendar__box {
  747. position: relative;
  748. // padding: 0 0.1rem;
  749. padding-bottom: 0.07rem;
  750. }
  751. .uni-calendar__box-bg {
  752. /* #ifndef APP-NVUE */
  753. display: flex;
  754. /* #endif */
  755. justify-content: center;
  756. align-items: center;
  757. position: absolute;
  758. top: 0;
  759. left: 0;
  760. right: 0;
  761. bottom: 0;
  762. }
  763. .uni-calendar__box-bg-text {
  764. font-size: 2rem;
  765. font-weight: bold;
  766. color: #999;
  767. opacity: 0.1;
  768. text-align: center;
  769. /* #ifndef APP-NVUE */
  770. line-height: 1;
  771. /* #endif */
  772. }
  773. .uni-date-changed {
  774. padding: 0 0.1rem;
  775. // line-height: 0.5rem;
  776. text-align: center;
  777. color: #333;
  778. border-top-color: #DCDCDC;
  779. ;
  780. border-top-style: solid;
  781. border-top-width: 0.01rem;
  782. flex: 1;
  783. }
  784. .uni-date-btn--ok {
  785. padding: 0.2rem 0.15rem;
  786. }
  787. .uni-date-changed--time-start {
  788. /* #ifndef APP-NVUE */
  789. display: flex;
  790. /* #endif */
  791. align-items: center;
  792. }
  793. .uni-date-changed--time-end {
  794. /* #ifndef APP-NVUE */
  795. display: flex;
  796. /* #endif */
  797. align-items: center;
  798. }
  799. .uni-date-changed--time-date {
  800. color: #999;
  801. line-height: 0.5rem;
  802. margin-right: 0.05rem;
  803. // opacity: 0.6;
  804. }
  805. .time-picker-style {
  806. // width: 62px;
  807. /* #ifndef APP-NVUE */
  808. display: flex;
  809. /* #endif */
  810. justify-content: center;
  811. align-items: center
  812. }
  813. .mr-10 {
  814. margin-right: 0.1rem;
  815. }
  816. .dialog-close {
  817. position: absolute;
  818. top: 0;
  819. right: 0;
  820. bottom: 0;
  821. /* #ifndef APP-NVUE */
  822. display: flex;
  823. /* #endif */
  824. flex-direction: row;
  825. align-items: center;
  826. padding: 0 0.25rem;
  827. margin-top: 0.1rem;
  828. }
  829. .dialog-close-plus {
  830. width: 0.16rem;
  831. height: 0.02rem;
  832. background-color: #737987;
  833. border-radius: 0.02rem;
  834. transform: rotate(45deg);
  835. }
  836. .dialog-close-rotate {
  837. position: absolute;
  838. transform: rotate(-45deg);
  839. }
  840. .uni-datetime-picker--btn {
  841. border-radius: 1rem;
  842. height: 0.4rem;
  843. line-height: 0.4rem;
  844. background-color: #007aff;
  845. color: #fff;
  846. font-size: 0.16rem;
  847. letter-spacing: 0.05rem;
  848. }
  849. /* #ifndef APP-NVUE */
  850. .uni-datetime-picker--btn:active {
  851. opacity: 0.7;
  852. }
  853. /* #endif */
  854. </style>