Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHO-ACTIVITY-PHP
·
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
ccbikai
9 years ago
Commit
0f9dd69e15aa869123d4b0a8146d7ed26c018abc
1 parent
fdfb8021
删除品牌搜索记录
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
91 deletions
static/js/category/brand.js
static/sass/category/_brand.scss
template/m.yohobuy.com/actions/category/brand/search.phtml
static/js/category/brand.js
View file @
0f9dd69
...
...
@@ -11,22 +11,16 @@ var $ = require('jquery'),
var
swiper
,
$fixTitleBar
,
$brandText
,
$brandHref
,
$brandList
=
$
(
'.brand-list'
);
var
searchH
=
$
(
'.newbrand-search'
).
outerHeight
(),
headerH
=
$
(
'.yoho-header'
).
outerHeight
(),
brandSwipe
=
parseInt
(
searchH
)
+
parseInt
(
headerH
)
-
1
,
minBrandListTop
,
searchArray
=
[];
minBrandListTop
;
var
brandsData
,
$keyword
,
clearTextHammer
,
removeHistory
,
searchList
,
yohoHistory
;
clearTextHammer
;
swiper
=
new
Swiper
(
'.swiper-container'
,
{
lazyLoading
:
true
,
...
...
@@ -147,21 +141,6 @@ function searchResult() {
if
(
Object
.
keys
(
result
).
length
>
0
)
{
rightBarBindClick
();
}
$
(
'.search-result .brand-list p'
).
each
(
function
(
index
)
{
searchList
=
new
Hammer
(
$
(
'.search-result .brand-list p'
).
eq
(
index
)[
0
]);
searchList
.
on
(
'tap'
,
function
()
{
$brandText
=
$
(
'.search-result .brand-list p'
).
eq
(
index
).
find
(
'a'
).
html
();
$brandHref
=
$
(
'.search-result .brand-list p'
).
eq
(
index
).
find
(
'a'
).
attr
(
'href'
);
if
(
localStorage
.
getItem
(
'yohoHistory'
))
{
yohoHistory
=
localStorage
.
getItem
(
'yohoHistory'
);
searchArray
.
push
(
yohoHistory
);
}
if
(
searchArray
.
toString
().
split
(
$brandText
).
length
<
2
)
{
searchArray
.
push
(
'{"searchName":"'
+
$brandText
+
'","searchHref":"'
+
$brandText
+
'"}'
);
}
localStorage
.
setItem
(
'yohoHistory'
,
searchArray
);
});
});
}
if
(
$
(
'.brand-search-page'
).
length
)
{
...
...
@@ -169,7 +148,6 @@ if ($('.brand-search-page').length) {
$keyword
=
$
(
'#keyword'
);
$keyword
.
on
(
'input'
,
function
()
{
$
(
'.history'
).
css
(
'display'
,
'none'
);
if
(
$keyword
.
val
().
length
)
{
searchResult
();
$
(
this
).
closest
(
'.search-box'
).
css
(
'width'
,
'11.25rem'
);
...
...
@@ -183,6 +161,7 @@ if ($('.brand-search-page').length) {
clearTextHammer
=
new
Hammer
(
$
(
'.clear-text'
)[
0
]);
clearTextHammer
.
on
(
'tap'
,
function
(
e
)
{
e
.
preventDefault
();
$
(
'.search-result'
).
html
(
''
);
$
(
'#keyword'
).
val
(
''
).
trigger
(
'input'
);
e
.
srcEvent
.
stopPropagation
();
});
...
...
@@ -190,20 +169,4 @@ if ($('.brand-search-page').length) {
$
(
'form.search-box'
).
on
(
'submit'
,
function
()
{
return
false
;
});
if
(
localStorage
&&
localStorage
.
getItem
(
'yohoHistory'
))
{
yohoHistory
=
$
.
parseJSON
(
'['
+
localStorage
.
getItem
(
'yohoHistory'
)
+
']'
);
if
(
yohoHistory
)
{
$
.
each
(
yohoHistory
,
function
(
index
,
content
)
{
$
(
'<a href="'
+
content
.
searchHref
+
'">'
+
content
.
searchName
+
'</a>'
).
appendTo
(
'.historyList'
);
});
}
}
else
{
$
(
'.history'
).
css
(
'display'
,
'none'
);
}
removeHistory
=
new
Hammer
(
$
(
'.removeHistory'
)[
0
]);
removeHistory
.
on
(
'tap'
,
function
(
e
)
{
$
(
'.historyList'
).
html
(
' '
);
localStorage
.
clear
();
});
}
...
...
static/sass/category/_brand.scss
View file @
0f9dd69
...
...
@@ -195,49 +195,4 @@
padding-top
:
176rem
/
$pxConvertRem
;
}
.history
{
width
:
100%
;
height
:
auto
;
overflow
:
hidden
;
position
:
absolute
;
left
:
0
;
top
:
176rem
/
$pxConvertRem
;
>
h6
{
width
:
100%
;
height
:
88rem
/
$pxConvertRem
;
line-height
:
88rem
/
$pxConvertRem
;
color
:
#999
;
text-indent
:
.6rem
;
font-size
:
36em
/
$pxConvertRem
;
}
.historyList
{
width
:
100%
;
height
:
auto
;
overflow
:
hidden
;
display
:
block
;
>
a
{
width
:
auto
;
height
:
58rem
/
$pxConvertRem
;
overflow
:
hidden
;
line-height
:
58rem
/
$pxConvertRem
;
margin
:
0
0
20rem
/
$pxConvertRem
.6rem
;
padding
:
0
20rem
/
$pxConvertRem
;
float
:
left
;
background-color
:
#f8f8f8
;
color
:
#444
;
}
}
>
span
{
width
:
auto
;
height
:
68rem
/
$pxConvertRem
;
overflow
:
hidden
;
display
:
inline-block
;
line-height
:
68rem
/
$pxConvertRem
;
border
:
1px
solid
#e6e6e6
;
padding
:
0
28rem
/
$pxConvertRem
;
font-size
:
48em
/
$pxConvertRem
;
margin-left
:
.6rem
;
color
:
#000
;
}
}
}
...
...
template/m.yohobuy.com/actions/category/brand/search.phtml
View file @
0f9dd69
...
...
@@ -10,12 +10,6 @@
</div>
</form>
</div>
<div
class=
"history"
>
<h
6
>历史纪录</h
6
>
<div
class=
"historyList"
>
</div>
<span
class='removeHistory'>清空搜索历史</span>
</div>
<div
class=
"search-result"
>
</div>
</div>
...
...
Please
register
or
login
to post a comment