// ==UserScript== // @name 西南交通大学希望学院教务网教学评估流水线 // @version 1.1 // @description 进入教学评估,脚本将自动选A,自动倒计时提交。自动给所有老师教学评估。有问题可以联系我993264636 // @author furina707 gemini // @match *://119.6.110.75:9007/student/teachingEvaluation/evaluation/index* // @match *://119.6.110.75:9007/student/teachingEvaluation/teachingEvaluation/evaluationPage* // @grant none // @run-at document-end // ==/UserScript== (function() { 'use strict'; // 判断是否在详情页 const isDetailPage = window.location.href.includes("evaluationPage"); const isIndexPage = window.location.href.includes("evaluation/index"); // 随机等待函数 const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms + Math.random() * 500)); // 自动化主逻辑 async function startAutomation() { if (isIndexPage) { const buttons = Array.from(document.querySelectorAll("button")); const targetBtn = buttons.find(btn => btn.innerText.includes("评估") && !btn.innerText.includes("查看")); if (targetBtn) { localStorage.setItem('auto_eval_running', 'true'); targetBtn.click(); } } if (isDetailPage) { // 1. 自动勾选 A document.querySelectorAll('input[type="radio"]').forEach(radio => { if (radio.value.endsWith("_1")) radio.checked = true; // 适配URP的value规则 }); // 2. 填写评价 const zgpjField = document.querySelector('textarea[name="zgpj"]') || document.querySelector('textarea'); if (zgpjField) zgpjField.value = "老师授课认真,逻辑清晰,非常有收获。"; // 3. 监控倒计时 const monitor = setInterval(() => { const mEl = document.querySelector("#RemainM"); const sEl = document.querySelector("#RemainS"); if (mEl && mEl.innerText === '0' && sEl && sEl.innerText === '0') { clearInterval(monitor); // 直接调用全局提交函数 if (typeof window.toEvaluation === "function") { window.toEvaluation('submit'); setTimeout(() => { const yesBtn = document.querySelector('.layui-layer-btn0'); if (yesBtn) yesBtn.click(); // 提交后延迟返回 setTimeout(() => { window.location.href = "/student/teachingEvaluation/evaluation/index"; }, 2500); }, 1000); } } }, 1000); } } // 创建并显示按钮 function createBtn() { if (document.getElementById('auto-eval-btn')) return; const btn = document.createElement('button'); btn.id = 'auto-eval-btn'; btn.innerHTML = "▶ 开始自动评教"; btn.style.cssText = ` position: fixed; top: 100px; right: 20px; z-index: 999999; padding: 10px 15px; background: #4CAF50; color: white; border: 2px solid #fff; border-radius: 20px; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,0.3); font-weight: bold; `; document.body.appendChild(btn); btn.onclick = () => { btn.innerHTML = "⏳ 运行中..."; btn.style.background = "#ff9800"; startAutomation(); }; // 如果之前在运行,则本页自动开始 if (localStorage.getItem('auto_eval_running') === 'true') { btn.innerHTML = "⏳ 运行中..."; btn.style.background = "#ff9800"; startAutomation(); } } // 延迟执行,确保DOM和iframe加载完成 setTimeout(createBtn, 1000); })();