Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jamesyang1999
ShopXO
提交
1664facd
ShopXO
项目概览
jamesyang1999
/
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,发现更多精彩内容 >>
提交
1664facd
编写于
3月 06, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
问答应用开发
上级
1a3d87af
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
421 addition
and
13 deletion
+421
-13
application/plugins/answers/Admin.php
application/plugins/answers/Admin.php
+68
-8
application/plugins/answers/Service.php
application/plugins/answers/Service.php
+37
-0
application/plugins/view/answers/admin/baseinfo.html
application/plugins/view/answers/admin/baseinfo.html
+16
-1
application/plugins/view/answers/admin/goodsinfo.html
application/plugins/view/answers/admin/goodsinfo.html
+72
-0
application/service/GoodsService.php
application/service/GoodsService.php
+8
-2
public/static/plugins/css/answers/admin.css
public/static/plugins/css/answers/admin.css
+113
-2
public/static/plugins/js/answers/admin.js
public/static/plugins/js/answers/admin.js
+107
-0
未找到文件。
application/plugins/answers/Admin.php
浏览文件 @
1664facd
...
...
@@ -13,6 +13,7 @@ namespace app\plugins\answers;
use
think\Controller
;
use
app\service\PluginsService
;
use
app\plugins\answers\Service
;
use
app\service\SearchService
;
/**
* 问答 - 后台管理
...
...
@@ -118,9 +119,6 @@ class Admin extends Controller
*/
public
function
sliderinfo
(
$params
=
[])
{
// 参数
$params
=
input
();
// 数据
if
(
!
empty
(
$params
[
'id'
]))
{
...
...
@@ -151,7 +149,6 @@ class Admin extends Controller
}
// 开始处理
$params
=
input
();
return
Service
::
SlideSave
(
$params
);
}
...
...
@@ -161,8 +158,9 @@ class Admin extends Controller
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-15T11:03:30+0800
* @param [array] $params [输入参数]
*/
public
function
sliderdelete
()
public
function
sliderdelete
(
$params
=
[]
)
{
// 是否ajax请求
if
(
!
IS_AJAX
)
...
...
@@ -171,7 +169,6 @@ class Admin extends Controller
}
// 开始处理
$params
=
input
();
return
Service
::
SlideDelete
(
$params
);
}
...
...
@@ -181,8 +178,9 @@ class Admin extends Controller
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-01-12T22:23:06+0800
* @param [array] $params [输入参数]
*/
public
function
sliderstatusupdate
()
public
function
sliderstatusupdate
(
$params
=
[]
)
{
// 是否ajax请求
if
(
!
IS_AJAX
)
...
...
@@ -191,8 +189,70 @@ class Admin extends Controller
}
// 开始处理
$params
=
input
();
return
Service
::
SlideStatusUpdate
(
$params
);
}
/**
* 推荐商品编辑编辑
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
goodsinfo
(
$params
=
[])
{
// 数据
if
(
!
empty
(
$params
[
'id'
]))
{
$data_params
=
array
(
'where'
=>
[
'id'
=>
intval
(
$params
[
'id'
])],
);
$ret
=
Service
::
SlideList
(
$data_params
);
$this
->
assign
(
'data'
,
empty
(
$ret
[
'data'
][
0
])
?
[]
:
$ret
[
'data'
][
0
]);
}
return
$this
->
fetch
(
'../../../plugins/view/answers/admin/goodsinfo'
);
}
/**
* 商品搜索
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
goodssearch
(
$params
=
[])
{
// 是否ajax请求
if
(
!
IS_AJAX
)
{
return
$this
->
error
(
'非法访问'
);
}
// 搜索数据
return
Service
::
GoodsSearchList
(
$params
);
}
/**
* 商品保存
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
goodssave
(
$params
=
[])
{
// 是否ajax请求
if
(
!
IS_AJAX
)
{
return
$this
->
error
(
'非法访问'
);
}
print_r
(
$params
);
die
;
}
}
?>
\ No newline at end of file
application/plugins/answers/Service.php
浏览文件 @
1664facd
...
...
@@ -204,5 +204,42 @@ class Service
}
return
DataReturn
(
'编辑失败或数据未改变'
,
-
100
);
}
/**
* 商品搜索
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
* @param [array] $params [输入参数]
*/
public
static
function
GoodsSearchList
(
$params
=
[])
{
// 条件
$where
=
[
[
'g.is_delete_time'
,
'='
,
0
],
[
'g.is_shelves'
,
'='
,
1
]
];
// 关键字
if
(
!
empty
(
$params
[
'keywords'
]))
{
$where
[]
=
[
'g.title'
,
'like'
,
'%'
.
$params
[
'keywords'
]
.
'%'
];
}
// 分类id
if
(
!
empty
(
$params
[
'category_id'
]))
{
$category_ids
=
GoodsService
::
GoodsCategoryItemsIds
([
$params
[
'category_id'
]],
1
);
$category_ids
[]
=
$params
[
'category_id'
];
$where
[]
=
[
'gci.category_id'
,
'in'
,
$category_ids
];
}
// 指定字段
$field
=
'g.id,g.title'
;
// 获取数据
return
GoodsService
::
CategoryGoodsList
([
'where'
=>
$where
,
'm'
=>
0
,
'n'
=>
100
,
'field'
=>
$field
]);
}
}
?>
\ No newline at end of file
application/plugins/view/answers/admin/baseinfo.html
浏览文件 @
1664facd
...
...
@@ -26,7 +26,7 @@
<div
class=
"am-form-group"
>
<label>
链接地址
<span
class=
"fs-12 fw-100 cr-999"
>
(带http://或https://)
</span></label>
<input
type=
"url"
placeholder=
"链接地址"
name=
"url"
data-validation-message=
"链接地址格式有误"
class=
"am-radius"
{{
if
!
empty
($
data
)}}
value=
"{{$data.url}}"
{{/
if
}}
/>
<input
type=
"url"
placeholder=
"链接地址"
name=
"url"
data-validation-message=
"链接地址格式有误"
class=
"am-radius"
{{
if
!
empty
($
data
['
url
']
)}}
value=
"{{$data.url}}"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group"
>
...
...
@@ -40,6 +40,21 @@
</div>
</div>
<div
class=
"am-form-group"
>
<label>
右侧热门问答名称
<span
class=
"fs-12 fw-100 cr-999"
>
(默认 热门问答)
</span></label>
<input
type=
"text"
name=
"right_top_hot_name"
placeholder=
"右侧热门问答名称"
maxlength=
"30"
data-validation-message=
"右侧热门问答名称格式最多 30 个字符"
class=
"am-radius"
{{
if
!
empty
($
data
['
right_top_hot_name
'])}}
value=
"{{$data.right_top_hot_name}}"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group"
>
<label>
中间最新问答名称
<span
class=
"fs-12 fw-100 cr-999"
>
(默认 最新问答)
</span></label>
<input
type=
"text"
name=
"right_middle_new_name"
placeholder=
"中间最新问答名称"
maxlength=
"30"
data-validation-message=
"中间最新问答名称格式最多 30 个字符"
class=
"am-radius"
{{
if
!
empty
($
data
['
right_middle_new_name
'])}}
value=
"{{$data.right_middle_new_name}}"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group"
>
<label>
右侧推荐商品名称
<span
class=
"fs-12 fw-100 cr-999"
>
(默认 推荐商品)
</span></label>
<input
type=
"text"
name=
"right_top_goods_name"
placeholder=
"右侧推荐商品名称"
maxlength=
"30"
data-validation-message=
"右侧推荐商品名称格式最多 30 个字符"
class=
"am-radius"
{{
if
!
empty
($
data
['
right_top_goods_name
'])}}
value=
"{{$data.right_top_goods_name}}"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group am-form-group-refreshing"
>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100"
data-am-loading=
"{loadingText:'处理中...'}"
>
保存
</button>
</div>
...
...
application/plugins/view/answers/admin/goodsinfo.html
0 → 100644
浏览文件 @
1664facd
{{include file="public/header" /}}
<!-- right content start -->
<div
class=
"content-right"
>
<div
class=
"content"
>
<legend>
<span
class=
"fs-16"
>
{{if empty($data['id'])}}
商品添加
{{else /}}
商品编辑
{{/if}}
</span>
<a
href=
"{{:PluginsAdminUrl('answers', 'admin', 'index')}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
</legend>
<div
class=
"answers-content"
>
<!-- form start -->
<form
class=
"am-form form-validation view-save"
action=
"{{:PluginsAdminUrl('answers', 'admin', 'goodssave')}}"
method=
"POST"
request-type=
"ajax-url"
request-value=
"{{:PluginsAdminUrl('answers', 'admin', 'index')}}"
enctype=
"multipart/form-data"
>
<div
class=
"goods-container"
>
<div
class=
"goods-form"
data-search-url=
"{{:PluginsAdminUrl('answers', 'admin', 'goodssearch')}}"
>
<select
class=
"am-radius c-p chosen-select goods-form-category"
data-placeholder=
"可选择..."
data-validation-message=
"请选择商品分类"
>
<option
value=
""
>
可选择...
</option>
{{if !empty($goods_category_list)}}
{{foreach $goods_category_list as $v}}
<option
value=
"{{$v.id}}"
>
{{$v.name}}
</option>
{{/foreach}}
{{/if}}
</select>
<input
type=
"text"
placeholder=
"商品名称"
class=
"am-radius goods-form-keywords"
/>
<button
type=
"button"
class=
"am-btn am-btn-secondary am-radius am-btn-sm search-submit"
>
搜索
</button>
</div>
<div
class=
"am-form-group am-form-group-refreshing goods-list"
>
<input
type=
"text"
name=
"goods_category_ids"
value=
"{{if !empty($goods_category_ids)}}{{:implode(',', json_decode($data['goods_category_ids'], true))}}{{/if}}"
data-validation-message=
"请选择商品"
required
/>
<div
class=
"goods-items am-fl"
>
<div
class=
"title"
>
可选
</div>
<ul
class=
"goods-content am-list ul-left"
>
<div
class=
"table-no"
>
没有相关数据
</div>
</ul>
</div>
<button
type=
"button"
class=
"am-btn am-btn-default am-btn-xs selected-all"
>
全选
<i
class=
"am-icon-angle-double-right"
></i></button>
<div
class=
"goods-items am-fr"
>
<div
class=
"title"
>
已选
</div>
<ul
class=
"goods-content am-list ul-right"
>
<div
class=
"table-no {{if !empty($data)}}none{{/if}}"
>
没有相关数据
</div>
{{if !empty($goods_list)}}
{{foreach $goods_list as $v}}
<li
class=
"am-animation-slide-bottom items-li-{{$v.id}}"
>
<span
class=
"name"
data-value=
"{{$v.id}}"
>
{{$v.name}}
</span>
<i
class=
"am-icon-trash-o am-fr"
></i>
</li>
{{/foreach}}
{{/if}}
</ul>
</div>
</div>
</div>
<div
class=
"am-form-group am-form-group-refreshing"
>
<input
type=
"hidden"
name=
"id"
{{
if
!
empty
($
params
['
id
'])}}
value=
"{{$params.id}}"
{{/
if
}}
/>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100"
data-am-loading=
"{loadingText:'处理中...'}"
>
保存
</button>
</div>
</form>
<!-- form end -->
</div>
</div>
</div>
<!-- right content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->
\ No newline at end of file
application/service/GoodsService.php
浏览文件 @
1664facd
...
...
@@ -310,10 +310,16 @@ class GoodsService
}
// 产地
$v
[
'place_origin_name'
]
=
empty
(
$v
[
'place_origin'
])
?
null
:
RegionService
::
RegionName
(
$v
[
'place_origin'
]);
if
(
isset
(
$v
[
'place_origin_name'
]))
{
$v
[
'place_origin_name'
]
=
empty
(
$v
[
'place_origin'
])
?
null
:
RegionService
::
RegionName
(
$v
[
'place_origin'
]);
}
// 品牌
$v
[
'brand_name'
]
=
empty
(
$v
[
'brand_id'
])
?
null
:
BrandService
::
BrandName
(
$v
[
'brand_id'
]);
if
(
isset
(
$v
[
'brand_id'
]))
{
$v
[
'brand_name'
]
=
empty
(
$v
[
'brand_id'
])
?
null
:
BrandService
::
BrandName
(
$v
[
'brand_id'
]);
}
// 时间
if
(
!
empty
(
$v
[
'add_time'
]))
...
...
public/static/plugins/css/answers/admin.css
浏览文件 @
1664facd
...
...
@@ -7,11 +7,12 @@
padding-bottom
:
20px
;
}
.answers-content
.items
.immages-tag
{
border
:
1px
solid
#eee
;
text-align
:
center
;
}
.answers-content
.items
.immages-tag
img
{
max-width
:
100%
;
border
:
1px
dashed
#eee
;
padding
:
5px
;
}
.answers-content
.edit-submit
{
margin-bottom
:
20px
;
...
...
@@ -35,4 +36,114 @@
ul
.plugins-images-view
li
{
width
:
100%
;
height
:
auto
;
}
\ No newline at end of file
}
/**
* 商品推荐编辑
*/
form
.am-form
{
margin-bottom
:
20px
;
}
form
.am-form
.am-form-group
{
padding
:
0
;
}
.goods-container
.goods-form-category
,
.goods-container
.chosen-container
,
.goods-container
.goods-form-keywords
{
width
:
30%
!important
;
}
.goods-container
.chosen-container
,
.goods-container
.goods-form-keywords
{
display
:
-webkit-inline-box
!important
;
}
.goods-container
.chosen-single
{
width
:
100%
;
}
.goods-container
.goods-form
{
margin-bottom
:
2px
;
}
.goods-list
{
overflow
:
hidden
;
margin-bottom
:
20px
;
position
:
relative
;
}
.goods-list
.goods-items
{
width
:
calc
(
50%
-
50px
);
height
:
300px
;
}
.goods-list
.goods-items
.title
{
text-align
:
center
;
}
.goods-list
.goods-items
.goods-content
{
border
:
1px
solid
#eee
;
height
:
calc
(
100%
-
25px
);
overflow-y
:
scroll
;
overflow-x
:
hidden
;
border-radius
:
2px
;
}
.goods-list
.goods-items
.goods-content
li
{
padding
:
5px
45px
5px
5px
;
border-style
:
dotted
;
border-color
:
#eaeaea
;
border-width
:
1px
0
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
white-space
:
nowrap
;
max-width
:
100%
;
color
:
#666
;
position
:
relative
;
}
.goods-list
.goods-items
.goods-content
li
:nth-child
(
2
)
{
border-top
:
0
;
}
.goods-list
.goods-items
.goods-content
li
i
{
cursor
:
pointer
;
padding
:
0
10px
0
5px
;
position
:
absolute
;
top
:
5px
;
right
:
5px
;
}
.goods-list
.selected-all
{
position
:
absolute
;
top
:
50%
;
left
:
calc
(
50%
-
30px
);
}
.goods-container
input
[
name
=
"goods_category_ids"
]
{
position
:
absolute
;
left
:
-1000000px
;
top
:
-1000000px
;
}
.goods-list
i
{
color
:
#888
!important
;
}
.am-form-error
.goods-items
.goods-content
{
border-color
:
#dd514c
;
}
.content-view
{
max-width
:
100%
;
max-height
:
200px
;
overflow-y
:
auto
;
overflow-x
:
hidden
;
}
.content-view-win
{
border
:
1px
solid
#eee
;
padding
:
10px
;
}
.content-view-win
img
,
.content-view
img
{
max-width
:
100%
;
}
@media
only
screen
and
(
max-width
:
641px
)
{
.goods-container
.goods-form-category
,
.goods-container
.goods-form-keywords
{
width
:
calc
(
55%
-
60px
)
!important
;
display
:
-webkit-inline-box
!important
;
}
.goods-container
.chosen-container
{
display
:
none
!important
;
}
.content-view-td
{
display
:
none
;
}
}
public/static/plugins/js/answers/admin.js
0 → 100644
浏览文件 @
1664facd
$
(
function
()
{
// 添加元素到右侧
function
RightElementAdd
(
value
,
name
)
{
if
(
$
(
'
ul.ul-right
'
).
find
(
'
.items-li-
'
+
value
).
length
==
0
)
{
var
html
=
'
<li class="am-animation-slide-bottom items-li-
'
+
value
+
'
"><span class="name" data-value="
'
+
value
+
'
">
'
+
name
+
'
</span><i class="am-icon-trash-o am-fr"></i></li>
'
;
$
(
'
ul.ul-right
'
).
append
(
html
);
}
// 右侧数据同步
RightElementGoods
();
// 左侧是否还有内容
if
(
$
(
'
ul.ul-left li
'
).
length
==
0
)
{
$
(
'
ul.ul-left .table-no
'
).
removeClass
(
'
none
'
);
}
else
{
$
(
'
ul.ul-left .table-no
'
).
addClass
(
'
none
'
);
}
}
// 批量-商品id同步
function
RightElementGoods
()
{
var
value_all
=
[];
$
(
'
ul.ul-right li
'
).
each
(
function
(
k
,
v
)
{
value_all
[
k
]
=
$
(
this
).
find
(
'
span.name
'
).
data
(
'
value
'
);
});
$
(
'
.goods-container input[name="goods_category_ids"]
'
).
val
(
value_all
.
join
(
'
,
'
)).
blur
();
// 右侧是否还有数据
if
(
$
(
'
ul.ul-right li
'
).
length
==
0
)
{
$
(
'
ul.ul-right .table-no
'
).
removeClass
(
'
none
'
);
}
else
{
$
(
'
ul.ul-right .table-no
'
).
addClass
(
'
none
'
);
}
}
// 左侧点击到右侧
$
(
'
ul.ul-left
'
).
on
(
'
click
'
,
'
i.am-icon-angle-right
'
,
function
()
{
var
value
=
$
(
this
).
prev
().
data
(
'
value
'
);
var
name
=
$
(
this
).
prev
().
text
();
$
(
this
).
parent
().
remove
();
RightElementAdd
(
value
,
name
);
});
// 左侧全部移动到右侧
$
(
'
.selected-all
'
).
on
(
'
click
'
,
function
()
{
$
(
'
ul.ul-left li
'
).
each
(
function
(
k
,
v
)
{
var
value
=
$
(
this
).
find
(
'
span.name
'
).
data
(
'
value
'
);
var
name
=
$
(
this
).
find
(
'
span.name
'
).
text
();
$
(
this
).
remove
();
RightElementAdd
(
value
,
name
);
});
});
// 右侧删除
$
(
'
ul.ul-right
'
).
on
(
'
click
'
,
'
i.am-icon-trash-o
'
,
function
()
{
$
(
this
).
parent
().
remove
();
RightElementGoods
();
});
// 商品搜索
$
(
'
.goods-form .search-submit
'
).
on
(
'
click
'
,
function
()
{
var
category_id
=
$
(
'
.goods-form .goods-form-category
'
).
val
();
var
keywords
=
$
(
'
.goods-form .goods-form-keywords
'
).
val
();
console
.
log
(
category_id
,
keywords
)
// ajax请求
$
.
ajax
({
url
:
$
(
'
.goods-form
'
).
data
(
'
search-url
'
),
type
:
'
POST
'
,
dataType
:
"
json
"
,
timeout
:
10000
,
data
:{
"
category_id
"
:
category_id
,
"
keywords
"
:
keywords
},
success
:
function
(
result
)
{
if
(
result
.
code
==
0
)
{
var
html
=
''
;
for
(
var
i
in
result
.
data
)
{
html
+=
'
<li class="am-animation-slide-bottom"><span class="name" data-value="
'
+
result
[
'
data
'
][
i
][
'
id
'
]
+
'
">
'
+
result
[
'
data
'
][
i
][
'
title
'
]
+
'
</span><i class="am-icon-angle-right am-fr"></i></li>
'
;
}
$
(
'
ul.ul-left .table-no
'
).
addClass
(
'
none
'
);
$
(
'
ul.ul-left li
'
).
remove
();
$
(
'
ul.ul-left
'
).
append
(
html
);
}
else
{
Prompt
(
result
.
msg
);
}
},
error
:
function
()
{
Prompt
(
'
网络异常错误
'
);
}
});
});
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录