NWAFU 研究生评教自动填写(含主观题)

仅在研究生评教页面:评分题全10分,师德题选A,文本题自动填写

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         NWAFU 研究生评教自动填写(含主观题)
// @namespace    https://newehall.nwafu.edu.cn/
// @version      1.2.0
// @description  仅在研究生评教页面:评分题全10分,师德题选A,文本题自动填写
// @match        https://newehall.nwafu.edu.cn/gsapp/sys/jxpgapp/*
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  // —— 只在评教页面运行 ——
  if (!location.hash.includes('/xspj')) return;

  const timer = setInterval(() => {
    const radios = document.querySelectorAll('input[type="radio"]');
    const textarea = document.querySelector('textarea');

    if (radios.length === 0) return;

    clearInterval(timer);
    console.log('📘 自动评教脚本启动(完整版)');

    // ========== 1️⃣ 数值评分题:全部选 10 分 ==========
    const groups = {};
    radios.forEach(radio => {
      if (!groups[radio.name]) groups[radio.name] = [];
      groups[radio.name].push(radio);
    });

    Object.values(groups).forEach(group => {
      // 优先找 value=10
      const ten = group.find(r => r.value === '10');
      if (ten) ten.click();
    });

    console.log('✅ 数值评分题已全部选 10 分');

    // ========== 2️⃣ 第 11 题:师德师风 → 选 A(非常好) ==========
    const moralOption = Array.from(radios).find(r =>
      r.nextSibling && r.nextSibling.textContent.includes('非常好')
    );

    if (moralOption) {
      moralOption.click();
      console.log('✅ 师德师风题已选择:非常好');
    }

    // ========== 3️⃣ 第 12 题:文本评价 ==========
    if (textarea && textarea.value.trim() === '') {
      textarea.value = '课程内容安排合理,讲授清晰,对专业学习具有积极帮助。';
      textarea.dispatchEvent(new Event('input', { bubbles: true }));
      console.log('✅ 已填写课程评价文本');
    }

    // ========== 4️⃣ 延迟提交 ==========
    setTimeout(() => {
      const submitBtn = Array.from(document.querySelectorAll('button'))
        .find(btn => btn.innerText.includes('提交'));

      if (submitBtn) {
        submitBtn.click();
        console.log('🚀 评教已自动提交');
      } else {
        console.warn('⚠️ 未找到提交按钮');
      }
    }, 1200);

  }, 300);

})();