Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
biao
9 years ago
Commit
117c518f06e8a9c2656044b7cfa476719da20f66
1 parent
32ecc936
update
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
153 additions
and
124 deletions
static/js/home/home.js
static/js/home/maybe-like.js
static/js/me/currency-new.js
static/js/me/entry.js
template/m.yohobuy.com/partials/layout/use.phtml
static/js/home/home.js
View file @
117c518
...
...
@@ -193,4 +193,4 @@ exports.set = function(c) {
});
};
require
(
'./maybe-like'
);
\ No newline at end of file
require
(
'./maybe-like'
)();
...
...
static/js/home/maybe-like.js
View file @
117c518
...
...
@@ -4,146 +4,152 @@
* @date: 2015/10/12
*/
var
$
=
require
(
'jquery'
),
Hammer
=
require
(
'yoho.hammer'
),
tip
=
require
(
'../plugin/tip'
),
loading
=
require
(
'../plugin/loading'
),
lazyLoad
=
require
(
'yoho.lazyload'
);
var
navHammer
,
winH
=
$
(
window
).
height
(),
$goodList
=
$
(
'#goods-list'
),
searching
=
false
,
page
=
0
,
gender
=
null
,
kidsType
=
$
(
'.mobile-wrap'
).
hasClass
(
'kids-wrap'
)
?
true
:
false
,
lifestyleType
=
$
(
'.mobile-wrap'
).
hasClass
(
'lifestyle-wrap'
)
?
true
:
false
,
num
,
url
;
var
$curNav
,
index
,
$navList
=
$
(
'#maybe-like-nav'
);
//ajax url
if
(
kidsType
)
{
url
=
'/product/recom/maylikekids'
;
}
else
if
(
lifestyleType
)
{
url
=
'/product/recom/maylikelife'
;
}
else
{
gender
=
$
(
'.mobile-wrap'
).
hasClass
(
'boys-wrap'
)
?
'1,3'
:
'2,3'
,
url
=
'/product/recom/maylike?gender='
+
gender
;
}
$curNav
=
$navList
.
children
(
'.focus'
);
if
(
lifestyleType
)
{
navHammer
=
new
Hammer
(
$navList
[
0
]);
navHammer
.
on
(
'tap'
,
function
(
e
)
{
var
$this
=
$
(
e
.
target
).
closest
(
'li'
),
$goods
=
$
(
'.goods-list'
),
$content
;
e
.
preventDefault
();
if
(
$this
.
hasClass
(
'focus'
))
{
return
;
}
module
.
exports
=
function
(
specificGender
)
{
var
$
=
require
(
'jquery'
),
Hammer
=
require
(
'yoho.hammer'
),
tip
=
require
(
'../plugin/tip'
),
loading
=
require
(
'../plugin/loading'
),
lazyLoad
=
require
(
'yoho.lazyload'
);
var
navHammer
,
winH
=
$
(
window
).
height
(),
$goodList
=
$
(
'#goods-list'
),
searching
=
false
,
page
=
0
,
gender
=
null
,
num
,
url
;
//The kidsType can be specified by the parameter. Add by @ZhaoBiao
var
kidsType
=
specificGender
===
'kidsType'
||
$
(
'.mobile-wrap'
).
hasClass
(
'kids-wrap'
)
?
true
:
false
,
lifestyleType
=
specificGender
===
'lifestyleType'
||
$
(
'.mobile-wrap'
).
hasClass
(
'lifestyle-wrap'
)
?
true
:
false
;
var
$curNav
,
index
,
$navList
=
$
(
'#maybe-like-nav'
);
//ajax url
if
(
kidsType
)
{
url
=
'/product/recom/maylikekids'
;
}
else
if
(
lifestyleType
)
{
url
=
'/product/recom/maylikelife'
;
}
else
{
gender
=
(
specificGender
===
'boys'
||
$
(
'.mobile-wrap'
).
hasClass
(
'boys-wrap'
))
?
'1,3'
:
'2,3'
,
url
=
'/product/recom/maylike?gender='
+
gender
;
}
$curNav
=
$navList
.
children
(
'.focus'
);
index
=
$this
.
index
();
if
(
lifestyleType
)
{
navHammer
=
new
Hammer
(
$navList
[
0
]);
navHammer
.
on
(
'tap'
,
function
(
e
)
{
var
$this
=
$
(
e
.
target
).
closest
(
'li'
),
$goods
=
$
(
'.goods-list'
),
$content
;
$this
.
addClass
(
'focus'
);
$curNav
.
removeClass
(
'focus'
);
e
.
preventDefault
();
if
(
$this
.
hasClass
(
'focus'
))
{
return
;
}
$goods
.
not
(
'.hide'
).
addClass
(
'hide'
);
$content
=
$goods
.
eq
(
index
);
$content
.
removeClass
(
'hide'
);
index
=
$this
.
index
();
$curNav
=
$this
;
$this
.
addClass
(
'focus'
);
$curNav
.
removeClass
(
'focus'
);
$
(
document
).
trigger
(
'scroll'
);
//Trigger lazyLoad
e
.
srcEvent
.
stopPropagation
();
});
}
$goods
.
not
(
'.hide'
).
addClass
(
'hide'
);
$content
=
$goods
.
eq
(
index
);
$content
.
removeClass
(
'hide'
);
loading
.
init
(
$
(
'.maybe-like'
))
;
$curNav
=
$this
;
function
search
()
{
if
(
searching
)
{
return
;
$
(
document
).
trigger
(
'scroll'
);
//Trigger lazyLoad
e
.
srcEvent
.
stopPropagation
();
});
}
searching
=
true
;
loading
.
showLoadingMask
();
//num = $goodList.find('.good-info').length;
$
.
ajax
({
type
:
'GET'
,
url
:
url
,
data
:
{
page
:
page
+
1
},
success
:
function
(
data
)
{
if
(
data
===
' '
)
{
searching
=
false
;
loading
.
hideLoadingMask
();
if
(
gender
)
{
if
(
gender
===
'1,3'
)
{
url
=
'/boys/bottomBanner'
;
}
else
{
url
=
'/girls/bottomBanner'
;
}
$
.
ajax
({
type
:
'GET'
,
url
:
url
,
success
:
function
(
data
)
{
if
(
data
&&
data
.
img
)
{
$
(
'#load-more-img'
).
show
();
$
(
'#load-more-img a'
).
attr
(
'href'
,
data
.
url
);
$
(
'#load-more-img a > img'
).
attr
(
'src'
,
data
.
img
);
}
},
error
:
function
()
{
loading
.
init
(
$
(
'.maybe-like'
));
function
search
()
{
if
(
searching
)
{
return
;
}
searching
=
true
;
loading
.
showLoadingMask
();
//num = $goodList.find('.good-info').length;
$
.
ajax
({
type
:
'GET'
,
url
:
url
,
data
:
{
page
:
page
+
1
},
success
:
function
(
data
)
{
if
(
data
===
' '
)
{
searching
=
false
;
loading
.
hideLoadingMask
();
if
(
gender
)
{
if
(
gender
===
'1,3'
)
{
url
=
'/boys/bottomBanner'
;
}
else
{
url
=
'/girls/bottomBanner'
;
}
});
$
.
ajax
({
type
:
'GET'
,
url
:
url
,
success
:
function
(
data
)
{
if
(
data
&&
data
.
img
)
{
$
(
'#load-more-img'
).
show
();
$
(
'#load-more-img a'
).
attr
(
'href'
,
data
.
url
);
$
(
'#load-more-img a > img'
).
attr
(
'src'
,
data
.
img
);
}
},
error
:
function
()
{
}
});
}
return
;
}
return
;
}
num
=
$goodList
.
find
(
'.good-info'
).
length
;
num
=
$goodList
.
find
(
'.good-info'
).
length
;
$goodList
.
append
(
data
);
$goodList
.
append
(
data
);
// 2015/10/31 fei.hong: 修复第一页分页不显示图片的问题
if
(
num
===
0
)
{
lazyLoad
(
$goodList
.
find
(
'.good-info'
).
find
(
'img.lazy'
));
}
else
{
lazyLoad
(
$goodList
.
find
(
'.good-info:gt('
+
(
num
-
1
)
+
')'
).
find
(
'img.lazy'
));
}
// 2015/10/31 fei.hong: 修复第一页分页不显示图片的问题
if
(
num
===
0
)
{
lazyLoad
(
$goodList
.
find
(
'.good-info'
).
find
(
'img.lazy'
));
}
else
{
lazyLoad
(
$goodList
.
find
(
'.good-info:gt('
+
(
num
-
1
)
+
')'
).
find
(
'img.lazy'
));
searching
=
false
;
loading
.
hideLoadingMask
();
page
++
;
},
error
:
function
()
{
tip
.
show
(
'网络断开连接了~'
);
searching
=
false
;
loading
.
hideLoadingMask
();
}
});
}
searching
=
false
;
loading
.
hideLoadingMask
();
page
++
;
},
error
:
function
()
{
tip
.
show
(
'网络断开连接了~'
);
searching
=
false
;
loading
.
hideLoadingMask
();
}
$
(
'.maybe-like p'
).
on
(
'touchstart'
,
function
(
e
)
{
search
();
});
}
$
(
'.maybe-like p'
).
on
(
'touchstart'
,
function
(
e
)
{
search
();
});
function
scrollHandler
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
200
)
{
search
();
function
scrollHandler
()
{
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
200
)
{
search
();
}
}
}
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
\ No newline at end of file
//srcoll to load more
$
(
window
).
scroll
(
function
()
{
window
.
requestAnimationFrame
(
scrollHandler
);
});
};
...
...
static/js/me/currency-new.js
0 → 100644
View file @
117c518
/**
* 新有货币界面
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2015/12/30
*/
//var $ = require('jquery');
//
//function getGender () {
// // body...
//}
require
(
'../home/maybe-like'
)();
...
...
static/js/me/entry.js
View file @
117c518
...
...
@@ -19,3 +19,4 @@ require('./logistic');
require
(
'./pay'
);
require
(
'./personal-details'
);
require
(
'./currency'
);
require
(
'./currency-new'
);
...
...
template/m.yohobuy.com/partials/layout/use.phtml
View file @
117c518
...
...
@@ -334,3 +334,9 @@
seajs.use('js/me/currency');
</script>
{{/if}}
{{#if currencyPage}}
<script>
seajs.use('js/me/currency-new');
</script>
{{/if}}
...
...
Please
register
or
login
to post a comment