上一主题 下一主题
ScriptCat,新一代的脚本管理器脚本站,与全世界分享你的用户脚本油猴脚本开发指南教程目录
返回列表 发新帖
楼主: gitbb - 

职教云答题

[复制链接]

该用户从未签到

1

主题

1

回帖

3

积分

助理工程师

积分
3
发表于 2021-12-7 11:11:39 来自手机  | 显示全部楼层 | 阅读模式
// ==UserScript==
// @name         职教云自动答题
// @namespace    http://zjy.com
// @version      1.0
// @description  职教云 自动答题
// @author       Zhang Chenxi
// @match        https://zjy2.icve.com.cn/*
// @require      http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// @grant        GM_xmlhttpRequest
// @grant        GM_download
// ==/UserScript==
var result = "";
(function() {
  $(function(){
      function init_word(){
        var quesion_list = $(".e-q-q");
        var question_number = quesion_list.length;
        for(var i=0;i<question_number;i++){
            runAsync("q="+quesion_list[i].innerText,i);
        }
        var x = 15*question_number;//最长提交时间,单位s
        var y = 8*question_number;// 最短提交时间,单位s
        var rand = parseInt(Math.random() * (x - y + 1) + y);
        $("input[name='useTime']").val(rand);
        $("input[name='UseTime']").val(rand);
          $(".e-quest-header").append("<br><div style='color:red'>本次提交时间约为:"+ Math.round(rand/60)+"分"+(rand%60)+"秒<div>");
         // $(".e-quest-header").append("<br>—总之岁月漫长,然而值得等待—");
      }
      window.setTimeout( init_word, 2000 );
  });
  })();
  function get_option(true_answer,question_id){
    var option_list = $(".e-a-g ul")[question_id];
    var option_length = $(option_list).children().length;
    for(var i=0;i<option_length;i++){
      var answert_1 = $($(option_list).children()[i]).children(".ErichText.destroyTitleButton")[0].innerText;
      if(answert_1 == true_answer){
        $(option_list).children()[i].click();
        break;
      }else{
        if(i==option_length-1){
        var max = option_length-1;//最长提交时间,单位s
        var min = 0;// 最短提交时间,单位s
        var rand = parseInt(Math.random() * (max - min + 1) + min);
         $(option_list).children()[rand].click();
         var c = ["A","B","C","D"];
         console.log("第"+(question_id+1)+"题未找到答案,系统随机选择"+c[rand] );
        }
      }
    }
  }
  function runAsync(data_ry,question_id){
      GM_xmlhttpRequest({
          method: "POST",
          url: "",//接口
          data:data_ry,
          headers: {
              "Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
          },
          onload: function(response) {
              get_option(response.responseText.trim(),question_id);
          }
      });
  }

该用户从未签到

1

主题

1

回帖

3

积分

助理工程师

积分
3
发表于 2021-12-7 11:12:36 来自手机  | 显示全部楼层
这个玩意没有题库接口,所以请大神看看能搞个题库接口上去嘛
回复

使用道具 举报

  • TA的每日心情
    开心
    2023-2-28 23:59
  • 签到天数: 191 天

    [LV.7]常住居民III

    620

    主题

    5084

    回帖

    5958

    积分

    管理员

    非物质文化遗产社会摇传承人

    积分
    5958

    荣誉开发者管理员油中2周年生态建设者喜迎中秋

    发表于 2021-12-7 11:24:52 | 显示全部楼层
    这种一般来说要自己写了
    根据他提交的格式做处理,返回相同的格式
    哥哥可以学一下php?
    混的人。
    ------------------------------------------
    進撃!永遠の帝国の破壊虎---李恒道

    入驻了爱发电https://afdian.net/a/lihengdao666
    个人宣言:この世界で私に胜てる人とコードはまだ生まれていません。死ぬのが怖くなければ来てください。
    回复

    使用道具 举报

    发表回复

    本版积分规则

    快速回复 返回顶部 返回列表