就想做个简单的自动体温上报脚本,登录--完成单选--提交
`
// ==UserScript==
// @name SDJZU体温上报
// @namespace http://tampermonkey.net/
// @version 0.2
// @description 自动登录,上报
// @author Yukon
// @include https://static.sdjzu.edu.cn/*
// @icon https://www.sdjzu.edu.cn/images/favicon.ico
// @require https://cdn.bootcss.com/jquery/3.5.1/jquery.min.js
// @grant none
// ==/UserScript==
(function(){
'use strict';
var lhref = location.href;
if(lhref.includes("/pages/user")){
// 输入账号
let a = document.getElementsByClassName('uni-input-input')[0];
a.value='123456';
var event = document.createEvent('HTMLEvents');
event.initEvent("input", true, true);
event.eventType = 'message';
a.dispatchEvent(event);
// 输入密码
let b = document.getElementsByClassName('uni-input-input')[1];
b.value='123456';
event.initEvent("input", true, true);
event.eventType = 'message';
b.dispatchEvent(event);
// 点击登录
document.getElementsByClassName("login-btn round")[0].click()
}
if(lhref.includes("/pages/application")){
// 填表
document.getElementsByClassName("margin-tb-xs uni-label-pointer")[0].click()
document.getElementsByClassName("margin-tb-xs uni-label-pointer")[2].click()
document.getElementsByClassName("margin-tb-xs uni-label-pointer")[4].click()
document.getElementsByClassName("margin-tb-xs uni-label-pointer")[6].click()
document.getElementsByClassName("margin-tb-xs uni-label-pointer")[8].click()
document.getElementsByClassName("margin-tb-xs uni-label-pointer")[10].click()
}
})();
`