app/Resources/static-src/app/common/widget/sign.js

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

export default  class Sing {
  constructor($element) {
    this.$element = $element;
    this.selectedDate = null;
    this.inited = false;
    this.daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    this.signedRecordsUrl = null;
    this.signUrl = null;
    this.initEvent();
    this.setup();
  }

  initEvent() {
    this.$element.on('click', '[data-role=sign]', () => this.sign());
    this.$element.on('mouseenter', '[data-role="signed"]', () => this.signedIn());
    this.$element.on('mouseleave', '[data-role="signed"]', () => this.signedOut(event));
    this.$element.on('mouseenter', '.sign_main', () => this.keep());
    this.$element.on('mouseleave', '.sign_main', () => this.remove());
    this.$element.on('click', '[data-role=previous]', () => this.previousMonth());
    this.$element.on('click', '[data-role=next]', () => this.nextMonth());
  }

  setup() {
    this.selectedDate = this.$element.find('#title-month').data('time');
    var signedRecordsUrl = this.$element.data('records');
    var signUrl = this.$element.data('signurl');
    this.signedRecordsUrl = signedRecordsUrl;
    this.signUrl = signUrl;
  }
  keep() {
    this.$element.find('.sign_main').addClass('keepShow');
  }
  remove() {
    this.$element.find('.sign_main').removeClass('keepShow');
    this.hiddenSignTable();
  }
  getDaysInMonth(month, year) {
    if ((month == 1) && (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))) {
      return 29;
    } else {
      return this.daysInMonth[month];
    }
  }
  getWeekByDate(year, month, day) {
    return new Date(year + '/' + month + '/' + day).getDay();
  }
  sign() {
    var today = new Date().getDate();
    $.ajax({
      url: this.signUrl,
      dataType: 'json',
      success:  (data) => {

        $('#sign').html('<div  class="sign-area" data-role="signed" onclick="return false;" >' + '<a class="btn-signin after" >' + Translator.trans('classroom.member_signed') + '<br>' + Translator.trans('classroom.sign_keep_days', {'keepDays' : data.keepDays}) +  '</a></div>');
        this.showSignTable();
        this.initTable(true);
        this.$element.find('.d-' + today).addClass('signed_anime_day');
        // window.location.reload();
      },
      error:  (xhr)=> {

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。