calendar.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  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||'') + yearText + ( nowDate.month||'') + monthText}}</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: 7px;">
  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 80px;">
  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: 50px;"></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">{{confirmText}}</view>
  88. <view class="uni-datetime-picker-btn-cancel" @click="clean">{{cancelText}}</view>
  89. </view>
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. import Calendar from './util.js';
  95. import calendarItem from './calendar-item.vue'
  96. import timePicker from './time-picker.vue'
  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. calendarItem,
  127. timePicker
  128. },
  129. props: {
  130. date: {
  131. type: String,
  132. default: ''
  133. },
  134. defTime: {
  135. type: [String, Object],
  136. default: ''
  137. },
  138. selectableTimes: {
  139. type: [Object],
  140. default () {
  141. return {}
  142. }
  143. },
  144. selected: {
  145. type: Array,
  146. default () {
  147. return []
  148. }
  149. },
  150. lunar: {
  151. type: Boolean,
  152. default: false
  153. },
  154. startDate: {
  155. type: String,
  156. default: ''
  157. },
  158. endDate: {
  159. type: String,
  160. default: ''
  161. },
  162. range: {
  163. type: Boolean,
  164. default: false
  165. },
  166. typeHasTime: {
  167. type: Boolean,
  168. default: false
  169. },
  170. insert: {
  171. type: Boolean,
  172. default: true
  173. },
  174. showMonth: {
  175. type: Boolean,
  176. default: true
  177. },
  178. clearDate: {
  179. type: Boolean,
  180. default: true
  181. },
  182. left: {
  183. type: Boolean,
  184. default: true
  185. },
  186. right: {
  187. type: Boolean,
  188. default: true
  189. },
  190. checkHover: {
  191. type: Boolean,
  192. default: true
  193. },
  194. hideSecond: {
  195. type: [Boolean],
  196. default: false
  197. },
  198. pleStatus: {
  199. type: Object,
  200. default () {
  201. return {
  202. before: '',
  203. after: '',
  204. data: [],
  205. fulldate: ''
  206. }
  207. }
  208. }
  209. },
  210. data() {
  211. return {
  212. show: false,
  213. weeks: [],
  214. calendar: {},
  215. nowDate: '',
  216. aniMaskShow: false,
  217. firstEnter: true,
  218. time: '',
  219. timeRange: {
  220. startTime: '',
  221. endTime: ''
  222. },
  223. tempSingleDate: '',
  224. tempRange: {
  225. before: '',
  226. after: ''
  227. }
  228. }
  229. },
  230. watch: {
  231. date: {
  232. immediate: true,
  233. handler(newVal, oldVal) {
  234. if (!this.range) {
  235. this.tempSingleDate = newVal
  236. setTimeout(() => {
  237. this.init(newVal)
  238. }, 100)
  239. }
  240. }
  241. },
  242. defTime: {
  243. immediate: true,
  244. handler(newVal, oldVal) {
  245. if (!this.range) {
  246. this.time = newVal
  247. } else {
  248. // console.log('-----', newVal);
  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. cancelText() {
  334. return t("uni-datetime-picker.cancel")
  335. },
  336. yearText() {
  337. return t("uni-datetime-picker.year")
  338. },
  339. monthText() {
  340. return t("uni-datetime-picker.month")
  341. },
  342. MONText() {
  343. return t("uni-calender.MON")
  344. },
  345. TUEText() {
  346. return t("uni-calender.TUE")
  347. },
  348. WEDText() {
  349. return t("uni-calender.WED")
  350. },
  351. THUText() {
  352. return t("uni-calender.THU")
  353. },
  354. FRIText() {
  355. return t("uni-calender.FRI")
  356. },
  357. SATText() {
  358. return t("uni-calender.SAT")
  359. },
  360. SUNText() {
  361. return t("uni-calender.SUN")
  362. },
  363. confirmText() {
  364. return t("uni-calender.confirm")
  365. },
  366. },
  367. created() {
  368. // 获取日历方法实例
  369. this.cale = new Calendar({
  370. // date: new Date(),
  371. selected: this.selected,
  372. startDate: this.startDate,
  373. endDate: this.endDate,
  374. range: this.range,
  375. // multipleStatus: this.pleStatus
  376. })
  377. // 选中某一天
  378. // this.cale.setDate(this.date)
  379. this.init(this.date)
  380. // this.setDay
  381. },
  382. methods: {
  383. leaveCale() {
  384. this.firstEnter = true
  385. },
  386. handleMouse(weeks) {
  387. if (weeks.disable) return
  388. if (this.cale.lastHover) return
  389. let {
  390. before,
  391. after
  392. } = this.cale.multipleStatus
  393. if (!before) return
  394. this.calendar = weeks
  395. // 设置范围选
  396. this.cale.setHoverMultiple(this.calendar.fullDate)
  397. this.weeks = this.cale.weeks
  398. // hover时,进入一个日历,更新另一个
  399. if (this.firstEnter) {
  400. this.$emit('firstEnterCale', this.cale.multipleStatus)
  401. this.firstEnter = false
  402. }
  403. },
  404. rangeWithinMonth(A, B) {
  405. const [yearA, monthA] = A.split('-')
  406. const [yearB, monthB] = B.split('-')
  407. return yearA === yearB && monthA === monthB
  408. },
  409. // 取消穿透
  410. clean() {
  411. this.close()
  412. },
  413. clearCalender() {
  414. if (this.range) {
  415. this.timeRange.startTime = ''
  416. this.timeRange.endTime = ''
  417. this.tempRange.before = ''
  418. this.tempRange.after = ''
  419. this.cale.multipleStatus.before = ''
  420. this.cale.multipleStatus.after = ''
  421. this.cale.multipleStatus.data = []
  422. this.cale.lastHover = false
  423. } else {
  424. this.time = ''
  425. this.tempSingleDate = ''
  426. }
  427. this.calendar.fullDate = ''
  428. this.setDate()
  429. },
  430. bindDateChange(e) {
  431. const value = e.detail.value + '-1'
  432. this.init(value)
  433. },
  434. /**
  435. * 初始化日期显示
  436. * @param {Object} date
  437. */
  438. init(date) {
  439. this.cale.setDate(date)
  440. this.weeks = this.cale.weeks
  441. this.nowDate = this.calendar = this.cale.getInfo(date)
  442. },
  443. // choiceDate(weeks) {
  444. // if (weeks.disable) return
  445. // this.calendar = weeks
  446. // // 设置多选
  447. // this.cale.setMultiple(this.calendar.fullDate, true)
  448. // this.weeks = this.cale.weeks
  449. // this.tempSingleDate = this.calendar.fullDate
  450. // this.tempRange.before = this.cale.multipleStatus.before
  451. // this.tempRange.after = this.cale.multipleStatus.after
  452. // this.change()
  453. // },
  454. /**
  455. * 打开日历弹窗
  456. */
  457. open() {
  458. // 弹窗模式并且清理数据
  459. if (this.clearDate && !this.insert) {
  460. this.cale.cleanMultipleStatus()
  461. // this.cale.setDate(this.date)
  462. this.init(this.date)
  463. }
  464. this.show = true
  465. this.$nextTick(() => {
  466. setTimeout(() => {
  467. this.aniMaskShow = true
  468. }, 50)
  469. })
  470. },
  471. /**
  472. * 关闭日历弹窗
  473. */
  474. close() {
  475. this.aniMaskShow = false
  476. this.$nextTick(() => {
  477. setTimeout(() => {
  478. this.show = false
  479. this.$emit('close')
  480. }, 300)
  481. })
  482. },
  483. /**
  484. * 确认按钮
  485. */
  486. confirm() {
  487. this.setEmit('confirm')
  488. this.close()
  489. },
  490. /**
  491. * 变化触发
  492. */
  493. change() {
  494. if (!this.insert) return
  495. this.setEmit('change')
  496. },
  497. /**
  498. * 选择月份触发
  499. */
  500. monthSwitch() {
  501. let {
  502. year,
  503. month
  504. } = this.nowDate
  505. this.$emit('monthSwitch', {
  506. year,
  507. month: Number(month)
  508. })
  509. },
  510. /**
  511. * 派发事件
  512. * @param {Object} name
  513. */
  514. setEmit(name) {
  515. let {
  516. year,
  517. month,
  518. date,
  519. fullDate,
  520. lunar,
  521. extraInfo
  522. } = this.calendar
  523. this.$emit(name, {
  524. range: this.cale.multipleStatus,
  525. year,
  526. month,
  527. date,
  528. time: this.time,
  529. timeRange: this.timeRange,
  530. fulldate: fullDate,
  531. lunar,
  532. extraInfo: extraInfo || {}
  533. })
  534. },
  535. /**
  536. * 选择天触发
  537. * @param {Object} weeks
  538. */
  539. choiceDate(weeks) {
  540. if (weeks.disable) return
  541. this.calendar = weeks
  542. this.calendar.userChecked = true
  543. // 设置多选
  544. this.cale.setMultiple(this.calendar.fullDate, true)
  545. this.weeks = this.cale.weeks
  546. this.tempSingleDate = this.calendar.fullDate
  547. this.tempRange.before = this.cale.multipleStatus.before
  548. this.tempRange.after = this.cale.multipleStatus.after
  549. this.change()
  550. },
  551. /**
  552. * 回到今天
  553. */
  554. backtoday() {
  555. let date = this.cale.getDate(new Date()).fullDate
  556. // this.cale.setDate(date)
  557. this.init(date)
  558. this.change()
  559. },
  560. /**
  561. * 比较时间大小
  562. */
  563. dateCompare(startDate, endDate) {
  564. // 计算截止时间
  565. startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
  566. // 计算详细项的截止时间
  567. endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
  568. if (startDate <= endDate) {
  569. return true
  570. } else {
  571. return false
  572. }
  573. },
  574. /**
  575. * 上个月
  576. */
  577. pre() {
  578. const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate
  579. this.setDate(preDate)
  580. this.monthSwitch()
  581. },
  582. /**
  583. * 下个月
  584. */
  585. next() {
  586. const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate
  587. this.setDate(nextDate)
  588. this.monthSwitch()
  589. },
  590. /**
  591. * 设置日期
  592. * @param {Object} date
  593. */
  594. setDate(date) {
  595. this.cale.setDate(date)
  596. this.weeks = this.cale.weeks
  597. this.nowDate = this.cale.getInfo(date)
  598. }
  599. }
  600. }
  601. </script>
  602. <style lang="scss">
  603. .uni-calendar {
  604. /* #ifndef APP-NVUE */
  605. display: flex;
  606. /* #endif */
  607. flex-direction: column;
  608. }
  609. .uni-calendar__mask {
  610. position: fixed;
  611. bottom: 0;
  612. top: 0;
  613. left: 0;
  614. right: 0;
  615. background-color: rgba(0, 0, 0, 0.4);
  616. transition-property: opacity;
  617. transition-duration: 0.3s;
  618. opacity: 0;
  619. /* #ifndef APP-NVUE */
  620. z-index: 99;
  621. /* #endif */
  622. }
  623. .uni-calendar--mask-show {
  624. opacity: 1
  625. }
  626. .uni-calendar--fixed {
  627. position: fixed;
  628. bottom: calc(var(--window-bottom));
  629. left: 0;
  630. right: 0;
  631. transition-property: transform;
  632. transition-duration: 0.3s;
  633. transform: translateY(460px);
  634. /* #ifndef APP-NVUE */
  635. z-index: 99;
  636. /* #endif */
  637. }
  638. .uni-calendar--ani-show {
  639. transform: translateY(0);
  640. }
  641. .uni-calendar__content {
  642. background-color: #fff;
  643. }
  644. .uni-calendar__content-mobile {
  645. border-top-left-radius: 10px;
  646. border-top-right-radius: 10px;
  647. box-shadow: 0px 0px 5px 3px rgba(0, 0, 0, 0.1);
  648. }
  649. .uni-calendar__header {
  650. position: relative;
  651. /* #ifndef APP-NVUE */
  652. display: flex;
  653. /* #endif */
  654. flex-direction: row;
  655. justify-content: center;
  656. align-items: center;
  657. height: 50px;
  658. }
  659. .uni-calendar__header-mobile {
  660. padding: 10px;
  661. padding-bottom: 0;
  662. }
  663. .uni-calendar--fixed-top {
  664. /* #ifndef APP-NVUE */
  665. display: flex;
  666. /* #endif */
  667. flex-direction: row;
  668. justify-content: space-between;
  669. border-top-color: rgba(0, 0, 0, 0.4);
  670. border-top-style: solid;
  671. border-top-width: 1px;
  672. }
  673. .uni-calendar--fixed-width {
  674. width: 50px;
  675. }
  676. .uni-calendar__backtoday {
  677. position: absolute;
  678. right: 0;
  679. top: 25rpx;
  680. padding: 0 5px;
  681. padding-left: 10px;
  682. height: 25px;
  683. line-height: 25px;
  684. font-size: 12px;
  685. border-top-left-radius: 25px;
  686. border-bottom-left-radius: 25px;
  687. color: #fff;
  688. background-color: #f1f1f1;
  689. }
  690. .uni-calendar__header-text {
  691. text-align: center;
  692. width: 100px;
  693. font-size: 15px;
  694. color: #666;
  695. }
  696. .uni-calendar__button-text {
  697. text-align: center;
  698. width: 100px;
  699. font-size: 14px;
  700. color: #007aff;
  701. /* #ifndef APP-NVUE */
  702. letter-spacing: 3px;
  703. /* #endif */
  704. }
  705. .uni-calendar__header-btn-box {
  706. /* #ifndef APP-NVUE */
  707. display: flex;
  708. /* #endif */
  709. flex-direction: row;
  710. align-items: center;
  711. justify-content: center;
  712. width: 50px;
  713. height: 50px;
  714. }
  715. .uni-calendar__header-btn {
  716. width: 9px;
  717. height: 9px;
  718. border-left-color: #808080;
  719. border-left-style: solid;
  720. border-left-width: 1px;
  721. border-top-color: #555555;
  722. border-top-style: solid;
  723. border-top-width: 1px;
  724. }
  725. .uni-calendar--left {
  726. transform: rotate(-45deg);
  727. }
  728. .uni-calendar--right {
  729. transform: rotate(135deg);
  730. }
  731. .uni-calendar__weeks {
  732. position: relative;
  733. /* #ifndef APP-NVUE */
  734. display: flex;
  735. /* #endif */
  736. flex-direction: row;
  737. }
  738. .uni-calendar__weeks-item {
  739. flex: 1;
  740. }
  741. .uni-calendar__weeks-day {
  742. flex: 1;
  743. /* #ifndef APP-NVUE */
  744. display: flex;
  745. /* #endif */
  746. flex-direction: column;
  747. justify-content: center;
  748. align-items: center;
  749. height: 40px;
  750. border-bottom-color: #F5F5F5;
  751. border-bottom-style: solid;
  752. border-bottom-width: 1px;
  753. }
  754. .uni-calendar__weeks-day-text {
  755. font-size: 12px;
  756. color: #B2B2B2;
  757. }
  758. .uni-calendar__box {
  759. position: relative;
  760. // padding: 0 10px;
  761. padding-bottom: 7px;
  762. }
  763. .uni-calendar__box-bg {
  764. /* #ifndef APP-NVUE */
  765. display: flex;
  766. /* #endif */
  767. justify-content: center;
  768. align-items: center;
  769. position: absolute;
  770. top: 0;
  771. left: 0;
  772. right: 0;
  773. bottom: 0;
  774. }
  775. .uni-calendar__box-bg-text {
  776. font-size: 200px;
  777. font-weight: bold;
  778. color: #999;
  779. opacity: 0.1;
  780. text-align: center;
  781. /* #ifndef APP-NVUE */
  782. line-height: 1;
  783. /* #endif */
  784. }
  785. .uni-date-changed {
  786. padding: 0 10px;
  787. // line-height: 50px;
  788. text-align: center;
  789. color: #333;
  790. border-top-color: #DCDCDC;
  791. ;
  792. border-top-style: solid;
  793. border-top-width: 1px;
  794. flex: 1;
  795. }
  796. .uni-date-btn--ok {
  797. padding: 20px 15px;
  798. }
  799. .uni-date-changed--time-start {
  800. /* #ifndef APP-NVUE */
  801. display: flex;
  802. /* #endif */
  803. align-items: center;
  804. }
  805. .uni-date-changed--time-end {
  806. /* #ifndef APP-NVUE */
  807. display: flex;
  808. /* #endif */
  809. align-items: center;
  810. }
  811. .uni-date-changed--time-date {
  812. color: #999;
  813. line-height: 50px;
  814. margin-right: 5px;
  815. // opacity: 0.6;
  816. }
  817. .time-picker-style {
  818. // width: 62px;
  819. /* #ifndef APP-NVUE */
  820. display: flex;
  821. /* #endif */
  822. justify-content: center;
  823. align-items: center
  824. }
  825. .mr-10 {
  826. margin-right: 10px;
  827. }
  828. .dialog-close {
  829. position: absolute;
  830. top: 0;
  831. right: 0;
  832. bottom: 0;
  833. /* #ifndef APP-NVUE */
  834. display: flex;
  835. /* #endif */
  836. flex-direction: row;
  837. align-items: center;
  838. padding: 0 25px;
  839. margin-top: 10px;
  840. }
  841. .dialog-close-plus {
  842. width: 16px;
  843. height: 2px;
  844. background-color: #737987;
  845. border-radius: 2px;
  846. transform: rotate(45deg);
  847. }
  848. .dialog-close-rotate {
  849. position: absolute;
  850. transform: rotate(-45deg);
  851. }
  852. .uni-datetime-picker--btn {
  853. border-radius: 100px;
  854. height: 40px;
  855. line-height: 40px;
  856. background-color: #007aff;
  857. color: #fff;
  858. font-size: 16px;
  859. letter-spacing: 2px;
  860. }
  861. .uni-datetime-picker-btn-cancel {
  862. border-radius: 100px;
  863. height: 40px;
  864. line-height: 40px;
  865. background-color: #dd6161;
  866. color: #fff;
  867. font-size: 16px;
  868. letter-spacing: 2px;
  869. margin-top: 20rpx;
  870. }
  871. /* #ifndef APP-NVUE */
  872. .uni-datetime-picker--btn:active {
  873. opacity: 0.7;
  874. }
  875. .uni-datetime-picker-btn-cancel:active {
  876. opacity: 0.7;
  877. }
  878. /* #endif */
  879. </style>