123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- // 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 () {
- }
- })
|