公衆號翻牌抽獎分享獲取流量

 ios不支持端口號  分享的鏈接不能帶端口號

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">

<title>泰東方國際</title>

<link href="css/WeUI/weui.min.css" rel="stylesheet" />

<style>

h1,h2,h3,h4,h5,h6,div,p,ul,li,span,html,body,input,textarea,i,b,strong{

  font-style: normal;

  -webkit-tap-highlight-color:rgba(255,0,0,0);

  box-sizing: border-box;

-webkit-box-sizing: border-box;

-moz-box-sizing: border-box;

}

body, button, input, select, textarea { font:12px/1.5tahoma, arial, \5b8b\4f53; }

body {

background: #3521F6;

font-size: 1rem;

}

.top {

width: 100%;

}

.weui-grid {

padding: 0;

}

.weui-grid:before {

border: 0;

}

.weui-grid:after {

border: 0;

}

.weui-grids:before {

border: 0;

}

a {

text-decoration:none;

text-align: center;

color: #000;

}

.img {

width: 90%;

margin: auto;

display: inherit;

margin-top: 2vw;

height: 33.9vw;

}

.info {

display: none;

margin: auto;

margin-top: 2vw;

background: url('ldimg/01f.png') no-repeat;

background-size: 100% 100%;

width: 0;

text-align: center;

overflow: hidden;

font-size: 24px;

padding:0.35rem 0 0;

height: 33.9vw;

}

.shelter {

opacity: 0.5;

filter: alpha(opacity=50);

}

.bottom {

width: 100%;

}

.weui-grid:active {

background: transparent;

}

.img-fixed {

position: absolute;

top: 0;

width: 100%;

z-index: 101;

}

.section-div {

height: 5vh;

}

.section-content {

padding-top: 0.3rem;

padding-bottom: 0.1rem;

font-size: 0.28rem;

}

.section-content-title {

color: rgba(249, 217, 121, 1);

text-align: center;

font-size: 0.26rem;

font-weight: 800;

display: flex;

justify-content: center;

align-items: center;

}

.section-content-title-btns{

background:rgba(241,211,125,1);

border:1px solid rgba(241,211,125,1);

border-radius:8px;

color:rgba(30, 45, 191, 1);

padding: 0 10px;

margin-left: 10px;

font-size: 0.2rem;

}

.section-content-cism {

text-align: center;

font-size: 0.16rem;

color: #fff;

}

.section-content-cism img {

width: 55%;

margin: 0.2rem 0 0.1rem;

}

.copying{

margin: 0.2rem;

background: #2600D0;

border-radius:10px;

padding: 0.2rem 0.1rem;

position: relative;

}

.copying-infos{

position: absolute;

top: 0.2rem;

left: 0;

width: 100%;

z-index: 1000;

}

.weui-grids:after, .weui-grids:before{

color: transparent;

border-left: 0;

}

.copying-img{

width: 0.8rem;

height: 0.8rem;

border: 1px solid #19F0F5;

border-radius: 50%;

overflow: hidden;

line-height: 0.75rem;

margin: 0.2rem auto;

}

.copying-img img{

width: 100%;

height: 100%;

}

.copying-title{

font-size: 0.2rem;

text-align: center;

color: #fff;

padding: 0.24rem 0;

}

.copying-title span{

color: #FBD077;

}

#weui-grids a{

color: #FF6B6E;

}

.a-size{

color: #FF6B6E;

font-weight: bold;

font-size:0.2rem;

width: 1.5rem;

margin: auto;

}

.a-size-zl{

color: #FF6B6E;font-weight: bold;

font-size:0.65rem;

}

.a-size-s{

color: #FF6B6E;font-weight: bold;

font-size:0.26rem;

}

.copying-integral{

padding: 0.4rem 0.15rem;

display: flex;

justify-content: space-between;

align-items: center;

color: #FBDB78;

font-size: 0.24rem;

}

