calendar.vue 22 KB

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