// pages/makePiano/makePiano.js const app = getApp() const util = require("../../utils/util") Page({ /** * 页面的初始数据 */ data: { animationBox: {}, animationBg: {}, weekList:[], curIndex:0, array: [ '全部时间', '08:00 ~ 10:00', '10:00 ~ 12:00', '12:00 ~ 14:00', '14:00 ~ 16:00', '16:00 ~ 18:00', '18:00 ~ 20:00', '20:00 ~ 22:00', ], objectArray: [ { id: 0, name: '全部时间' }, { id: 1, name: '08:00 ~ 10:00' }, { id: 2, name: '10:00 ~ 12:00' }, { id: 3, name: '12:00 ~ 14:00' }, { id: 4, name: '14:00 ~ 16:00' }, { id: 5, name: '16:00 ~ 18:00' }, { id: 6, name: '18:00 ~ 20:00' }, { id: 7, name: '20:00 ~ 22:00' } ], index: 0, schoolList:[ {}, {}, {}, {}, {}, ], loading:'上拉加载', flag:0, }, getWeek:function(e){ this.setData({ curIndex : e.currentTarget.dataset.index }) }, bindPickerChange: function (e) { this.setData({ index: e.detail.value }) }, localtionMethod: function () { var that = this wx.getLocation({ type: 'wgs84', success(res) { console.log(res) wx.setStorageSync('latlng', res) }, fail(res){ wx.hideLoading({ success: (res) => { wx.showModal({ title: '提示', content: "定位失败,请检查手机'位置服务'或GPS功能已开启并授权小程序位置信息", }) }, }) } }) }, showSelect:function(){ var animation = wx.createAnimation({ timingFunction: 'linear', }) this.animation = animation var num = 0 var opacity = 0 if(this.data.yFlag == false){ num = 165 opacity = 0.4 this.setData({ yFlag: true }) } else { num = -360 opacity = 0 this.setData({ yFlag: false }) } animation.translateY(num).step() this.setData({ animationBox:animation.export() }) var animation2 = wx.createAnimation({ timingFunction: 'linear', }) this.animation2 = animation2 animation2.opacity(opacity).step() this.setData({ animationBg:animation2.export() }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var list = [] for(var i = 0; i < 7; i++){ var date = util.fun_date(i) var week = util.fun_week(date) var json = { date: date.substring(5,date.length), week: week } list.push(json) } this.setData({ weekList: list }) this.localtionMethod() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { if(this.data.flag == 0){ this.setData({ loading: '加载中', flag: 1 }) setTimeout(() => { this.setData({ schoolList:[ {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, ], loading: '没有更多数据', flag: 2 }) }, 2000); } }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })