// ==UserScript== // @name 自动教评 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 自动填写学生评教表单,选择很好,主观评价写太好了,并提交表单。 // @author You // @match https://urpst.tute.edu.cn/* // @grant unsafeWindow // ==/UserScript== (function() { 'use strict'; window.addEventListener('load', function() { // 获取所有评估按钮 const evaluationButtons = Array.from(document.querySelectorAll('button.btn-purple')); processEvaluation(evaluationButtons, 0); }); function processEvaluation(buttons, index) { fillForm(); if (index >= buttons.length) { console.log('所有评估已处理完毕'); return; } const button = buttons[index]; button.click(); console.log('点击了评估按钮:', index); // 检查评估是否完成 checkEvaluationCompleted(() => { // 评估完成后处理下一个 processEvaluation(buttons, index + 1); }); } function checkEvaluationCompleted(callback) { const interval = setInterval(() => { // 检查评估是否变为查看 const isCompleted = document.querySelectorAll('button.btn-info').length > 0; if (isCompleted) { console.log('评估完成'); clearInterval(interval); callback(); } }, 1000); // 每秒检查一次 } // 填写表单的逻辑 function fillForm() { // 填写单选按钮 const radioButtons = document.querySelectorAll('input[type=radio][value="5_1"], input[type=radio][value="10_1"]'); radioButtons.forEach(function(button) { button.checked = true; }); // 填写主观评价 const subjectiveInput = document.querySelector('textarea[name="zgpj"]'); if (subjectiveInput) { subjectiveInput.value = '太好了'; } // 等待两分钟后提交表单 setTimeout(function() { const submitButton = document.getElementById('buttonSubmit'); if (submitButton) { submitButton.click(); // 处理弹出的layer确认对话框 setTimeout(function() { // 假设“是”按钮是弹窗中的第一个按钮 const yesButton = document.querySelector('.layui-layer-btn0'); if (yesButton) { yesButton.click(); } }, 1000); // 等待1秒以确保弹窗已加载 } }, 140000); // 等待两分钟 } })();