Page({ data: { students: [], // 存储学生信息的数组 }, // 从后端获取学生数据并排序 loadStudents: function() { const that = this; wx.request({ url: 'https://wx.fzu.edu.cn/info/1010/2092.htm', // 后端API地址 method: 'GET', success: function(res) { const studentsData = res.data; // 后端返回按JSON格式组织好的数据 const students = studentsData.map(student => new Student(student.name, student.id, student.points)); // 按积分从小到大排序 that.setData({ students: students.sort((a, b) => a.points - b.points) }); }, fail: function(err) { console.error('Failed to load students:', err); } }); }, })