calendar.vue 21 KB

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