抖音c端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 2.4 KiB

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