自动化评估脚本(课程和教师)

自动化填写课程和教师评估问卷

当前为 2024-11-12 提交的版本,查看 最新版本

// ==UserScript==
// @name         自动化评估脚本(课程和教师)
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  自动化填写课程和教师评估问卷
// @author       huhu
// @icon         https://www.urongda.com/_next/image?url=%2Flogos%2Fnormal%2Fmedium%2Funiversity-of-chinese-academy-of-sciences-logo-1024px.png&w=640&q=75
// @match        *://xkcts.ucas.ac.cn:*/evaluate/evaluateCourse/*
// @match        *://xkcts.ucas.ac.cn:*/evaluate/evaluateTeacher/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 创建自动化按钮
    const autoButton = document.createElement('button');
    autoButton.innerText = '自动填写评估';
    autoButton.style.position = 'fixed';
    autoButton.style.top = '100px';
    autoButton.style.right = '10px';
    autoButton.style.zIndex = '9999';
    autoButton.style.padding = '10px';
    autoButton.style.backgroundColor = '#4CAF50';
    autoButton.style.color = 'white';
    autoButton.style.border = 'none';
    autoButton.style.borderRadius = '5px';
    autoButton.style.cursor = 'pointer';

    // 按钮点击事件,根据当前URL路径判断是课程评估还是教师评估
    autoButton.onclick = function() {
        if (window.location.pathname.includes('/evaluateCourse')) {
            // 课程评估自动填写逻辑
            document.querySelectorAll('input[type="radio"][value="5"]').forEach(function(radio) {
                radio.checked = true;
            });
            // 请替换为你需要填入的评价
            document.getElementById('item_1355').value = '课程安排合理,教学材料详实,对课程主题深入浅出';
            document.getElementById('item_1356').value = '课程安排合理,教学材料详实,对课程主题深入浅出';
            document.getElementById('item_1357').value = '课程安排合理,教学材料详实,对课程主题深入浅出';
            document.getElementById('item_1358').value = '课程安排合理,教学材料详实,对课程主题深入浅出';
            document.getElementById('item_1359').value = '课程安排合理,教学材料详实,对课程主题深入浅出';

            // 可选:触发更改事件(如果需要)
            document.getElementById('item_1355').dispatchEvent(new Event('input'));
            document.getElementById('item_1356').dispatchEvent(new Event('input'));
            document.getElementById('item_1357').dispatchEvent(new Event('input'));
            document.getElementById('item_1358').dispatchEvent(new Event('input'));
            document.getElementById('item_1359').dispatchEvent(new Event('input'));

            // 自动选择特定的单选题选项
            const specificRadio = document.querySelector('input[type="radio"][id="1361"][name="radio_1360"]');
            if (specificRadio) {
                specificRadio.checked = true;
            }

            // 自动选择特定的多选题选项
            const specificCheckbox = document.querySelector('input[type="checkbox"][id="1368"][name="item_1366"]');
            if (specificCheckbox) {
                specificCheckbox.checked = true;
            }

            alert('课程评估已自动填写完成!');
        } else if (window.location.pathname.includes('/evaluateTeacher')) {
            // 教师评估自动填写逻辑
            document.querySelectorAll('input[type="radio"][value="5"]').forEach(function(radio) {
                radio.checked = true;
            });
            // 请替换为你需要填入的评价
            document.getElementById('item_1403').value = '教师专业水平高,教学风格生动活泼,关注学生成长';
            document.getElementById('item_1404').value = '教师专业水平高,教学风格生动活泼,关注学生成长';

            // 可选:触发更改事件(如果需要)
            document.getElementById('item_1403').dispatchEvent(new Event('input'));
            document.getElementById('item_1404').dispatchEvent(new Event('input'));

            alert('教师评估已自动填写完成!');
        } else {
            alert('无法识别评估类型,请检查页面URL');
        }
    };

    // 将按钮添加到页面中
    document.body.appendChild(autoButton);
})();