|
@@ -16,13 +16,16 @@ lazyLoad($('img.lazy')); |
|
@@ -16,13 +16,16 @@ lazyLoad($('img.lazy')); |
16
|
|
16
|
|
17
|
$('body').addClass('star-class-body');
|
17
|
$('body').addClass('star-class-body');
|
18
|
|
18
|
|
19
|
-function loadIntimacyAvatar(myImage, src) {
|
|
|
20
|
- var newSrc = '';
|
19
|
+function setAvatar($userAvatar) {
|
|
|
20
|
+ var myImage = new Image(),
|
|
|
21
|
+ avatar;
|
21
|
|
22
|
|
|
|
23
|
+ // 部分老用户没有头像,显示默认头像
|
|
|
24
|
+ avatar = $userAvatar.data('avatar');
|
|
|
25
|
+ myImage.src = avatar;
|
22
|
myImage.onload = function() {
|
26
|
myImage.onload = function() {
|
23
|
- newSrc = 'background-image:url(' + src + ')';
|
27
|
+ $userAvatar.css('background-image', 'url(' + avatar + ')');
|
24
|
};
|
28
|
};
|
25
|
- return newSrc;
|
|
|
26
|
}
|
29
|
}
|
27
|
|
30
|
|
28
|
// 日历弹出框显示及粉丝排行榜数据组装
|
31
|
// 日历弹出框显示及粉丝排行榜数据组装
|
|
@@ -33,7 +36,6 @@ function intimacyData(data) { |
|
@@ -33,7 +36,6 @@ function intimacyData(data) { |
33
|
signDay = data.signDay.split(','),
|
36
|
signDay = data.signDay.split(','),
|
34
|
html = '',
|
37
|
html = '',
|
35
|
style = '',
|
38
|
style = '',
|
36
|
- bgStyle = '',
|
|
|
37
|
nowDate = new Date(),
|
39
|
nowDate = new Date(),
|
38
|
myImage = new Image(),
|
40
|
myImage = new Image(),
|
39
|
nowYear = nowDate.getFullYear(),
|
41
|
nowYear = nowDate.getFullYear(),
|
|
@@ -59,17 +61,9 @@ function intimacyData(data) { |
|
@@ -59,17 +61,9 @@ function intimacyData(data) { |
59
|
style = '';
|
61
|
style = '';
|
60
|
}
|
62
|
}
|
61
|
|
63
|
|
62
|
- if (data.fanCharts[i].img !== '' && data.fanCharts[i].img !== null) {
|
|
|
63
|
- myImage.src = data.fanCharts[i].img;
|
|
|
64
|
- bgStyle = loadIntimacyAvatar(myImage, data.fanCharts[i].img);
|
|
|
65
|
- } else {
|
|
|
66
|
- bgStyle = '';
|
|
|
67
|
- }
|
|
|
68
|
-
|
|
|
69
|
html += '<li>' +
|
64
|
html += '<li>' +
|
70
|
'<i class="rank-ico">' + data.fanCharts[i].num + '</i>' +
|
65
|
'<i class="rank-ico">' + data.fanCharts[i].num + '</i>' +
|
71
|
- '<span data-avatar="' + data.fanCharts[i].img + '" style="' + bgStyle +
|
|
|
72
|
- '" class="rank-avatar"></span>' +
|
66
|
+ '<span data-avatar="' + data.fanCharts[i].img + '" class="rank-avatar"></span>' +
|
73
|
'<span class="fans-name">' + data.fanCharts[i].name + '</span>' +
|
67
|
'<span class="fans-name">' + data.fanCharts[i].name + '</span>' +
|
74
|
'<div class="fans-intimacy">亲密度<span class="' + style + '">' +
|
68
|
'<div class="fans-intimacy">亲密度<span class="' + style + '">' +
|
75
|
data.fanCharts[i].intimacyNum + '</span></div>' +
|
69
|
data.fanCharts[i].intimacyNum + '</span></div>' +
|
|
@@ -78,6 +72,12 @@ function intimacyData(data) { |
|
@@ -78,6 +72,12 @@ function intimacyData(data) { |
78
|
|
72
|
|
79
|
$ul.html(html);
|
73
|
$ul.html(html);
|
80
|
|
74
|
|
|
|
75
|
+ $('.fan-charts-cont .rank-avatar').each(function(key, item) {
|
|
|
76
|
+ if ($(item).attr('data-avatar') !== '') {
|
|
|
77
|
+ setAvatar($(item));
|
|
|
78
|
+ }
|
|
|
79
|
+ });
|
|
|
80
|
+
|
81
|
$myIntimacy.find('span').html(data.todayIntimacy);
|
81
|
$myIntimacy.find('span').html(data.todayIntimacy);
|
82
|
$increased.find('span').html(data.todayIntimacy);
|
82
|
$increased.find('span').html(data.todayIntimacy);
|
83
|
|
83
|
|
|
@@ -251,36 +251,10 @@ $('.add-intimacy').on('touchstart', function(event) { |
|
@@ -251,36 +251,10 @@ $('.add-intimacy').on('touchstart', function(event) { |
251
|
|
251
|
|
252
|
// 关闭日历弹出窗事件
|
252
|
// 关闭日历弹出窗事件
|
253
|
$('.pop-intimacy .pop-close, .classroom-mask').on('click', function() {
|
253
|
$('.pop-intimacy .pop-close, .classroom-mask').on('click', function() {
|
254
|
-
|
|
|
255
|
- // $('.pop-intimacy').css({
|
|
|
256
|
- // zIndex: '-1'
|
|
|
257
|
- // }).hide();
|
|
|
258
|
- // $('.classroom-mask').css({
|
|
|
259
|
- // zIndex: '-1'
|
|
|
260
|
- // }).hide();
|
|
|
261
|
-
|
|
|
262
|
- // $('body').css({
|
|
|
263
|
- // overflow: 'visible'
|
|
|
264
|
- // });
|
|
|
265
|
-
|
|
|
266
|
- // location.reload();
|
|
|
267
|
-
|
|
|
268
|
history.go(0);
|
254
|
history.go(0);
|
269
|
});
|
255
|
});
|
270
|
|
256
|
|
271
|
-function setAvatar() {
|
|
|
272
|
- var $userAvatar = $('.user-head'),
|
|
|
273
|
- myImage = new Image(),
|
|
|
274
|
- avatar;
|
|
|
275
|
-
|
|
|
276
|
- // 部分老用户没有头像,显示默认头像
|
|
|
277
|
- avatar = $userAvatar.data('avatar');
|
|
|
278
|
- myImage.src = avatar;
|
|
|
279
|
- myImage.onload = function() {
|
|
|
280
|
- $userAvatar.css('background-image', 'url(' + avatar + ')');
|
|
|
281
|
- };
|
|
|
282
|
-}
|
|
|
283
|
|
257
|
|
284
|
if ($('.user-head').attr('data-avatar') !== '') {
|
258
|
if ($('.user-head').attr('data-avatar') !== '') {
|
285
|
- setAvatar();
|
259
|
+ setAvatar($('.user-head'));
|
286
|
} |
260
|
} |