Greasy Fork

ECP自动填充ping码

配合浏览器的自动填充账号密码功能,实现电子商务平台(ECP2.0)及电工交易专区(SGCCETP)的自动登录及自动输入ping码

当前为 2023-02-20 提交的版本,查看 最新版本

// ==UserScript==
// @name         ECP自动填充ping码
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description   配合浏览器的自动填充账号密码功能,实现电子商务平台(ECP2.0)及电工交易专区(SGCCETP)的自动登录及自动输入ping码
// @author       coccvo
// @match        https://sgccetp.com.cn/*
// @match        https://ecp.sgcc.com.cn/*
// @icon         https://sgccetp.com.cn/portal/favicon.ico
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
  "use strict";

     console.log("location.hostname:",location.hostname)

//电工交易专区
if(location.href.match('https://sgccetp.com.cn/isc/newlogin.html'))//登录页面
{
    setInterval(function(){var button = document.getElementById("register"); button.click();}, 300); //切换手机登录到Ukey登录
    if(document.querySelector("input#uKeyPin") != null && document.querySelector("input#cipher") != null)
     {
          setTimeout(function(){
            document.querySelector('button[onclick="newLogin()"]').click();
          },//点击登录按钮
          900);
  setInterval(function(){
            document.querySelector("input.pin").value='1234';
            document.querySelector('.sure.none').removeAttribute('disabled');
            document.querySelector('.sure.none').click();
          },//输入ping,点确定
          800);
     };
    }
if(location.href.match('https://sgccetp.com.cn/purchase'))//系统页面
{
    setInterval(function () {
        let spans = document.querySelectorAll('span');
        for (let i = 0; i < spans.length; i++) {
            if (spans[i].innerText === '用户PIN:') {
                setTimeout(function () {
                    let pinInput = document.querySelector('.pin');
                    let sureBtn = document.querySelector('.sure.none');
                    pinInput.value = '1234';
                    sureBtn.removeAttribute('disabled');
                    sureBtn.click();
                }, 500);
            }
        }//输入ping,点确定
    }, 5000);
}

//ECP2.0平台
    if(location.href.match('https://ecp.sgcc.com.cn/isc/newlogin.html'))//登录页面
{
    setTimeout(function(){var button = document.getElementById("register"); button.click();}, 300); //切换手机登录到Ukey登录

          setTimeout(function(){
            document.querySelector('button[class="fa btn btn-primary btn-sm"]').click();
          },//点击登录按钮
          1000);
         setInterval(function(){
            document.querySelector("input.pin").value='1234';
            document.querySelector('.sure.none').removeAttribute('disabled');
            document.querySelector('.sure.none').click();
          },//输入ping,点确定
          800);

    }
if(location.href.match('https://ecp.sgcc.com.cn/ecp2.0/purchase_ext'))//系统页面
{
    setInterval(function () {
        let spans = document.querySelectorAll('span');
        for (let i = 0; i < spans.length; i++) {
            if (spans[i].innerText === '用户PIN:') {
                setTimeout(function () {
                    let pinInput = document.querySelector('.pin');
                    let sureBtn = document.querySelector('.sure.none');
                    pinInput.value = '1234';
                    sureBtn.removeAttribute('disabled');
                    sureBtn.click();
                }, 500);
            }
        }//输入ping,点确定
    }, 5000);
}

})();