ECP自动填充ping码

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

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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);
}

})();