invite-share.js
1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* 邀请码分享头部
*/
require('common/_invite-share.css');
require('common');
let $ = require('yoho-jquery');
let inviteCode = window.queryString.inviteCode;
function inviteSharePoint(type) {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_INVITE_SHARE_C',
param: JSON.stringify({
TYPE: type
})
}, true);
}
}
(function() {
let inviteShare = require('common/invite-share.hbs');
if (inviteCode) {
$.ajax({
type: 'GET',
url: '/activity/invite-uesr-info',
data: {
inviteCode: inviteCode
},
success: function(result) {
if (result.code === 200 && parseInt(result.data.isDisplay, 10) === 1) {
let shareData = inviteShare({
inviteShare: result.data
});
$('.top-downloadbar').hide();
$('body').prepend(shareData); // 放置最前
$('.close-invite').on('click', function() {
$('.invite-share').hide();
});
$('.invite-go').click(function() {
inviteSharePoint(1);
});
$('.share-packet').click(function() {
inviteSharePoint(2);
});
}
}
});
}
}());