Skip to content

Commit 4021710

Browse files
committed
add product_category
1 parent bd8059f commit 4021710

File tree

19 files changed

+693
-17
lines changed

19 files changed

+693
-17
lines changed

manong_manager/manong_manager_web/manong_manager_web.iml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,6 @@
8585
<orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.28" level="project" />
8686
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:4.1.3.RELEASE" level="project" />
8787
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
88+
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:servlet-api:2.5" level="project" />
8889
</component>
8990
</module>

manong_manager/manong_manager_web/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@
6363
<artifactId>spring-context-support</artifactId>
6464
</dependency>
6565

66+
<dependency>
67+
<groupId>javax.servlet</groupId>
68+
<artifactId>servlet-api</artifactId>
69+
<scope>provided</scope>
70+
</dependency>
71+
6672
</dependencies>
6773

6874

manong_manager/manong_manager_web/src/main/java/com/manong/controller/PageController.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
package com.manong.controller;
22

3+
import com.manong.service.impl.ProductCategoryService;
4+
import org.springframework.beans.factory.annotation.Autowired;
35
import org.springframework.stereotype.Controller;
46
import org.springframework.web.bind.annotation.PathVariable;
57
import org.springframework.web.bind.annotation.RequestMapping;
8+
import pojo.EasyUITree;
9+
10+
import javax.servlet.http.HttpServletRequest;
11+
import java.util.List;
612

713
/**
814
* Created by wistbean on 2018/10/2.
@@ -11,6 +17,10 @@
1117
@Controller
1218
public class PageController {
1319

20+
21+
@Autowired
22+
ProductCategoryService productCategoryService;
23+
1424
@RequestMapping("/{page}")
1525
public String requestPage(@PathVariable String page){
1626
return page;
@@ -21,4 +31,11 @@ public String requestIndex(){
2131
return "index";
2232
}
2333

34+
@RequestMapping("/product_add")
35+
public String requestProductAdd(HttpServletRequest request){
36+
List<EasyUITree> categories = productCategoryService.findProductCategoryListByParentId((short) 0);
37+
request.getSession().setAttribute("categories",categories);
38+
return "product_add";
39+
}
40+
2441
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
var MN = MANONG ={
2+
3+
initProductCategory: function () {
4+
function loadSubCategory(value) {
5+
6+
var $box = $("#productAddForm").find('#cbox');
7+
8+
if(value == 0){
9+
$box.html('').hide();
10+
return;
11+
}
12+
13+
$.getJSON("/product_category/list",{id:value},function (data) {
14+
15+
var s = '';
16+
s = '<select id="cc2" class="easyui-combobox" name="cid2" style="width:200px;">';
17+
s += '<option value="0">请选二级分类</option>';
18+
19+
$.each(data,function (idx,item) {
20+
s += '<option value="'+item.id+'">'+item.text+'</option>';
21+
});
22+
23+
s += '</select>'
24+
$box.html(s).show();
25+
26+
});
27+
28+
};
29+
30+
$("#productAddForm").find("select[name='cid']").combobox({
31+
onChange:function () {
32+
var value = $("#cc").val();
33+
loadSubCategory(value);
34+
}
35+
});
36+
},
37+
init:function (data) {
38+
//初始化商品分类
39+
this.initProductCategory();
40+
}
41+
42+
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<%@ page import="pojo.EasyUITree" %>
2+
<%@ page import="java.util.List" %><%--
3+
User: wistbean
4+
Date: 2018/12/18
5+
Time: 16:46
6+
--%>
7+
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
8+
<title>商品添加</title>
9+
<script type="text/javascript" charset="utf-8" src="ueditor/ueditor.config.js"></script>
10+
<script type="text/javascript" charset="utf-8" src="ueditor/ueditor.all.min.js"> </script>
11+
<!--建议手动加在语言,避免在ie下有时因为加载语言失败导致编辑器加载失败-->
12+
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文-->
13+
<script type="text/javascript" charset="utf-8" src="ueditor/lang/zh-cn/zh-cn.js"></script>
14+
<script type="text/javascript" charset="utf-8" src="/js/product_add.js"></script>
15+
16+
<%
17+
List<EasyUITree> list = (List<EasyUITree>) session.getAttribute("categories");
18+
%>
19+
20+
<div style="padding: 10px 10px 10px 10px;">
21+
22+
<form id="productAddForm" method="post">
23+
24+
<table cellpadding="10px">
25+
<tr>
26+
<td>商品名称</td>
27+
<td><input class="easyui-textbox" data-options="required:true" style="width:800px"></td>
28+
</tr>
29+
<tr>
30+
<td>商品分类</td>
31+
<td>
32+
<select id="cc" class="easyui-combobox" name="cid" style="width:200px;">
33+
<option value="0">请选择</option>
34+
<%
35+
for(int i=0;i<list.size();i++){
36+
EasyUITree item = list.get(i);
37+
%>
38+
39+
<option value="<%=item.getId()%>"><%=item.getText()%></option>
40+
<%
41+
}
42+
%>
43+
</select>
44+
45+
<p id="cbox" style="display: none"></p>
46+
</td>
47+
</tr>
48+
49+
<tr>
50+
<td>市场价格</td>
51+
<td>
52+
<input class="easyui-numberbox" data-options="min:1,max:99999999,precision:2,required:true"
53+
style="width:800px">
54+
</td>
55+
</tr>
56+
57+
<tr>
58+
<td>商品价格</td>
59+
<td>
60+
<input class="easyui-numberbox" data-options="min:1,max:99999999,precision:2,required:true"
61+
style="width:800px">
62+
</td>
63+
</tr>
64+
65+
<tr>
66+
<td>商品编号</td>
67+
<td>
68+
<input class="easyui-numberbox" data-options="required:true"
69+
style="width:800px">
70+
</td>
71+
</tr>
72+
73+
<tr>
74+
<td>商品主图</td>
75+
<td>
76+
<a id="btn" href="#" class="easyui-linkbutton">上传图片</a>
77+
</td>
78+
</tr>
79+
80+
<tr>
81+
<td>商品描述</td>
82+
<td>
83+
<script id="editor" type="text/plain" style="width:800px;height:500px;"></script>
84+
</td>
85+
</tr>
86+
87+
</table>
88+
89+
</form>
90+
91+
<div align="center">
92+
<a id="btn" href="#" class="easyui-linkbutton">提交</a>
93+
<a id="btn" href="#" class="easyui-linkbutton">重置</a>
94+
95+
</div>
96+
97+
</div>
98+
99+
<script>
100+
101+
$(function () {
102+
//实例化编辑器
103+
//建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
104+
var ue = UE.getEditor('editor');
105+
106+
MANONG.init();
107+
})
108+
109+
</script>
110+
28.5 KB
Loading

manong_manager/manong_manager_web/src/main/webapp/ueditor/ueditor.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
*/
2222
var URL = window.UEDITOR_HOME_URL || getUEBasePath();
2323

24+
URL = URL + "/ueditor/"
25+
2426
/**
2527
* 配置项主体。注意,此处所有涉及到路径的配置别遗漏URL变量。
2628
*/
Binary file not shown.

manong_manager/manong_manager_web/target/tomcat/logs/access_log.2018-12-12

Whitespace-only changes.

0 commit comments

Comments
 (0)