calendar.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931
  1. <template>
  2. <view class="uni-calendar" @mouseleave="leaveCale">
  3. <view v-if="!insert && show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}"
  4. @click="maskClick"></view>
  5. <view v-if="insert || show" class="uni-calendar__content"
  6. :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow, 'uni-calendar__content-mobile': aniMaskShow}">
  7. <view class="uni-calendar__header" :class="{'uni-calendar__header-mobile' :!insert}">
  8. <view class="uni-calendar__header-btn-box" @click.stop="changeMonth('pre')">
  9. <view class="uni-calendar__header-btn uni-calendar--left"></view>
  10. </view>
  11. <picker mode="date" :value="date" fields="month" @change="bindDateChange">
  12. <text
  13. class="uni-calendar__header-text">{{ (nowDate.year||'') + yearText + ( nowDate.month||'') + monthText}}</text>
  14. </picker>
  15. <view class="uni-calendar__header-btn-box" @click.stop="changeMonth('next')">
  16. <view class="uni-calendar__header-btn uni-calendar--right"></view>
  17. </view>
  18. <view v-if="!insert" class="dialog-close" @click="close">
  19. <view class="dialog-close-plus" data-id="close"></view>
  20. <view class="dialog-close-plus dialog-close-rotate" data-id="close"></view>
  21. </view>
  22. </view>
  23. <view class="uni-calendar__box">
  24. <view v-if="showMonth" class="uni-calendar__box-bg">
  25. <text class="uni-calendar__box-bg-text">{{nowDate.month}}</text>
  26. </view>
  27. <view class="uni-calendar__weeks" style="padding-bottom: 7px;">
  28. <view class="uni-calendar__weeks-day">
  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. this.$emit('changeStatus', true);
  476. if (this.clearDate && !this.insert) {
  477. this.cale.cleanMultipleStatus()
  478. this.init(this.date)
  479. }
  480. this.show = true
  481. this.$nextTick(() => {
  482. setTimeout(() => {
  483. this.aniMaskShow = true
  484. }, 50)
  485. })
  486. },
  487. /**
  488. * 关闭日历弹窗
  489. */
  490. close() {
  491. this.$emit('changeStatus', false);
  492. this.aniMaskShow = false
  493. this.$nextTick(() => {
  494. setTimeout(() => {
  495. this.show = false
  496. this.$emit('close')
  497. }, 300)
  498. })
  499. },
  500. /**
  501. * 确认按钮
  502. */
  503. confirm() {
  504. this.setEmit('confirm')
  505. this.close()
  506. },
  507. /**
  508. * 变化触发
  509. */
  510. change() {
  511. if (!this.insert) return
  512. this.setEmit('change')
  513. },
  514. /**
  515. * 选择月份触发
  516. */
  517. monthSwitch() {
  518. let {
  519. year,
  520. month
  521. } = this.nowDate
  522. this.$emit('monthSwitch', {
  523. year,
  524. month: Number(month)
  525. })
  526. },
  527. /**
  528. * 派发事件
  529. * @param {Object} name
  530. */
  531. setEmit(name) {
  532. if(!this.range){
  533. if(!this.calendar.fullDate){
  534. this.calendar = this.cale.getInfo(new Date())
  535. this.tempSingleDate = this.calendar.fullDate
  536. }
  537. if(this.hasTime && !this.time) {
  538. this.time = getTime(new Date(), this.hideSecond)
  539. }
  540. }
  541. let {
  542. year,
  543. month,
  544. date,
  545. fullDate,
  546. extraInfo
  547. } = this.calendar
  548. this.$emit(name, {
  549. range: this.cale.multipleStatus,
  550. year,
  551. month,
  552. date,
  553. time: this.time,
  554. timeRange: this.timeRange,
  555. fulldate: fullDate,
  556. extraInfo: extraInfo || {}
  557. })
  558. },
  559. /**
  560. * 选择天触发
  561. * @param {Object} weeks
  562. */
  563. choiceDate(weeks) {
  564. if (weeks.disable) return
  565. this.calendar = weeks
  566. this.calendar.userChecked = true
  567. // 设置多选
  568. this.cale.setMultiple(this.calendar.fullDate, true)
  569. this.weeks = this.cale.weeks
  570. this.tempSingleDate = this.calendar.fullDate
  571. const beforeDate = new Date(this.cale.multipleStatus.before).getTime()
  572. const afterDate = new Date(this.cale.multipleStatus.after).getTime()
  573. // 如果先选择结束日期,后选择开始日期,需要交换
  574. if (beforeDate > afterDate && afterDate) {
  575. this.tempRange.before = this.cale.multipleStatus.after
  576. this.tempRange.after = this.cale.multipleStatus.before
  577. } else {
  578. this.tempRange.before = this.cale.multipleStatus.before
  579. this.tempRange.after = this.cale.multipleStatus.after
  580. }
  581. this.change()
  582. },
  583. changeMonth(type) {
  584. let newDate
  585. if(type === 'pre') {
  586. newDate = this.cale.getPreMonthObj(this.nowDate.fullDate).fullDate
  587. } else if(type === 'next') {
  588. newDate = this.cale.getNextMonthObj(this.nowDate.fullDate).fullDate
  589. }
  590. this.setDate(newDate)
  591. this.monthSwitch()
  592. },
  593. /**
  594. * 设置日期
  595. * @param {Object} date
  596. */
  597. setDate(date) {
  598. this.cale.setDate(date)
  599. this.weeks = this.cale.weeks
  600. this.nowDate = this.cale.getInfo(date)
  601. }
  602. }
  603. }
  604. </script>
  605. <style lang="scss" >
  606. $uni-primary: #007aff !default;
  607. .uni-calendar {
  608. /* #ifndef APP-NVUE */
  609. display: flex;
  610. /* #endif */
  611. flex-direction: column;
  612. }
  613. .uni-calendar__mask {
  614. position: fixed;
  615. bottom: 0;
  616. top: 0;
  617. left: 0;
  618. right: 0;
  619. background-color: rgba(0, 0, 0, 0.4);
  620. transition-property: opacity;
  621. transition-duration: 0.3s;
  622. opacity: 0;
  623. /* #ifndef APP-NVUE */
  624. z-index: 99;
  625. /* #endif */
  626. }
  627. .uni-calendar--mask-show {
  628. opacity: 1
  629. }
  630. .uni-calendar--fixed {
  631. position: fixed;
  632. bottom: calc(var(--window-bottom));
  633. left: 0;
  634. right: 0;
  635. transition-property: transform;
  636. transition-duration: 0.3s;
  637. transform: translateY(460px);
  638. /* #ifndef APP-NVUE */
  639. z-index: 99;
  640. /* #endif */
  641. }
  642. .uni-calendar--ani-show {
  643. transform: translateY(0);
  644. }
  645. .uni-calendar__content {
  646. background-color: #fff;
  647. }
  648. .uni-calendar__content-mobile {
  649. border-top-left-radius: 10px;
  650. border-top-right-radius: 10px;
  651. box-shadow: 0px 0px 5px 3px rgba(0, 0, 0, 0.1);
  652. }
  653. .uni-calendar__header {
  654. position: relative;
  655. /* #ifndef APP-NVUE */
  656. display: flex;
  657. /* #endif */
  658. flex-direction: row;
  659. justify-content: center;
  660. align-items: center;
  661. height: 50px;
  662. }
  663. .uni-calendar__header-mobile {
  664. padding: 10px;
  665. padding-bottom: 0;
  666. }
  667. .uni-calendar--fixed-top {
  668. /* #ifndef APP-NVUE */
  669. display: flex;
  670. /* #endif */
  671. flex-direction: row;
  672. justify-content: space-between;
  673. border-top-color: rgba(0, 0, 0, 0.4);
  674. border-top-style: solid;
  675. border-top-width: 1px;
  676. }
  677. .uni-calendar--fixed-width {
  678. width: 50px;
  679. }
  680. .uni-calendar__backtoday {
  681. position: absolute;
  682. right: 0;
  683. top: 25rpx;
  684. padding: 0 5px;
  685. padding-left: 10px;
  686. height: 25px;
  687. line-height: 25px;
  688. font-size: 12px;
  689. border-top-left-radius: 25px;
  690. border-bottom-left-radius: 25px;
  691. color: #fff;
  692. background-color: #f1f1f1;
  693. }
  694. .uni-calendar__header-text {
  695. text-align: center;
  696. width: 100px;
  697. font-size: 15px;
  698. color: #666;
  699. }
  700. .uni-calendar__button-text {
  701. text-align: center;
  702. width: 100px;
  703. font-size: 14px;
  704. color: $uni-primary;
  705. /* #ifndef APP-NVUE */
  706. letter-spacing: 3px;
  707. /* #endif */
  708. }
  709. .uni-calendar__header-btn-box {
  710. /* #ifndef APP-NVUE */
  711. display: flex;
  712. /* #endif */
  713. flex-direction: row;
  714. align-items: center;
  715. justify-content: center;
  716. width: 50px;
  717. height: 50px;
  718. }
  719. .uni-calendar__header-btn {
  720. width: 9px;
  721. height: 9px;
  722. border-left-color: #808080;
  723. border-left-style: solid;
  724. border-left-width: 1px;
  725. border-top-color: #555555;
  726. border-top-style: solid;
  727. border-top-width: 1px;
  728. }
  729. .uni-calendar--left {
  730. transform: rotate(-45deg);
  731. }
  732. .uni-calendar--right {
  733. transform: rotate(135deg);
  734. }
  735. .uni-calendar__weeks {
  736. position: relative;
  737. /* #ifndef APP-NVUE */
  738. display: flex;
  739. /* #endif */
  740. flex-direction: row;
  741. }
  742. .uni-calendar__weeks-item {
  743. flex: 1;
  744. }
  745. .uni-calendar__weeks-day {
  746. flex: 1;
  747. /* #ifndef APP-NVUE */
  748. display: flex;
  749. /* #endif */
  750. flex-direction: column;
  751. justify-content: center;
  752. align-items: center;
  753. height: 40px;
  754. border-bottom-color: #F5F5F5;
  755. border-bottom-style: solid;
  756. border-bottom-width: 1px;
  757. }
  758. .uni-calendar__weeks-day-text {
  759. font-size: 12px;
  760. color: #B2B2B2;
  761. }
  762. .uni-calendar__box {
  763. position: relative;
  764. // padding: 0 10px;
  765. padding-bottom: 7px;
  766. }
  767. .uni-calendar__box-bg {
  768. /* #ifndef APP-NVUE */
  769. display: flex;
  770. /* #endif */
  771. justify-content: center;
  772. align-items: center;
  773. position: absolute;
  774. top: 0;
  775. left: 0;
  776. right: 0;
  777. bottom: 0;
  778. }
  779. .uni-calendar__box-bg-text {
  780. font-size: 200px;
  781. font-weight: bold;
  782. color: #999;
  783. opacity: 0.1;
  784. text-align: center;
  785. /* #ifndef APP-NVUE */
  786. line-height: 1;
  787. /* #endif */
  788. }
  789. .uni-date-changed {
  790. padding: 0 10px;
  791. // line-height: 50px;
  792. text-align: center;
  793. color: #333;
  794. border-top-color: #DCDCDC;
  795. ;
  796. border-top-style: solid;
  797. border-top-width: 1px;
  798. flex: 1;
  799. }
  800. .uni-date-btn--ok {
  801. padding: 20px 15px;
  802. }
  803. .uni-date-changed--time-start {
  804. /* #ifndef APP-NVUE */
  805. display: flex;
  806. /* #endif */
  807. align-items: center;
  808. }
  809. .uni-date-changed--time-end {
  810. /* #ifndef APP-NVUE */
  811. display: flex;
  812. /* #endif */
  813. align-items: center;
  814. }
  815. .uni-date-changed--time-date {
  816. color: #999;
  817. line-height: 50px;
  818. /* #ifdef MP-TOUTIAO */
  819. font-size: 16px;
  820. /* #endif */
  821. margin-right: 5px;
  822. // opacity: 0.6;
  823. }
  824. .time-picker-style {
  825. // width: 62px;
  826. /* #ifndef APP-NVUE */
  827. display: flex;
  828. /* #endif */
  829. justify-content: center;
  830. align-items: center
  831. }
  832. .mr-10 {
  833. margin-right: 10px;
  834. }
  835. .dialog-close {
  836. position: absolute;
  837. top: 0;
  838. right: 0;
  839. bottom: 0;
  840. /* #ifndef APP-NVUE */
  841. display: flex;
  842. /* #endif */
  843. flex-direction: row;
  844. align-items: center;
  845. padding: 0 25px;
  846. margin-top: 10px;
  847. }
  848. .dialog-close-plus {
  849. width: 16px;
  850. height: 2px;
  851. background-color: #737987;
  852. border-radius: 2px;
  853. transform: rotate(45deg);
  854. }
  855. .dialog-close-rotate {
  856. position: absolute;
  857. transform: rotate(-45deg);
  858. }
  859. .uni-datetime-picker--btn {
  860. border-radius: 100px;
  861. height: 40px;
  862. line-height: 40px;
  863. background-color: $uni-primary;
  864. color: #fff;
  865. font-size: 16px;
  866. letter-spacing: 2px;
  867. }
  868. /* #ifndef APP-NVUE */
  869. .uni-datetime-picker--btn:active {
  870. opacity: 0.7;
  871. }
  872. /* #endif */
  873. </style>