Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
whb
9 years ago
Commit
ca17e7ad788e8e9ab1770e4995e3feb733449881
2 parents
fe4de38b
72609a22
Merge branch 'develop' of
http://git.dev.yoho.cn/web/yohobuy.git
into develop
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
50 deletions
web-static/js/common/product-event.js
web-static/js/header.js
web-static/js/product/product.js
web-static/js/common/product-event.js
View file @
ca17e7a
...
...
@@ -109,7 +109,5 @@ module.exports = function($o, rowWidth) {
$o
.
bind
(
'mouseenter'
,
handleEvent
);
//$o.bind('mouseleave', handleEvent);
return
pMouseHover
;
};
\ No newline at end of file
...
...
web-static/js/header.js
View file @
ca17e7a
...
...
@@ -301,13 +301,15 @@ function fadeAnimate() {
}
window
.
$logotrans
.
fadeOut
(
window
.
loopdurationtime
,
function
()
{
window
.
isen
=
false
;
window
.
$logotrans
.
css
(
'background-image'
,
'url(http://static.yohobuy.com/newheader/img/logo.png)'
);
window
.
$logotrans
.
fadeIn
(
window
.
loopdurationtime
,
function
()
{
window
.
onetimeoout
=
window
.
setTimeout
(
function
()
{
window
.
$logotrans
.
fadeOut
(
window
.
loopdurationtime
,
function
()
{
window
.
clearTimeout
(
window
.
onetimeoout
);
window
.
isen
=
true
;
window
.
$logotrans
.
css
(
'background-image'
,
'url(http://static.yohobuy.com/newheader/img/logo_e.png)'
);
window
.
$logotrans
.
css
(
'background-image'
,
'url(http://static.yohobuy.com/newheader/img/logo_e.png)'
);
window
.
$logotrans
.
fadeIn
(
window
.
loopdurationtime
,
function
()
{
window
.
globaltimeout
=
window
.
setTimeout
(
fadeAnimate
,
1
*
60
*
1000
);
});
...
...
@@ -850,7 +852,7 @@ function actionExeTemplate() {
var
resulthtml
=
$
(
'#goodcartempwarpper'
).
html
().
replace
(
/
\\
/g
,
''
);
$
(
'#goodcartempwarpper'
).
html
(
resulthtml
);
vipInfoCombine
=
handlebars
.
compile
(
$
(
'#tmpl-my-login-new'
).
html
())
vipInfoCombine
=
handlebars
.
compile
(
$
(
'#tmpl-my-login-new'
).
html
())
;
}
/**
* 执行搜索
...
...
@@ -867,32 +869,47 @@ function actionSearch() {
*/
function
actionLoginState
(
_data
)
{
var
timestamp
=
new
Date
().
getTime
();
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>]'
var
loginHtml
=
'<span>Hi~<a href="http://www.yohobuy.com/home?t='
+
timestamp
+
'">{{user_name}}</a></span> '
+
'{{#equalone is_login}}'
+
'[<a href="{{logout}}" class="list-a login-out">退出</a>]'
+
'{{else}}'
+
'[<a href="http://www.yohobuy.com/signin.html" class="list-a login-out">请登录</a>] '
+
'[<a href="http://www.yohobuy.com/reg.html" onclick="" class="list-a login-out">免费注册</a>]'
+
'{{/equalone}}'
;
var
boxObj
=
$
(
'#loginBox'
);
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>]'
;
var
loginHtml
=
'<span>Hi~<a href="http://www.yohobuy.com/home?t='
+
timestamp
+
'">{{user_name}}</a></span> '
+
'{{#equalone islogin}}'
+
'[<a href="{{logout}}" class="list-a login-out">退出</a>]'
+
'{{else}}'
+
'[<a href="http://www.yohobuy.com/signin.html" class="list-a login-out">请登录</a>] '
+
'[<a href="http://www.yohobuy.com/reg.html" onclick="" class="list-a login-out">免费注册</a>]'
+
'{{/equalone}}'
;
var
$boxObj
=
$
(
'#loginBox'
);
var
info
=
$
.
cookie
(
'_UID'
);
loginInfoCombine
=
handlebars
.
compile
(
loginHtml
);
var
name
=
_data
.
data
.
profile_name
;
var
_length
=
0
;
var
t
=
0
;
var
char
=
''
;
var
user
=
info
.
split
(
'::'
);
var
userName
=
user
[
0
]
||
' '
;
var
_logout
=
''
;
var
islogin
=
'1'
;
var
_num
=
0
;
var
data
=
{
user_name
:
name
,
logout
:
_logout
,
random
:
Math
.
random
()
};
if
(
typeof
info
==
'undefined'
||
info
==
null
)
{
boxObj
.
html
(
noLoginHtml
);
loginInfoCombine
=
handlebars
.
compile
(
loginHtml
);
if
(
typeof
info
===
'undefined'
||
info
===
null
)
{
$boxObj
.
html
(
noLoginHtml
);
return
false
;
}
var
user
=
info
.
split
(
'::'
);
if
(
typeof
user
==
'undefined'
||
user
.
length
<
4
)
{
boxObj
.
html
(
noLoginHtml
);
if
(
typeof
user
===
'undefined'
||
user
.
length
<
4
)
{
$boxObj
.
html
(
noLoginHtml
);
return
false
;
}
var
userName
=
user
[
0
]
||
' '
;
var
name
=
''
;
var
_length
=
0
;
for
(
var
t
=
0
;
t
<
userName
.
length
;
t
++
)
{
var
char
=
userName
.
substr
(
t
,
1
);
for
(
t
;
t
<
userName
.
length
;
t
++
)
{
char
=
userName
.
substr
(
t
,
1
);
if
(
/.*
[\u
4e00-
\u
9fa5
]
+.*$/
.
test
(
char
))
{
_length
+=
2
;
}
else
{
...
...
@@ -903,10 +920,10 @@ function actionLoginState(_data) {
name
=
userName
;
}
else
{
_num
=
0
;
for
(
var
t
=
0
;
t
<
userName
.
length
;
t
++
)
{
for
(
t
;
t
<
userName
.
length
;
t
++
)
{
if
(
_num
<
10
)
{
var
char
=
userName
.
substr
(
t
,
1
);
if
(
char
!=
'*'
)
{
char
=
userName
.
substr
(
t
,
1
);
if
(
char
!==
'*'
)
{
if
(
/.*
[\u
4e00-
\u
9fa5
]
+.*$/
.
test
(
char
))
{
_num
+=
2
;
}
else
{
...
...
@@ -920,65 +937,59 @@ function actionLoginState(_data) {
name
+=
'...'
;
}
}
var
_logout
=
''
;
if
(
/http:
\/\/
/
.
test
(
user
[
3
]))
{
_logout
=
user
[
3
].
replace
(
'www.yohobuy.com'
,
'www.yohobuy.com'
);
}
else
{
_logout
=
'http://www.yohobuy.com/logout_'
+
user
[
3
]
+
'.html'
;
}
var
data
=
{
"user_name"
:
name
,
"logout"
:
_logout
,
"random"
:
Math
.
random
()
};
var
is_login
=
'1'
;
if
(
_data
.
result
===
-
1
)
{
is
_
login
=
'-1'
;
islogin
=
'-1'
;
}
data
[
'is_login'
]
=
is_login
;
boxObj
.
html
(
loginInfoCombine
(
data
));
data
.
islogin
=
islogin
;
$boxObj
.
html
(
loginInfoCombine
(
data
));
}
/**
* 获得vip用户信息
* @return {[type]} [description]
*/
function
actionVipInfo
(
_data
)
{
if
(
_data
.
result
==
1
)
{
var
vipInfo
=
_data
.
data
;
var
vipInfo
=
_data
.
data
;
var
headUrl
=
''
;
if
(
typeof
vipInfo
==
undefined
||
vipInfo
.
length
<
1
)
{
if
(
_data
.
result
===
1
)
{
if
(
typeof
vipInfo
===
undefined
||
vipInfo
.
length
<
1
)
{
return
false
;
}
$
(
'#myYohoBox'
).
mouseenter
(
function
()
{
$
(
this
).
addClass
(
'acttags'
);
$
(
'#myYohoBox .myyoho-info'
).
show
().
html
(
vipInfoCombine
(
vipInfo
));
var
headUrl
=
$
(
'.myyoho-photo img'
).
attr
(
'data-url'
);
if
(
$
.
_checkUrlState
==
1
)
{
headUrl
=
$
(
'.myyoho-photo img'
).
attr
(
'data-url'
);
if
(
$
.
_checkUrlState
===
1
)
{
$
(
'.myyoho-photo'
).
show
().
find
(
'img'
).
attr
(
'src'
,
headUrl
);
return
;
}
if
(
headUrl
==
''
||
$
.
_checkUrl
!
=
''
)
{
if
(
headUrl
==
=
''
||
$
.
_checkUrl
!=
=
''
)
{
return
;
}
$
.
ajax
({
url
:
headUrl
,
type
:
'GET'
,
complete
:
function
(
response
)
{
if
(
response
.
status
==
200
||
response
.
status
==
0
)
{
if
(
response
.
status
==
=
200
||
response
.
status
=
==
0
)
{
$
(
'.myyoho-photo'
).
show
().
find
(
'img'
).
attr
(
'src'
,
headUrl
);
$
.
_checkUrlState
=
1
;
}
$
.
_checkUrl
=
headUrl
;
}
});
;
});
$
(
'#myYohoBox'
).
mouseleave
(
function
()
{
$
(
this
).
removeClass
(
'acttags'
);
$
(
'#myYohoBox .myyoho-info'
).
hide
()
$
(
'#myYohoBox .myyoho-info'
).
hide
()
;
});
}
else
{}
}
}
/**
* 获取登录信息
...
...
@@ -988,9 +999,10 @@ function actionLoginInfo() {
var
param
=
{
method
:
'open.passport.get'
};
$
.
getData
(
apiDomain
,
param
,
function
(
_data
)
{
actionLoginState
(
_data
);
// 更改登录状态
actionVipInfo
(
_data
);
//获得vip;
actionVipInfo
(
_data
);
//获得vip;
});
}
/**
...
...
@@ -1015,7 +1027,7 @@ function init() {
actionClickMiniCartBox
();
//点击购物车跳转
actionListenDelCarGoods
();
//监听购物车删除
actionListenCartMore
();
//
actionLoginInfo
();
//获取登录信息
actionLoginInfo
();
//获取登录信息
}
init
();
\ No newline at end of file
...
...
web-static/js/product/product.js
View file @
ca17e7a
...
...
@@ -26,6 +26,8 @@ exports.init = function(num) {
productList
=
null
;
$goodItem
.
unbind
();
productList
=
productEvent
(
$goodItem
,
num
);
/**
...
...
Please
register
or
login
to post a comment