calendar.vue 22 KB

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