C端小程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

104 行
2.2 KiB

  1. var config = require("../../../config/config.js");
  2. var app = getApp();
  3. const Http = require("../../../utils/HttpBasics");
  4. let util = require("../../../utils/util");
  5. const imgurl = require("../../../utils/imgurl");
  6. const {creditType} = require("../../../utils/creditType");
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. score: 10,
  13. pageNum: 1,
  14. list: [],
  15. showcontent: false,
  16. loadingUrl: imgurl.loading.url,
  17. bgg: imgurl.bgg.url,
  18. allow_load: true,
  19. creditAmount:0
  20. },
  21. /**
  22. * 生命周期函数--监听页面加载
  23. */
  24. onLoad: function (options) {
  25. },
  26. gotorule: function () {
  27. wx.navigateTo({
  28. url: '/pages/grade/grade',
  29. })
  30. },
  31. /**
  32. * 生命周期函数--监听页面显示
  33. */
  34. onShow: function () {
  35. let that = this;
  36. that.record(1, 15);
  37. },
  38. record(pageNum) {
  39. var that = this;
  40. if (that.data.allow_load) {
  41. Http.get({
  42. url: config.api.integralList,
  43. data: {
  44. pageNum: pageNum,
  45. pageSize: 20,
  46. }
  47. }).then(res => {
  48. wx.stopPullDownRefresh();
  49. res.data.list.map(file => {
  50. creditType.map((item,index)=>{
  51. if (file.creditType==item.value){
  52. file.creditTypeName = item.name;
  53. }
  54. })
  55. file.createDate = util.formatTime(
  56. file.createDate,
  57. "yyyy-MM-dd hh:mm:ss"
  58. );
  59. });
  60. if (pageNum >= res.data.pages) {
  61. that.setData({
  62. allow_load: false,
  63. });
  64. }
  65. that.data.list = that.data.list.concat(res.data.list);
  66. that.setData({
  67. list: that.data.list,
  68. creditAmount: that.data.list[0].creditAmount
  69. });
  70. })
  71. .catch(err => {
  72. wx.stopPullDownRefresh();
  73. wx.showToast({
  74. title: err.errMsg,
  75. icon: 'none',
  76. duration: 2000,
  77. mask: false
  78. });
  79. })
  80. }
  81. },
  82. /**
  83. * 刷新
  84. */
  85. onPullDownRefresh: function (e) {
  86. let that = this;
  87. that.setData({
  88. pageNum: 1,
  89. list:[]
  90. });
  91. that.record(1);
  92. },
  93. onReachBottom: function () {
  94. var that = this;
  95. that.data.pageNum++;
  96. that.setData({
  97. pageNum: that.data.pageNum
  98. });
  99. that.record(that.data.pageNum);
  100. }
  101. })