set-trend-world.js
1.86 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
let tip = require('plugin/tip');
let dialog = require('plugin/dialog');
$('.show-explain').on('click', function() {
$('.show-explain').hide();
$('.explain-main').css({height: 'auto'});
});
$('.hide-explain').on('click', function() {
$('.show-explain').show();
$('.explain-main').css({height: 0});
});
// 埋点
function point(type, trend) {
let pointJosn = {
TYPE: type
};
if (trend) {
pointJosn.TREND = trend;
}
if ($('.yoho-page').hasClass('my-page')) {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_HOMEPOP_TREND_SET_C',
param: JSON.stringify(pointJosn)
}, true);
}
}
}
$('.set-world').click(function() {
$.ajax({
type: 'GET',
url: '/activity/set-trend-world',
data: {
trendWord: $('.trend-world-area').val()
},
success: function(result) {
tip.show(result.message);
if (result.code === 200) {
point(1, $('.trend-world-area').val());
$('.trend-code').html($('.trend-world-area').val());
setTimeout(function() {
$('.set-trend-world').hide();
}, 2500);
}
}
});
});
$('.withhold').click(function() {
if (!window.cookie('trend-path') || parseInt(window.cookie('trend-path'), 10) !== 1 &&
/^\/home/.test(location.pathname)) {
dialog.showDialog({
dialogText: '您还可以在“个人中心-基本资料-我的潮流口令”中进行设置',
hasFooter: {
centerBtnText: '我知道了'
}
});
window.setCookie('trend-path', 1);
}
point(2);
$('.set-trend-world').hide();
});
$('.back').click(function() {
$('.set-trend-world').hide();
});