| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- const _Http = getApp().globalData.http,
- getHeight = require("../../utils/getRheRemainingHeight");
- Page({
- data: {
- list: [],
- },
- onLoad(options) {},
- /* 日历加载完成 */
- handleCalendarLoad({
- detail
- }) {
- console.log("日历加载完成", detail)
- /* let {
- year,
- month,
- day
- } = detail.date;
- month = month < 10 ? "0" + month : month;
- day = day < 10 ? "0" + day : day;
- this.querySignIn(year + '-' + month + '-' + day) */
- },
- /* 日期发生变化 */
- handleCalendarDateChange({
- detail
- }) {
- console.log("日期发生变化", detail)
- this.setData({
- list: []
- })
- if (detail.date.marker) {
- let {
- year,
- month,
- day
- } = detail.date;
- month = month < 10 ? "0" + month : month;
- day = day < 10 ? "0" + day : day;
- this.querySignIn(year + '-' + month + '-' + day)
- }
- },
- /* 查询签到日 */
- checkIn(content) {
- _Http.basic({
- "accesstoken": "3614131fa126be7f41ea07d99b5d9fe6",
- "id": 20221229150001,
- content
- }).then(res => {
- console.log("查询签到日", content, res)
- if (res.data.length) {
- this.selectComponent("#calendar").setMarkers(res.data.map(v => {
- let date = v.split("-");
- return {
- year: date[0],
- month: date[1],
- day: date[2],
- type: "schedule",
- mark: '签到',
- color: '#2a97ff',
- bgColor: '#cce6ff'
- }
- }))
- }
- })
- },
- /* 查询签到记录 */
- querySignIn(signindate) {
- _Http.basic({
- "id": 20221229150101,
- "content": {
- signindate,
- pageSize: 999
- }
- }).then(res => {
- console.log('查询签到记录', res)
- this.setData({
- list: res.data
- })
- })
- },
- /* 日期范围发生变化 */
- handleCalendarRangeChange({
- detail
- }) {
- console.log("日期范围变化", detail)
- let {
- year,
- month,
- day
- } = detail.curr;
- this.checkIn({
- year,
- month
- });
- this.setData({
- list: []
- })
- month = month < 10 ? "0" + month : month;
- day = day < 10 ? "0" + day : day;
- this.querySignIn(year + '-' + month + '-' + day)
- },
- /* 更新日期数据 */
- toDate(date) {
- this.selectComponent("#calendar").toDate(date)
- },
- toSignIn() {
- wx.navigateTo({
- url: '/packageA/clockIn/signIn',
- })
- },
- onReady() {
- this.setListHeight();
- },
- setListHeight() {
- getHeight.getHeight('.head', this).then(res => {
- if (this.data.listHeight != res)
- this.setData({
- listHeight: res
- })
- });
- },
- })
|