Greasy Fork

Greasy Fork is available in English.

sztu自动评教

深圳技术大学自动评教--2023-2024-二

目前为 2024-06-24 提交的版本。查看 最新版本

// ==UserScript==
// @name         sztu自动评教
// @namespace    http://tampermonkey.net/
// @version      0.1.0
// @description  深圳技术大学自动评教--2023-2024-二
// @author       xiaowhang
// @match        https://jwxt.sztu.edu.cn/jsxsd/framework/xsMain.htmlx#*
// @match        https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_list.do*
// @match        https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_edit.do*
// @match        https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_find.do
// @grant        none
// @license MIT
// ==/UserScript==

// alert('hello world');
const url = location.pathname,
  mainPage = 'https://jwxt.sztu.edu.cn/jsxsd/framework/xsMain.htmlx#',
  findPage = 'https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_find.do',
  listPage = 'https://jwxt.sztu.edu.cn/jsxsd/xspj/xspj_list.do',
  editPage = 'http://jwglxt.qau.edu.cn/jsxsd/xspj/xspj_edit.do';
// console.info(url)

function sleep(time) {
  return new Promise(resolve => setTimeout(resolve, time));
}

// function refresh() {
//   window.location.reload();
// }

if (findPage.indexOf(url) != -1) {
  //---学生评价页面
  const evaluate = document.querySelector('a'); //---评教
  window.open(evaluate.getAttribute('href'));
}

sleep(500).then(() => {
  //---教师列表页面

  if (listPage.indexOf(url) != -1) {
    const urlList = [];

    const trList = document.querySelectorAll('tr');
    console.info(trList);

    for (let i = 1; i < trList.length; i++) {
      const isDone = trList[i].childNodes[11].innerText; //---是否评教
      if (isDone === '否') urlList.push(trList[i].childNodes[15].childNodes[1].getAttribute('href'));
    }

    console.info(urlList);

    if (urlList.length !== 0) urlList.forEach(url => window.open(url));
    else alert("已完成所有评教,请注意提交")
  }
});

sleep(500).then(() => {
  //----评教页面
  if (editPage.indexOf(url) != -1) {
    const tdList = document.getElementsByName('zbtd');
    console.info(tdList);
    for (td of tdList) {
      td.childNodes[1].childNodes[1].click();
    }
    // console.info(tdList[tdList.length - 2].childNodes[5].childNodes[1]);
    tdList[tdList.length - 2].childNodes[5].childNodes[1].click();

    const submit = document.getElementById('bc');
    submit.click();

    setTimeout(function () {
      window.close();
    }, 1000);
  }
});