calendar.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947
  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="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" :selected="selected"
  53. :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}}</view>
  78. <time-picker type="time" :end="timepickerEndTime" v-model="timeRange.endTime" :border="false"
  79. :hide-second="hideSecond" :disabled="!tempRange.after" class="time-picker-style">
  80. </time-picker>
  81. </view>
  82. </view>
  83. <view v-if="!insert" class="uni-date-changed uni-date-btn--ok">
  84. <view class="uni-datetime-picker--btn" @click="confirm">{{confirmText}}</view>
  85. </view>
  86. </view>
  87. </view>
  88. </template>
  89. <script>
  90. import {
  91. Calendar,
  92. getDate,
  93. getTime
  94. } from './util.js';
  95. import calendarItem from './calendar-item.vue'
  96. import timePicker from './time-picker.vue'
  97. import {
  98. initVueI18n
  99. } from '@dcloudio/uni-i18n'
  100. import i18nMessages from './i18n/index.js'
  101. const {
  102. t
  103. } = initVueI18n(i18nMessages)
  104. /**
  105. * Calendar 日历
  106. * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
  107. * @tutorial https://ext.dcloud.net.cn/plugin?id=56
  108. * @property {String} date 自定义当前时间,默认为今天
  109. * @property {String} startDate 日期选择范围-开始日期
  110. * @property {String} endDate 日期选择范围-结束日期
  111. * @property {Boolean} range 范围选择
  112. * @property {Boolean} insert = [true|false] 插入模式,默认为false
  113. * @value true 弹窗模式
  114. * @value false 插入模式
  115. * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
  116. * @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
  117. * @property {Boolean} showMonth 是否选择月份为背景
  118. * @property {[String} defaultValue 选择器打开时默认显示的时间
  119. * @event {Function} change 日期改变,`insert :ture` 时生效
  120. * @event {Function} confirm 确认选择`insert :false` 时生效
  121. * @event {Function} monthSwitch 切换月份时触发
  122. * @example <uni-calendar :insert="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
  123. */
  124. export default {
  125. components: {
  126. calendarItem,
  127. timePicker
  128. },
  129. options: {
  130. // #ifdef MP-TOUTIAO
  131. virtualHost: false,
  132. // #endif
  133. // #ifndef MP-TOUTIAO
  134. virtualHost: true
  135. // #endif
  136. },
  137. props: {
  138. date: {
  139. type: String,
  140. default: ''
  141. },
  142. defTime: {
  143. type: [String, Object],
  144. default: ''
  145. },
  146. selectableTimes: {
  147. type: [Object],
  148. default () {
  149. return {}
  150. }
  151. },
  152. selected: {
  153. type: Array,
  154. default () {
  155. return []
  156. }
  157. },
  158. startDate: {
  159. type: String,
  160. default: ''
  161. },
  162. endDate: {
  163. type: String,
  164. default: ''
  165. },
  166. startPlaceholder: {
  167. type: String,
  168. default: ''
  169. },
  170. endPlaceholder: {
  171. type: String,
  172. default: ''
  173. },
  174. range: {
  175. type: Boolean,
  176. default: false
  177. },
  178. hasTime: {
  179. type: Boolean,
  180. default: false
  181. },
  182. insert: {
  183. type: Boolean,
  184. default: true
  185. },
  186. showMonth: {
  187. type: Boolean,
  188. default: true
  189. },
  190. clearDate: {
  191. type: Boolean,
  192. default: true
  193. },
  194. checkHover: {
  195. type: Boolean,
  196. default: true
  197. },
  198. hideSecond: {
  199. type: [Boolean],
  200. default: false
  201. },
  202. pleStatus: {
  203. type: Object,
  204. default () {
  205. return {
  206. before: '',
  207. after: '',
  208. data: [],
  209. fulldate: ''
  210. }
  211. }
  212. },
  213. defaultValue: {
  214. type: [String, Object, Array],
  215. default: ''
  216. }
  217. },
  218. data() {
  219. return {
  220. show: false,
  221. weeks: [],
  222. calendar: {},
  223. nowDate: {},
  224. aniMaskShow: false,
  225. firstEnter: true,
  226. time: '',
  227. timeRange: {
  228. startTime: '',
  229. endTime: ''
  230. },
  231. tempSingleDate: '',
  232. tempRange: {
  233. before: '',
  234. after: ''
  235. }
  236. }
  237. },
  238. watch: {
  239. date: {
  240. immediate: true,
  241. handler(newVal) {
  242. if (!this.range) {
  243. this.tempSingleDate = newVal
  244. setTimeout(() => {
  245. this.init(newVal)
  246. }, 100)
  247. }
  248. }
  249. },
  250. defTime: {
  251. immediate: true,
  252. handler(newVal) {
  253. if (!this.range) {
  254. this.time = newVal
  255. } else {
  256. this.timeRange.startTime = newVal.start
  257. this.timeRange.endTime = newVal.end
  258. }
  259. }
  260. },
  261. startDate(val) {
  262. // 字节小程序 watch 早于 created
  263. if (!this.cale) {
  264. return
  265. }
  266. this.cale.setStartDate(val)
  267. this.cale.setDate(this.nowDate.fullDate)
  268. this.weeks = this.cale.weeks
  269. },
  270. endDate(val) {
  271. // 字节小程序 watch 早于 created
  272. if (!this.cale) {
  273. return
  274. }
  275. this.cale.setEndDate(val)
  276. this.cale.setDate(this.nowDate.fullDate)
  277. this.weeks = this.cale.weeks
  278. },
  279. selected(newVal) {
  280. // 字节小程序 watch 早于 created
  281. if (!this.cale) {
  282. return
  283. }
  284. this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
  285. this.weeks = this.cale.weeks
  286. },
  287. pleStatus: {
  288. immediate: true,
  289. handler(newVal) {
  290. const {
  291. before,
  292. after,
  293. fulldate,
  294. which
  295. } = newVal
  296. this.tempRange.before = before
  297. this.tempRange.after = after
  298. setTimeout(() => {
  299. if (fulldate) {
  300. this.cale.setHoverMultiple(fulldate)
  301. if (before && after) {
  302. this.cale.lastHover = true
  303. if (this.rangeWithinMonth(after, before)) return
  304. this.setDate(before)
  305. } else {
  306. this.cale.setMultiple(fulldate)
  307. this.setDate(this.nowDate.fullDate)
  308. this.calendar.fullDate = ''
  309. this.cale.lastHover = false
  310. }
  311. } else {
  312. // 字节小程序 watch 早于 created
  313. if (!this.cale) {
  314. return
  315. }
  316. this.cale.setDefaultMultiple(before, after)
  317. if (which === 'left' && before) {
  318. this.setDate(before)
  319. this.weeks = this.cale.weeks
  320. } else if (after) {
  321. this.setDate(after)
  322. this.weeks = this.cale.weeks
  323. }
  324. this.cale.lastHover = true
  325. }
  326. }, 16)
  327. }
  328. }
  329. },
  330. computed: {
  331. timepickerStartTime() {
  332. const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate
  333. return activeDate === this.startDate ? this.selectableTimes.start : ''
  334. },
  335. timepickerEndTime() {
  336. const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate
  337. return activeDate === this.endDate ? this.selectableTimes.end : ''
  338. },
  339. /**
  340. * for i18n
  341. */
  342. selectDateText() {
  343. return t("uni-datetime-picker.selectDate")
  344. },
  345. startDateText() {
  346. return this.startPlaceholder || t("uni-datetime-picker.startDate")
  347. },
  348. endDateText() {
  349. return this.endPlaceholder || t("uni-datetime-picker.endDate")
  350. },
  351. okText() {
  352. return t("uni-datetime-picker.ok")
  353. },
  354. yearText() {
  355. return t("uni-datetime-picker.year")
  356. },
  357. monthText() {
  358. return t("uni-datetime-picker.month")
  359. },
  360. MONText() {
  361. return t("uni-calender.MON")
  362. },
  363. TUEText() {
  364. return t("uni-calender.TUE")
  365. },
  366. WEDText() {
  367. return t("uni-calender.WED")
  368. },
  369. THUText() {
  370. return t("uni-calender.THU")
  371. },
  372. FRIText() {
  373. return t("uni-calender.FRI")
  374. },
  375. SATText() {
  376. return t("uni-calender.SAT")
  377. },
  378. SUNText() {
  379. return t("uni-calender.SUN")
  380. },
  381. confirmText() {
  382. return t("uni-calender.confirm")
  383. },
  384. },
  385. created() {
  386. // 获取日历方法实例
  387. this.cale = new Calendar({
  388. selected: this.selected,
  389. startDate: this.startDate,
  390. endDate: this.endDate,
  391. range: this.range,
  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(isSingleChange) {
  526. if (!this.insert && !isSingleChange) 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(true)
  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>