123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- // pages/integralDetail/integralDetail.js
- var http = require("../../../utils/http.js");
- var util = require("../../../utils/util.js");
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- pages: 0,
- current: 1,
- size: 10,
- scoreDetails: [], //积分明细列表
- isAll: false,
- userInfo: {}, //用户积分等级信息
- scoreExplain: {}, //积分说明
- showPop: false, //攻略弹框显隐
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- //请求积分明细
- this.getScoreDetails()
- //获取用户积分等级信息
- this.getUserScore()
- //积分攻略
- this.getScoreExplain()
- },
- /**
- * 获取用户积分等级信息
- */
- getUserScore: function() {
- var param = {
- url: '/p/user/userInfo',
- method: 'GET',
- data: {
- current: this.data.current,
- size: 10
- },
- callBack: (res) => {
- this.setData({
- userInfo : res
- })
- }
- }
- http.request(param)
- },
- /**
- * 请求积分明细
- */
- getScoreDetails: function() {
- wx.showLoading()
- var param = {
- url: '/p/score/page',
- method: 'GET',
- data: {
- current: this.data.current,
- size: 10
- },
- callBack: (res) => {
- wx.hideLoading()
- let list = []
- if (res.current == 1) {
- list = res.records
- } else {
- list = this.data.scoreDetails
- list = list.concat(res.records)
- }
- this.setData({
- scoreDetails: list,
- pages: res.pages,
- current: res.current
- });
- console.log(this.data.scoreDetails)
- }
- }
- http.request(param);
- },
- /**
- * 触底加载下一页
- */
- getNextPage() {
- console.log('触底加载')
- if (this.data.pages > this.data.current) {
- this.setData({
- current: this.data.current + 1
- })
- this.getScoreDetails()
- } else {
- this.setData({
- isAll: true
- })
- }
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- console.log('钩子:触底加载')
- this.getNextPage()
- },
- /**
- * 积分攻略
- */
- getScoreExplain: function() {
- var param = {
- url: '/p/score/getScoreQuestion',
- method: 'GET',
- data: {},
- callBack: (res) => {
- res.paramValue = util.formatHtml(res.paramValue);
- this.setData({
- scoreExplain: res
- })
- console.log(this.data.scoreExplain)
- }
- };
- http.request(param)
- },
- /**
- * 积分攻略弹框显隐
- */
- clikcPop: function() {
- var showPop = !this.data.showPop
- this.setData({
- showPop
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|