Showing
1 changed file
with
115 additions
and
106 deletions
@@ -60,6 +60,50 @@ identityFn = handlebars.compile($('#identity-back').html() || ''); | @@ -60,6 +60,50 @@ identityFn = handlebars.compile($('#identity-back').html() || ''); | ||
60 | 60 | ||
61 | require('../plugins/slider'); | 61 | require('../plugins/slider'); |
62 | 62 | ||
63 | +/** *埋点方法***/ | ||
64 | +function givePoint(op, parameter) { | ||
65 | + var CID = 1; | ||
66 | + | ||
67 | + if (!window._yas || !window._yas.sendCustomInfo) { | ||
68 | + return false; | ||
69 | + } | ||
70 | + | ||
71 | + // 男:1,女:2,潮童:3,创意生活:4 | ||
72 | + switch (document.cookie('_Channel')) { | ||
73 | + case 'boys': | ||
74 | + CID = 1; | ||
75 | + break; | ||
76 | + case 'girls': | ||
77 | + CID = 2; | ||
78 | + break; | ||
79 | + case 'kids': | ||
80 | + CID = 3; | ||
81 | + break; | ||
82 | + case 'lifestyle': | ||
83 | + CID = 4; | ||
84 | + break; | ||
85 | + default: | ||
86 | + CID = 1; | ||
87 | + } | ||
88 | + | ||
89 | + parameter = $.extend({ | ||
90 | + REC_POSE: '', | ||
91 | + PRD_ID: '', | ||
92 | + PRD_NUM: 0, | ||
93 | + C_ID: CID, | ||
94 | + ACTION_ID: 0, | ||
95 | + page_num: 1 | ||
96 | + }, parameter); | ||
97 | + | ||
98 | + if (parameter.REC_POSE === '' || parameter.PRD_ID === '') { | ||
99 | + return true; | ||
100 | + } | ||
101 | + window._yas.sendCustomInfo({ | ||
102 | + op: op, | ||
103 | + param: JSON.stringify(parameter) | ||
104 | + }, true); | ||
105 | +} | ||
106 | + | ||
63 | function createStuDialog(cont) { | 107 | function createStuDialog(cont) { |
64 | var opt = { | 108 | var opt = { |
65 | className: 'stu-dialog', | 109 | className: 'stu-dialog', |
@@ -106,8 +150,8 @@ function clearSelectUl($a, code) { | @@ -106,8 +150,8 @@ function clearSelectUl($a, code) { | ||
106 | * 最终提交表单 | 150 | * 最终提交表单 |
107 | */ | 151 | */ |
108 | function submitIdentity(json) { | 152 | function submitIdentity(json) { |
109 | - //xls-3提交认证埋点 | ||
110 | - givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 1}); | 153 | + // xls-3提交认证埋点 |
154 | + givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 1}); | ||
111 | $.ajax({ | 155 | $.ajax({ |
112 | type: 'GET', | 156 | type: 'GET', |
113 | url: '/product/students/verify', | 157 | url: '/product/students/verify', |
@@ -115,14 +159,16 @@ function submitIdentity(json) { | @@ -115,14 +159,16 @@ function submitIdentity(json) { | ||
115 | }).then(function(data) { | 159 | }).then(function(data) { |
116 | if (data.code === 200) { | 160 | if (data.code === 200) { |
117 | window.location.href = data.data; | 161 | window.location.href = data.data; |
118 | - //xls-4认证成功埋点 | ||
119 | - givePoint('YB_STUDENT_ATTCT_RESULT',{SRC_ID: 5, SUBMIT_RES: 1}); | 162 | + |
163 | + // xls-4认证成功埋点 | ||
164 | + givePoint('YB_STUDENT_ATTCT_RESULT', {SRC_ID: 5, SUBMIT_RES: 1}); | ||
120 | } else { | 165 | } else { |
121 | $identityForm.addClass('hide'); | 166 | $identityForm.addClass('hide'); |
122 | $('identity-back-wrap').remove(); | 167 | $('identity-back-wrap').remove(); |
123 | $identityWrap.append(identityFn({msg: data.message})); | 168 | $identityWrap.append(identityFn({msg: data.message})); |
124 | - //xls-4认证失败埋点 | ||
125 | - givePoint('YB_STUDENT_ATTCT_RESULT',{SRC_ID: 5, SUBMIT_RES: 2,FAILURE_CAUSE: data.message}); | 169 | + |
170 | + // xls-4认证失败埋点 | ||
171 | + givePoint('YB_STUDENT_ATTCT_RESULT', {SRC_ID: 5, SUBMIT_RES: 2, FAILURE_CAUSE: data.message}); | ||
126 | } | 172 | } |
127 | }); | 173 | }); |
128 | } | 174 | } |
@@ -378,8 +424,8 @@ $rightDia.on('click', function() { | @@ -378,8 +424,8 @@ $rightDia.on('click', function() { | ||
378 | 424 | ||
379 | createStuDialog(cont); | 425 | createStuDialog(cont); |
380 | 426 | ||
381 | - //xls-5学生营销,页面加载埋点 | ||
382 | - givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-rights-box', F_NAME: '学生权益', | 427 | + // xls-5学生营销,页面加载埋点 |
428 | + givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-rights-box', F_NAME: '学生权益', | ||
383 | F_URL: '', F_INDEX: 2, I_INDEX: 0}); | 429 | F_URL: '', F_INDEX: 2, I_INDEX: 0}); |
384 | }); | 430 | }); |
385 | 431 | ||
@@ -423,8 +469,8 @@ $('.enable .info').on('click', function(e) { | @@ -423,8 +469,8 @@ $('.enable .info').on('click', function(e) { | ||
423 | requestCoupon($(this).closest('a').data('id')); | 469 | requestCoupon($(this).closest('a').data('id')); |
424 | redirect.gunangSrc = $(this).closest('a').get(0).href; | 470 | redirect.gunangSrc = $(this).closest('a').get(0).href; |
425 | 471 | ||
426 | - //xls-5学生营销,页面加载埋点 | ||
427 | - givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-coupon-box', F_NAME: '优惠券', | 472 | + // xls-5学生营销,页面加载埋点 |
473 | + givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-coupon-box', F_NAME: '优惠券', | ||
428 | F_URL: '', F_INDEX: 4, I_INDEX: 0}); | 474 | F_URL: '', F_INDEX: 4, I_INDEX: 0}); |
429 | }); | 475 | }); |
430 | 476 | ||
@@ -444,57 +490,65 @@ $('#identity-Btn').on('click', function() { | @@ -444,57 +490,65 @@ $('#identity-Btn').on('click', function() { | ||
444 | if (identData.name === '') { | 490 | if (identData.name === '') { |
445 | failText = '真实姓名不能为空'; | 491 | failText = '真实姓名不能为空'; |
446 | $prompt.html(failText); | 492 | $prompt.html(failText); |
447 | - //xls-3埋点 | ||
448 | - givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | 493 | + |
494 | + // xls-3埋点 | ||
495 | + givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | ||
449 | return; | 496 | return; |
450 | } | 497 | } |
451 | if (!/^[\u4e00-\u9fa5a-zA-Z]{2,12}$/.test(identData.name)) { | 498 | if (!/^[\u4e00-\u9fa5a-zA-Z]{2,12}$/.test(identData.name)) { |
452 | failText = '真实姓名为2~12个汉字或者英文'; | 499 | failText = '真实姓名为2~12个汉字或者英文'; |
453 | $prompt.html(failText); | 500 | $prompt.html(failText); |
454 | - //xls-3埋点 | ||
455 | - givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | 501 | + |
502 | + // xls-3埋点 | ||
503 | + givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | ||
456 | return; | 504 | return; |
457 | } | 505 | } |
458 | if (identData.certNo === '') { | 506 | if (identData.certNo === '') { |
459 | failText = '身份证号不能为空'; | 507 | failText = '身份证号不能为空'; |
460 | $prompt.html(failText); | 508 | $prompt.html(failText); |
461 | - //xls-3埋点 | ||
462 | - givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | 509 | + |
510 | + // xls-3埋点 | ||
511 | + givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | ||
463 | return; | 512 | return; |
464 | } | 513 | } |
465 | if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identData.certNo)) { | 514 | if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identData.certNo)) { |
466 | failText = '身份证号格式错误'; | 515 | failText = '身份证号格式错误'; |
467 | $prompt.html(failText); | 516 | $prompt.html(failText); |
468 | - //xls-3埋点 | ||
469 | - givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | 517 | + |
518 | + // xls-3埋点 | ||
519 | + givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | ||
470 | return; | 520 | return; |
471 | } | 521 | } |
472 | if (identData.collegeName === '') { | 522 | if (identData.collegeName === '') { |
473 | failText = '学校名称不能为空'; | 523 | failText = '学校名称不能为空'; |
474 | $prompt.html(failText); | 524 | $prompt.html(failText); |
475 | - //xls-3埋点 | ||
476 | - givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | 525 | + |
526 | + // xls-3埋点 | ||
527 | + givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | ||
477 | return; | 528 | return; |
478 | } | 529 | } |
479 | if (identData.educationDegree === '') { | 530 | if (identData.educationDegree === '') { |
480 | failText = '学历程度不能为空'; | 531 | failText = '学历程度不能为空'; |
481 | $prompt.html(failText); | 532 | $prompt.html(failText); |
482 | - //xls-3埋点 | ||
483 | - givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | 533 | + |
534 | + // xls-3埋点 | ||
535 | + givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | ||
484 | return; | 536 | return; |
485 | } | 537 | } |
486 | if (identData.enrollmentYear === '') { | 538 | if (identData.enrollmentYear === '') { |
487 | failText = '入学年份不能为空'; | 539 | failText = '入学年份不能为空'; |
488 | $prompt.html(failText); | 540 | $prompt.html(failText); |
489 | - //xls-3埋点 | ||
490 | - givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | 541 | + |
542 | + // xls-3埋点 | ||
543 | + givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | ||
491 | return; | 544 | return; |
492 | } | 545 | } |
493 | if (!$agreen.hasClass('active')) { | 546 | if (!$agreen.hasClass('active')) { |
494 | failText = '未同意Yoho!有货学生认证协议'; | 547 | failText = '未同意Yoho!有货学生认证协议'; |
495 | $prompt.html(failText); | 548 | $prompt.html(failText); |
496 | - //xls-3埋点 | ||
497 | - givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | 549 | + |
550 | + // xls-3埋点 | ||
551 | + givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText}); | ||
498 | return; | 552 | return; |
499 | } | 553 | } |
500 | $prompt.html(''); | 554 | $prompt.html(''); |
@@ -506,118 +560,73 @@ $('.ident-select-wrap').one('click', function() { | @@ -506,118 +560,73 @@ $('.ident-select-wrap').one('click', function() { | ||
506 | $(this).removeClass('gray-p'); | 560 | $(this).removeClass('gray-p'); |
507 | }); | 561 | }); |
508 | 562 | ||
509 | - | ||
510 | - | ||
511 | -function givePoint(op,parameter) { | ||
512 | - var CID = 1; | ||
513 | - | ||
514 | - if (!window._yas || !window._yas.sendCustomInfo) { | ||
515 | - return false; | ||
516 | - } | ||
517 | - | ||
518 | - //男:1,女:2,潮童:3,创意生活:4 | ||
519 | - switch(cookie('_Channel')) { | ||
520 | - case 'boys': | ||
521 | - CID = 1; | ||
522 | - break; | ||
523 | - case 'girls': | ||
524 | - CID = 2; | ||
525 | - break; | ||
526 | - case 'kids': | ||
527 | - CID = 3; | ||
528 | - break; | ||
529 | - case 'lifestyle': | ||
530 | - CID = 4; | ||
531 | - break; | ||
532 | - } | ||
533 | - | ||
534 | - parameter = $.extend({ | ||
535 | - 'REC_POSE': '', | ||
536 | - 'PRD_ID': '', | ||
537 | - 'PRD_NUM': 0, | ||
538 | - 'C_ID': CID, | ||
539 | - 'ACTION_ID': 0, | ||
540 | - 'page_num': 1 | ||
541 | - }, parameter); | ||
542 | - | ||
543 | - if (parameter.REC_POSE === '' || parameter.PRD_ID === '') { | ||
544 | - return true; | ||
545 | - } | ||
546 | - console.info(parameter); | ||
547 | - window._yas.sendCustomInfo({ | ||
548 | - 'op': op, | ||
549 | - 'uid': getUid(), | ||
550 | - 'param': JSON.stringify(parameter) | ||
551 | - }, true); | ||
552 | -} | ||
553 | /* | 563 | /* |
554 | *埋点 | 564 | *埋点 |
555 | */ | 565 | */ |
556 | -$(function(){ | ||
557 | - | ||
558 | - if ($('#identity-success').length >0) { | ||
559 | - //xls-4学生认证成功埋点 | ||
560 | - givePoint('YB_STUDENT_ATTCT_RESULT',{SRC_ID: 5, SUBMIT_RES: 1}); | 566 | +$(function() { |
567 | + | ||
568 | + if ($('#identity-success').length > 0) { | ||
569 | + // xls-4学生认证成功埋点 | ||
570 | + givePoint('YB_STUDENT_ATTCT_RESULT', {SRC_ID: 5, SUBMIT_RES: 1}); | ||
561 | } | 571 | } |
562 | - if ($('#identity-fail').length >0) { | ||
563 | - //xls-4学生认证失败埋点 | ||
564 | - givePoint('YB_STUDENT_ATTCT_RESULT',{SRC_ID: 5, SUBMIT_RES: 2, | 572 | + if ($('#identity-fail').length > 0) { |
573 | + // xls-4学生认证失败埋点 | ||
574 | + givePoint('YB_STUDENT_ATTCT_RESULT', {SRC_ID: 5, SUBMIT_RES: 2, | ||
565 | FAILURE_CAUSE: $('#identity-fail-text').html()}); | 575 | FAILURE_CAUSE: $('#identity-fail-text').html()}); |
566 | } | 576 | } |
567 | 577 | ||
568 | - //xls-5学生营销,页面加载埋点 | ||
569 | - givePoint('YB_STUDENT_HOME',{SRC_ID: 5}); | 578 | + // xls-5学生营销,页面加载埋点 |
579 | + givePoint('YB_STUDENT_HOME', {SRC_ID: 5}); | ||
570 | 580 | ||
571 | - $('.banner-img').click(function(){ | 581 | + $('.banner-img').click(function() { |
572 | var url = $(this).children().attr('href'), | 582 | var url = $(this).children().attr('href'), |
573 | index = $(this).index(); | 583 | index = $(this).index(); |
574 | 584 | ||
575 | - //xls-5学生营销,页面加载埋点 | ||
576 | - givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'banner', F_NAME: 'banner', | ||
577 | - F_URL: url, F_INDEX: 1, I_INDEX: parseInt(index)+1}); | 585 | + // xls-5学生营销,页面加载埋点 |
586 | + givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'banner', F_NAME: 'banner', | ||
587 | + F_URL: url, F_INDEX: 1, I_INDEX: parseInt(index, 0) + 1}); | ||
578 | }); | 588 | }); |
579 | 589 | ||
580 | - $('#stu-coupon-more').click(function(){ | 590 | + $('#stu-coupon-more').click(function() { |
581 | var url = $(this).attr('href'); | 591 | var url = $(this).attr('href'); |
582 | - | ||
583 | - //xls-5学生营销,页面加载埋点 | ||
584 | - givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-coupon-box', F_NAME: '优惠券', | 592 | + |
593 | + // xls-5学生营销,页面加载埋点 | ||
594 | + givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-coupon-box', F_NAME: '优惠券', | ||
585 | F_URL: url, F_INDEX: 4, I_INDEX: 0}); | 595 | F_URL: url, F_INDEX: 4, I_INDEX: 0}); |
586 | }); | 596 | }); |
587 | 597 | ||
588 | - $('#stu-good-more').click(function(){ | 598 | + $('#stu-good-more').click(function() { |
589 | var url = $(this).attr('href'); | 599 | var url = $(this).attr('href'); |
590 | 600 | ||
591 | - //xls-5学生营销,页面加载埋点 | ||
592 | - givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-good-box', F_NAME: '热门单品', | 601 | + // xls-5学生营销,页面加载埋点 |
602 | + givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-good-box', F_NAME: '热门单品', | ||
593 | F_URL: url, F_INDEX: 5, I_INDEX: 0}); | 603 | F_URL: url, F_INDEX: 5, I_INDEX: 0}); |
594 | }); | 604 | }); |
595 | 605 | ||
596 | - $('.good-thumb').click(function(){ | 606 | + $('.good-thumb').click(function() { |
597 | var url = $(this).attr('href'), | 607 | var url = $(this).attr('href'), |
598 | index = $(this).closest('.good-info').index(); | 608 | index = $(this).closest('.good-info').index(); |
599 | 609 | ||
600 | - //xls-5学生营销,页面加载埋点 | ||
601 | - givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-good-box', F_NAME: '热门单品', | ||
602 | - F_URL: url, F_INDEX: 5, I_INDEX: parseInt(index)+1}); | 610 | + // xls-5学生营销,页面加载埋点 |
611 | + givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-good-box', F_NAME: '热门单品', | ||
612 | + F_URL: url, F_INDEX: 5, I_INDEX: parseInt(index, 0) + 1}); | ||
603 | }); | 613 | }); |
604 | - | ||
605 | - $('.stu-good-detail a').click(function(){ | 614 | + |
615 | + $('.stu-good-detail a').click(function() { | ||
606 | var url = $(this).attr('href'), | 616 | var url = $(this).attr('href'), |
607 | index = $(this).closest('.good-info').index(); | 617 | index = $(this).closest('.good-info').index(); |
608 | - console.info(index); | ||
609 | 618 | ||
610 | - //xls-5学生营销,页面加载埋点 | ||
611 | - givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-good-box', F_NAME: '热门单品', | ||
612 | - F_URL: url, F_INDEX: 5, I_INDEX: parseInt(index)+1}); | 619 | + // xls-5学生营销,页面加载埋点 |
620 | + givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-good-box', F_NAME: '热门单品', | ||
621 | + F_URL: url, F_INDEX: 5, I_INDEX: parseInt(index, 0) + 1}); | ||
613 | }); | 622 | }); |
614 | 623 | ||
615 | - $('.commodity-list a').click(function(){ | 624 | + $('.commodity-list a').click(function() { |
616 | var url = $(this).attr('href'), | 625 | var url = $(this).attr('href'), |
617 | index = $(this).index(); | 626 | index = $(this).index(); |
618 | 627 | ||
619 | - //xls-5学生营销,页面加载埋点 | ||
620 | - givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-activity-box', F_NAME: '活动推荐', | ||
621 | - F_URL: url, F_INDEX: 6, I_INDEX: parseInt(index)+1}); | 628 | + // xls-5学生营销,页面加载埋点 |
629 | + givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-activity-box', F_NAME: '活动推荐', | ||
630 | + F_URL: url, F_INDEX: 6, I_INDEX: parseInt(index, 0) + 1}); | ||
622 | }); | 631 | }); |
623 | -}); | 632 | +}); |
-
Please register or login to post a comment