美文网首页
promise对微信小程序封装

promise对微信小程序封装

作者: 葡萄果茶 | 来源:发表于2018-05-12 16:40 被阅读352次

import initCalendar, { getSelectedDay, jumpToToday } from '../../../template/calendar/index'

import api from '../../../api/sdk.js'

const conf = {

  data: {

    hiddenmodal: true, 

    hasEmptyGrid: false,

    showPicker: false,

    selectedDay:{},

    courseList:[

      {

        city:'襄阳市',

        courseName:'策略课',

        teacher:'襄阳事业部(陈雪琴)'

      },{

        city: '襄阳市',

        courseName: '策略课',

        teacher: '襄阳事业部(陈雪琴)'

      }

    ]

  },

  onShow: function() {

    api.admin_course_list_by_page()

    initCalendar({

      // multi: true, // 是否开启多选,

      // disablePastDay: true, // 是否禁选过去日期

      /**

      * 选择日期后执行的事件

      * @param { object } currentSelect 当前点击的日期

      * @param { array } allSelectedDays 选择的所有日期(当mulit为true时,才有allSelectedDays参数)

      */

      afterTapDay: (currentSelect, allSelectedDays) => {

        console.log('当前点击的日期', currentSelect);

        allSelectedDays && console.log('选择的所有日期', allSelectedDays);

        console.log('getSelectedDay方法', getSelectedDay());

      },

      /**

      * 日期点击事件(此事件会完全接管点击事件)

      * @param { object } currentSelect 当前点击的日期

      * @param { object } event 日期点击事件对象

      */

      // onTapDay(currentSelect, event) {

      //  console.log(currentSelect);

      //  console.log(event);

      // },

    });

  },

  openDetail:function(){

        wx.navigateTo({

            url: '../../weiketang/detail/detail',

        })

  },

  search:function(){

      this.setData({

          hiddenmodal: !this.data.hiddenmodal

      }) 

  },

  cancel: function () {

      this.setData({

          hiddenmodal: true

      });

  },

  //确认 

  confirm: function () {

      this.setData({

          hiddenmodal: true

      })

  }, 

  openCitys:function(e){

      if (e.target.id == 'close') {

          return;

      } else {

          wx.navigateTo({

              url: '../city/city',

          })

      }

  },

  openDepart: function (e) {

      if (e.target.id == 'close') {

          return;

      } else {

          wx.navigateTo({

              url: '../department/department',

          })

      }

  },

  openTeacher: function (e) {

      if (e.target.id == 'close') {

          return;

      } else {

          wx.navigateTo({

              url: '../teacher/teacher',

          })

      }

  },

  openCourse: function (e) {

      if (e.target.id == 'close') {

          return;

      } else {

          wx.navigateTo({

              url: '../course/course',

          })

      }

  },

  /**

  * 跳转至今天

  */

  jump() {

    jumpToToday();

  }

};

Page(conf);

相关文章

网友评论

      本文标题:promise对微信小程序封装

      本文链接:https://www.haomeiwen.com/subject/vjjzqftx.html