|
|
/**
|
|
|
* 星潮教室
|
|
|
* 星潮教室-首页
|
|
|
* @author: wsl<shuiling.wang@yoho.cn>
|
|
|
* @date: 2016/4/11
|
|
|
*/
|
...
|
...
|
@@ -12,6 +12,7 @@ var bannerSwiper, collocationSwiper; |
|
|
|
|
|
var nowDaysNub = 0;
|
|
|
|
|
|
// 日历弹出框显示及粉丝排行榜数据组装
|
|
|
function intimacyData(data) {
|
|
|
var $ul = $('.fan-charts-cont'),
|
|
|
$myIntimacy = $('.my-intimacy'),
|
...
|
...
|
@@ -22,8 +23,6 @@ function intimacyData(data) { |
|
|
|
|
|
var i;
|
|
|
|
|
|
// var signDay = '30,2,3,6,8,10';
|
|
|
|
|
|
if (signDay.length > 0) {
|
|
|
for (i = 0; i < nowDaysNub; i++) {
|
|
|
if (signDay.indexOf(i + 1) > -1) {
|
...
|
...
|
@@ -60,6 +59,17 @@ function intimacyData(data) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
//当前字符串字节数统计
|
|
|
function bytesCountAction(code, bytesCount) {
|
|
|
if (/^[\u0000-\u00ff]$/.test(code)) {
|
|
|
bytesCount += 1;
|
|
|
} else {
|
|
|
bytesCount += 2;
|
|
|
}
|
|
|
|
|
|
return bytesCount;
|
|
|
}
|
|
|
|
|
|
if ($('.banner-swiper').find('li').length > 1) {
|
|
|
bannerSwiper = new Swiper('.banner-swiper', {
|
|
|
lazyLoading: true,
|
...
|
...
|
@@ -85,12 +95,48 @@ if ($('.collocation-swiper').find('li').length > 1) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
// 星鲜事显示点赞人数的区域
|
|
|
if ($('.artice-zan').find('li').length > 0) {
|
|
|
$('.zan-more').show();
|
|
|
}
|
|
|
|
|
|
// 亲密度用户名字字数限制
|
|
|
if ($('.home-floor-sign').length > 0) {
|
|
|
var $name = $('.home-floor-sign').find('.user-name'),
|
|
|
nameVal = $name.html(),
|
|
|
nameSize = nameVal.length,
|
|
|
bytesCount = 0,
|
|
|
bcount = 0,
|
|
|
newName = '';
|
|
|
|
|
|
var i, code;
|
|
|
|
|
|
for (i = 0; i < nameSize; i++) {
|
|
|
code = nameVal.charAt(i);
|
|
|
bytesCount = bytesCountAction(code, bytesCount);
|
|
|
|
|
|
if (bytesCount < 5) {
|
|
|
newName += code;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (bytesCount > 8) {
|
|
|
newName += '..'
|
|
|
}
|
|
|
|
|
|
for (i = 0; i < nameSize; i++) {
|
|
|
code = nameVal.charAt(i);
|
|
|
bcount = bytesCountAction(code, bcount);
|
|
|
|
|
|
if (bcount > bytesCount - 2) {
|
|
|
newName += code;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 点赞
|
|
|
$name.html(newName);
|
|
|
}
|
|
|
|
|
|
// 星鲜事点赞事件
|
|
|
$('.like-ico').on('click', function() {
|
|
|
var $that = $(this),
|
|
|
addString = '';
|
...
|
...
|
@@ -126,8 +172,7 @@ $('.like-ico').on('click', function() { |
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
// 签到
|
|
|
// 增加亲密度请求
|
|
|
$('.add-intimacy').on('click', function() {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
...
|
...
|
@@ -145,6 +190,7 @@ $('.add-intimacy').on('click', function() { |
|
|
});
|
|
|
});
|
|
|
|
|
|
// 关闭日历弹出窗事件
|
|
|
$('.pop-intimacy .pop-close, .mask').on('click', function() {
|
|
|
$('.pop-intimacy').hide();
|
|
|
$('.mask').hide();
|
...
|
...
|
@@ -155,7 +201,7 @@ $('.pop-intimacy .pop-close, .mask').on('click', function() { |
|
|
});
|
|
|
|
|
|
|
|
|
// 收藏
|
|
|
// 星搭配收藏请求
|
|
|
$('.count-area .collection').on('click', function() {
|
|
|
var $that = $(this),
|
|
|
$icon = $that.find('.collected-ico');
|
...
|
...
|
|