代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html lang="lang">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="wap-font-scale" content="no">
<meta name="format-detection" content="telephone=no">
<title>扫码领红包</title>
<link rel="stylesheet" href="css/global.css?v=11111">
</head>
<body>
<div class="r_content" id="mainPage">
<div class="rule_card">
<!--<a href="javascript:;" class="goback"><img src="img/goback.png" alt=""></a>-->
<p>
<a href="activeRule.html" class="active_rule">活动规则>></a>
<a href="myPack.html">我的红包>></a>
</p>
<!--<span class="msgCount">0</span>-->
</div>
<div class="mainImg">
<img src="img/main_002.png" alt="">
<div class="getTip">
<img src="img/main_005.png" alt="">
<marquee behavior="" direction="" scrollamount="5"></marquee>
</div>
</div>
<div class="footCont">
<div class="personInfo">
<img id="userIcon" src="" alt="">
<div>
<p id="userNickname">微信名</p>
<p>我已累计获得<span class="getNumber" style="color:#E94F40;">0</span>元红包</p>
</div>
</div>
<a class="getPackBtn" href="javascript:;">
<img src="img/main_003.png" alt="">
<span class="cangetTip" style="display: none"></span>
</a>
<a class="myInvite" href="myInvite.html">我的邀请>>></a>
<p class="getPaceTip">点击领红包生成二维码发送好友.<br>好友扫码成功绑定后,双方获得一个随机红包</p>
</div>
<a href="http://cq.189.cn/wapmall/index.php?app=goods&id=2020&fromid=5" class="linkImg">
<img src="img/main_043.png" alt="">
</a>
</div>
<div class="hideModel">
<div class="" id="bindModel" style="display: none">
<a href="javascript:;" class="mainImg">
<img src="img/main_006.png" alt="" id="goBind">
<p>亲,领取红包需要绑定公众号哦!</p>
</a>
<a href="javascript:;" class="cancelImg cancelBindModel">
<img src="img/main_007.png" alt="">
</a>
</div>
</div>
<div class="hideModel">
<div class="" id="create_self_code_model" style="display: none">
<a href="javascript:;" class="mainImg">
<img src="img/main_009.png" alt="" class="goCode">
<p>很抱歉,您暂时还没有红包可领!<br><br>生成专属二维码,推荐好友扫码<br><br>最高可得888元红包呦!</p>
</a>
<a href="javascript:;" class="cancelImg cancelCodeModel">
<img src="img/main_007.png" alt="">
</a>
</div>
</div>
<div class="hideModel">
<div class="" id="cannotGetModel" style="display: none">
<a href="javascript:;" class="mainImg">
<img src="img/main_022.png" alt="" class="goCode">
<p>亲,您已经是老朋友啦<br>不能再帮好友扫描二维码了呦<br>快去推荐未绑定的好友<br>一起瓜分巨额红包!</p>
</a>
<a href="javascript:;" class="cancelImg cancelCannotModel">
<img src="img/main_007.png" alt="">
</a>
</div>
</div>
</body>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/public.js"></script>
<script>
$(function(){
getUserInfo();
var state = {
title: "扫码领红包分享",
url: "http://cqred.cqfuyuan.cn/index/Wxauth/index?channel=2",
otherkey: null
};
history.replaceState(state, document.title, document.location.href);
$("#goBind").on('click',function(){
window.location.href="bindTip.html";
})
$(".cancelBindModel").on('click',function () {
hideTipBind();
})
showTipBind = function(){
$('#bindModel').show();
}
hideTipBind = function(){
$('#bindModel').hide();
}
$(".cancelCodeModel").on('click',function () {
hideCodeTip();
})
showCodeTip = function(){
$('#create_self_code_model').show();
}
hideCodeTip = function(){
$('#create_self_code_model').hide();
}
$(".goCode").on('click',function(){
window.location.href="myCode.html?imgId="+localStorage.getItem("imgId");
})
$(".cancelCannotModel").on('click',function () {
hideCannotModel();
})
showCannotModel = function(){
$('#cannotGetModel').show();
}
hideCannotModel = function(){
$('#cannotGetModel').hide();
}
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]); return null; //返回参数值
}
var channel = getUrlParam('channel');
//var openId = 'oownCjt50Gxh7lsxnNop-SAxuilw';
//var openId = 'oownCjihnQZFSoMfwoWKrB6-QbH0';
var openId = getUrlParam('token')||'oownCjpE9uTttBdyDcnaKK3sKrMA';
if(openId != null)
localStorage.setItem('token', openId);
var myPackLen = 0;
function getUserInfo(){
$.ajax({
type:"post",
url:baseUrl+"/getUserInfo",
data:{token:localStorage.getItem('token')},
success:function(result){
console.log(result);
var data = result.data;
//分享二维码
localStorage.setItem('imgId', data.qr_code);
localStorage.setItem('nickname', data.nickname);
localStorage.setItem('openid', data.openid);
localStorage.setItem('icon', data.icon);
localStorage.setItem('mobile',data.mobile);
// 是否新用户 1 新用户 0老用户
localStorage.setItem('new_user_status',data.new_user_status);
// 受邀请新用户是否抽奖 1已抽奖 0 未抽奖
localStorage.setItem('newUserLosStatus',data.newUserLosStatus);
localStorage.setItem('newUserStatus',data.newUserStatus);
if(data.invitationUser != null)
localStorage.setItem('invitUser', data.invitationUser.nickname);
$("#userIcon").attr("src",data.icon);
$("#userNickname").html(data.nickname);
localStorage.setItem("data",JSON.stringify(data));
getPackJudge(data);
},
error:function(result){
console.log("err="+result);
}
})
// window.location.href = "http://cqred.cqfuyuan.cn/index/Wxauth/index?channel=2";
}
function getPackJudge(data){
console.log(channel+"----"+data.qcrcodeStatus);
if(channel == '1' && data.qcrcodeStatus == 1){
showCannotModel();
}
if(localStorage.getItem('new_user_status') == 1){//是新用户
if(data.invitationUser == null){ //无推荐人
if(data.newUserStatus == 0){ // 新用户未抽奖
if(data.sign_time != null){ // 已绑定
window.location.href = "bindSuccess.html";
//showModel('bindSuccess.html'); //直接显示绑定成功红包
}else if(data.sign_time == null){//未绑定
if(localStorage.getItem("mainPageFlag") != "123"){
showTipBind();
//showModel('bindModel.html');//提示绑定
localStorage.setItem('mainPageFlag', "123");
}
//showModel('sweepCodeIn.html'); //显示开红包,然后提示绑定
}
}
}else if(data.invitationUser != null){ //有推荐人
if(data.newUserLosStatus == 0){ //受邀请新用户未抽奖
if(data.sign_time != null){ //已绑定
window.location.href = "sweepCodeIn2.html";
//showModel('sweepCodeIn2.html');
//showModel('bindSuccessHaveInvit.html'); //直接显示绑定成功红包
} else if(data.sign_time == null){// 未绑定
if(localStorage.getItem("mainPageFlag") != "123"){
showTipBind();
//showModel('bindModel.html');//提示绑定
localStorage.setItem('mainPageFlag', "123");
}
//showModel('sweepCodeIn2.html'); // 显示开红包,然后提示绑定
}
}
}
}
}
//"领红包"
$(".getPackBtn").on('click',function(){
//新用户已领取红包或老用户
if((localStorage.getItem('newUserLosStatus') == 1 || localStorage.getItem('newUserStatus') == 1) || localStorage.getItem('new_user_status') == 0){
if(canGetPackFlag.length>0){//有可领取红包
var id = canGetPackFlag[0].id;
localStorage.setItem("invi_id",id);
localStorage.setItem("invitSuccNickname",canGetPackFlag[0].user.nickname);
window.location.href="sweepCodeIn3.html";
canGetPackFlag.shift();
if(canGetPackFlag.length>0){
$(".cangetTip").show();
$(".cangetTip").html(canGetPackFlag.length);
}else{
$(".cangetTip").hide();
}
console.log(canGetPackFlag);
}else{ // 无可领取红包
showCodeTip();
//showModel('createSelfCodeModel.html');
}
} else if(localStorage.getItem('mainPageFlag')=="123"){
showTipBind();
}
})
//返回按钮
$(".goback").on('click',function(){
window.history.back(-1);
})
/*我获得的红包总计*/
setPackCount();
function setPackCount(){
$.ajax({
type:"post",
url:baseUrl+"/getUserPrizeList",
data:{token :localStorage.getItem('openid')},
success:function(result){
var data = result.data;
var sum = 0;
for(var i=0;i<data.length;i++){
var len = data[i].prize_name.indexOf('元话费');
if(len>-1){
var prize = parseFloat(data[i].prize_name.substring(0,len));
sum+=prize;
}
if(data[i].send_status == 0){
myPackLen++;
}
}
$(".getNumber").html(sum);
$(".msgCount").html(myPackLen);
},
error:function(result){
console.log("err="+result);
}
})
}
//邀请列表是否可“领红包”
var canGetPackFlag = [];
initMyInvite();
function initMyInvite(){
$.ajax({
type:"post",
url:baseUrl+"/invitationsList",
data:{token: localStorage.getItem('openid')},
success:function(result){
var data = result.data;
console.log(result);
for(var i=0;i<data.length;i++){
if(data[i].myLosStatus == 0 && data[i].invita_status==1 && data[i].user.sign_time!= null){
canGetPackFlag.push(data[i]);
}
}
console.log(canGetPackFlag);
if(canGetPackFlag.length>0){
$(".cangetTip").show();
$(".cangetTip").html(canGetPackFlag.length);
}
},
error:function(result){
console.log("err="+result);
}
})
}
/*中奖滚动列表*/
initGetPrizeList();
function initGetPrizeList(){
$.ajax({
type:"post",
url:baseUrl+"/getPrizeList",
data:{token:localStorage.getItem('openid')},
success:function(result){
var data = result.data;
var htm = "";
for(var i=0;i<data.length;i++){
htm += data[i].nickname + "获得" + data[i].prize_name + " ";
}
$("marquee").html(htm);
},
error:function(result){
console.log("err="+result);
}
})
}
})
</script>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。