calendar.vue 23 KB

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