Authored by 郝肖肖

Merge branch 'feature/downEventYas' into release/5.2

1 -  
2 var $ = require('yoho-jquery'), 1 var $ = require('yoho-jquery'),
3 loading = require('../../plugin/loading'), 2 loading = require('../../plugin/loading'),
4 tip = require('../../plugin/tip'), 3 tip = require('../../plugin/tip'),
@@ -21,13 +20,15 @@ inviteObj = { @@ -21,13 +20,15 @@ inviteObj = {
21 // 变量 20 // 变量
22 inter: 0, // 定时器变量 21 inter: 0, // 定时器变量
23 ischeckCode: false, // 是否成功发送验证码 22 ischeckCode: false, // 是否成功发送验证码
24 - actId: $('.invite-group input[name="actId"]').val(), // 活动id  
25 - shareUid: $('.invite-group input[name="shareUid"]').val(), // 分享者id  
26 - openId: $('.invite-group input[name="openId"]').val(), // 微信openId 23 + actId: $('.invite-group input[name="actId"]').val(), // 活动id
  24 + shareUid: $('.invite-group input[name="shareUid"]').val(), // 分享者id
  25 + openId: $('.invite-group input[name="openId"]').val(), // 微信openId
27 nums: $('.invite-group input[name="nums"]').val() // 发送优惠券的次数 26 nums: $('.invite-group input[name="nums"]').val() // 发送优惠券的次数
28 }, 27 },
29 init: function() { 28 init: function() {
30 - var $el = this.el, that = this, isreceiveBtn = false; 29 + var $el = this.el,
  30 + that = this,
  31 + isreceiveBtn = false;
31 32
32 // 设置大背景,因为body只能后来设置,前期设置page里面 33 // 设置大背景,因为body只能后来设置,前期设置page里面
33 if ($('.invite-page').length > 0) { 34 if ($('.invite-page').length > 0) {
@@ -91,7 +92,7 @@ inviteObj = { @@ -91,7 +92,7 @@ inviteObj = {
91 92
92 // 下载app 93 // 下载app
93 $el.$downloadBtn.click(function() { 94 $el.$downloadBtn.click(function() {
94 - that.downLoadApp(); 95 + window.downLoadApp();
95 }); 96 });
96 97
97 // 领取福利 98 // 领取福利
@@ -109,7 +110,8 @@ inviteObj = { @@ -109,7 +110,8 @@ inviteObj = {
109 110
110 // 发送已注册用户参与活动的优惠券 111 // 发送已注册用户参与活动的优惠券
111 ischeckOldUserCoupon: function(mobile) { 112 ischeckOldUserCoupon: function(mobile) {
112 - var that = this, $el = this.el; 113 + var that = this,
  114 + $el = this.el;
113 115
114 $.ajax({ 116 $.ajax({
115 url: '/activity/invite/checkOldUserCoupon', 117 url: '/activity/invite/checkOldUserCoupon',
@@ -317,15 +319,6 @@ inviteObj = { @@ -317,15 +319,6 @@ inviteObj = {
317 $('.invite-dialog-bg').remove(); 319 $('.invite-dialog-bg').remove();
318 $el.$inviteDialog.hide(); 320 $el.$inviteDialog.hide();
319 that.clearGrayInfo(); 321 that.clearGrayInfo();
320 - },  
321 -  
322 - // 下载app  
323 - downLoadApp: function() {  
324 - var appUrl = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';  
325 -  
326 - setTimeout(function() {  
327 - window.location = appUrl;  
328 - }, 200);  
329 } 322 }
330 }; 323 };
331 324
@@ -204,7 +204,7 @@ $.extend({ @@ -204,7 +204,7 @@ $.extend({
204 204
205 // 单击下载按钮 - 接受微信商城或者第三方来源的数据埋点信息 205 // 单击下载按钮 - 接受微信商城或者第三方来源的数据埋点信息
206 if (queryString().union_type) { 206 if (queryString().union_type) {
207 - setCookie('unionTypeYas', queryString().union_type); 207 + setCookie('unionTypeYas', queryString().union_type, {path: '/'});
208 } 208 }
209 209
210 }()); 210 }());
@@ -307,6 +307,31 @@ if ($footer.find('.user-name').text().length === 11) { @@ -307,6 +307,31 @@ if ($footer.find('.user-name').text().length === 11) {
307 $footer.find('.user-name').html(phoneHidden($footer.find('.user-name').text())); 307 $footer.find('.user-name').html(phoneHidden($footer.find('.user-name').text()));
308 } 308 }
309 309
  310 +// 浮层下载APP
  311 +function downLoadApp() {
  312 + var appUrl = 'http://union.yoho.cn/union/downapp.html';
  313 + var clickedAt = new Date();
  314 +
  315 + setTimeout(function() {
  316 + var mkt = queryString().union_type || cookie('unionTypeYas') || false;
  317 +
  318 + if ((new Date()) - clickedAt < 2000) {
  319 + if (mkt) {
  320 + appUrl += '?union_type=' + mkt;
  321 + }
  322 +
  323 + if (window._yas && window._yas.sendCustomInfo) {
  324 + window._yas.sendCustomInfo({
  325 + op: 'YB_DOWNLOAD_C',
  326 + param: JSON.stringify({C_ID: _ChannelVary[cookie('_Channel')] || 1, TO_URL: appUrl})
  327 + }, true);
  328 + }
  329 +
  330 + window.location = appUrl;
  331 + }
  332 + }, 500);
  333 +}
  334 +
310 // 为您优选埋点 http://redmine.yoho.cn/issues/10117 335 // 为您优选埋点 http://redmine.yoho.cn/issues/10117
311 function givePoint(parameter) { 336 function givePoint(parameter) {
312 var CID = 1; 337 var CID = 1;
@@ -398,3 +423,5 @@ window.queryString = queryString(); @@ -398,3 +423,5 @@ window.queryString = queryString();
398 window.givePoint = givePoint; 423 window.givePoint = givePoint;
399 424
400 window._ChannelVary = _ChannelVary; 425 window._ChannelVary = _ChannelVary;
  426 +
  427 +window.downLoadApp = downLoadApp;
@@ -7,37 +7,10 @@ @@ -7,37 +7,10 @@
7 var $ = require('yoho-jquery'), 7 var $ = require('yoho-jquery'),
8 Hammer = require('yoho-hammer'); 8 Hammer = require('yoho-hammer');
9 9
10 -var floatLayerBtnHammer,  
11 - C_ID; 10 +var floatLayerBtnHammer;
12 11
13 require('../common'); 12 require('../common');
14 13
15 -C_ID = window._ChannelVary[window.cookie('_Channel')] || 1;  
16 -  
17 -function downLoadApp() {  
18 - var appUrl = 'http://union.yoho.cn/union/downapp.html';  
19 - var clickedAt = new Date();  
20 -  
21 - setTimeout(function() {  
22 - var mkt = window.queryString.mkt_code || window.cookie('mkt_code') || false;  
23 -  
24 - if ((new Date()) - clickedAt < 2000) {  
25 - if (mkt) {  
26 - appUrl += '?union_type=' + mkt;  
27 - }  
28 -  
29 - if (window._yas && window._yas.sendCustomInfo) {  
30 - window._yas.sendCustomInfo({  
31 - op: 'YB_DOWNLOAD_C',  
32 - param: JSON.stringify({C_ID: C_ID, TO_URL: appUrl})  
33 - }, true);  
34 - }  
35 -  
36 - window.location = appUrl;  
37 - }  
38 - }, 500);  
39 -}  
40 -  
41 $('#float-layer-close').on('touchend', function() { 14 $('#float-layer-close').on('touchend', function() {
42 $('#float-layer-app').hide(); 15 $('#float-layer-app').hide();
43 window.setCookie('_float-layer-app', 'id490655927', 16 window.setCookie('_float-layer-app', 'id490655927',
@@ -55,7 +28,7 @@ $('#float-layer-close').on('touchend', function() { @@ -55,7 +28,7 @@ $('#float-layer-close').on('touchend', function() {
55 if ($('#float-layer-btn') && $('#float-layer-btn')[0]) { 28 if ($('#float-layer-btn') && $('#float-layer-btn')[0]) {
56 floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]); 29 floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]);
57 floatLayerBtnHammer.on('tap', function(e) { 30 floatLayerBtnHammer.on('tap', function(e) {
58 - downLoadApp('bottom'); 31 + window.downLoadApp('bottom');
59 e.srcEvent.stopPropagation(); 32 e.srcEvent.stopPropagation();
60 }); 33 });
61 34
@@ -24,30 +24,6 @@ function getQueryString(name) { @@ -24,30 +24,6 @@ function getQueryString(name) {
24 return null; 24 return null;
25 } 25 }
26 26
27 -function downLoadApp() {  
28 - var appUrl = 'http://union.yoho.cn/union/downapp.html';  
29 - var clickedAt = new Date();  
30 -  
31 - setTimeout(function() {  
32 - var mkt = window.queryString.union_type || window.cookie('unionTypeYas') || false;  
33 -  
34 - if ((new Date()) - clickedAt < 2000) {  
35 - if (mkt) {  
36 - appUrl += '?union_type=' + mkt;  
37 - }  
38 -  
39 - if (window._yas && window._yas.sendCustomInfo) {  
40 - window._yas.sendCustomInfo({  
41 - op: 'YB_DOWNLOAD_C',  
42 - param: JSON.stringify({C_ID: window._ChannelVary[window.cookie('_Channel')] || 1, TO_URL: appUrl})  
43 - }, true);  
44 - }  
45 -  
46 - window.location = appUrl;  
47 - }  
48 - }, 500);  
49 -}  
50 -  
51 $('#float-layer-close').on('touchend', function(e) { 27 $('#float-layer-close').on('touchend', function(e) {
52 $('#float-layer-app').hide(); 28 $('#float-layer-app').hide();
53 window.setCookie('_float-layer-app', 'id490655927', 29 window.setCookie('_float-layer-app', 'id490655927',
@@ -65,7 +41,7 @@ $('#float-layer-close').on('touchend', function(e) { @@ -65,7 +41,7 @@ $('#float-layer-close').on('touchend', function(e) {
65 if ($('#float-layer-btn') && $('#float-layer-btn')[0]) { 41 if ($('#float-layer-btn') && $('#float-layer-btn')[0]) {
66 floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]); 42 floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]);
67 floatLayerBtnHammer.on('tap', function(e) { 43 floatLayerBtnHammer.on('tap', function(e) {
68 - downLoadApp('bottom'); 44 + window.downLoadApp('bottom');
69 e.srcEvent.stopPropagation(); 45 e.srcEvent.stopPropagation();
70 }); 46 });
71 47