|
@@ -301,13 +301,15 @@ function fadeAnimate() { |
|
@@ -301,13 +301,15 @@ function fadeAnimate() { |
301
|
}
|
301
|
}
|
302
|
window.$logotrans.fadeOut(window.loopdurationtime, function() {
|
302
|
window.$logotrans.fadeOut(window.loopdurationtime, function() {
|
303
|
window.isen = false;
|
303
|
window.isen = false;
|
|
|
304
|
+
|
304
|
window.$logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo.png)');
|
305
|
window.$logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo.png)');
|
305
|
window.$logotrans.fadeIn(window.loopdurationtime, function() {
|
306
|
window.$logotrans.fadeIn(window.loopdurationtime, function() {
|
306
|
window.onetimeoout = window.setTimeout(function() {
|
307
|
window.onetimeoout = window.setTimeout(function() {
|
307
|
window.$logotrans.fadeOut(window.loopdurationtime, function() {
|
308
|
window.$logotrans.fadeOut(window.loopdurationtime, function() {
|
308
|
window.clearTimeout(window.onetimeoout);
|
309
|
window.clearTimeout(window.onetimeoout);
|
309
|
window.isen = true;
|
310
|
window.isen = true;
|
310
|
- window.$logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo_e.png)');
|
311
|
+ window.$logotrans.css('background-image',
|
|
|
312
|
+ 'url(http://static.yohobuy.com/newheader/img/logo_e.png)');
|
311
|
window.$logotrans.fadeIn(window.loopdurationtime, function() {
|
313
|
window.$logotrans.fadeIn(window.loopdurationtime, function() {
|
312
|
window.globaltimeout = window.setTimeout(fadeAnimate, 1 * 60 * 1000);
|
314
|
window.globaltimeout = window.setTimeout(fadeAnimate, 1 * 60 * 1000);
|
313
|
});
|
315
|
});
|
|
@@ -850,7 +852,7 @@ function actionExeTemplate() { |
|
@@ -850,7 +852,7 @@ function actionExeTemplate() { |
850
|
var resulthtml = $('#goodcartempwarpper').html().replace(/\\/g, '');
|
852
|
var resulthtml = $('#goodcartempwarpper').html().replace(/\\/g, '');
|
851
|
|
853
|
|
852
|
$('#goodcartempwarpper').html(resulthtml);
|
854
|
$('#goodcartempwarpper').html(resulthtml);
|
853
|
- vipInfoCombine = handlebars.compile($('#tmpl-my-login-new').html())
|
855
|
+ vipInfoCombine = handlebars.compile($('#tmpl-my-login-new').html());
|
854
|
}
|
856
|
}
|
855
|
/**
|
857
|
/**
|
856
|
* 执行搜索
|
858
|
* 执行搜索
|
|
@@ -867,32 +869,47 @@ function actionSearch() { |
|
@@ -867,32 +869,47 @@ function actionSearch() { |
867
|
*/
|
869
|
*/
|
868
|
function actionLoginState(_data) {
|
870
|
function actionLoginState(_data) {
|
869
|
var timestamp = new Date().getTime();
|
871
|
var timestamp = new Date().getTime();
|
870
|
- var noLoginHtml = '<span>Hi~</span>[<a href="http://www.yohobuy.com/signin.html" class="list-a login-out ">请登录</a>] [<a href="http://www.yohobuy.com/reg.html" class="list-a login-out" onclick="">免费注册</a>]'
|
|
|
871
|
- var loginHtml = '<span>Hi~<a href="http://www.yohobuy.com/home?t=' + timestamp + '">{{user_name}}</a></span> '+
|
|
|
872
|
- '{{#equalone is_login}}'+
|
|
|
873
|
- '[<a href="{{logout}}" class="list-a login-out">退出</a>]'+
|
|
|
874
|
- '{{else}}'+
|
|
|
875
|
- '[<a href="http://www.yohobuy.com/signin.html" class="list-a login-out">请登录</a>] '+
|
|
|
876
|
- '[<a href="http://www.yohobuy.com/reg.html" onclick="" class="list-a login-out">免费注册</a>]'+
|
|
|
877
|
- '{{/equalone}}';
|
|
|
878
|
- var boxObj = $('#loginBox');
|
872
|
+ var noLoginHtml = '<span>Hi~</span>[<a href="http://www.yohobuy.com/signin.html" class="list-a login-out ">' +
|
|
|
873
|
+ '请登录</a>] ' +
|
|
|
874
|
+ '[<a href="http://www.yohobuy.com/reg.html" class="list-a login-out" onclick="">免费注册</a>]';
|
|
|
875
|
+ var loginHtml = '<span>Hi~<a href="http://www.yohobuy.com/home?t=' + timestamp +
|
|
|
876
|
+ '">{{user_name}}</a></span> ' +
|
|
|
877
|
+ '{{#equalone islogin}}' +
|
|
|
878
|
+ '[<a href="{{logout}}" class="list-a login-out">退出</a>]' +
|
|
|
879
|
+ '{{else}}' +
|
|
|
880
|
+ '[<a href="http://www.yohobuy.com/signin.html" class="list-a login-out">请登录</a>] ' +
|
|
|
881
|
+ '[<a href="http://www.yohobuy.com/reg.html" onclick="" class="list-a login-out">免费注册</a>]' +
|
|
|
882
|
+ '{{/equalone}}';
|
|
|
883
|
+ var $boxObj = $('#loginBox');
|
879
|
var info = $.cookie('_UID');
|
884
|
var info = $.cookie('_UID');
|
880
|
- loginInfoCombine = handlebars.compile(loginHtml);
|
885
|
+ var name = _data.data.profile_name;
|
|
|
886
|
+ var _length = 0;
|
|
|
887
|
+ var t = 0;
|
|
|
888
|
+ var char = '';
|
|
|
889
|
+ var user = info.split('::');
|
|
|
890
|
+ var userName = user[0] || ' ';
|
|
|
891
|
+ var _logout = '';
|
|
|
892
|
+ var islogin = '1';
|
|
|
893
|
+ var _num = 0;
|
|
|
894
|
+ var data = {
|
|
|
895
|
+ user_name: name,
|
|
|
896
|
+ logout: _logout,
|
|
|
897
|
+ random: Math.random()
|
|
|
898
|
+ };
|
|
|
899
|
+
|
881
|
|
900
|
|
882
|
- if (typeof info == 'undefined' || info == null) {
|
|
|
883
|
- boxObj.html(noLoginHtml);
|
901
|
+ loginInfoCombine = handlebars.compile(loginHtml);
|
|
|
902
|
+ if (typeof info === 'undefined' || info === null) {
|
|
|
903
|
+ $boxObj.html(noLoginHtml);
|
884
|
return false;
|
904
|
return false;
|
885
|
}
|
905
|
}
|
886
|
- var user = info.split('::');
|
|
|
887
|
- if (typeof user == 'undefined' || user.length < 4) {
|
|
|
888
|
- boxObj.html(noLoginHtml);
|
906
|
+ if (typeof user === 'undefined' || user.length < 4) {
|
|
|
907
|
+ $boxObj.html(noLoginHtml);
|
889
|
return false;
|
908
|
return false;
|
890
|
}
|
909
|
}
|
891
|
- var userName = user[0] || ' ';
|
|
|
892
|
- var name = '';
|
|
|
893
|
- var _length = 0;
|
|
|
894
|
- for (var t = 0; t < userName.length; t++) {
|
|
|
895
|
- var char = userName.substr(t, 1);
|
910
|
+
|
|
|
911
|
+ for (t; t < userName.length; t++) {
|
|
|
912
|
+ char = userName.substr(t, 1);
|
896
|
if (/.*[\u4e00-\u9fa5]+.*$/.test(char)) {
|
913
|
if (/.*[\u4e00-\u9fa5]+.*$/.test(char)) {
|
897
|
_length += 2;
|
914
|
_length += 2;
|
898
|
} else {
|
915
|
} else {
|
|
@@ -903,10 +920,10 @@ function actionLoginState(_data) { |
|
@@ -903,10 +920,10 @@ function actionLoginState(_data) { |
903
|
name = userName;
|
920
|
name = userName;
|
904
|
} else {
|
921
|
} else {
|
905
|
_num = 0;
|
922
|
_num = 0;
|
906
|
- for (var t = 0; t < userName.length; t++) {
|
923
|
+ for (t; t < userName.length; t++) {
|
907
|
if (_num < 10) {
|
924
|
if (_num < 10) {
|
908
|
- var char = userName.substr(t, 1);
|
|
|
909
|
- if (char != '*') {
|
925
|
+ char = userName.substr(t, 1);
|
|
|
926
|
+ if (char !== '*') {
|
910
|
if (/.*[\u4e00-\u9fa5]+.*$/.test(char)) {
|
927
|
if (/.*[\u4e00-\u9fa5]+.*$/.test(char)) {
|
911
|
_num += 2;
|
928
|
_num += 2;
|
912
|
} else {
|
929
|
} else {
|
|
@@ -920,65 +937,59 @@ function actionLoginState(_data) { |
|
@@ -920,65 +937,59 @@ function actionLoginState(_data) { |
920
|
name += '...';
|
937
|
name += '...';
|
921
|
}
|
938
|
}
|
922
|
}
|
939
|
}
|
923
|
- var _logout = '';
|
940
|
+
|
|
|
941
|
+
|
924
|
if (/http:\/\//.test(user[3])) {
|
942
|
if (/http:\/\//.test(user[3])) {
|
925
|
_logout = user[3].replace('www.yohobuy.com', 'www.yohobuy.com');
|
943
|
_logout = user[3].replace('www.yohobuy.com', 'www.yohobuy.com');
|
926
|
} else {
|
944
|
} else {
|
927
|
_logout = 'http://www.yohobuy.com/logout_' + user[3] + '.html';
|
945
|
_logout = 'http://www.yohobuy.com/logout_' + user[3] + '.html';
|
928
|
}
|
946
|
}
|
929
|
- var data = {
|
|
|
930
|
- "user_name": name,
|
|
|
931
|
- "logout": _logout,
|
|
|
932
|
- "random": Math.random()
|
|
|
933
|
- };
|
|
|
934
|
- var is_login = '1';
|
|
|
935
|
if (_data.result === -1) {
|
947
|
if (_data.result === -1) {
|
936
|
- is_login = '-1';
|
948
|
+ islogin = '-1';
|
937
|
}
|
949
|
}
|
938
|
- data['is_login'] = is_login;
|
|
|
939
|
- boxObj.html(loginInfoCombine(data));
|
950
|
+ data.islogin = islogin;
|
|
|
951
|
+ $boxObj.html(loginInfoCombine(data));
|
940
|
}
|
952
|
}
|
941
|
/**
|
953
|
/**
|
942
|
* 获得vip用户信息
|
954
|
* 获得vip用户信息
|
943
|
* @return {[type]} [description]
|
955
|
* @return {[type]} [description]
|
944
|
*/
|
956
|
*/
|
945
|
function actionVipInfo(_data) {
|
957
|
function actionVipInfo(_data) {
|
946
|
- if (_data.result == 1) {
|
|
|
947
|
- var vipInfo = _data.data;
|
958
|
+ var vipInfo = _data.data;
|
|
|
959
|
+ var headUrl = '';
|
948
|
|
960
|
|
949
|
- if (typeof vipInfo == undefined || vipInfo.length < 1) {
|
961
|
+ if (_data.result === 1) {
|
|
|
962
|
+ if (typeof vipInfo === undefined || vipInfo.length < 1) {
|
950
|
return false;
|
963
|
return false;
|
951
|
}
|
964
|
}
|
952
|
$('#myYohoBox').mouseenter(function() {
|
965
|
$('#myYohoBox').mouseenter(function() {
|
953
|
$(this).addClass('acttags');
|
966
|
$(this).addClass('acttags');
|
954
|
$('#myYohoBox .myyoho-info').show().html(vipInfoCombine(vipInfo));
|
967
|
$('#myYohoBox .myyoho-info').show().html(vipInfoCombine(vipInfo));
|
955
|
- var headUrl = $('.myyoho-photo img').attr('data-url');
|
|
|
956
|
- if ($._checkUrlState == 1) {
|
968
|
+ headUrl = $('.myyoho-photo img').attr('data-url');
|
|
|
969
|
+ if ($._checkUrlState === 1) {
|
957
|
$('.myyoho-photo').show().find('img').attr('src', headUrl);
|
970
|
$('.myyoho-photo').show().find('img').attr('src', headUrl);
|
958
|
return;
|
971
|
return;
|
959
|
}
|
972
|
}
|
960
|
- if (headUrl == '' || $._checkUrl != '') {
|
973
|
+ if (headUrl === '' || $._checkUrl !== '') {
|
961
|
return;
|
974
|
return;
|
962
|
}
|
975
|
}
|
963
|
$.ajax({
|
976
|
$.ajax({
|
964
|
url: headUrl,
|
977
|
url: headUrl,
|
965
|
type: 'GET',
|
978
|
type: 'GET',
|
966
|
complete: function(response) {
|
979
|
complete: function(response) {
|
967
|
- if (response.status == 200 || response.status == 0) {
|
980
|
+ if (response.status === 200 || response.status === 0) {
|
968
|
$('.myyoho-photo').show().find('img').attr('src', headUrl);
|
981
|
$('.myyoho-photo').show().find('img').attr('src', headUrl);
|
969
|
$._checkUrlState = 1;
|
982
|
$._checkUrlState = 1;
|
970
|
}
|
983
|
}
|
971
|
$._checkUrl = headUrl;
|
984
|
$._checkUrl = headUrl;
|
972
|
}
|
985
|
}
|
973
|
});
|
986
|
});
|
974
|
-
|
|
|
975
|
- ;
|
|
|
976
|
});
|
987
|
});
|
977
|
$('#myYohoBox').mouseleave(function() {
|
988
|
$('#myYohoBox').mouseleave(function() {
|
978
|
$(this).removeClass('acttags');
|
989
|
$(this).removeClass('acttags');
|
979
|
- $('#myYohoBox .myyoho-info').hide()
|
990
|
+ $('#myYohoBox .myyoho-info').hide();
|
980
|
});
|
991
|
});
|
981
|
- } else {}
|
992
|
+ }
|
982
|
}
|
993
|
}
|
983
|
/**
|
994
|
/**
|
984
|
* 获取登录信息
|
995
|
* 获取登录信息
|
|
@@ -988,9 +999,10 @@ function actionLoginInfo() { |
|
@@ -988,9 +999,10 @@ function actionLoginInfo() { |
988
|
var param = {
|
999
|
var param = {
|
989
|
method: 'open.passport.get'
|
1000
|
method: 'open.passport.get'
|
990
|
};
|
1001
|
};
|
|
|
1002
|
+
|
991
|
$.getData(apiDomain, param, function(_data) {
|
1003
|
$.getData(apiDomain, param, function(_data) {
|
992
|
actionLoginState(_data); // 更改登录状态
|
1004
|
actionLoginState(_data); // 更改登录状态
|
993
|
- actionVipInfo(_data);//获得vip;
|
1005
|
+ actionVipInfo(_data); //获得vip;
|
994
|
});
|
1006
|
});
|
995
|
}
|
1007
|
}
|
996
|
/**
|
1008
|
/**
|
|
@@ -1015,7 +1027,7 @@ function init() { |
|
@@ -1015,7 +1027,7 @@ function init() { |
1015
|
actionClickMiniCartBox(); //点击购物车跳转
|
1027
|
actionClickMiniCartBox(); //点击购物车跳转
|
1016
|
actionListenDelCarGoods(); //监听购物车删除
|
1028
|
actionListenDelCarGoods(); //监听购物车删除
|
1017
|
actionListenCartMore(); //
|
1029
|
actionListenCartMore(); //
|
1018
|
- actionLoginInfo();//获取登录信息
|
1030
|
+ actionLoginInfo(); //获取登录信息
|
1019
|
}
|
1031
|
}
|
1020
|
|
1032
|
|
1021
|
init(); |
1033
|
init(); |