123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <title>邀请有礼</title>
- <link rel="icon" href="../static/img/favicon2.ico" type="img/x-ico">
- <link rel="stylesheet" href="../static/js/vender/toastr/toastr.min.css">
- <link rel="stylesheet" href="../static/css/invite.css">
- <script src="../static/js/vender/jquery-3.4.1.min.js"></script>
- <script src="../static/js/vender/toastr/toastr.min.js"></script>
- <script src="../static/js/vender/config.js"></script>
- <style>
- .my-tips{
- position: fixed;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- font-size: 0.28rem;
- }
- </style>
- </head>
- <body>
- <div class="invite-container pr">
- <div class="rules" onclick="handleShow()">活动规则</div>
- <div class="h658">
- <img src="../static/img/invite/inviteTop.png" class="bottom-img" alt="">
- <div class="recv-cont">
- <div class="title" id="title">
- </div>
- <div class="recv-btn-container">
- <div onclick="appDown()" class="recv-btn"></div>
- </div>
- <div class="recv-ipt" id="recv_ipt">
- <span class="fl">
- <span>我的邀请码:</span>
- <span class="fw500" id="invitationCode"></span>
- </span>
- <span class="copy-btn-style btn-code-copy fr">点击复制</span>
- </div>
- </div>
- </div>
- <div class="load-menu">
- <div class="center-reward-con">
- <div class="top-title">我的奖励</div>
- <div id="goode">
- <div class="reward-second-title"></div>
- <ul class="goodFriend-title-list">
- <li class="tac">被邀好友帐号</li>
- <li class="tac">获时长数(小时)</li>
- <li class="tac">邀请时间</li>
- </ul>
- </div>
- </div>
- <div class="center-reward-con mt40">
- <div class="top-title">邀请榜TOP10</div>
- <div id="rank">
- <ul class="goodFriend-title-list">
- <li class="tac">排名</li>
- <li class="tac">用户名</li>
- <li class="tac">邀请数量</li>
- <li class="tac">奖励(时长)</li>
- </ul>
- </div>
- </div>
- </div>
- <div class="mask">
- <div class="dialog">
- <div class="code-title-font"></div>
- <div class="tb-codes">
- <p class="fw500">好友购机,买一送一</p>
- <p>被邀好友购买任意套餐,您可获其等额时长返现(仅限首单);邀请越多返现越多,返现无上限。请用户参与活动前认真阅读规则,若因未按规则参与活动而造成的损失,由用户自行承担。</p>
- <p class="fw500">规则</p>
- <p>1、好友购机前,邀请人账户内无云手机(无云手机购买记录者),或仅有免费试用时长的用户,则无法获时长奖励;</p>
- <p>2、邀请成功后,双方自动成为好友,邀请奖励将通过好友消息的方式进行发放,邀请方需要点击【领取】,才可领取成功,时长奖励返现至您账户内时长最多的云手机。邀请奖励领取期限为24小时,超过领取期限则无法领取奖励。</p>
- <p>3、如发现有刷单等行为用户,将对该账号及其所关联账号进行冻结处理;</p>
- <p>4、本活动最终解释权归双子星云手机所有。</p>
- </div>
- </div>
- <div class="close" onclick="handleClose()"></div>
- </div>
- </div>
- <input type="text" style="opacity: 0;z-index: -10;position: fixed;" id="passwordCopy" value="">
- <input type="text" style="opacity: 0;z-index: -10;position: fixed;" id="inviteCopy" value="">
- <script>
- toastr.options.positionClass = 'toast-center-center';
- toastr.options.timeOut = '1500';
- </script>
- <script type="text/javascript">
- let timer, flag = true;
- var url = window.location.href;
- url = url.split('/')
- // var baseUrl = url[0] + '//' + url[2]
- var loc = window.location.search;
- var n1 = loc.length;//地址的总长度
- var n2 = loc.indexOf("=");//取得=号的位置
- // var id = loc.substr(n2 + 1, n1 - n2);//从=号后面的内容
- var id = loc.substr(n2 + 1, n1 - n2);//从=号后面的内容
- var u = navigator.userAgent;
- var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
- var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
- if (!id) {
- if (isAndroid) {
- window.native.toGame('noToken');
- } else if (isiOS) {
- window.webkit.messageHandlers.getPackageName.postMessage('noToken');
- } else {
- toastr.error('请登录')
- }
- }
- $.ajax({
- url: baseUrl + '/api/activity/v3/invitation/getInvitationInfo',
- type: 'get',
- headers: {
- 'Authorization': id //id
- },
- contentType: "application/json",
- dataType: 'json',
- cache: false,
- success: function (res) {
- $('#invitationCode').text(res.data.invitationCode)
- //加载数据
- $('#passwordCopy').val($('#invitationCode').text());
- //复制按钮
- $('.btn-code-copy').on('click', function () {
- stopManyClick(() => {
- var input = document.getElementById("passwordCopy");
- // 选中文本
- input.select();
- // 执行浏览器复制命令
- // document.activeElement.blur();
- document.execCommand("copy");
- toastr.error('复制成功', 0)
- })
- });
- if (res.data.friendList.length > 0) {
- var str = ''
- for (var i = 0; i < res.data.friendList.length; i++) {
- var phone = res.data.friendList[i].newPhone
- var inviteMsg = res.data.friendList[i].duration
- var registerTime = res.data.friendList[i].createTime
- var nPhone = phone.substr(0, 3) + '****' + phone.substring(7, 11)
- str += '<div class="goodFriend-item">'
- str += '<span class="tal">' + nPhone + '</span>'
- str += Number(inviteMsg) && inviteMsg > 0 ? '<span class="tac cF04646">' + inviteMsg + '</span>' : '<span class="tac">' + inviteMsg + '</span>'
- str += '<span class="tar">' + registerTime + '</span>'
- str += '</div>';
- }
- } else if (res.data.friendList.length === 0) {
- str = '<div class="no-data">还没有邀请到好友哦~</div>'
- }
- $('#goode').append(str);
- },
- error: function () {
- str = '<div class="no-data">还没有邀请到好友哦~</div>'
- $('#goode').append(str)
- }
- })
- $("#recv_ipt").bind('input propertychange', function (e) {
- stopManyClick(() => {
- var ipt_phones = $('#recv_ipt').val();
- var c = $(this);
- if (/[^\d]/.test(c.val())) {//替换非数字字符
- var temp_amount = c.val().replace(/[^\d]/g, '');
- $(this).val(temp_amount);
- toastr.error('请输入正确的手机号')
- }
- if (ipt_phones.length >= 12) {
- toastr.error('请输入正确的手机号')
- var recvstr = ipt_phones.substring(0, 11)
- $("#recv_ipt").val(recvstr);
- }
- })
- });
- function handleShow() {
- $('.dialog').animate({ top: '2.4rem' }, "fast");
- $('.close').animate({ top: '10.56rem' }, "fast");
- $('.mask').show();
- document.documentElement.style.overflow = 'hidden';
- }
- function handleClose() {
- $('.dialog').animate({ top: '-6.96rem' }, "fast");
- $('.close').animate({ top: '-0.68rem' }, "fast");
- $('.mask').hide();
- document.documentElement.style.overflow = 'auto';
- }
- function appDown() {
- var u = navigator.userAgent;
- var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
- var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
- if (!id) {
- if (isAndroid) {
- window.native.toGame('noToken');
- } else if (isiOS) {
- window.webkit.messageHandlers.getPackageName.postMessage('noToken');
- } else {
- toastr.error('请登录')
- }
- return
- }
- $.ajax({
- url: baseUrl + '/api/activity/v1/promote/getImPromoteUrl',
- type: 'get',
- headers: {
- 'Authorization': id //id
- },
- contentType: "application/json",
- dataType: 'json',
- cache: false,
- success: function (res) {
- var jsonStr = JSON.stringify(res.data)
- var jsonObj = JSON.parse(jsonStr)
- if (isiOS) {
- // WKWebView使用
- // 使用下方方法,会报错,为使界面执行逻辑通畅,因此使用try-catch
- try {
- getMessage(jsonObj);
- } catch (error) {
- console.log(error)
- }
- try {
- window.webkit.messageHandlers.getMessage.postMessage(jsonObj)
- } catch (error) {
- console.log(error)
- }
- } else if (isAndroid) {
- window.native.onClikWebView()
- } else {
- stopManyClick(() => {
- //加载数据
- var copyBefore = JSON.stringify(res.data.url);
- var copyUrl = copyBefore.split('"');
- console.log(copyUrl[1])
- $('#inviteCopy').val(copyUrl[1]);
- var input = document.getElementById("inviteCopy");
- // 选中文本
- input.select();
- // 执行浏览器复制命令
- document.execCommand("copy");
- toastr.error('复制成功')
- })
- }
- }
- })
- }
- // 查询季度排行榜
- function getInvitationRankList() {
- $.ajax({
- url: baseUrl + '/api/activity/v3/invitation/getInvitationRankList',
- type: 'get',
- headers: {
- 'Authorization': id //id
- },
- contentType: "application/json",
- dataType: 'json',
- cache: false,
- success: function (res) {
- var str = '';
- if (res.status === 0) {
- res.data.forEach(function (item, index) {
- var surfaceName = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/.test(item.surfaceName) ? item.surfaceName.substr(0, 3) + '****' + item.surfaceName.substring(7, 11) : item.surfaceName
- if (index === 0) {
- str += '<div class="rank-item">';
- str += '<span class="tac h52"><img class="icon" src="../static/img/invite/no1.png" alt=""></span>'
- str += '<span class="tac cF04646">' + surfaceName + '</span>'
- str += '<span class="tac cF04646">' + item.invitationNum + '</span>'
- str += '<span class="tac cF04646">' + item.duration + '</span>'
- str += '</div>';
- } else if (index === 1) {
- str += '<div class="rank-item">';
- str += '<span class="tac h52"><img class="icon" src="../static/img/invite/no2.png" alt=""></span>'
- str += '<span class="tac cF04646">' + surfaceName + '</span>'
- str += '<span class="tac cF04646">' + item.invitationNum + '</span>'
- str += '<span class="tac cF04646">' + item.duration + '</span>'
- str += '</div>';
- } else if (index === 2) {
- str += '<div class="rank-item">';
- str += '<span class="tac h52"><img class="icon" src="../static/img/invite/no3.png" alt=""></span>'
- str += '<span class="tac cF04646">' + surfaceName + '</span>'
- str += '<span class="tac cF04646">' + item.invitationNum + '</span>'
- str += '<span class="tac cF04646">' + item.duration + '</span>'
- str += '</div>';
- } else if (index < 10) {
- str += '<div class="rank-item">';
- str += '<span class="tac c333">' + (index + 1) + '</span>'
- str += '<span class="tac">' + surfaceName + '</span>'
- str += '<span class="tac">' + item.invitationNum + '</span>'
- str += '<span class="tac">' + item.duration + '</span>'
- str += '</div>';
- }
- });
- }
- $('#rank').append(str);
- }
- })
- }
- getInvitationRankList()
- // 查询最新获得奖励
- function getInvitationRecently() {
- $.ajax({
- url: baseUrl + '/api/activity/v3/invitation/getInvitationRecently',
- type: 'get',
- headers: {
- 'Authorization': id //id
- },
- contentType: "application/json",
- dataType: 'json',
- cache: false,
- success: function (res) {
- if (res.status === 0) {
- console.log(res.data)
- if(res.data.length <= 10){
- let datas = ['173', '134', '152', '136', '138', '173', '134', '152', '136', '138'];
- var str = '<ul class="list">'
- datas.forEach(function (item) {
- str += '<li>恭喜' + item + '*******成功获得时长' + (item - 100) + '小时</li>'
- })
- str += '</ul>'
- } else {
- var str = '<ul class="list">'
- res.data.forEach(function (item) {
- str += '<li>恭喜' + item.username.substr(0, 3) + '*******成功获得时长' + item.duration + '小时</li>'
- })
- str += '</ul>'
- }
- $('#title').append(str);
- }
- }
- })
- }
- getInvitationRecently()
- //防止提示一秒内重复显示
- function stopManyClick(fn) {
- if (flag) {
- fn();
- }
- flag = false;
- if (timer) { clearTimeout(timer); }
- timer = setTimeout(() => { flag = true }, 1500);
- }
- </script>
- </body>
- </html>
|