登录教务系统后在控制台执行即可。
计算机学院保研只看公必,专必,专业限选;这里只统计了公必,专必;专业限选如果有的话需要自己改一些代码

/*
登录教务系统
https://jwxt.sysu.edu.cn/jwxt/mk/studentWeb/#/stuAchievementView?code=jwxsd_wdcj&resourceName=%25E6%2588%2591%25E7%259A%2584%25E6%2588%2590%25E7%25BB%25A9
之后粘贴到控制台执行
*/
async function fetchScores(year, semester) {
    const url = `https://jwxt.sysu.edu.cn/jwxt/achievement-manage/score-check/list?scoSchoolYear=${year}&trainTypeCode=01&addScoreFlag=true&scoSemester=${semester}&_t=1745475270`;
    const options = {
        headers: {
            "accept": "application/json, text/plain, */*",
            "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
            "cache-control": "no-cache",
            "lastaccesstime": "1745475270054",
            "menuid": "jwxsd_wdcj",
            "moduleid": "null",
            "pragma": "no-cache",
            "sec-ch-ua": "\"Chromium\";v=\"134\", \"Not:A-Brand\";v=\"24\", \"Microsoft Edge\";v=\"134\"",
            "sec-ch-ua-mobile": "?0",
            "sec-ch-ua-platform": "\"Windows\"",
            "sec-fetch-dest": "empty",
            "sec-fetch-mode": "cors",
            "sec-fetch-site": "same-origin",
            "x-requested-with": "XMLHttpRequest"
        },
        referrer: "https://jwxt.sysu.edu.cn/jwxt/mk/studentWeb/",
        referrerPolicy: "strict-origin-when-cross-origin",
        body: null,
        method: "GET",
        mode: "cors",
        credentials: "include"
    };

    try {
        const response = await fetch(url, options);
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        return await response.json();
    } catch (error) {
        console.error('Fetch error:', error);
        return { data: [] };
    }
}

async function calculateGPA() {
    const years = ["2022-2023", "2023-2024", "2024-2025"];
    const semesters = ["1", "2"];
    let totalGradePoints = 0;
    let totalCredits = 0;

    for (const year of years) {
        for (const semester of semesters) {
            // 排除 2024 - 2025 学年的第二学期
            if (year === "2024-2025" && semester === "2") {
                continue;
            }
            const scores = await fetchScores(year, semester);
            for (const course of scores.data) {
                if (course.scoCourseCategoryName === "专必" || course.scoCourseCategoryName === "公必") {
                    const gradePoint = parseFloat(course.scoPoint);
                    const credit = parseFloat(course.scoCredit);
                    totalGradePoints += gradePoint * credit;
                    totalCredits += credit;
                }
            }
        }
    }

    const gpa = totalCredits > 0 ? totalGradePoints / totalCredits : 0;
    console.log(`保研绩点(满分五分制): ${gpa.toFixed(6)}`);
    return gpa;
}

calculateGPA();
Last modification:April 24, 2025
如果觉得我的文章对你有用,请随意赞赏