.copying-integral-btn{

background:linear-gradient(to right,#EC2D61,#FBD077);

font-size: 0.17rem;

padding: 0.091rem 0.2rem;

border-radius: 20px;

box-shadow: 1px 1px 3px #666;

}

.progress{

height: 5px;

background: rgba(0,0,0,0.2);

width: 96%;

margin: auto;

box-sizing: border-box;

position: relative;

border-radius: 2px;

}

.progress-son{

position: absolute;

left: 0;

height: 5px;

width: 0;

background: #00FFFF;

border-radius: 2px;

top:0;

transition: all 0.5s;

}

.progress-integral{

display: flex;

justify-content: space-between;

align-items: center;

color: #FBDB78;

font-size: 0.24rem;

padding: 0.1rem 0.15rem 0.25rem;

}

.conversion{

display: flex;

justify-content: center;

align-items: center;

font-size: 0.3rem;

color: #FBDB78;

padding-bottom: 0.3rem;

}

.conversion-img{

width: 1.5rem;

height: 1.5rem;

margin: 0 0.2rem;

}

.conversion-title{

padding-bottom: 0.1rem;

text-align: center;

}

.conversion-btn{

    background:linear-gradient(to right,#51217f,#565288);

font-size: 0.17rem;

padding: 0.091rem 0.2rem;

text-align: center;

border-radius: 20px;

color: #999;

width: 1.4rem;

}

.conversion-btn-show{

background:linear-gradient(to right,#EC2D61,#FBD077);

color: #fff;

/* box-shadow: 1px 1px 3px #b0770a; */

}

.friendsHelp{

position: relative;

margin: 0.2rem;

margin-top: 1.5rem;

}

.friendsHelp-baImg{

width: 3rem;

position: absolute;

left: 50%;

margin-left: -1.5rem;

top: -1.1rem;

}

.friendsHelp-content{

background: #FBDB78;

font-size: 0.21rem;

border-radius: 8px;

padding: 0.2rem;

}

.friendsHelp-content-title{

font-size: 0.33rem;

color: #FF6B6E;

background: url('ldimg/btk.png') no-repeat;

background-size:100% 100%;

width: 3rem;;

padding: 0.12rem 0;

text-align: center;

margin: auto;

}

.friendsHelp-content-remark{

text-align: center;

padding: 0.14rem 0 0.1rem;

}

.friendsHelp-content-list{

margin: 0.2rem;

/* box-shadow: 1px 1px 5px #b0770a; */

height: 7rem;

overflow: auto;

background: url('ldimg/jlback.png') no-repeat;

background-size:100% 100%;

}

.friendsHelp-content-list-item{

display: flex;

justify-content: space-between;

padding: 0.2rem;

align-items: center;

}

.friendsHelp-content-list-item-left{

display: flex;

align-items: center;

}

.friendsHelp-content-list-item-left img{

width: 0.8rem;

height: 0.8rem;

border-radius: 50%;

overflow: hidden;

margin-right: 0.21rem;

}

.friendsHelp-content-list-item-left-title1{

color: #2F2E2A;

font-size: 0.28rem;

font-weight: 600;

}

.friendsHelp-content-list-item-left-title2{

color: #666;

font-size: 0.2rem;

}

.friendsHelp-content-list-item-right{

color:#FF6B6E;

font-size: 0.24rem;

font-weight: 600;

}

.friendsHelp-btn{

  background:linear-gradient(to right,#EC2D61,#FBD077);

font-size: 0.32rem;

text-align: center;

border-radius: 20px;

color: #fff;

/* box-shadow: 1px 1px 5px #b0770a; */

width: 2.9rem;

padding: 0.1rem 0;

margin: 0.4rem auto 0.2rem;

}

.summarize{

margin: 0.2rem;

margin-top:0.3rem;

position: relative;

}

.summarize-title{

font-size: 0.33rem;

color: #fff;

background: url('ldimg/btsf.png') no-repeat;

background-size:100% 100%;

width: 3rem;;

padding: 0.12rem 0;

text-align: center;

margin: auto;

line-height:normal;

margin-bottom: 0.3rem;

}

.summarize-content{

font-size: 0.24rem;

color: #fff;

margin: 0.2rem;

margin-top: 0;

margin-bottom: 0.12rem;

}

.summarize-img{

position: absolute;

right: 0;

bottom: -0.7rem;

width: 1.1rem;

}

.base-title{

color: #FBDB78;

font-size: 0.2rem;

text-align: center;

padding: 0.3rem;

}

.weui-dialog__hd{

padding:0;

}

.back-blok{

background: #000000;

opacity: 0.8;

}

.opoUp{

position: fixed;

top: 3rem;

left: 0;

width: 100%;

height: 5.8rem;

z-index: 1001;

background: url(ldimg/ttas.png) no-repeat;

background-size:100% 100%;

padding: 0.2rem;

}

.opoUp-title{

color: #FBDB78;

font-size: 0.7rem;

text-align: center;

padding: 1rem 0 0.12rem;

}

.opoUp-content{

font-size: 0.26rem;

color: #fff;text-align: center;

padding: 0 0 0.16rem;

}

.opoUp-content2{

font-size: 0.5rem;text-align: center;

color: #FBDB78;

}

.opoUp-title2{

color: #FBDB78;

font-size: 0.7rem;

text-align: center;

padding: 0.8rem 0 0.12rem;

}

.opoUp-contents{

font-size: 0.22rem;

color: #fff;text-align: center;

padding: 0 0 0.16rem;

}

.opoUp-btn{

background:linear-gradient(to right,#EC2D61,#FBD077);

font-size: 0.34rem;

text-align: center;

border-radius: 2rem;

color: #fff;

box-shadow: 1px 1px 3px #666;

width: 3.8rem;

padding: 0.081rem 0;

margin: 0.9rem auto 0;

}

.opoUp-info-img{

width: 0.8rem;

height: 0.8rem;

border-radius: 50%;

border:1px solid #10AEFF;

overflow: hidden;

margin: auto;

margin-top: 0.1rem;

margin-bottom: 0.1rem;

line-height: 0.75rem;

}

.opoUp-info-img img{

width: 100%;

height: 100%;

}

.opoUp-info-name{

text-align: center;

color: #fff;

font-size:0.28rem;

}

.opoUp-integral{

display: flex;

justify-content: space-between;

}

.opoUp-integral-left{

display: flex;

align-items: flex-end;

color: #FBDB78;

font-size: 0.24rem;

padding-bottom: 0.15rem;

margin: 0 0.2rem;

}

.opoUp-integral-left img{

width: 0.6rem;

}

.opoUp-integral-right{

width: 1.1rem;

height: 1.1rem;

}

.opoUp-progress{

height: 10px;

border-radius: 5px;

}

.opoUp-progress-son{

height: 10px;

border-radius: 5px;

}

.opoUp-x{

position: absolute;

right: 0.2rem;

color: #fff;

font-size: 0.34rem;

width: 0.8rem;

text-align: center;

height: 0.8rem;

line-height: 0.8rem;

}

.opoUp--txlx{

position: absolute;

right: 0.2rem;

color: #fff;

font-size: 0.34rem;

width: 0.8rem;

text-align: center;

height: 0.8rem;

line-height: 0.8rem;

}

.back-drop{

  height:100%;

  width:100%;

  background:rgba(22,22,22,.6);

  left:0;

  bottom:0;

  position: fixed;

  z-index: 1003;

}

.maskInventoryDson{

color: #fff;

font-size: 0.22rem;

text-align: center;

margin-top:-10px;

}

.body-opoUp{

position: fixed;

top: 0;

width: 100%;

left: 0;

height: 100%;

z-index: 1000;

}

</style>

<script>

/**

* 設置HTML的font-zise

* **/

(function(win, doc) {

if (!win.addEventListener) return;

var html = document.documentElement;

function setFont() {

var cliWidth = html.clientWidth;

if (cliWidth > 750) {

cliWidth = 750;

}

html.style.fontSize = 100 * (cliWidth / 750) + 'px';

document.body.style.opacity = 1;

}

win.addEventListener('focusout', function() {

window.scrollTo(0, 0);

});

win.addEventListener('resize', setFont, false);

doc.addEventListener('DOMContentLoaded', setFont, false);

})(window, document);

</script>

</head>

<body id="body" style="display:none">

<div class="body-opoUp" οnclick="bodyChange()" style="display:none">

</div>

<div class="back-drop" style="display:none">

<img style="width:70%;position:absolute;right:0.2rem;top:0.2rem;" src="ldimg/wechat-share.png">

</div>

<input ref="copy" class="copy" value="" readonly style="opacity:0;display:block;position:fixed;z-index:-10;top:-10rem">

<input ref="copy" class="copy-id" value="" readonly style="opacity:0;display:block;position:fixed;z-index:-10;top:-10rem">

<img class="top img-fixed" src="ldimg/back.png" alt="">

<div class="section">

<!-- <div class="section-div"></div> -->

<div class="section-content">

<div class="section-content-title">

<div>泰東方海外試管</div>

<div class="section-content-title-btns">

助你防疫

</div>

</div>

<div class="section-content-cism">

<img src="ldimg/bt.png">

<div>獲得1000積分可兌換10個口罩!</div>

</div>

</div>

<div class="copying">

<div class="copying-infos">

<div class="copying-img">

<!-- <img src="ldimg/01.png">//用戶頭像 -->

</div>

<div style="text-align:center;font-size:0.2rem;color: #fff;margin-top: -0.08rem;" class="openId" οnclick="copyWx()"></div>

<div class="copying-title">

<span id="name">

微信用戶

</span> 你還有 <span id="num">

0

</span> 次抽獎機會

</div>

</div>

<div style="height: 2.2rem;"></div>

<div class="weui-grids" id="draw">

</div>

<div id="" class="copying-integral">

<div>剩餘積分:<span id="inte">

0

</span></div>

<div class="copying-integral-btn" οnclick="wechatShare()">去邀請好友助力</div>

</div>

<div class="progress">

<div id="" class="progress-son"></div>

</div>

<div class="progress-integral">

<div>0</div>

<div>1000</div>

</div>

<div class="conversion">

<div>

<img src="ldimg/kzj.png" class="conversion-img">

<div class="maskInventoryDson">( 庫存:<span class="maskInventory">0</span> )</div>

</div>

<div>

<div id="" class="conversion-title">

1000積分

</div>

<div class="conversion-btn">

兌換

</div>

</div>

</div>

</div>

<div class="friendsHelp">

<img class="friendsHelp-baImg" src="ldimg/t.png" class="">

<div class="friendsHelp-content">

<div style="height: 10px;">

</div>

<div class="friendsHelp-content-title">

好友助力

</div>

<div class="friendsHelp-content-remark">

邀請好友助力獲得額外次數,好友也能得機會!

</div>

<div class="friendsHelp-content-list">

<div style="text-align:center;padding-top:0.5rem;">暫無助力記錄</div>

<!-- <div class="friendsHelp-content-list-item">

<div id="" class="friendsHelp-content-list-item-left">

<img src="ldimg/01.png">

<div id="">

<div class="friendsHelp-content-list-item-left-title1">c沉澱</div>

<div class="friendsHelp-content-list-item-left-title2">2020-10-10 12:00 00</div>

</div>

</div>

<div class="friendsHelp-content-list-item-right">

爲您助力一次

</div>

</div> -->

</div>

<div class="friendsHelp-btn" οnclick="wechatShare()">

繼續邀請

</div>

</div>

</div>

<div class="summarize">

<div class="summarize-title">

活動說明

</div>

<div id="" class="summarize-content">

1、首次可免費3次翻盤機會,得積分;

</div>

<div id="" class="summarize-content">

2、邀請好友助力,獲取更多翻牌機會;

</div>

<div id="" class="summarize-content">

3、積分達1000分,兌換10個口罩,數量有限先到先得;

</div>

<div id="" class="summarize-content">

4、添加客服微信可瞭解快速獲取積分攻略;

</div>

<div id="" class="summarize-content">

5、本活動最終解釋權歸泰東方國際所有。

</div>

<img src="ldimg/d.png" class="summarize-img">

</div>

<div class="base-title">

本次活動最終解釋權歸泰東方國際所有。

</div>

</div>

<!-- <div class="js_dialog" id="iosDialog99" style="display:none">

<div class="weui-mask"></div>

<div class="weui-dialog">

<div class="" style="font-size: 0.4rem;font-weight: 600;padding: 0.25rem;">很遺憾</div>

<div class="weui-dialog__bd">口罩已兌換完畢,敬請期待下次活動</div>

<div class="weui-dialog__ft">

<a href="javascript:;" οnclick="Refresh()" class="weui-dialog__btn weui-dialog__btn_primary">知道了</a>

</div>

</div>

</div> -->

<!-- <div class="js_dialog" id="iosDialog2" style="display: none;">

<div class="weui-mask"></div>

<div class="weui-dialog">

<div class="weui-dialog__hd"><strong class="weui-dialog__title">很遺憾,您沒有中獎</strong></div>

<div class="weui-dialog__bd">不要氣餒,您可以再翻一次</div>

<div class="weui-dialog__ft">

<a href="javascript:;" οnclick="Refresh()" class="weui-dialog__btn weui-dialog__btn_primary">再翻一次</a>

</div>

</div>

</div> -->

<!-- //抽中彈框 -->

<div class="js_dialog" id="iosDialog1" style="display:none">

<div class="weui-mask back-blok"></div>

<div class="opoUp">

<div class="opoUp--txlx" οnclick="Refresh()">

<img src="ldimg/icon-x.png" style="width:0.25rem;">

</div>

<div class="opoUp-es-conversion">

<!-- <div class="opoUp-title" style="padding:0;font-size: 0.3rem;padding-top: 0.3rem;">泰東方海外試管</div>

<div class="opoUp-title" style="padding:0;font-size: 0.3rem;">助力你防疫</div> -->

<div class="section-content-title" style="padding-top: 0.65rem;font-size: 0.28rem;">

<div id="">

泰東方海外試管

</div>

<div class="section-content-title-btns">

助你防疫

</div>

</div>

<div class="opoUp-title" style="padding-top:0.25rem">恭喜您!</div>

<div class="opoUp-content">

抽中 <span id="hb" style="color:#FF6C6F">0</span> 積分<br>

添加客服微信,獲取更多得分攻略。

</div>

<div class="opoUp-content2 workWeChat" onClick="copy()">--------</div>

<div style="color:#fff;font-size:0.26rem;text-align: center;">

(點擊微信號複製)

</div>

</div>

</div>

</div>

<div class="js_dialog" id="dialogs" style="display:none">

<div class="weui-mask back-blok"></div>

<div class="opoUp">

<div class="opoUp-x" style="display:none">

<img src="ldimg/icon-x.png" style="width:0.25rem;">

</div>

<div class="opoUp-conversion" style="display:none">

<div class="opoUp-title">兌換成功</div>

<div class="opoUp-content">請添加下方客服微信號完善地址信息,<br>我們將安排儘快爲你寄出!<br></div>

<div class="opoUp-content2 workWeChat" onClick="copy()">--------</div>

<div style="color:#fff;font-size:0.26rem;text-align: center;">

(點擊微信號複製)

</div>

</div>

<div class="opoUp-help" style="display:none">

<div class="opoUp-title2">助力成功</div>

<div class="opoUp-contents">

活動期間翻牌即可獲得積分兌換口罩!

</div>

<div class="opoUp-btn opoUp-help-conversions">我也要兌換</div>

</div>

<div class="opoUp-other" style="display:none">

<div class="opoUp-info">

<div class="opoUp-info-img"><img src="ldimg/01.png" class="opoUp-other-info-img"></div>

<div class="opoUp-info-name opoUp-other-info-name">

微信用戶

</div>

<div class="opoUp-integral">

<div class="opoUp-integral-left">

<div>

<img src="ldimg/ttrw.png">

</div>

<div>Ta當前積分:<span id="" class="opoUp-other-info-int"></span></div>

</div>

<img src="ldimg/kzj.png" class="opoUp-integral-right">

</div>

<div class="progress opoUp-progress">

<div id="" class="progress-son opoUp-progress-son"></div>

</div>

<div class="progress-integral">

<div>0</div>

<div>1000</div>

</div>

</div>

<div class="opoUp-contents">

點擊助力幫好友拿口罩,你也獲得抽獎機會!!

</div>

<div class="opoUp-btn opoUp-other-help" style="margin-top:0.05rem">爲好友助力</div>

</div>

</div>

</div>

<script src="js/jquery-1.9.1.min.js"></script>

<script async="async" src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>

<script>

let coutnas = 0;

let winningPoints = 0

let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]

fphtml(arr)

function fphtml(arrs) {

var html = '';

for (var i = 0; i < arrs.length; i++) {

html += '<a href="javascript:;" id="a' + arrs[i] + '" class="weui-grid">' +

'<img class="img" src="ldimg/01.png" alt=""><div class="info"><div class="a-size"></div><div class="a-size-zl">' +

arrs[i] + '</div><div class="a-size-s">積分</div></div></a>'

}

$('#draw').html(html)

}

var clickstate = 0;

var turn = function(target, time, opts) {

target.find('a').click(function(n) {

let id = n.currentTarget.id

let indexAs = id.substr(id.length - 1, 1)

if (clickstate == 1) {

return;

}

let lotteryShow = true

$.ajax({

type: "get",

async: false, //同步

url: "http://qrcode.tubebabyblog.top:8090/lottery/lottery?openId=" + openId,

success: function(res) {

console.log(res)

if (res.code == 0) {

if (typeof(res.data) == 'string' && (res.data.indexOf('口罩已兌換完畢') != -1 || res.data.indexOf('口罩已領取完畢') !=

-1)) {

$('.body-opoUp').css('display', 'block')

alert(res.data)

return

}

lotteryShow = false

let data = res.data,

remainingPointList = res.data.remainingPointList,

userVO = res.data.userVO

if (userVO) {

// 用戶個人信息

$('#num').html(userVO.chance)

$('#name').html(userVO.userName)

$('.copying-img').html('<img src="' + userVO.headPic + '">')

$('#inte').html(userVO.point)

openId = userVO.openId

iintl = userVO.point

var px = iintl > 1000 ? 100 : iintl / 1000 * 100

$('.copying .progress-son').css('width', (px + '%'))

if (iintl >= 1000) {

$('.conversion-btn').addClass('conversion-btn-show')

}

}

coutnas = res.data.winningPoints

remainingPointList.splice(indexAs, 0, coutnas)

for (var i = 0; i < remainingPointList.length; i++) {

$('#draw .a-size-zl')[i].innerHTML = remainingPointList[i]

}

} else {

alert(res.msg)

}

},

});

if (lotteryShow) {

return

}

var current = $(this);

$(this).find('.img').stop().animate(opts[0], time, function() {

$(this).next().html('<div class="a-size">恭喜獲得</div><div class="a-size-zl">' + coutnas +

'</div><div class="a-size-s">積分</div>')

$(this).hide().next().show();

$(this).next().animate(opts[1], time);

setTimeout(function() {

$('#' + current[0].id).siblings('a').find('.info').addClass('shelter');

$('#' + current[0].id).siblings('a').find('.img').stop().animate(opts[0], time, function() {

$(this).hide().next().show();

$(this).next().animate(opts[1], time);

});

}, 1000);

clickstate = 1;

setTimeout(function() {

if ($('#hb').html() != "10") {

$('#hb').html(coutnas)

$('#iosDialog1').show();

} else {

$('#iosDialog2').show();

}

}, 2500);

});

});

}

var verticalOpts = [{

'width': 0

}, {

'width': '90%'

}];

turn($('#draw'), 400, verticalOpts);

function Refresh() {

$('#iosDialog1').hide();

var opts = [{

'width': 0

}, {

'width': '90%'

}];

var time = 400

$('#draw').find('.info').stop().animate(opts[0], time, function() {

$(this).prev().animate(opts[1], time);

$(this).prev().css('width', '90%')

$(this).hide().prev().show();

$(this).removeClass('shelter')

});

setTimeout(function() {

clickstate = 0;

for (var i = 0; i < arr.length; i++) {

var l = $('#draw .info')[i]

l.innerHTML = '<div class="a-size"></div><div class="a-size-zl">' + arr[i] +

'</div><div class="a-size-s">積分</div>'

}

}, 1500);

}

function TurnMyCenter() {

$('#iosDialog1').hide();

}

//------------------------------------------------

</script>

<script type="text/javascript">

function getParam(paramName) {

paramValue = "", isFound = !1;

if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {

arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;

while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() ==

paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++

}

return paramValue == "" && (paramValue = null), paramValue

}

// 去除IOS 彈框上的網址

window.alert = function(name) {

var iframe = document.createElement("IFRAME");

iframe.style.display = "none";

document.documentElement.appendChild(iframe);

window.frames[0].window.alert(name);

iframe.parentNode.removeChild(iframe)

}

</script>

<script type="text/javascript">

let code = getParam('code')

let userOpenId = getParam('userOpenId')

$('.back-drop').css('display', 'none')

console.log(userOpenId)

console.log(code)

let workWeChat = ''

let openId = ''

let infoData = {}

let maskInventory = 0

let indexData = ''

let iintl = 0

var ua = navigator.userAgent.toLowerCase();

var isWeixin = ua.indexOf('micromessenger') != -1;

if (isWeixin && !code) {

let urlcode = encodeURI("http://lottery.tubebabyblog.top/lottery/callBack.html")

if (userOpenId && userOpenId != 'null') {

urlcode = encodeURI("http://lottery.tubebabyblog.top/lottery/callBack.html?userOpenId=" + userOpenId)

}

window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx51d6fdd81c845a49&redirect_uri=" +

urlcode + "&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect"

}

if (code) {

$('#body').css('display', 'block')

}

//分析助力進入

if (userOpenId && userOpenId != 'null') {

help()

$('#dialogs').css('display', 'block');

$('.opoUp-other').css('display', 'block');

} else {

getOpenId()

}

//爲好友助力

$('.opoUp-other').on('click', '.opoUp-other-help', function() {

clickHelp()

})

//我也要兌換

$('.opoUp-help').on('click', '.opoUp-help-conversions', function() {

userOpenId = openId

$('#dialogs').css('display', 'none')

$('.opoUp-help').css('display', 'none')

})

$('.opoUp-x').click(function() {

userOpenId = openId

$('#dialogs').css('display', 'none')

$('.opoUp-x').css('display', 'none')

$('.opoUp-other').css('display', 'none')

$('.opoUp-help').css('display', 'none')

$('.opoUp-conversion').css('display', 'none')

})

$('.back-drop').click(function() {

$('.back-drop').css('display', 'none')

})

//複製

function copy() {

let url = $('.copy');

url.select();

document.execCommand("copy");

alert('複製成功!');

}

//複製

function copyWx() {

let url = $('.copy-id');

url.select();

document.execCommand("copy");

alert('複製成功!');

}

setTimeout(function() {

wechatShare(this.location.href)

}, 1500)

function wechatShare(urlList) {

//分享需要攜帶本人openid

let self = this

let useUrl = userOpenId != 'null' ? encodeURI(

'http://lottery.tubebabyblog.top/lottery/index.html?type=true&userOpenId=' +

userOpenId) : encodeURI('http://lottery.tubebabyblog.top/lottery/index.html?userOpenId=' + openId)

if (urlList) {

useUrl = urlList

} else {

$('.back-drop').css('display', 'block')

}

$.ajax({

type: "post",

url: "http://qrcode.tubebabyblog.top:8090/lottery/jsSDK",

data: JSON.stringify({

'url': this.location.href

}),

contentType: "application/json;charset-UTF-8",

success: function(res) {

let data = res

wx.config({

debug: false,

appId: data.data.appId,

timestamp: data.data.timestamp,

nonceStr: data.data.nonceStr,

signature: data.data.signature,

jsApiList: [

"onMenuShareTimeline",

"onMenuShareAppMessage"

]

});

wx.ready(() => {

wx.onMenuShareTimeline({

title: '送口罩,我們是認真的!——泰東方試管',

link: useUrl,

imgUrl: 'http://lottery.tubebabyblog.top/lottery/ldimg/logo.png',

success: (data) => {

if (data.errMsg === 'onMenuShareTimeline:ok') {

alert('分享成功');

}

},

cancel: () => {

alert('分享失敗');

}

});

wx.onMenuShareAppMessage({

title: '送口罩,我們是認真的!——泰東方試管', // 分享標題

desc: '點擊翻牌免費領取口罩,數量有限,先到先得', // 分享描述

link: useUrl, // 分享鏈接,該鏈接域名或路徑必須與當前頁面對應的公衆號JS安全域名一致

imgUrl: 'http://lottery.tubebabyblog.top/lottery/ldimg/logo.png', // 分享圖標

type: 'link', // 分享類型,music、video或link,不填默認爲link

dataUrl: '', // 如果type是music或video,則要提供數據鏈接,默認爲空

success: (data) => {

if (data.errMsg === 'onMenuShareAppMessage:ok') {

alert('分享成功');

}

},

cancel: () => {

alert('分享失敗');

}

});

})

},

});

}

function bodyChange() {

alert('本期口罩已領取完畢,敬請期待下次活動!添加客服微信xiao1609han進行兌換!')

}

$('.conversion-btn').click(function() {

if (maskInventory == 0) {

return

}

if (iintl >= 1000) {

exchange()

}

})

//兌換接口

function exchange() {

$.ajax({

type: "get",

url: "http://qrcode.tubebabyblog.top:8090/lottery/exchange?openId=" + openId,

success: function(res) {

console.log(res)

if (res.code == 0) {

if (typeof(res.data) == 'string' && (res.data.indexOf('口罩已兌換完畢') != -1 || res.data.indexOf('口罩已領取完畢') != -1)) {

$('.body-opoUp').css('display', 'block')

alert(res.data)

return

}

workWeChat = res.data.workWeChat

maskInventory = res.data.maskInventory

$('.maskInventory').html(res.data.maskInventory)

let userVO = res.data.userVO

$('#inte').html(userVO.point)

iintl = userVO.point

var px = iintl > 1000 ? 100 : iintl / 1000 * 100

$('.copying .progress-son').css('width', (px + '%'))

if (iintl < 1000) {

$('.conversion-btn').removeClass('conversion-btn-show')

}

$('#num').html(userVO.chance)

$('.workWeChat').html(workWeChat)

$('.copy').val(workWeChat)

$('#dialogs').css('display', 'block');

$('.opoUp-x').css('display', 'block');

$('.opoUp-conversion').css('display', 'block');

} else {

alert(res.msg)

}

},

});

}

//獲取首頁信息

function getOpenId() {

$.ajax({

type: "get",

url: "http://qrcode.tubebabyblog.top:8090/lottery/getOpenId?code=" + code,

success: function(res) {

console.log(res)

if (res.code == 0) {

let datas = res.data,

friendHelpVOList = res.data.friendHelpVOList,

configVO = res.data.configVO,

userVO = res.data.userVO,

indexData = res.data;

//助力列表

var friendHelpHtml = '';

if (friendHelpVOList && friendHelpVOList.length > 0) {

for (let i = 0; i < friendHelpVOList.length; i++) {

friendHelpHtml += '<div class="friendsHelp-content-list-item">' +

'<div id="" class="friendsHelp-content-list-item-left">' +

'<img src="' + friendHelpVOList[i].headPic +

'"><div id=""><div class="friendsHelp-content-list-item-left-title1">' + friendHelpVOList[i].userName +

'</div>' +

'<div class="friendsHelp-content-list-item-left-title2">' + friendHelpVOList[i].createdTime +

'</div></div></div>' +

'<div class="friendsHelp-content-list-item-right">爲您助力' + friendHelpVOList[i].frequency + '次</div></div>'

}

}

if (res.data.existsExchangeVO) {

console.log(res.data.existsExchangeVO)

if (!res.data.existsExchangeVO.result) {

$('.body-opoUp').css('display', 'block')

alert(res.data.existsExchangeVO.message)

}

}

if (configVO) {

$('.workWeChat').html(configVO.workWeChat)

$('.copy').val(configVO.workWeChat)

$('.maskInventory').html(configVO.maskInventory)

maskInventory = configVO.maskInventory

// if (maskInventory == 0) {

// $('.body-opoUp').css('display', 'block')

// $('.conversion-btn').addClass('conversion-btn-show')

// // alert('本期口罩已領取完畢,敬請期待下次活動!添加客服微信xiao1609han進行兌換!')

// }

}

if (friendHelpHtml == '') {

friendHelpHtml = '<div style="text-align:center;padding-top:0.5rem;">暫無助力記錄</div>'

}

$('.friendsHelp-content-list').html(friendHelpHtml)

if (userVO) {

// 用戶個人信息

$('#num').html(userVO.chance)

$('#name').html(userVO.userName)

$('.copying-img').html('<img src="' + userVO.headPic + '">')

$('#inte').html(userVO.point)

$('.openId').html(userVO.openId + '(點擊ID複製)')

$('.copy-id').val(userVO.openId)

openId = userVO.openId

iintl = userVO.point

var px = iintl > 1000 ? 100 : iintl / 1000 * 100

$('.copying .progress-son').css('width', (px + '%'))

if (iintl >= 1000) {

$('.conversion-btn').addClass('conversion-btn-show')

}

}

} else {

let urlcode = encodeURI("http://lottery.tubebabyblog.top/lottery/callBack.html")

window.location.href =

"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx51d6fdd81c845a49&redirect_uri=" +

urlcode + "&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect"

}

},

error: function() {

let urlcode = encodeURI("http://lottery.tubebabyblog.top/lottery/callBack.html")

window.location.href =

"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx51d6fdd81c845a49&redirect_uri=" +

urlcode + "&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect"

}

});

}

function clickHelp() {

console.log(openId)

$.ajax({

type: "get",

url: "http://qrcode.tubebabyblog.top:8090/lottery/clickHelp?&userOpenId=" + userOpenId + '&assistOpenId=' +

openId,

success: function(res) {

console.log(res)

if (res.code == 0) {

alert(res.data.message)

if (res.data.result) {

$('.opoUp-other').css('display', 'none')

$('.opoUp-help').css('display', 'block')

}

}else{

alert(res.msg)

}

}

})

}

//分享助力 首頁接口

function help() {

$.ajax({

type: "get",

url: "http://qrcode.tubebabyblog.top:8090/lottery/help?code=" + code + "&userOpenId=" + userOpenId,

success: function(res) {

console.log(res)

if (res.code == 0) {

let datas = res.data,

friendHelpVOList = res.data.friendHelpVOList,

configVO = res.data.configVO,

userVO = res.data.userVO,

beAssistedUserVO = res.data.beAssistedUserVO,

indexData = res.data;

if (res.data.existsExchangeVO) {

if (!res.data.existsExchangeVO.result) {

$('.body-opoUp').css('display', 'block')

$('.opoUp-x').css('display', 'block')

$('.opoUp-other-help').css('display', 'none')

alert(res.data.existsExchangeVO.message)

}

}

if (configVO) {

maskInventory = configVO.maskInventory

$('.maskInventory').html(configVO.maskInventory)

// if (maskInventory == 0) {

// $('.body-opoUp').css('display', 'block')

// $('.conversion-btn').addClass('conversion-btn-show')

// }

$('.workWeChat').html(configVO.workWeChat)

}

if (beAssistedUserVO) {

$('.opoUp-info-img').html('<img src="' + beAssistedUserVO.headPic + '">')

$('.opoUp-other-info-name').html(beAssistedUserVO.userName)

$('.opoUp-other-info-int').html(beAssistedUserVO.point)

var px = beAssistedUserVO.point > 1000 ? 100 : beAssistedUserVO.point / 1000 * 100

console.log(px)

$('.opoUp-progress-son').css('width', (px + '%'))

}

//助力列表

var friendHelpHtml = '';

if (friendHelpVOList && friendHelpVOList.length > 0) {

for (let i = 0; i < friendHelpVOList.length; i++) {

friendHelpHtml += '<div class="friendsHelp-content-list-item">' +

'<div id="" class="friendsHelp-content-list-item-left">' +

'<img src="' + friendHelpVOList[i].headPic +

'"><div id=""><div class="friendsHelp-content-list-item-left-title1">' + friendHelpVOList[i].userName +

'</div>' +

'<div class="friendsHelp-content-list-item-left-title2">' + friendHelpVOList[i].createdTime +

'</div></div></div>' +

'<div class="friendsHelp-content-list-item-right">爲您助力' + friendHelpVOList[i].frequency + '次</div></div>'

}

}

if (friendHelpHtml == '') {

friendHelpHtml = '<div style="text-align:center;padding-top:0.5rem;">暫無助力記錄</div>'

}

$('.friendsHelp-content-list').html(friendHelpHtml)

if (userVO) {

// 用戶個人信息

$('#num').html(userVO.chance)

$('#name').html(userVO.userName)

$('.copying-img').html('<img src="' + userVO.headPic + '">')

$('#inte').html(userVO.point)

$('.openId').html(userVO.openId + '(點擊ID複製)')

$('.copy-id').val(userVO.openId)

openId = userVO.openId

console.log(openId)

iintl = userVO.point

var px = iintl > 1000 ? 100 : iintl / 1000 * 100

$('.copying .progress-son').css('width', (px + '%'))

if (iintl >= 1000) {

$('.conversion-btn').addClass('conversion-btn-show')

}

}

} else {

alert(res.msg)

}

},

error: function(res) {

console.log(res.responseText)

let urlcode = encodeURI("http://lottery.tubebabyblog.top/lottery/callBack.html")

if (userOpenId && userOpenId != 'null') {

urlcode = encodeURI("http://lottery.tubebabyblog.top/lottery/callBack.html?userOpenId=" + userOpenId)

}

window.location.href =

"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx51d6fdd81c845a49&redirect_uri=" + urlcode +

"&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect"

},

});

}

//抽獎

function lottery() {

$.ajax({

type: "get",

url: "http://qrcode.tubebabyblog.top:8090/lottery/lottery?code=" + code,

success: function(res) {

console.log(res)

},

});

}

</script>

</body>

</html>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章