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
Email Patches
Plain Diff
Browse Files
Authored by
lore-w
9 years ago
Commit
d55b83def94484da272ad98f2f3e2dd23da0f4c0
1 parent
a4a19270
图片上传优化/我的收藏优化
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
10 deletions
static/js/me/fav.js
static/js/me/suggest.js
static/sass/me/_fav.scss
template/m.yohobuy.com/actions/index/home/favorite.phtml
static/js/me/fav.js
View file @
d55b83d
...
...
@@ -44,7 +44,6 @@ function initSwiper() {
$swiperList
=
$
(
'.swiper-container'
);
for
(
i
=
0
;
i
<
$swiperList
.
length
;
i
++
)
{
id
=
$swiperList
.
eq
(
i
).
attr
(
'data-id'
);
console
.
log
(
id
);
if
(
!!
swiperObj
[
id
])
{
swiperObj
[
id
].
destroy
(
true
,
true
);
...
...
@@ -91,7 +90,7 @@ function loadData($parent, url, page) {
}
else
if
(
data
.
length
>
10
)
{
$parent
.
append
(
data
);
$parent
.
closest
(
'.fav-type'
).
find
(
'.fav-content-loading'
).
remove
();
if
(
url
===
'favBrand'
)
{
initSwiper
();
//如果是收藏品牌需要初始化swiper
...
...
@@ -142,6 +141,7 @@ favTabHammer.on('tap', function(e) {
loadData
(
$favProductList
,
'favProduct'
,
1
);
}
}
else
{
brandTab
=
true
;
if
(
$favBrandList
.
find
(
'div'
).
length
===
0
&&
$favBrandList
.
closest
(
'.fav-type'
).
find
(
'.fav-null-box'
).
hasClass
(
'hide'
))
{
loadData
(
$favBrandList
,
'favBrand'
,
1
);
...
...
@@ -211,12 +211,13 @@ $(document).scroll(function() {
if
(
$
(
window
).
scrollTop
()
+
winH
>=
$
(
document
).
height
()
-
footerH
)
{
if
(
brandTab
)
{
console
.
log
(
1
);
$brandLoadMore
.
filter
(
'.hide'
).
removeClass
(
'hide'
);
if
(
!
brandLockId
)
{
brandPageId
++
;
loadData
(
$favBrandList
,
'favBrand'
,
brandPageId
);
}
}
else
{
...
...
@@ -224,7 +225,6 @@ $(document).scroll(function() {
$loadMore
.
filter
(
'.hide'
).
removeClass
(
'hide'
);
if
(
!
lockId
)
{
console
.
log
(
222
);
pageId
++
;
loadData
(
$favProductList
,
'favProduct'
,
pageId
);
}
...
...
static/js/me/suggest.js
View file @
d55b83d
...
...
@@ -20,14 +20,15 @@ var $uploadImgList = $('.upload-img-list'),
$likeBtn
=
$
(
'.suggest-item .like-btn'
),
$disLikeBtn
=
$
(
'.suggest-item .dislike-btn'
),
$imgAdd
=
$
(
'.img-add'
),
imgStr
=
''
;
imgStr
=
''
,
uploadImgNum
=
0
;
require
(
'./jquery.uploadifive'
);
imgTpl
=
'{{# imgList}}'
+
'<li>'
+
'<img src="{{imgUrl}}" />'
+
'<span class="upload-img-remove"></span>'
+
'{{# imgUrl}}<img src="{{.}}" />'
+
'<span class="upload-img-remove"></span>{{/ imgUrl}}'
+
'</li>'
+
'{{/ imgList}}'
;
...
...
@@ -41,16 +42,20 @@ $('#upload-img').uploadifive({
fileSizeLimit
:
1024
,
height
:
'100%'
,
width
:
'100%'
,
queueSizeLimit
:
1
,
multi
:
false
,
onAddQueueItem
:
function
(
files
)
{
//TODO
$uploadImgList
.
html
(
imgTemplate
({
imgList
:
true
}));
},
onUploadComplete
:
function
(
file
,
data
)
{
$uploadImgList
.
html
(
''
);
imgStr
=
JSON
.
parse
(
data
).
imgList
[
0
].
imgRelUrl
;
$uploadImgList
.
html
(
imgTemplate
(
JSON
.
parse
(
data
)));
$imgAdd
.
hide
();
uploadImgNum
++
;
}
});
...
...
@@ -92,6 +97,7 @@ if (document.getElementById('img-form') !== null) {
if
(
$
(
e
.
target
).
hasClass
(
'upload-img-remove'
))
{
$uploadImgList
.
html
(
''
);
imgStr
=
''
;
uploadImgNum
--
;
setTimeout
(
function
()
{
$imgAdd
.
show
();
},
50
);
...
...
static/sass/me/_fav.scss
View file @
d55b83d
...
...
@@ -291,4 +291,10 @@
@include
background-size
(
auto
40%
);
}
}
.fav-content-loading
{
width
:
100%
;
height
:
2rem
;
background
:
image_url
(
'loading.gif'
)
center
center
no-repeat
;
@include
background-size
(
auto
40%
);
}
}
\ No newline at end of file
...
...
template/m.yohobuy.com/actions/index/home/favorite.phtml
View file @
d55b83d
...
...
@@ -8,6 +8,7 @@
<div
class=
"fav-content"
id=
"fav-content"
>
<div
class=
"fav-type"
>
<ul
class=
"fav-product-list"
></ul>
<div
class=
"fav-content-loading"
></div>
<div
class=
"fav-null-box hide"
>
<span
class=
"fav-null"
>您暂无收藏任何商品</span>
...
...
@@ -17,12 +18,13 @@
</div>
<div
class=
"fav-type"
>
<div
class=
"fav-brand-swiper"
></div>
<div
class=
"fav-content-loading"
></div>
<div
class=
"fav-null-box hide"
>
<span
class=
"fav-null"
>您暂无收藏任何品牌</span>
<a
class=
"go-shopping"
href=
"{{brandUrl}}"
>随便逛逛</a>
</div>
<div
class=
"fav-brand-load-more load-background hide"
></div>
<div
class=
"fav-brand-load-more
fav-
load-background hide"
></div>
</div>
</div>
{
{/
favorite
}
}
...
...
Please
register
or
login
to post a comment