scheduleList.js 21.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740
import { RRule } from "rrule";
import {
  getDynamicList,
  meetingCollection,
  updateMeetingTask,
  getHomeUserSchedule1
} from "../../api/request";
import {
  getDateMap,
  getExcludeDate,
  getNextDateList,
  getWeekNumber,
  getBlankList,
  toLocaleDateString
} from "./schedule.js";
import {
  getFormatDate,
  throttle,
  padZero,
  getCreateShowTime
} from "../../utils/utils";
const currentDate = new Date();
const minYear = 2020;
const maxYear = currentDate.getFullYear() + 1;
let DateMap = getDateMap(minYear, maxYear);
const weekList = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
import create from "dd-store";
let maxClickCount = 5;
create.Page({
  data: {
    $data: null,
    iconDay: currentDate.getDate(),
    scheduleList: [],
    todayStr: toLocaleDateString(currentDate),
    currentData: toLocaleDateString(currentDate),
    currentDataIndex: 0,
    offset: "stop",
    show: false,
    loading: true,
    traceTime: "1970-03-01 00:00:00",
    isStopBodyScroll: false,
    dynamicList: [],
    current: 1,
    pages: 1,
    listLoading: true,
    isFullscreen: false
  },
  scrollTop: 0,
  pageSize: 10,
  totalPages: 1,
  currentPage: 1,
  firstPage: 1,
  scheduleList: [],
  timer: null,
  isFirstLoad: true,
  blankDataLength: 0,
  blankDataLengthAfter: 0,
  minYear: minYear,
  maxYear: maxYear,
  todayIndex: 0,
  onShow() {
    //如果是重复会议重新算
    if (this.$store.data.indexNeedUpdate) {
      DateMap = getDateMap(this.minYear, this.maxYear);
      this.onLoad();
      this.$store.data.indexNeedUpdate = false;
      this.update();
    }
    //单次会议往DateMap中添加
    if (this.$store.data.onceMeetingContent) {
      this.getScheduleList(this.$store.data.onceMeetingContent, "once");
      this.$store.data.onceMeetingContent = null;
      this.update();
    }
  },
  onLoad() {
    this.setData({
      isFullscreen: getApp().globalData.isFullscreen
    });
    dd.setNavigationBar({
      title: this.$store.data.tabBarIndex == "0" ? "动态" : "日程"
    });
    //获取动态列表
    this.getPages(1);
    //获取日程列表
    this.getData();
    this.isFirstLoad = true;
  },
  //动态列表侧滑的时候禁止页面上下滑动
  setBodyDisableScroll(isStopBodyScroll) {
    this.setData({
      isStopBodyScroll
    });
  },
  //点击页面关闭侧滑模块
  closeSwipe() {
    if (this.$store.closeActiveSwipe) {
      this.$store.closeActiveSwipe();
    }
  },
  getPages(current, callBack) {
    getDynamicList({
      current,
      size: 10
    }).then(res => {
      if (!res.data.data) {
        this.setData({
          listLoading: false
        });
        return;
      }
      const dynamicList = res.data.data.records.map((item, index) => {
        for (let i = 0; i < item.meetingLogDataList.length; i++) {
          if (item.meetingLogDataList[i].creatorInfo) {
            item.meetingLogDataList[i].creatorInfo = JSON.parse(
              item.meetingLogDataList[i].creatorInfo
            );
          }
          if (item.meetingLogDataList[i].createTime) {
            item.meetingLogDataList[i].createTime = getCreateShowTime(
              item.meetingLogDataList[i].createTime
            );
          }
          let itemData = item.meetingLogDataList[i].meetingLogResource;
          if (itemData) {
            itemData.groupId = item.groupId;
            if (itemData.taskInfos || itemData.fileInfos) {
              if (itemData.creatorInfo) {
                itemData.creatorInfo = JSON.parse(itemData.creatorInfo);
              }
              if (itemData.fileInfos) {
                itemData.fileInfos = JSON.parse(itemData.fileInfos);
              }
              if (itemData.taskInfos) {
                itemData.taskInfos = JSON.parse(itemData.taskInfos);
              }
              if (itemData.acceptorInfo) {
                itemData.acceptorInfo = JSON.parse(itemData.acceptorInfo);
              }
            }
          }
        }
        return item;
      });

      //第一页数据会重新请求需要替换
      if (current === 1) {
        this.setData({
          dynamicList
        });
      } else {
        const newDynamicList = this.data.dynamicList.concat(dynamicList);
        this.setData({
          dynamicList: newDynamicList
        });
      }
      this.setData({
        listLoading: false,
        current: res.data.data.current,
        pages: res.data.data.pages
      });
      if (callBack) {
        callBack();
      }
    });
  },
  //动态置顶
  changeCollection(e) {
    const { index, scheduleId, collection } = e.target.dataset;
    meetingCollection({
      scheduleId,
      collection
    }).then(res => {
      //取消置顶
      if (collection === "N") {
        // 重新获取第一页的数据
        this.getPages(1, () => {
          dd.showToast({
            content: "取消成功"
          });
        });
      } else {
        //置顶
        const dynamicList = this.data.dynamicList;
        const replaceItem = dynamicList[index];
        dynamicList[index].traceTime = res.data.data;
        dynamicList.splice(index, 1);
        dynamicList.unshift(replaceItem);
        this.setData(
          {
            dynamicList: dynamicList
          },
          () => {
            dd.showToast({
              content: "置顶成功"
            });
          }
        );
      }
    });
  },
  //动态上拉加载分页数据
  onScrollToLower() {
    if (this.data.current < this.data.pages) {
      this.getPages(this.data.current + 1);
    }
  },
  //动态修改状态
  onChangeTaskStatusOnList(e) {
    const data = {
      groupId: e.groupId,
      scheduleId: e.scheduleId,
      resourceType: "task",
      creatorId: getApp().globalData.userid,
      creatorInfo: getApp().globalData.userInfo,
      id: e.id,
      logType: "task_status_modify",
      taskStatus: e.status
    };
    updateMeetingTask(data).then(res => {
      if (res.data.code === 0) {
        let dataIndex1 = "";
        let dataIndex2 = "";
        this.data.dynamicList.forEach((item, index) => {
          if (item.scheduleId === e.scheduleId) {
            dataIndex1 = index;
            item.meetingLogDataList.forEach((it, index2) => {
              if (it.meetingLogResource.id == e.id) {
                dataIndex2 = index2;
              }
            });
          }
        });
        const setData = `dynamicList[${dataIndex1}].meetingLogDataList[${dataIndex2}].meetingLogResource.taskStatus`;
        this.setData({
          [setData]: e.status
        });
      }
    });
  },
  //日程获取分页数据
  getPagination(scheduleList = []) {
    this.totalPages = Math.ceil(scheduleList.length / this.pageSize);
    for (let i = 0; i < scheduleList.length; i++) {
      if (scheduleList[i].dateStr == toLocaleDateString(currentDate)) {
        const centerPage = Math.floor(i / this.pageSize);
        this.todayIndex = i;
        this.setData({
          currentDataIndex: i
        })
        // firstPage转为4的倍数,一次下拉加载40条
        const firstPage = centerPage - 2;
        this.firstPage =
          firstPage % 4 == 0 ? firstPage : firstPage - (firstPage % 4);
        this.currentPage = centerPage + 2;
        break;
      }
    }
  },
  getData() {
    getHomeUserSchedule1({
      startTime: "2020-01-01 00:00:00",
      endTime: "2025-12-30 23:59:59"
    }).then(res => {
      this.getScheduleList(res.data.data);
    });
  },
  //生成DateMap值
  setDateMapValue(startTime, endTime, item, type) {
    const pushItem = {
      endTime: endTime,
      startTime: startTime,
      planDate: getFormatDate(startTime, "yyyyMMdd", "-"),
      thisDayStartTime: getFormatDate(startTime, "HH:mm"),
      thisDayEndTime: getFormatDate(endTime, "HH:mm"),
      confirmAttendance: item.confirmAttendance,
      title: item.title,
      id: item.id,
      isBeOverdue: currentDate.getTime() > endTime.getTime() ? true : false
    };
    //模板会议id为空
    if (type == "repeat") {
      pushItem.scheduleTemplateId = item.id;
      pushItem.id = "";
    }

    // 如果是跨天会议,需要手动在起始天以后的其他天 添加会议日程
    const nextDateList = getNextDateList(startTime, endTime); //返回日期包括起始天
    if (nextDateList.length > 1) {
      pushItem.isDaySpan = true;
      pushItem.isFewDays = 1;
      pushItem.isfirstDayOrEndDay = "0"; // 0 第一天,1中间的天,2结束的天
      pushItem.duration = nextDateList.length;
      for (let i = 1; i < nextDateList.length; i++) {
        if (DateMap.has(nextDateList[i])) {
          DateMap.get(nextDateList[i]).unshift({
            ...pushItem,
            isFewDays: i + 1,
            isfirstDayOrEndDay: nextDateList.length - 1 === i ? "2" : "1" // 0 第一天,1中间的天,2结束的天
          });
        }
      }
    }

    if (DateMap.has(toLocaleDateString(startTime))) {
      DateMap.get(toLocaleDateString(startTime)).push(pushItem);
    }
  },
  // 根据接口返回数据生成填充DateMap
  setDateMapByResponse(response) {
    if (response) {
      // 处理单次会议 scheduleList
      const scheduleListWithTemplateId = [];
      response.scheduleList.forEach(item => {
        // 有scheduleTemplateId则是虚拟会议转成实体会议,需要替换rrule生成的模板会议
        if (item.scheduleTemplateId) {
          scheduleListWithTemplateId.push(item);
        } else {
          this.setDateMapValue(
            new Date(item.startTime.replace(/-/g, "/")),
            new Date(item.endTime.replace(/-/g, "/")),
            item
          );
        }
      });

      // 处理重复会议 templateList
      response.templateList.forEach(item => {
        //日程会议
        const itemScheduleList = scheduleListWithTemplateId.filter(
          it => it.scheduleTemplateId == item.id
        );
        // 生成rrules规则
        const initialTimeList = item.initialTime.split("-");
        const startTimeList = item.startTime.split(":");
        const DTSTART = `${initialTimeList[0]}${initialTimeList[1]}${initialTimeList[2]}T${startTimeList[0]}${startTimeList[1]}00Z`;
        const rule = RRule.fromString(
          `${item.recurrenceModel.recurrenceRule};DTSTART=${DTSTART}`
        );

        const setDateMapValueAll = (startTime, endTime, item) => {
          //如果有日程会议则用日程会议替换
          let replaceItem = [];
          if (itemScheduleList.length > 0) {
            replaceItem = itemScheduleList.filter(
              it => it.planDate == getFormatDate(startTime, "yyyyMMdd", "-")
            );
          }
          if (replaceItem.length > 0) {
            this.setDateMapValue(
              new Date(replaceItem[0].startTime.replace(/-/g, "/")),
              new Date(replaceItem[0].endTime.replace(/-/g, "/")),
              replaceItem[0]
            );
          } else {
            this.setDateMapValue(startTime, endTime, item, "repeat");
          }
        };
        // 需要剔除某一天
        if (item.excludePlanDates) {
          const excludeData = getExcludeDate(item.excludePlanDates.split(","));
          rule.all().forEach(startTime => {
            //修正时间(时间有8小时时差)
            startTime.setHours(startTime.getHours() - 8);
            // 生成结束时间
            const endTime = new Date(startTime);
            endTime.setMinutes(
              endTime.getMinutes() + item.recurrenceModel.duration
            );
            // 剔除规则: 时间小于futureTime 时间不在单个排除日期里面
            if (
              startTime.getTime() < excludeData.minFutureTime &&
              !excludeData.excludeDateList.includes(
                getFormatDate(startTime, "yyyyMMdd", "-")
              )
            ) {
              setDateMapValueAll(startTime, endTime, item);
            }
          });
        }
        // 正常生成数据
        else {
          rule.all().forEach(startTime => {
            //修正时间(时间有8小时时差)
            startTime.setHours(startTime.getHours() - 8);
            // 生成结束时间
            const endTime = new Date(startTime);
            endTime.setMinutes(
              endTime.getMinutes() + item.recurrenceModel.duration
            );
            setDateMapValueAll(startTime, endTime, item);
          });
        }
      });
    }
  },
  //日程数据
  getScheduleList(response, type) {
    if (type == "once") {
      this.setDateMapValue(response.startTime, response.endTime, response);
    } else {
      this.setDateMapByResponse(response);
    }
    // 取出DateMap的value值平铺到DateList
    const DateList = [];
    DateMap.forEach(function (value, key) {
      const keyDate = new Date(key);
      const year = keyDate.getFullYear();
      const month = keyDate.getMonth();
      const date = keyDate.getDate();
      const day = keyDate.getDay();

      // 生成年
      if (month === 0 && date === 1) {
        DateList.push({
          type: "year",
          value: year,
          dateStr: `${year}`
        });
      }
      //生成月
      if (date === 1) {
        DateList.push({
          type: "month",
          value: month + 1,
          dateStr: `${year}/${month + 1}`
        });
      }
      //生成周
      if (day === 0) {
        const rangeDate = new Date(year, month, date + 6);
        const rangeMonth2 = new Date(rangeDate).getMonth();
        const rangeDay2 = new Date(rangeDate).getDate();
        DateList.push({
          type: "week",
          value: `第${getWeekNumber(year, month, date)}周,${month +
            1}${date}日 - ${
            rangeMonth2 == month ? "" : rangeMonth2 + 1 + "月"
            }${rangeDay2}日`,
          dateStr: `${year}/${month + 1}/${date}-week`
        });
      }
      // 有日程长度
      if (value.length !== 0) {
        value.forEach((item, index) => {
          if (index === 0) {
            DateList.push({
              type: key !== toLocaleDateString(currentDate) ? "day" : "today",
              week: weekList[day],
              hasDateLabel: padZero(date),
              value: item,
              dateStr: `${key}`
            });
          } else {
            DateList.push({
              type: "day",
              value: item,
              dateStr: `${key}/${item.id || item.scheduleTemplateId}`
            });
          }
        });
      } else if (
        value.length === 0 &&
        key === toLocaleDateString(currentDate)
      ) {
        DateList.push({
          type: "thisday",
          value: "",
          hasDateLabel: padZero(date),
          week: weekList[day],
          dateStr: key
        });
      }
    });
    this.scheduleList = DateList;

    this.getPagination(this.scheduleList);
    // 第一次加载
    this.setData({
      scheduleList: this.scheduleList.slice(
        this.firstPage * this.pageSize,
        this.currentPage * this.pageSize
      ),
      loading: false
    });
  },
  //日程上拉加载
  lower() {
    if (this.currentPage < this.totalPages) {
      this.currentPage++;
      this.setData({
        scheduleList: this.scheduleList.slice(
          this.firstPage * this.pageSize,
          this.currentPage * this.pageSize
        )
      });
    } else {
      //超出加载一年的数据
      this.maxYear++;
      const yearData = getBlankList(this.maxYear);
      this.blankDataLengthAfter += yearData.length;
      this.scheduleList.push(...yearData);
      this.setData({
        scheduleList: this.scheduleList.slice(this.firstPage * this.pageSize)
      });
    }
  },
  onPullDownRefresh() {
    if (this.$store.data.tabBarIndex == "0") {
      this.getPages(1);
      dd.stopPullDownRefresh();
      return;
    }
    //日程页面到顶部的时候才下拉加载数据,否则定位距离太长
    if (this.$store.data.tabBarIndex == "1" && this.scrollTop !== 0) {
      dd.stopPullDownRefresh();
      return;
    }
    // const todayStr = this.data.scheduleList[0].dateStr;
    if (this.firstPage > 0) {
      this.firstPage -= 4;
      this.currentPage -= 4;
      this.setData(
        {
          todayStr: "",
          scheduleList: this.scheduleList.slice(
            this.firstPage * this.pageSize,
            this.currentPage * this.pageSize
          )
        },
        () => {
          this.setData({
            todayStr: this.data.scheduleList[this.pageSize * 4 - 1].dateStr
          });
          dd.stopPullDownRefresh();
        }
      );
    } else {
      this.minYear--;
      const yearData = getBlankList(this.minYear);
      this.blankDataLength += yearData.length;
      this.todayIndex += yearData.length;
      this.scheduleList.unshift(...yearData);
      this.totalPages = Math.ceil(this.scheduleList.length / this.pageSize);
      this.currentPage = Math.floor((yearData.length * 2) / this.pageSize);
      this.setData(
        {
          todayStr: "",
          scheduleList: this.scheduleList.slice(0, yearData.length * 2)
        },
        () => {
          this.setData({
            //加载一年的数据重定位可能会有点问题,重置一下
            currentData: this.scheduleList[yearData.length - 1].dateStr,
            currentDataIndex: yearData.length - 1,
            todayStr: this.scheduleList[yearData.length - 1].dateStr
          });
          dd.stopPullDownRefresh();
        }
      );
    }
  },
  scroll(e) {
    // 一次性惯性拉到顶速度跟不上,重置
    if (e.detail.scrollTop == 0) {
      this.setData({
        currentData: this.data.scheduleList[0].dateStr,
        currentDataIndex: 0
      });
    }
    //每次计算偏移值
    const offset = this.getScrollOffset(e.detail.scrollTop);
    dd.createSelectorQuery().selectAll('.li').boundingClientRect().exec((rect) => {
      //日程的上下箭头
      this.setScrollOffset(rect);
      if (offset == 'next') {
        for (let i = this.data.currentDataIndex; i < rect[0].length; i++) {
          if (rect[0][i].top > 0) {
            if (this.data.scheduleList[i].dateStr.split('/')[1] !== this.data.currentData.split('/')[1]) {
              this.setData({
                currentData: this.data.scheduleList[i].dateStr,
                currentDataIndex: i
              })
            }
            break;
          }
        }
      } else if (offset == "before") {
        let i = Math.min(this.data.currentDataIndex, this.data.scheduleList.length - 1);
        for (; i > 0; i--) {
          if (rect[0][i].top < 50) {
            if (this.data.scheduleList[i].dateStr.split("/")[1] !== this.data.currentData.split("/")[1]) {
              this.setData({
                currentData: this.data.scheduleList[i].dateStr,
                currentDataIndex: i
              });
            }
            break;
          }
        }
      }
    });
  },
  //判断滚动方向
  getScrollOffset(scrollTop) {
    let offset = "stop";
    if (scrollTop > this.scrollTop) {
      //向下滚动
      offset = "next";
    } else {
      //向上滚动
      offset = "before";
    }
    this.scrollTop = scrollTop;
    return offset;
  },
  setScrollOffset(rect) {
    if (rect[0][this.todayIndex]) {
      if (rect[0][this.todayIndex].top <= 50 && rect[0][this.todayIndex].top >= 20) {
        if (this.data.offset !== 'stop') {
          this.setData({ offset: 'stop' })
        }
      } else if (rect[0][this.todayIndex].top < 50) {
        if (this.data.offset !== 'next') {
          this.setData({ offset: 'next' })
        }

      } else if (rect[0][this.todayIndex].top > 20) {
        if (this.data.offset !== 'before') {
          this.setData({ offset: 'before' })
        }
      }
    } else {
      if (this.data.offset !== 'before') {
        this.setData({ offset: 'before' })
      }
    }
  },
  closePop() {
    this.setData({
      show: false
    });
  },
  changesidebar() {
    this.setData({
      show: true
    });
  },
  createMeeting() {
    dd.navigateTo({ url: "./../createMeeting/createMeeting" });
  },
  nextDetail: throttle(function (e) {
    dd.navigateTo({
      url: `./../meetingDetail/meetingDetail?scheduleItem=${encodeURIComponent(
        JSON.stringify(e.target.dataset.item)
      )}`
    });
  }, 1000),
  backToToday(type) {
    if (!type) {
      //如果当前的日期还没加载出来点击无效,下拉积累数据过长可以去掉
      const isFindArr = this.data.scheduleList.filter(
        it => it.dateStr == toLocaleDateString(currentDate)
      );
      if (isFindArr.length == 0 || this.data.scheduleList.length > 100) {
        //去掉头部空数据
        if (this.minYear < minYear) {
          this.scheduleList.splice(0, this.blankDataLength);
          this.minYear = minYear;
        }
        //去掉尾部数据
        if (this.maxYear > maxYear) {
          this.scheduleList.splice(-this.blankDataLengthAfter);
          this.maxYear = maxYear;
        }
        this.getPagination(this.scheduleList);
        this.setData({
          scheduleList: this.scheduleList.slice(
            this.firstPage * this.pageSize,
            this.currentPage * this.pageSize
          )
        });
      }
    }
    //需要先清空todayStr再设置才有效
    this.setData(
      {
        todayStr: ""
      },
      () => {
        this.setData({
          todayStr: toLocaleDateString(currentDate)
        });
      }
    );
  },
  // 修改tabBar
  changeTabBar(e) {
    const { tabbar, title } = e.currentTarget.dataset;
    const lastTimeTabBarIndex = this.$store.data.tabBarIndex;
    this.$store.data.tabBarIndex = tabbar;
    this.update();

    dd.setNavigationBar({
      title: title
    });

    if (this.isFirstLoad) {
      this.backToToday("first");
      this.isFirstLoad = false;
    }
    if (lastTimeTabBarIndex == tabbar) {
      if (tabbar == "1") {
        this.backToToday();
      }
    } else {
      //切换到动态页面时,日程重置成当前日期
      if (tabbar == "0") {
        this.lastOffset = this.data.offset;
        this.setData({
          offset: 'stop'
        })
      } else if (!this.isFirstLoad) {
        this.setData({
          offset: this.lastOffset
        })
      }
    }
  },

  onTitleClick() {
    maxClickCount--;
    if (maxClickCount == 0) {
      dd.alert({
        content: "版本号199"
      });
      maxClickCount = 5;
    }
  }
});