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.
39 lines
892 B
39 lines
892 B
Page({
|
|
data: {
|
|
leaderboard: [], // 存储排行榜数据
|
|
},
|
|
|
|
onLoad() {
|
|
this.fetchLeaderboard();
|
|
},
|
|
goback() {
|
|
wx.navigateTo({
|
|
url: '/pages/student/student',
|
|
});
|
|
},
|
|
|
|
fetchLeaderboard() {
|
|
wx.request({
|
|
url: 'http://10.133.64.210:8000/api/leaderboard/', // 获取排行榜的 API
|
|
method: 'GET',
|
|
success: (res) => {
|
|
if (res.statusCode === 200) {
|
|
this.setData({
|
|
leaderboard: res.data, // 设置排行榜数据
|
|
});
|
|
} else {
|
|
wx.showToast({
|
|
title: '获取排行榜失败',
|
|
icon: 'none',
|
|
});
|
|
}
|
|
},
|
|
fail: () => {
|
|
wx.showToast({
|
|
title: '请求失败,请检查网络',
|
|
icon: 'none',
|
|
});
|
|
}
|
|
});
|
|
},
|
|
}); |