index.js
1.32 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
/**
* 个人中心首页
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/12
*/
var $ = require('jquery'),
noticeScroll = require('../plugin/notice-scroll');
var $userAvatar = $('.user-avatar'),
$listItem = $('.list-item'),
$studentVe = $('.students-entry');
var myImage = new Image(),
avatar;
require('../product/recommend-for-you-user-center.js');
require('../product/suspend-cart.js');
// 部分老用户没有头像,显示默认头像
avatar = $userAvatar.data('avatar');
myImage.src = avatar;
myImage.onload = function() {
$userAvatar.css('background-image', 'url(' + avatar + ')');
};
noticeScroll('.notice', $('.notice').data('time') * 1000);
$('.yoho-page').on('touchstart', '.list-item, .type-item, .order-title', function() {
$listItem.removeClass('highlight');
$(this).addClass('highlight');
}).on('touchend touchcancel', '.list-item, .type-item, .order-title', function() {
$(this).removeClass('highlight');
});
var getChannel = function() {
var name = window.cookie('_Channel');
return {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[name] || 1;
};
$studentVe.on('click', function(){
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
C_ID: getChannel(),
SRC_ID: 2
}, true);
}
});