123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570 |
- <!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/springFestivalActivity.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>
- </head>
- <body>
- <div class="code-container">
- <div class="award-tip">购买星曜月卡获得1次抽奖资格 星曜年卡获得10次抽奖资格</div>
- <div class="rule-wrap">
- <div class="rule">活动规则</div>
- <div class="award">奖励一览</div>
- </div>
- <div class="gift-box">
- <img class="gift-img" src="../static/img/springFestivalActivity/gift.png" />
- </div>
- </div>
- <div class="next-container">
- <div class="lottery-tip">抽奖10次轮盘必中年卡</div>
- <div class="lottery-wrap">
- <div class="once">抽奖1次</div>
- <div class="five-times">抽奖5次</div>
- </div>
- <div class="rest-times">
- <div class="rest-times-text">剩余次数 <span class="rest-times-number">0</span>次</div>
- <div class="get-times">获取次数 >></div>
- </div>
- <div class="no-join-activity">使用激活码,星币支付及PC端不参与活动</div>
- <div class="share-wrap">分享至朋友圈、QQ获得“幸运BUFF”</div>
- <div class="get-award">已获取奖励</div>
- <div class="activity-time">活动时间 :2021年1月25日-2月15日</div>
- <div class="activity-tip">仅购买星曜月卡,星曜年卡才可参与此活动哦</div>
- </div>
- <div class="award-record-mask">
- <div class="dialog">
- <div class="tab-wrap">
- <div class="award-change-btn active" data-index="0">领取</div>
- <div class="award-change-btn" data-index="1">已使用</div>
- </div>
- <div class="record-wrap">
- <div class="title-row">
- <div class="title-award">奖品</div>
- <div class="title-Title">时间</div>
- <div class="title-operat">操作</div>
- </div>
- <div class="line"></div>
- <div class="data-list">
-
- </div>
- </div>
- <div class="sure-btn">确定</div>
- <img class="close" src="../static/img/springFestivalActivity/close.png" />
- </div>
- </div>
- <div class="rule-mask">
- <div class="rule-dialog">
- <img class="rule-text" src="../static/img/springFestivalActivity/ruleText.png" />
- <div class="rule-list">
- <div class="rule-point">1、活动期间,购买获得的抽取资格不限次数, 活动期间可用,活动结束后未使用的做过期处理。</div>
- <div class="rule-point">2、参与活动的套餐是星曜月卡与年卡套餐,其他套餐不参与活动。</div>
- <div class="rule-point">3、星币、激活码购买的订单不参与本次活动。</div>
- <div class="rule-point">4、抽取的奖励只能新增云机,请去云手机首页查看。</div>
- <div class="rule-point">5、活动结束后3天保留奖励分配入口,但不能再参与活动。</div>
- <div class="rule-point">6、双子星官方对活动具有最终解释权。</div>
- </div>
- <img class="rule-close" src="../static/img/springFestivalActivity/close.png" />
- </div>
- </div>
- <div class="award-mask">
- <div class="award-dialog">
- <div class="award-result-row">
- <img class="icon" src="../static/img/springFestivalActivity/left-icon.png" />
- <span class="award-result">参与抽奖有几率获得以下奖励</span>
- <img class="icon" src="../static/img/springFestivalActivity/right-icon.png" />
- </div>
- <div class="card-wrap"></div>
- <img class="award-close" src="../static/img/springFestivalActivity/close.png" />
- </div>
- </div>
- <div class="award-result-mask">
- <div class="award-result-dialog">
- <div class="have-times-wrap">
- <div class="result-tip-row">
- <div class="award-result-tip">善良的人,好运气最终是会眷顾你</div>
- <div class="join-result-tip">参与抽奖有几率获得以下奖励</div>
- </div>
- <div class="card-wrap award-result-wrap"></div>
- <div class="btn-row">
- <div class="left-btn">再抽<span class="report-times"></span>次</div>
- <div class="look-btn">查看</div>
- </div>
- <div class="times-text">还剩次数:<span class="times-text-number"></span>次</div>
- </div>
- <div class="no-times-wrap">
- <div class="no-times-tip">
- <div>意不意外,惊不惊喜!</div>
- <div>当前抽奖次数不足哦</div>
- </div>
- <div class="no-times-btn">购买星曜云手机获取次数</div>
- </div>
- <img class="award-result-close" src="../static/img/springFestivalActivity/close.png" />
- </div>
- </div>
- <div class="distribution-mask">
- <div class="distribution-dialog">
- <div class="distribution-wrap">
- <div class="limit-tip">
- <div>云手机数量已达上限</div>
- <div>请分配云机时长</div>
- </div>
- <div class="distribution-btn">分配奖励</div>
- </div>
- </div>
- </div>
- <script>
- toastr.options.positionClass = 'toast-center-center';
- toastr.options.timeOut = '1500';
- </script>
- <script type="text/javascript">
- // var baseUrl = 'http://test.androidscloud.com'
- let timer,flag = true;
- var url = window.location.href;
- url = url.split('/')
- var loc = window.location.search,
- n1 = loc.length,//地址的总长度
- n2 = loc.indexOf("="),//取得=号的位置
- id = loc.substr(n2 + 1, n1 - n2),//从=号后面的内容
- u = navigator.userAgent,
- ua = navigator.userAgent.toLowerCase(),
- isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
- isMiniprogram = false,
- isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
- let activityState = 0,
- surplus = 0,
- receive = 0,
- notReceive = 0;
- if(id !== ''){
- operate(3);
- }
- if (ua.match(/MicroMessenger/i) == "micromessenger") {
- //ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
- wx.miniProgram.getEnv((res) => {
- if (res.miniprogram) {
- isMiniprogram = true;
- } else {
- isMiniprogram = false;
- }
- })
- } else {
- isMiniprogram = false;
- }
- init();
- setInterval(() => {
- init();
- },30000);
- //初始化数据
- function init(times) {
- $.ajax({
- url: baseUrl + '/api/user/v1/activity/getSpringFestivalConfig',
- type: 'get',
- headers: {
- 'Authorization': id //id
- },
- contentType: "application/json",
- dataType: 'json',
- cache: false,
- success: function (res) {
- if(res.status === 0){
- $('.card-wrap').eq(0).text('');
- let time = `${res.data.startTime.substr(0,4)}年${res.data.startTime.substring(5,7)}月${res.data.startTime.substring(8,10)}日-${res.data.endTime.substring(5,7)}月${res.data.endTime.substring(8,10)}日`;
- $('.activity-time').eq(0).text(time);
- let str = '',
- cardData = [{name: '天',imgName: 'day'},{name: '周',imgName: 'week'},{name: '月',imgName: 'mouth'},
- {name: '季',imgName: 'season'},{name: '年',imgName: 'year'}],
- jackpot = res.data.jackpot;
- cardData = cardData.filter((item) => jackpot.includes(item.name));
- for (var i = 0; i < cardData.length; i++) {
- str += `<div class="card-item">
- <img class="card" src="../static/img/springFestivalActivity/${cardData[i].imgName}.png" />
- <div class="card-text">星曜${cardData[i].name}卡</div>
- </div>`
- }
- activityState = res.data.activityState;
- surplus = res.data.surplus;
- notReceive = res.data.notReceive;
- $('.rest-times-number').eq(0).text(surplus);
- $('.times-text-number').eq(0).text(surplus);
- if(res.data.addition === 1){
- $('.gift-box')[0].className = 'gift-box have-buff'
- } else {
- $('.gift-box')[0].className = 'gift-box'
- }
- if(notReceive > 0){
- $('.tab-wrap').eq(0).css('display', 'flex');
- $('.record-wrap').eq(0).css('marginTop', '0.2rem');
- $('.record-wrap').eq(0).css('height', '5.48rem');
- $('.data-list').eq(0).css('height', '4.38rem');
- }else{
- $('.tab-wrap').eq(0).css('display', 'none');
- $('.record-wrap').eq(0).css('marginTop', '1.6rem');
- $('.record-wrap').eq(0).css('height', '5.86rem');
- }
- $('.card-wrap').eq(0).append(str)
- }else{
- stopManyClick(() =>{
- toastr.error(res.msg)
- })
- }
-
- },
- })
- }
- //点击获奖记录
- $('.get-award')[0].addEventListener('click',() => {
- $('.dialog').animate({top: '2.24rem'},"fast");
- $('.award-record-mask').show();
- document.documentElement.style.overflow='hidden';
- getAward();
- },false);
- //点击获奖记录关闭按钮
- $('.close')[0].addEventListener('click',handleClose,false);
- function handleClose() {
- $('.dialog').animate({top: '-10.96rem'},"fast");
- $('.award-record-mask').hide();
- document.documentElement.style.overflow='auto';
- }
- //点击确定
- $('.sure-btn')[0].addEventListener('click',handleClose,false);
- //点击规则
- $('.rule')[0].addEventListener('click',() => {
- $('.rule-dialog').animate({top: '2.24rem'},"fast");
- $('.rule-mask').show();
- document.documentElement.style.overflow='hidden';
- },false);
- //点击规则关闭按钮
- $('.rule-close')[0].addEventListener('click',() => {
- $('.rule-dialog').animate({top: '-10.96rem'},"fast");
- $('.rule-mask').hide();
- document.documentElement.style.overflow='auto';
- },false);
- //点击奖励一览
- $('.award')[0].addEventListener('click',() => {
- $('.award-dialog').animate({top: '2.24rem'},"fast");
- $('.award-mask').show();
- document.documentElement.style.overflow='hidden';
- },false);
- //点击奖励一览关闭按钮
- $('.award-close')[0].addEventListener('click',() => {
- $('.award-dialog').animate({top: '-10.96rem'},"fast");
- $('.award-mask').hide();
- document.documentElement.style.overflow='auto';
- },false);
- //点击领取按钮
- $('.tab-wrap')[0].addEventListener('click',(e) => {
- receive = e.target.dataset.index;
- if(receive == 1){
- $('.award-change-btn')[0].className = 'award-change-btn'
- }else{
- $('.award-change-btn')[1].className = 'award-change-btn'
- }
- getAward();
- $('.award-change-btn')[receive].className = 'award-change-btn active'
- },false);
- //点击抽奖
- $('.once')[0].addEventListener('click',() => {
- handleAward(1)
- },false);
- $('.five-times')[0].addEventListener('click',() => {
- handleAward(5)
- },false);
- //点击再抽
- $('.left-btn')[0].addEventListener('click',() => {
- let val = $('.report-times').eq(0).text();
- handleAward(val,'report')
- },false);
- function handleAward(times,type) {
- if(surplus === 0){
- $('.have-times-wrap').eq(0).css('display', 'none');
- $('.no-times-wrap').eq(0).css('display', 'block');
- $('.award-result-dialog').animate({top: '1.86rem'},"fast");
- $('.award-result-mask').show();
- document.documentElement.style.overflow='hidden';
- return
- }
- $.ajax({
- url: baseUrl + '/api/user/v1/activity/obtainRewards',
- type: 'post',
- headers: {
- 'Authorization': id //id
- },
- data:JSON.stringify({
- frequency: times
- }),
- contentType: "application/json",
- dataType: 'json',
- cache: false,
- success: function (res) {
- if(res.status === 0){
- $('.have-times-wrap').eq(0).css('display', 'block');
- $('.no-times-wrap').eq(0).css('display', 'none');
- if(type !== 'report'){
- $('.award-result-dialog').animate({top: '1.86rem'},"fast");
- $('.award-result-mask').show();
- document.documentElement.style.overflow='hidden';
- }
- $('.award-result-wrap').eq(0).text('');
- let str = '',
- cardObj = {
- '天': 'day',
- '周': 'week',
- '月': 'mouth',
- '季': 'season',
- '年': 'year'
- },
- list = res.data.list;
- if(list.length === 1){
- $('.report-times').eq(0).text(1);
- $('.look-btn').eq(0).text('查看');
- $('.award-result-wrap')[0].className = 'card-wrap award-result-wrap one-result';
- str = `<div class="card-item">
- <img class="one-card" src="../static/img/springFestivalActivity/${cardObj[list[0].duration]}.png" />
- <div class="card-text">星曜${list[0].duration}卡</div>
- </div> `
- }else{
- $('.report-times').eq(0).text(5);
- $('.look-btn').eq(0).text('确定');
- $('.award-result-wrap')[0].className = 'card-wrap award-result-wrap'
- for (var i = 0; i < list.length; i++) {
- str += `<div class="card-item">
- <img class="card" src="../static/img/springFestivalActivity/${cardObj[list[i].duration]}.png" />
- <div class="card-text">星曜${list[i].duration}卡</div>
- </div>`
- }
- }
- $('.award-result-wrap').eq(0).append(str);
- init();
- }else{
- stopManyClick(() =>{
- toastr.error(res.msg)
- })
- }
- },
- })
- }
- //点击抽奖关闭按钮
- $('.award-result-close')[0].addEventListener('click',() => {
- $('.award-result-dialog').animate({top: '-10.96rem'},"fast");
- $('.award-result-mask').hide();
- document.documentElement.style.overflow='auto';
- },false);
- //点击分享按钮
- $('.share-wrap')[0].addEventListener('click',() => {
- if (isMiniprogram) { // 小程序
- wx.miniProgram.navigateTo({
- url: '/pages/home/home'
- })
- } else { // 不是小程序
- $.ajax({
- url: baseUrl + '/api/public/v4/actFissionAward/getActDetail',
- type: 'get',
- headers: {
- 'Authorization': id //id
- },
- contentType: "application/json",
- dataType: 'json',
- cache: false,
- success: function (res) {
- if (res.status === 0) {
- init();
- const shareInfo = res.data.shareInfo;
- if (isAndroid) {
- window.native.share(shareInfo.title, shareInfo.content, shareInfo.gotoUrl, shareInfo.shareImg)
- } else if (isIOS) {
- window.webkit.messageHandlers.share.postMessage({
- title: shareInfo.title,
- content: shareInfo.content,
- gotoUrl: shareInfo.gotoUrl,
- shareImg: shareInfo.shareImg
- });
- }
- } else {
- stopManyClick(() =>{
- toastr.error(res.msg)
- })
- }
- },
- })
- }
- $.ajax({
- url: baseUrl + '/api/user/v1/activity/addBuff',
- type: 'get',
- headers: {
- 'Authorization': id //id
- },
- contentType: "application/json",
- dataType: 'json',
- cache: false,
- success: function (res) {
- console.log(res)
- },
- })
-
- },false);
- //点击购买星耀获取云机按钮
- $('.no-times-btn')[0].addEventListener('click',() => {
- if (isMiniprogram) { // 小程序
- wx.miniProgram.navigateTo({
- url: '/packageA/order/buy/index?type=activity'
- })
- } else if (isAndroid) { // 安卓
- window.native.startPurchase(1, 365);
- } else if (isiOS) {
- window.webkit.messageHandlers.startPurchase.postMessage({ type: 1, day: 365 });
- }
- },false);
- //点击获取次数
- $('.get-times')[0].addEventListener('click',() => {
- if (isMiniprogram) { // 小程序
- if(notReceive > 0){
- wx.miniProgram.navigateTo({
- url: '/packageA/order/renew/index?type=activity'
- })
- } else {
- wx.miniProgram.navigateTo({
- url: '/packageA/order/buy/index?type=activity'
- })
- }
- } else if (isAndroid) { // 安卓
- if(notReceive > 0){
- window.native.startRenew();
- } else {
- window.native.startPurchase(1, 365);
- }
- } else if (isiOS) {
- if(notReceive > 0){
- window.webkit.messageHandlers.startRenew.postMessage();
- } else {
- window.webkit.messageHandlers.startPurchase.postMessage();
- }
- }
- },false);
- // 点击查看
- $('.look-btn')[0].addEventListener('click',() => {
- if(notReceive > 0){
- $('.distribution-dialog').animate({top: '5.24rem'},"fast");
- $('.distribution-mask').show();
- document.documentElement.style.overflow='hidden';
- return
- }
- if (isMiniprogram) { // 小程序
- wx.miniProgram.navigateTo({
- url: '/pages/home/home'
- })
- } else if (isAndroid) { // 安卓
- window.native.startMain();
- } else if (isiOS) {
- window.webkit.messageHandlers.startMain.postMessage();
- }
- },false);
- //点击分配奖励按钮
- $('.distribution-btn')[0].addEventListener('click',() => {
- $('.award-result-dialog').animate({top: '-10.96rem'},"fast");
- $('.award-result-mask').hide();
- $('.distribution-dialog').animate({top: '-10.96rem'},"fast");
- $('.distribution-mask').hide();
- $('.dialog').animate({top: '2.24rem'},"fast");
- $('.award-record-mask').show();
- document.documentElement.style.overflow='hidden';
- getAward()
- },false);
- //点击使用按钮
- $('.data-list')[0].addEventListener('click',(e) => {
- if (e.target.className === 'record-operate operate-btn') {
- let awardId = parseInt(e.target.dataset.awardid);
- let awardName = e.target.dataset.awardname;
- console.log(awardId)
- if (isMiniprogram) { // 小程序
- wx.miniProgram.navigateTo({
- url: '/packageA/order/buy/index?type=activity'
- })
- } else if (isAndroid) { // 安卓
- window.native.activatePhone(2, awardId, awardName);
- } else if (isiOS) {
- window.webkit.messageHandlers.activatePhone.postMessage({ type: 2, awardId: awardId, awardName: awardName });
- }
- }
- },false);
- //获取抽奖记录
- function getAward(){
- $.ajax({
- url: baseUrl + '/api/user/v1/activity/platformGetRewardsH5',
- type: 'post',
- headers: {
- 'Authorization': id //id
- },
- data:JSON.stringify({
- pageNum: 1,
- pageSize: 10,
- receive: receive
- }),
- contentType: "application/json",
- dataType: 'json',
- cache: false,
- success: function (res) {
- if(res.status === 0){
- $('.data-list').eq(0).text('');
- let str = '',
- records = res.data.records;
- for (var i = 0; i < records.length; i++) {
- str += `<div class="data-row">
- <div class="award-card">星曜${records[i].effectiveTimeStr}卡</div>
- <div class="record-time">${records[i].createTime}</div>
- <div class="${records[i].receiveType === 0?'record-operate':'record-operate operate-btn'}"
- data-awardId="${records[i].id}" data-awardName="星曜${records[i].effectiveTimeStr}卡">
- ${records[i].receiveType === 0?'已使用':'使用'}</div>
- </div>`
- }
- $('.data-list').eq(0).append(str)
- }else{
- stopManyClick(() =>{
- toastr.error(res.msg)
- })
- }
-
- },
- })
- }
- //埋点
- function operate(accessType){
- $.ajax({
- url: baseUrl + '/api/public/v1/game/user/operate',
- type: 'post',
- headers: {
- 'Authorization': id //id
- },
- data:JSON.stringify({
- accessType: accessType,
- entrance: 3,
- url: window.location.href
- }),
- contentType:"application/json",
- dataType: 'json',
- cache: false,
- success: function (res) {
- console.log(res)
- },
- })
- }
- //防止提示一秒内重复显示
- function stopManyClick(fn) {
- if (flag) {
- fn();
- }
- flag = false;
- if(timer){clearTimeout(timer);}
- timer = setTimeout(() => {flag = true}, 1500);
- }
- </script>
- </body>
- </html>
|