// ==UserScript==
// @name 达人自动邀约
// @namespace https://bbs.tampermonkey.net.cn/
// @version 0.1.0
// @description try to take over the world!
// @author You
// @match {{https://buyin.jinritemai.com/dashboard/servicehall/daren-square}}
// ==/UserScript==
function showSuccessMessage() {
console.log("执行成功!");
// 可以在此处添加其他针对执行成功的处理逻辑
}
function showFailureMessage(reason) {
console.log("执行失败:" + reason);
// 可以在此处添加其他针对执行失败的处理逻辑
}
function handleYaoyue() {
console.log("处理邀约");
const iframeDocument = document.getElementById("gz").contentWindow.document;
setTimeout(function() {
const contactBtn = iframeDocument.querySelector(".contact-btn");
if (contactBtn) {
contactBtn.click();
setTimeout(function() {
const addProductLastOperate = iframeDocument.querySelector(".text4.add-product-last-operate");
if (addProductLastOperate) {
addProductLastOperate.click();
setTimeout(function() {
const antBtns = iframeDocument.querySelectorAll(".ant-btn.ant-btn-primary");
if (antBtns && antBtns.length >= 2) {
antBtns[1].click();
showSuccessMessage();
goGoGo();
} else {
showFailureMessage("点击按钮失败");
}
}, 1500);
} else {
showFailureMessage("未找到添加商品按钮");
}
}, 1000);
} else {
showFailureMessage("未找到联系按钮");
}
}, 0);
}
function goGoGo() {
if (currentIndex >= userIds.length) {
console.log("已经邀约完毕");
return;
}
const currentUid = userIds[currentIndex];
console.log("开始邀约[" + currentIndex + "] UID:" + currentUid);
document.querySelector(".headerNav-item__text").textContent = "邀约进度: " + (currentIndex + 1) + "/" + userIds.length;
document.getElementById("gz").src = "https://buyin.jinritemai.com/dashboard/servicehall/daren-profile?uid=" + currentUid;
currentIndex++;
setTimeout(function() {
handleYaoyue();
}, 5000);
}
function start() {
userIds.length = 0;
const domList = document.getElementsByClassName("daren-card");
for (let i = 0; i < domList.length; i++) {
const profileText = domList[i].innerText;
if (!profileText.includes("已邀约") && !profileText.includes("同意合作") && !profileText.includes("拒绝合作")) {
userIds.push(domList[i].getAttribute("data-item-uid"));
}
}
window.onload = function() {
// 在页面加载完成后执行的代码
goGoGo();
// 调用 start() 函数
start();