增加网站用户数,js批量注册post
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>xiuno注册</title>
</head>
<body>
<div class="card-body" id="vuejs">
<form action="user-create.htm" method="post" id="form">
<div class="form-group input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="icon icon-envelope icon-fw"></i></span>
</div>
<input type="email" class="form-control" placeholder="Email" name="email" id="email" required="" :value="email">
</div>
<div class="form-group input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="icon icon-user icon-fw"></i></span>
</div>
<input type="text" class="form-control" placeholder="用户名" name="username" id="username" :value="zh">
</div>
<div class="media">
<div class="media-body">
<div class="form-group input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="icon icon-lock icon-fw"></i></span>
</div>
<input type="password" class="form-control" placeholder="密码" name="password" id="password" :value="mm">
</div>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block" id="submit" data-loading-text="正在提交..." hidden>注册</button>
</div>
</form>
<div class="media">
<br>
<br>
<br>
<div class="media-body text-right">
<button @click="go" >go自动注册50个</button>
<p>请手动解除阻止弹窗</p>
</div>
</div>
</div>
</body>
</html>
<script src="https://cdn.bootcss.com/vue/2.0.8/vue.min.js"></script>
<script>
var vuejs=new Vue({
el:'#vuejs',
data:{
email:'1123'+'@qq.qq',
zh:'',
mm:'',
},
methods:{
go(){
//this.$router.push({path:'/zt/'+id})
// window.open("zc.html?zt=2","_blank");
for (let n = 1; n <= 50; n++) {
window.open("zc.html?zt="+n,"_blank");
}
},
sj(){
let m=111111;
let n=999999;
let X=parseInt(Math.random()*(n+1-m)+m);
this.email=X+'@qq.qq';
this.zh=X;
this.mm='11111111111111111111111111'+X;
},
//每个页面一个编号,取编号设置延时post,防止同时post
getPar(par){ //js取get值
//获取当前URL
let local_url = document.location.href;
//获取要取得的get参数位置
let get = local_url.indexOf(par +"=");
if(get == -1){
return false;
}
//截取字符串
let get_par = local_url.slice(par.length + get + 1);
//判断截取后的字符串是否还有其他get参数
let nextPar = get_par.indexOf("&");
if(nextPar != -1){
get_par = get_par.slice(0, nextPar);
}
return get_par;
}
},
mounted(){
//随机生成账号密码
this.sj();
//触发提交
let Zt=Number(this.getPar('zt'));
console.log(Zt)
if(Zt>0){
setTimeout(function(){
document.getElementById("submit").click();
},1000*Zt)
}
//document.getElementById("submit").click();
}
})
</script>