calendar.vue 22 KB

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