|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- const navigationBarHeight = (getApp().statusBarHeight + 50) + 'px'
- var config = require("../../../config/config.js");
- var app = getApp();
- const Http = require("../../../utils/HttpBasics");
- let util = require("../../../utils/util");
- const imgurl = require("../../../utils/imgurl");
- const {creditType} = require("../../../utils/creditType");
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- navigationBarHeight,
- score: 10,
- pageNum: 1,
- list: [],
- showcontent: false,
- loadingUrl: imgurl.loading.url,
- bgg: imgurl.bgg.url,
- allow_load: true,
- creditAmount:0
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
-
- },
- gotorule: function () {
- tt.navigateTo({
- url: '/pages/grade/grade',
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- let that = this;
- that.record(1, 15);
- },
- record(pageNum) {
- var that = this;
- if (that.data.allow_load) {
- Http.get({
- url: config.api.integralList,
- data: {
- pageNum: pageNum,
- pageSize: 20,
- }
- }).then(res => {
- tt.stopPullDownRefresh();
- res.data.list.map(file => {
- creditType.map((item,index)=>{
- if (file.creditType==item.value){
- file.creditTypeName = item.name;
- }
- })
- file.createDate = util.formatTime(
- file.createDate,
- "yyyy-MM-dd hh:mm:ss"
- );
- });
- if (pageNum >= res.data.pages) {
- that.setData({
- allow_load: false,
- });
- }
- that.data.list = that.data.list.concat(res.data.list);
- that.setData({
- list: that.data.list,
- creditAmount: that.data.list[0].creditAmount
- });
- })
- .catch(err => {
- tt.stopPullDownRefresh();
- tt.showToast({
- title: err.errMsg,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- })
- }
- },
- /**
- * 刷新
- */
- onPullDownRefresh: function (e) {
- let that = this;
- that.setData({
- pageNum: 1,
- list:[],
- allow_load:true
- });
- that.record(1);
- },
- onReachBottom: function () {
- var that = this;
- that.data.pageNum++;
- that.setData({
- pageNum: that.data.pageNum
- });
- that.record(that.data.pageNum);
- }
- })
|