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.

40 lines
1006 B

// pages/teacher/rank/rank-Mode1/rank-Mode1.js
Page({
data: {
leaderboard: [], // 存储排行榜数据
},
onLoad() {
this.fetchLeaderboard();
},
fetchLeaderboard() {
wx.request({
url: 'http://127.0.0.1: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',
});
}
});
},
goBack() {
wx.navigateTo({
url: '/pages/teacher/Mode-quiz/Mode-quiz',
});
},
})