index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view class="calendar-page">
  3. <!-- 导航栏 -->
  4. <u-navbar bgColor="red">
  5. <view class="u-nav-slot" slot="left">
  6. <text class="text-bold text-xxl text-white"> {{ $t('schedule') }} </text>
  7. </view>
  8. <view class="u-nav-slot" slot="right"></view>
  9. </u-navbar>
  10. <uni-calendar insert foldAble :selected="selected" @change="change" />
  11. <u-gap height="120"/>
  12. <button class="cu-btn block bg-red margin-tb-sm lg radio" @click="uploadAction">
  13. <text> 上传 </text>
  14. </button>
  15. <button class="cu-btn block bg-red margin-tb-sm lg radio" @click="monitoringBtnClick">
  16. <text> 监控 </text>
  17. </button>
  18. </view>
  19. </template>
  20. <script>
  21. import Api from '../../api/api.js'
  22. import UniCalendar from "../../components/uni-calendar/uni-calendar.vue"
  23. export default {
  24. components:{
  25. UniCalendar
  26. },
  27. data() {
  28. return {
  29. currentDate: '',
  30. show: false,
  31. mode: 'range',
  32. selected: [
  33. {date: '2022-01-05', info: '签到', data: { custom: '自定义信息', name: '自定义消息头' }},
  34. {date: '2022-01-09', info: '打卡', data: { custom: '自定义信息', name: '自定义消息头' }},
  35. {date: '2022-02-03', info: '打卡', data: { custom: '自定义信息', name: '自定义消息头' }},
  36. ]
  37. }
  38. },
  39. onReady() {
  40. },
  41. mounted() {
  42. // let now = new Date()
  43. // let ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(now)
  44. // let mo = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(now)
  45. // this.currentDate = `${ye}${mo}` /// 202201
  46. let now = new Date();
  47. var year = now.getFullYear()
  48. var month = now.getMonth()+1
  49. this.currentDate = `${year}${month}` /// 202201
  50. console.log(this.currentDate)
  51. this.getClassSchedule()
  52. },
  53. methods:{
  54. async getClassSchedule() {
  55. Api.classSchedule(this.currentDate).then(res=>{
  56. console.log(res)
  57. })
  58. },
  59. previousBtnDidClick(){
  60. console.log('previousBtnDidClick')
  61. },
  62. nextBtnDidClick(){
  63. console.log('nextBtnDidClick')
  64. },
  65. change(e) {
  66. console.log(e)
  67. },
  68. uploadAction() {
  69. uni.navigateTo({url: '../test/upload'})
  70. },
  71. monitoringBtnClick() {
  72. uni.navigateTo({
  73. url: '../launch/index'
  74. })
  75. }
  76. }
  77. }
  78. </script>
  79. <style scoped>
  80. </style>