Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
______--______
ShopXO
提交
f9ddb5ed
ShopXO
项目概览
______--______
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f9ddb5ed
编写于
7月 28, 2019
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
搜索页面商品信息新增钩子
上级
ea5c5736
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
106 addition
and
34 deletion
+106
-34
application/index/controller/Search.php
application/index/controller/Search.php
+11
-10
application/index/view/default/buy/index.html
application/index/view/default/buy/index.html
+2
-2
application/index/view/default/search/content.html
application/index/view/default/search/content.html
+85
-0
public/static/index/default/css/search.css
public/static/index/default/css/search.css
+7
-7
public/static/index/default/js/search.js
public/static/index/default/js/search.js
+1
-15
未找到文件。
application/index/controller/Search.php
浏览文件 @
f9ddb5ed
...
...
@@ -10,6 +10,7 @@
// +----------------------------------------------------------------------
namespace
app\index\controller
;
use
think\facade\Hook
;
use
app\service\SearchService
;
use
app\service\BrandService
;
use
app\service\SeoService
;
...
...
@@ -149,20 +150,20 @@ class Search extends Common
// 获取商品列表
$this
->
params
[
'keywords'
]
=
$this
->
params
[
'wd'
];
$ret
=
SearchService
::
GoodsList
(
$this
->
params
);
if
(
empty
(
$ret
[
'data'
][
'data'
]))
{
$msg
=
'没有相关数据'
;
$code
=
-
100
;
}
else
{
$msg
=
'操作成功'
;
$code
=
0
;
}
// 搜索记录
SearchService
::
SearchAdd
(
$this
->
params
);
// 返回
return
DataReturn
(
$msg
,
$code
,
$ret
[
'data'
]);
// 无数据直接返回
if
(
empty
(
$ret
[
'data'
])
||
$ret
[
'code'
]
!=
0
)
{
return
DataReturn
(
'没有相关数据'
,
-
100
);
}
// 返回数据html
$this
->
assign
(
'data'
,
$ret
[
'data'
][
'data'
]);
$ret
[
'data'
][
'data'
]
=
$this
->
fetch
(
'content'
);
return
$ret
;
}
}
?>
\ No newline at end of file
application/index/view/default/buy/index.html
浏览文件 @
f9ddb5ed
...
...
@@ -156,7 +156,7 @@
<!-- 含运费小计 -->
<div
class=
"buy-point-discharge"
>
<p>
合计
<span>
¥
</span><em
class=
"pay-sum"
>
{{$base.total_price}}
</em>
合计
<span>
¥
</span><em
class=
"pay-sum"
>
{{$base.total_price}}
</em>
</p>
</div>
...
...
@@ -191,7 +191,7 @@
<div
class=
"base-real-pay"
>
<em>
实付款:
</em>
<span
class=
"price"
>
<span>
¥
</span>
<span>
¥
</span>
<em
class=
"nav-total-price"
>
{{$base.actual_price}}
</em>
</span>
</div>
...
...
application/index/view/default/search/content.html
0 → 100644
浏览文件 @
f9ddb5ed
{{if !empty($data)}}
{{foreach $data as $v}}
<li
class=
"am-animation-scale-up"
>
<div
class=
"items"
>
<!-- 搜索页面商品信息顶部钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div
class=
"plugins-tag"
>
<span>
plugins_view_search_goods_inside_top
</span>
</div>
{{/if}}
{{php}}
$hook_name = 'plugins_view_search_goods_inside_top';
$hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'goods_id'=>$v['id'], 'goods'=>$v]);
if(!empty($hook_data)
&&
is_array($hook_data))
{
foreach($hook_data as $hook)
{
if(is_string($hook) || is_int($hook))
{
echo htmlspecialchars_decode($hook);
}
}
}
{{/php}}
<a
href=
"{{$v.goods_url}}"
target=
"_blank"
class=
"goods-images"
>
<img
src=
"{{$v.images}}"
alt=
"{{$v.title}}"
>
</a>
<a
href=
"{{$v.goods_url}}"
target=
"_blank"
class=
"goods-title"
>
<p
class=
"am-text-truncate am-padding-xs"
title=
"{{$v.title}}"
>
{{$v.title}}
</p>
</a>
<p
class=
"am-padding-horizontal-xs am-cf"
>
<span
class=
"am-fl original-price"
>
¥{{$v.original_price}}
</span>
<span
class=
"am-fr sales-count"
>
销量 {{$v.sales_count}}
</span>
</p>
<!-- 搜索页面商品信息售价顶部钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div
class=
"plugins-tag"
>
<span>
plugins_view_search_goods_price_top
</span>
</div>
{{/if}}
{{php}}
$hook_name = 'plugins_view_search_goods_price_top';
$hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'goods_id'=>$v['id'], 'goods'=>$v]);
if(!empty($hook_data)
&&
is_array($hook_data))
{
foreach($hook_data as $hook)
{
if(is_string($hook) || is_int($hook))
{
echo htmlspecialchars_decode($hook);
}
}
}
{{/php}}
<p
class=
"price am-padding-horizontal-xs"
>
<strong>
¥{{$v.price}}
</strong>
</p>
<!-- 搜索页面商品信息底部钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div
class=
"plugins-tag"
>
<span>
plugins_view_search_goods_inside_bottom
</span>
</div>
{{/if}}
{{php}}
$hook_name = 'plugins_view_search_goods_inside_bottom';
$hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'goods_id'=>$v['id'], 'goods'=>$v]);
if(!empty($hook_data)
&&
is_array($hook_data))
{
foreach($hook_data as $hook)
{
if(is_string($hook) || is_int($hook))
{
echo htmlspecialchars_decode($hook);
}
}
}
{{/php}}
</div>
</li>
{{/foreach}}
{{/if}}
\ No newline at end of file
public/static/index/default/css/search.css
浏览文件 @
f9ddb5ed
.i
-pic.limit
img
{
width
:
100%
;}
.i
-pic.limit
.price
strong
{
font-size
:
14px
;
}
.i
tems
img
{
width
:
100%
;}
.i
tems
.price
strong
{
font-size
:
14px
;
}
.theme-popover
{
z-index
:
1011
;
overflow
:
visible
;
background
:
#fff
;
width
:
100%
;
}
.sort-nav
a
:hover
,
.sort-nav
a
:focus
{
color
:
#d2364c
;
}
.select
.title-tips
{
font-size
:
12px
;
color
:
#888
;
}
...
...
@@ -47,14 +47,14 @@ dl#select3 .dd-conent{ left:-200%; right:0px;}
.theme-popover-mask
{
z-index
:
1001
;
width
:
100%
;
height
:
auto
;
position
:
fixed
;
background
:
#000
;
top
:
0
;
opacity
:
0.6
;
bottom
:
0
;}
/*搜索结果*/
.i-pic.limit
{
margin
:
5px
;
border
:
1px
#e8e8e8
solid
;
overflow
:
hidden
;
position
:
relative
;
cursor
:
pointer
;}
.number.fl
{
position
:
absolute
;
bottom
:
5px
;
right
:
5px
;}
.price.fl
{
padding
:
5px
;}
.items
{
margin
:
5px
;
border
:
1px
#e8e8e8
solid
;
overflow
:
hidden
;
position
:
relative
;
cursor
:
pointer
;}
.items
.sales-count
{
color
:
#888
;
}
.items
.original-price
{
text-decoration
:
line-through
;
color
:
#666
;
}
/*分页*/
.am-pagination
li
{
float
:
none
;}
.search-side
{
display
:
none
;}
.limit
p
.title
,
.i-pic.check
p
.title
{
padding
:
0px
5px
;}
.search-pages-submit
{
margin
:
10px
0
;
}
@media
only
screen
and
(
min-width
:
640px
)
{
...
...
@@ -104,7 +104,7 @@ dl#select3 .dd-conent{ left:-200%; right:0px;}
.data-list
{
width
:
calc
(
100%
+
10px
);
margin-left
:
-5px
;
}
/*选中效果*/
.search-list
ul
li
:hover
.i
-pic.limit
,
.search-side
li
:hover
.i-pic
.check
{
-webkit-box-shadow
:
0px
12px
12px
-10px
rgba
(
0
,
0
,
0
,
.4
);
box-shadow
:
0px
12px
12px
-10px
rgba
(
0
,
0
,
0
,
.4
);
border
:
4px
solid
#d2364c
;
-webkit-transition
:
border-color
.2s
ease-in
;
-moz-transition
:
border-color
.2s
ease-in
;
-ms-transition
:
border-color
.2s
ease-in
;
-o-transition
:
border-color
.2s
ease-in
;
transition
:
border-color
.2s
ease-in
;
}
.search-list
ul
li
:hover
.i
tems
,
.search-side
li
:hover
.items
.check
{
-webkit-box-shadow
:
0px
12px
12px
-10px
rgba
(
0
,
0
,
0
,
.4
);
box-shadow
:
0px
12px
12px
-10px
rgba
(
0
,
0
,
0
,
.4
);
border
:
4px
solid
#d2364c
;
-webkit-transition
:
border-color
.2s
ease-in
;
-moz-transition
:
border-color
.2s
ease-in
;
-ms-transition
:
border-color
.2s
ease-in
;
-o-transition
:
border-color
.2s
ease-in
;
transition
:
border-color
.2s
ease-in
;
}
}
@media
only
screen
and
(
max-width
:
640px
)
{
...
...
public/static/index/default/js/search.js
浏览文件 @
f9ddb5ed
...
...
@@ -185,21 +185,7 @@ $(function()
$
(
'
.loding-view
'
).
hide
();
if
(
result
.
code
==
0
)
{
for
(
var
i
in
result
.
data
.
data
)
{
var
html
=
'
<li class="am-animation-scale-up"><div class="i-pic limit">
'
;
html
+=
'
<a href="
'
+
result
.
data
.
data
[
i
][
'
goods_url
'
]
+
'
" target="_blank">
'
;
html
+=
'
<img src="
'
+
result
.
data
.
data
[
i
][
'
images
'
]
+
'
" />
'
;
html
+=
'
</a>
'
;
html
+=
'
<a href="
'
+
result
.
data
.
data
[
i
][
'
goods_url
'
]
+
'
" target="_blank">
'
;
html
+=
'
<p class="am-text-truncate title fl">
'
+
result
.
data
.
data
[
i
][
'
title
'
]
+
'
</p>
'
;
html
+=
'
</a>
'
;
html
+=
'
<p class="price fl"><strong>¥
'
+
result
.
data
.
data
[
i
][
'
min_price
'
]
+
'
</strong></p>
'
;
html
+=
'
<p class="number fl">销量<span>
'
+
result
.
data
.
data
[
i
][
'
sales_count
'
]
+
'
</span></p>
'
;
html
+=
'
</div></li>
'
;
$
(
'
.data-list
'
).
append
(
html
);
}
$
(
'
.data-list
'
).
append
(
result
.
data
.
data
);
$
(
'
.search-pages-submit
'
).
attr
(
'
data-page
'
,
data
.
page
+
1
);
$
(
'
.search-pages-submit
'
).
attr
(
'
disabled
'
,
(
result
.
data
.
page_total
<=
1
));
$
(
'
.search-pages-submit
'
).
show
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录