calendar.vue 22 KB

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