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
Plain Diff
Browse Files
Authored by
ccbikai
9 years ago
Commit
76479d7d72a7805e9b44a6c2e4ee6669526aa12e
2 parents
68cb63a9
42914475
merge code
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
118 additions
and
73 deletions
library/Plugin/DataProcess/FloorProcess.php
library/Plugin/DataProcess/ListProcess.php
static/js/category/brand.js
static/sass/category/_brand.scss
template/m.yohobuy.com/actions/category/brand/search.phtml
yohobuy/m.yohobuy.com/application/models/Category/Brand.php
yohobuy/m.yohobuy.com/application/models/Index/Home.php
yohobuy/m.yohobuy.com/application/models/Product/Filter.php
yohobuy/m.yohobuy.com/application/models/Product/Newsale.php
library/Plugin/DataProcess/FloorProcess.php
View file @
76479d7
...
...
@@ -59,12 +59,9 @@ class FloorProcess
{
$result
=
array
();
foreach
(
$data
as
&
$one
)
{
$one
[
'url'
]
=
Helpers
::
getFilterUrl
(
$one
[
'url'
]);
$one
[
'img'
]
=
Helpers
::
getImageUrl
(
$one
[
'src'
],
640
,
310
);
unset
(
$one
[
'src'
]);
foreach
(
$data
as
$one
)
{
$result
[
'bannerTop'
][
'list'
][]
=
Helpers
::
formatBanner
(
$one
,
640
,
240
);
}
$result
[
'bannerTop'
][
'list'
]
=
$data
;
return
$result
;
}
...
...
library/Plugin/DataProcess/ListProcess.php
View file @
76479d7
...
...
@@ -197,6 +197,8 @@ class ListProcess
foreach
(
$result
[
'subs'
]
as
&
$val
)
{
if
(
$val
[
'dataId'
]
===
$gender
)
{
$val
[
'chosed'
]
=
true
;
$result
[
'name'
]
=
$val
[
'name'
];
}
}
...
...
static/js/category/brand.js
View file @
76479d7
...
...
@@ -14,12 +14,16 @@ var swiper,
var
searchH
=
$
(
'.newbrand-search'
).
outerHeight
(),
headerH
=
$
(
'.yoho-header'
).
outerHeight
(),
brandSwipe
=
parseInt
(
searchH
)
+
parseInt
(
headerH
)
-
1
;
brandSwipe
=
parseInt
(
searchH
)
+
parseInt
(
headerH
)
-
1
,
searchArray
=
[];
var
brandsData
,
$keyword
,
searchBtnHammer
,
clearTextHammer
;
clearTextHammer
,
removeHistory
,
searchList
,
yohoHistory
;
swiper
=
new
Swiper
(
'.swiper-container'
,
{
lazyLoading
:
true
,
...
...
@@ -97,7 +101,10 @@ function searchResult() {
brandHtml
.
push
(
k
);
brandHtml
.
push
(
'</h2></div>'
);
$
.
each
(
v
,
function
(
i
,
brand
)
{
brandHtml
.
push
(
'<p><a href="'
+
brand
.
url
+
'">'
+
brand
.
name
);
// brandHtml.push('<p><span>' + brand.name);
if
(
brand
.
isNew
)
{
brandHtml
.
push
(
'<i class="icon-hot">HOT</i>'
);
}
...
...
@@ -128,6 +135,20 @@ 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
()
{
if
(
localStorage
.
getItem
(
'yohoHistory'
))
{
yohoHistory
=
localStorage
.
getItem
(
'yohoHistory'
);
searchArray
.
push
(
yohoHistory
);
}
searchArray
.
push
(
'{"searchName":"'
+
$
(
'.search-result .brand-list p'
).
eq
(
index
).
find
(
'a'
).
html
()
+
'","searchHref":"'
+
$
(
'.search-result .brand-list p'
)
.
eq
(
index
).
find
(
'a'
).
attr
(
'href'
)
+
'"}'
);
localStorage
.
setItem
(
'yohoHistory'
,
searchArray
);
});
});
}
if
(
$
(
'.brand-search-page'
).
length
)
{
...
...
@@ -135,6 +156,7 @@ 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'
);
...
...
@@ -161,16 +183,20 @@ if ($('.brand-search-page').length) {
$
(
'form.search-box'
).
on
(
'submit'
,
function
()
{
return
false
;
});
if
(
localStorage
)
{
// clearHistoryHammer = new Hammer($('#clear-text')[0]);
// clearHistoryHammer.on('tap', function() {
// // setcookie('h_brands', '', {
// // expire: -1,
// // path: '/',
// // domain: '.m.yohobuy.com'
// // });
// $('#history-keyword').remove();
// $(this).hide();
// });
yohoHistory
=
$
.
parseJSON
(
'['
+
localStorage
.
getItem
(
'yohoHistory'
)
+
']'
);
console
.
log
(
yohoHistory
);
if
(
yohoHistory
)
{
$
.
each
(
yohoHistory
,
function
(
index
,
content
)
{
$
(
'<a href="'
+
content
.
searchHref
+
'">'
+
content
.
searchName
+
'</a>'
).
appendTo
(
'.historyList'
);
});
}
}
removeHistory
=
new
Hammer
(
$
(
'.removeHistory'
)[
0
]);
removeHistory
.
on
(
'tap'
,
function
(
e
)
{
$
(
'.historyList'
).
html
(
' '
);
localStorage
.
clear
();
});
}
...
...
static/sass/category/_brand.scss
View file @
76479d7
...
...
@@ -180,6 +180,52 @@
.search-result
{
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 @
76479d7
...
...
@@ -10,10 +10,16 @@
</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>
<script
id=
"brands-data"
type=
"text/tmpl"
>
{
{{brandList
}
}}
</script>
...
...
yohobuy/m.yohobuy.com/application/models/Category/Brand.php
View file @
76479d7
...
...
@@ -60,8 +60,18 @@ class BrandModel
// 搜索链接地址
$result
[
'searchUrl'
]
=
Helpers
::
url
(
'/brands/search'
,
null
);
/* 顶部的轮翻广告列表 */
if
(
!
empty
(
$brand
[
'brandTop'
][
0
][
'data'
]))
{
/* 顶部的轮翻广告或热门品牌列表(当没有轮翻广告的情况下会是这个样子的! 此处是根据接口改造成的逻辑) */
if
(
!
empty
(
$brand
[
'brandTop'
][
0
][
'data'
][
'list'
]))
{
$build
=
array
();
foreach
(
$brand
[
'brandTop'
][
0
][
'data'
][
'list'
]
as
$value
)
{
$build
[
'url'
]
=
Helpers
::
getFilterUrl
(
$value
[
'url'
]);
$build
[
'img'
]
=
Helpers
::
getImageUrl
(
$value
[
'src'
],
144
,
144
);
$build
[
'name'
]
=
$value
[
'name'
];
$result
[
'hotBrand'
][
'list'
][]
=
$build
;
}
}
// 顶部的轮翻广告列表
elseif
(
!
empty
(
$brand
[
'brandTop'
][
0
][
'data'
]))
{
$build
=
array
();
foreach
(
$brand
[
'brandTop'
][
0
][
'data'
]
as
$value
)
{
$build
[
'url'
]
=
Helpers
::
getFilterUrl
(
$value
[
'url'
]);
...
...
@@ -71,7 +81,7 @@ class BrandModel
}
}
/* 顶部的热门品牌列表 */
/* 顶部的热门品牌列表
(备注: 当没有轮翻广告的时候,此处内部的foreach不会被执行)
*/
if
(
!
empty
(
$brand
[
'brandTop'
][
1
][
'data'
][
'list'
]))
{
$build
=
array
();
foreach
(
$brand
[
'brandTop'
][
1
][
'data'
][
'list'
]
as
$value
)
{
...
...
yohobuy/m.yohobuy.com/application/models/Index/Home.php
View file @
76479d7
...
...
@@ -99,7 +99,7 @@ class HomeModel
// 调用接口获取数据
$banner
=
IndexData
::
getBannerStart
(
self
::
CODE_BG
);
if
(
isset
(
$banner
[
'data'
][
0
][
'data'
][
'list'
][
0
][
'src'
]))
{
$result
=
Helpers
::
getImageUrl
(
$banner
[
'data'
][
0
][
'data'
][
'list'
][
0
][
'src'
],
640
,
800
,
2
);
$result
=
Helpers
::
getImageUrl
(
$banner
[
'data'
][
0
][
'data'
][
'list'
][
0
][
'src'
],
640
,
800
,
1
);
}
if
(
USE_CACHE
)
{
...
...
yohobuy/m.yohobuy.com/application/models/Product/Filter.php
deleted
100644 → 0
View file @
68cb63a
<?php
namespace
Product
;
use
Configs\CacheConfig
;
use
LibModels\Wap\Product\SearchData
;
use
LibModels\Wap\Category\BrandData
;
use
LibModels\Wap\Category\ClassData
;
use
Plugin\DataProcess\ListProcess
;
/**
* 搜索相关的模板数据模型
*
* @name Filter
* @package Product
* @copyright yoho.inc
* @version 1.0 (2015-11-1 17:35:52)
*/
class
FilterModel
{
/**
* 获取筛选的数据
*
* @param array $condition 查询条件
* @return array
*/
public
static
function
getFilterData
(
$condition
)
{
$result
=
array
();
// 区别各种列表页面的筛选数据
if
(
isset
(
$condition
[
'brand'
]))
{
$listData
=
BrandData
::
filterBrandData
(
$condition
);
}
else
if
(
isset
(
$condition
[
'sort'
]))
{
$listData
=
ClassData
::
filterClassData
(
$condition
);
}
else
{
$listData
=
SearchData
::
searchByCondition
(
$condition
);
}
if
(
isset
(
$listData
[
'data'
])
&&
isset
(
$listData
[
'data'
][
'filter'
]))
{
$result
[
'filter'
]
=
ListProcess
::
getFilterData
(
$listData
[
'data'
][
'filter'
]);
}
return
$result
;
}
}
yohobuy/m.yohobuy.com/application/models/Product/Newsale.php
View file @
76479d7
...
...
@@ -183,8 +183,14 @@ class NewsaleModel
$newsale
=
NewsaleData
::
getNewsaleFocus
(
$codeKey
);
// 调用接口获取数据并封装
if
(
isset
(
$newsale
[
'code'
])
&&
isset
(
$newsale
[
'data'
][
0
][
'data'
][
0
]))
{
$result
=
Helpers
::
formatBanner
(
$newsale
[
'data'
][
0
][
'data'
][
0
],
640
,
240
);
if
(
isset
(
$newsale
[
'code'
])
&&
isset
(
$newsale
[
'data'
][
0
][
'data'
]))
{
if
(
count
(
$newsale
[
'data'
][
0
][
'data'
])
===
1
)
{
$result
=
Helpers
::
formatBanner
(
$newsale
[
'data'
][
0
][
'data'
][
0
],
640
,
240
);
}
else
{
foreach
(
$newsale
[
'data'
][
0
][
'data'
]
as
$one
)
{
$result
[
'list'
][]
=
Helpers
::
formatBanner
(
$one
,
640
,
240
);
}
}
}
if
(
USE_CACHE
)
{
...
...
Please
register
or
login
to post a comment