vipexam no ip limit

中科vipexam no ip limit

当前为 2020-11-07 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name vipexam no ip limit
  3. // @namespace https://github.com/maiersk
  4. // @version 0.1.3
  5. // @description 中科vipexam no ip limit
  6. // @author ABTTEX
  7. // @match http://www.vipexam.org/*
  8. // @match http://www.vipexam.cn/*
  9. // @match http://lib.vipexam.org/*
  10. // @match http://lib.vipexam.cn/*
  11. // @match http://vipexam.org/*
  12. // @match http://vipexam.cn/*
  13. // @require https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. //账号角色id,3是教师账号id,4是普通账号id
  20. var _role = 3;
  21. var _vipexam = null;
  22.  
  23. layui.use(['form','layer','jquery','cookie'], function(){
  24. var $ = layui.jquery,
  25. form = layui.form,
  26. layer = layui.layer,
  27. cookie = layui.cookie;
  28.  
  29. _vipexam = $.cookie("vipexam");
  30. var _storage = !!_vipexam ? JSON.parse(_vipexam) : _veuser;
  31. var _vid = _storage.user.account;
  32.  
  33. function RequestJson(url, params, callback) {
  34. var _idx = layer.load(1);
  35. $.ajax({ type: "post", data: params, url: url, dataType: "json", global: false, success: function (data) { callback && callback(data); }, complete: function () { layer.close(_idx); },error:function (XMLHttpRequest, textStatus, errorThrown){layer.close(_idx);} });
  36. }
  37.  
  38. //代替原有登录function
  39. form.on('submit(crashlogin)', function(data){
  40. _vid = $("#username").val();
  41. //ipValidates();
  42. RequestJson("user/login.action",{account:$("#username").val(),password:$("#password").val()},function(data){
  43. if(data.code == "1"){
  44. //if(_flag){
  45. //alert(JSON.stringify(data))
  46. data.user.role = _role
  47. //console.log(data.user.role)
  48. $.cookie("vipexam", JSON.stringify(data), { path: '/', expires: 7});
  49. _vipexam = $.cookie("vipexam");
  50. document.location = "index.html";
  51. //}else{
  52. // layer.msg("抱歉!IP:"+_ip+" 不在系统授权范围内!",{icon:2});
  53. //}
  54. }else{
  55. layer.msg(data.msg,{icon:2});
  56. }
  57. });
  58. return false;
  59. });
  60.  
  61. //关闭ip问题弹窗
  62. $(function(){
  63. setTimeout(function () {
  64. layer.closeAll();
  65. }, 350);
  66. });
  67.  
  68. //显示已登录信息
  69. if(_vid != "f46354b31ec64c9c96919e12a9bbd610"){
  70. $("#person").text(_vid);
  71. $("#rtbox").hide();
  72. $("#rtbox2").show();
  73. }
  74. });
  75.  
  76. $(document).ready(function() {
  77.  
  78. var div = $(".layui-form-item-center")
  79. var buthtml = '<input type="button" id="crashlogin" lay-submit lay-filter="crashlogin" value="crashlogin" />';
  80. //var buthtml = '<input type="button" id="crashlogin" value="crashlogin" />';
  81. div.append(buthtml);
  82.  
  83. // var but = $("#crashlogin")
  84.  
  85. // _vipexam = ""
  86.  
  87. // but.click(function(){
  88. // alert(JSON.stringify({account:$("#username").val(),password:$("#password").val()}))
  89. // $.ajax({
  90. // type: "post",
  91. // data: {account:$("#username").val(),password:$("#password").val()},
  92. // url: "user/login.action",
  93. // dataType: "json",
  94. // global: false,
  95. // success: function (data) {
  96. // if(data.code == "1"){
  97.  
  98. // alert(JSON.stringify(data))
  99. // $.cookie("vipexam", JSON.stringify(data), { path: '/', expires: 7});
  100. // _vipexam = $.cookie("vipexam");
  101. // document.location = "index.html";
  102.  
  103.  
  104. // }else{
  105. // layer.msg(data.msg,{icon:2});
  106. // }
  107. // },
  108. // complete: function () { },
  109. // error:function (XMLHttpRequest, textStatus, errorThrown){ }
  110. // });
  111. // })
  112.  
  113. })
  114.  
  115. })();