calendar.vue 22 KB

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