|
- const app = getApp()
- const config = require("../../config/config")
- const Http = require("../../utils/HttpBasics.js")
- const util = require("../../utils/util.js")
- const navigationBarHeight = (getApp().statusBarHeight + 44)+"px"
- Page({
- data:{
- imgHttps:app.globalData.imgHttps,
- navigationBarHeight,
- list:[
- ],
- credit:"",
- pageNum:1,
- },
- //获取积分信息
- getUserData(){
- Http.get({
- url:config.api.getUserInfo
- }).then(res=>{
- this.setData({
- credit:res.data.credit
- })
- }).catch(err=>{
- tt.showToast({
- title: err.message ? err.message : err.data,
- icon: "none"
- });
- })
- },
- getList(){
- tt.showLoading({
- title: '加载中...', // 内容
- });
- Http.get({
- url:config.api.creditList,
- data:{
- pageNum: this.data.pageNum,
- pageSize: 10,
- }
- }).then(res=>{
- let tmepLsit = res.data.list
- tmepLsit.map(item=>{
- item.createDate = util.formatTime(item.createDate,"yyyy-MM-dd hh:mm:ss")
- })
- if(this.data.pageNum>1){
- let arr = this.data.list
- this.setData({
- list:[...arr,...tmepLsit]
- })
-
- }else{
- this.setData({
- list:tmepLsit
- })
- }
- tt.hideLoading();
-
- }).catch(err=>{
- tt.hideLoading();
- tt.showToast({
- title: err.message?err.message:err.data, // 内容
- });
- })
- },
- onLoad: function () {
- this.getUserData()
- this.getList()
- },
- onReachBottom(){
- console.log("到底了");
- this.setData({
- pageNum:this.data.pageNum +1
- })
- this.getList()
- }
-
- })
|