// pages/cardList/cardList.js var app = getApp() var util = require('../../utils/util') Page({ /** * 页面的初始数据 */ data: { imageUrl: app.globalData.imageUrl, left: 25, titleIndex:1, childTitle:'我的卡包', loading:'正在加载', loadingIndex:0, loading2:"没有更多了", orgTitle: app.globalData.orgTitle, schoolName: '', params: { openId: '', classesType: '1' }, wcList: [], pianoList:[], params: { appId: app.globalData.appId, openId: wx.getStorageSync('openId'), page: 0, size: 10, typeId: '1002', status: 'select' } }, getPiano:function(e){ var index = e.currentTarget.dataset.index wx.navigateTo({ url: '/pages/pianoDetailCode/pianoDetail?obj='+ JSON.stringify(this.data.pianoList[index]), }) }, changeTitle:function(e){ var index = e.currentTarget.dataset.index this.setData({ titleIndex: index, left: e.currentTarget.dataset.leftnum }) }, toWcsp:function(e){ wx.navigateTo({ url: '/pages/wcsp/wcsp?id=' + e.currentTarget.dataset.id + '&typeId=1002&validDay='+ e.currentTarget.dataset.day + '&price=' + e.currentTarget.dataset.price + '&total=' + e.currentTarget.dataset.price }) }, getMySpecials: function () { if (this.data.params.openId == '') { const openId = "params.openId" this.setData({ [openId]: app.globalData.openId }) } util.doPost( 'getMySpecials', this.data.params, ).then(res => { if (res.success == 1) { this.setData({ wcList: this.data.wcList.concat(res.data.list), }) if (this.data.params.page < res.data.pages - 1) { this.setData({ loading: '上拉加载更多', loadingIndex: 1 }) this.data.params.page++; } else { this.setData({ loading: '没有更多了', loadingIndex: 2 }) } } }) }, callPhone:function(){ wx.makePhoneCall({ phoneNumber: wx.getStorageSync('campusInfo').telephone, }) }, getPianoList:function(){ const params ={ openId: wx.getStorageSync('openId') // openId : 'osm1O5MjCMIy_-wo4fmV8t0xjILs' } util.doPost( "openExercuseRecordList",params ).then(res =>{ if(res.success == 1){ this.setData({ pianoList: res.data }) } }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.getPianoList() // this.getMySpecials() this.setData({ schoolName: wx.getStorageSync('campusInfo').name }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { if(this.data.loadingIndex == 1){ this.setData({ loading:"正在加载" }) this.getMySpecials() } }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })