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.

117 lines
2.0 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. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. score: 10,
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function(options) {
  16. },
  17. gotorule: function() {
  18. wx.navigateTo({
  19. url: '/pages/grade/grade',
  20. })
  21. },
  22. record: function() {
  23. let that = this;
  24. Http.get({
  25. url: config.api.scoreHistory,
  26. data: {
  27. pageNum: 1,
  28. pageSize: 100
  29. }
  30. })
  31. .then(res => {
  32. console.log(res)
  33. if (res.data.list.length > 0) {
  34. res.data.list.map(file=>{
  35. file.createDate = util.formatTime(file.createDate, "yyyy-MM-dd hh:mm:ss")
  36. });
  37. that.setData({
  38. list:res.data.list
  39. })
  40. }
  41. })
  42. .catch(err => {
  43. wx.showModal({
  44. title: '抱歉',
  45. content: err.message,
  46. showCancel:false
  47. })
  48. })
  49. },
  50. getScore: function() {
  51. let that = this;
  52. Http.get({
  53. url: config.api.getScore,
  54. data: {}
  55. })
  56. .then(res => {
  57. console.log(res)
  58. that.setData({
  59. score: res.data.score,
  60. levelName: res.data.levelName,
  61. })
  62. })
  63. },
  64. /**
  65. * 生命周期函数--监听页面初次渲染完成
  66. */
  67. onReady: function() {
  68. },
  69. /**
  70. * 生命周期函数--监听页面显示
  71. */
  72. onShow: function() {
  73. let that = this;
  74. that.getScore();
  75. that.record();
  76. },
  77. /**
  78. * 生命周期函数--监听页面隐藏
  79. */
  80. onHide: function() {
  81. },
  82. /**
  83. * 生命周期函数--监听页面卸载
  84. */
  85. onUnload: function() {
  86. },
  87. /**
  88. * 页面相关事件处理函数--监听用户下拉动作
  89. */
  90. onPullDownRefresh: function() {
  91. },
  92. /**
  93. * 页面上拉触底事件的处理函数
  94. */
  95. onReachBottom: function() {
  96. },
  97. /**
  98. * 用户点击右上角分享
  99. */
  100. onShareAppMessage: function() {
  101. }
  102. })