// pages/student_info/student_info.js Page({ /** * 页面的初始数据 */ data: { studentId : '', name : '', callCount : '', score : '' }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { const that = this; console.log(wx.getStorageSync('token')); wx.request({ url: 'http://10.133.15.50:8888/student/courseInfo?courseId=' + wx.getStorageSync('courseId'), method: 'GET', header: { 'student_token': wx.getStorageSync('token') // 携带token }, data: { }, success: function(res) { if (res.statusCode === 200) { console.log(res.data.data); that.setData({ studentId : res.data.data.studentId, name : res.data.data.name, callCount : res.data.data.callCount, score : res.data.data.score }); } }, fail: function(error) { console.error('请求失败:', error); } }); }, })