|
- var config = require("../../config/config.js");
- var app = getApp();
- const Http = require("../../utils/HttpBasics");
- let util = require("../../utils/util");
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- score: 10,
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
-
- },
- gotorule: function() {
- wx.navigateTo({
- url: '/pages/grade/grade',
- })
- },
- record: function() {
- let that = this;
- Http.get({
- url: config.api.scoreHistory,
- data: {
- pageNum: 1,
- pageSize: 100
- }
- })
- .then(res => {
- console.log(res)
- if (res.data.list.length > 0) {
- res.data.list.map(file=>{
- file.createDate = util.formatTime(file.createDate, "yyyy-MM-dd hh:mm:ss")
- });
- that.setData({
- list:res.data.list
- })
- }
- })
- .catch(err => {
- wx.showModal({
- title: '抱歉',
- content: err.message,
- showCancel:false
- })
- })
- },
- getScore: function() {
- let that = this;
- Http.get({
- url: config.api.getScore,
- data: {}
- })
- .then(res => {
- console.log(res)
- that.setData({
- score: res.data.score,
- levelName: res.data.levelName,
- })
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function() {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
- let that = this;
- that.getScore();
- that.record();
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function() {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function() {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function() {
-
- }
- })
|