Showing
3 changed files
with
359 additions
and
0 deletions
client/js/hotBrands/index.js
0 → 100644
1 | +/** | ||
2 | + * Created by jiangmin on 2016/5/9. | ||
3 | + * 反馈管理 | ||
4 | + */ | ||
5 | +var $ = require('jquery'); | ||
6 | +common = require('../common/common'); | ||
7 | +datepicker = require('../util/datepicker'); | ||
8 | + | ||
9 | + | ||
10 | +/** | ||
11 | + * 下拉框 | ||
12 | + */ | ||
13 | + | ||
14 | +new common.dropDown({ | ||
15 | + el: "#status-filter" | ||
16 | +}); | ||
17 | + | ||
18 | +/** | ||
19 | + * 日期插件 | ||
20 | + */ | ||
21 | +$('.hasDatepicker').fdatepicker({ | ||
22 | + format: 'yyyy-mm-dd' | ||
23 | +}); | ||
24 | +/** | ||
25 | + * 列表 | ||
26 | + * @type {common.grid} | ||
27 | + */ | ||
28 | +var g = new common.grid({ | ||
29 | + el: '#content-list', | ||
30 | + parms: function () { | ||
31 | + return { | ||
32 | + brandName: common.util.__input('brandName-filter'), | ||
33 | + status: common.util.__input('status-filter') | ||
34 | + }; | ||
35 | + }, | ||
36 | + columns: [ | ||
37 | + { | ||
38 | + display: "ID", | ||
39 | + name: "id" | ||
40 | + }, { | ||
41 | + display: "品牌名称", | ||
42 | + name: "brandName" | ||
43 | + }, { | ||
44 | + display: "状态", | ||
45 | + name: 'status', | ||
46 | + render: function (item) { | ||
47 | + if (item.status == 1) { | ||
48 | + return "可用" | ||
49 | + } | ||
50 | + return "不可用" | ||
51 | + } | ||
52 | + }, { | ||
53 | + display: '排序', | ||
54 | + name: "orderBy" | ||
55 | + }, { | ||
56 | + display: '添加人', | ||
57 | + name: "creatorName" | ||
58 | + }, { | ||
59 | + display: '添加时间', | ||
60 | + name: "createTime", | ||
61 | + render: function (item) { | ||
62 | + var t = new Date(item.createTime * 1000); | ||
63 | + var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss"); | ||
64 | + return "<p>" + formatted + "</p>"; | ||
65 | + } | ||
66 | + }, { | ||
67 | + display: '修改人', | ||
68 | + name: "modifyName" | ||
69 | + }, { | ||
70 | + display: '修改时间', | ||
71 | + name: "modifyTime", | ||
72 | + render: function (item) { | ||
73 | + var t = new Date(item.modifyTime * 1000); | ||
74 | + var formatted = common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss"); | ||
75 | + return "<p>" + formatted + "</p>"; | ||
76 | + } | ||
77 | + }, { | ||
78 | + display: '操作', | ||
79 | + render: function (item) { | ||
80 | + var HtmArr = []; | ||
81 | + HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-info btn-xs update">修改</a>'); | ||
82 | + HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs delete">删出</a>'); | ||
83 | + return HtmArr.join(''); | ||
84 | + } | ||
85 | + }] | ||
86 | +}); | ||
87 | +g.init('/hotSearchBrand/queryHotBrandList1'); | ||
88 | +var edit = new common.edit2(".modal-body"); | ||
89 | +var Bll = { | ||
90 | + contentDatas: [], | ||
91 | + module: null, | ||
92 | + __render: function (selecter, templater, data) { | ||
93 | + $(selecter).html(common.util.__template2($("#" + templater).html(), data)); | ||
94 | + }, | ||
95 | + //弹框 | ||
96 | + toast: function (url, module, hint) { | ||
97 | + Bll.module = module; | ||
98 | + var d = new common.dialog({ | ||
99 | + title: hint, | ||
100 | + content: common.util.__template2($("#template").html(), Bll.module), | ||
101 | + width: '30%', | ||
102 | + button: [ | ||
103 | + { | ||
104 | + value: "保存", | ||
105 | + callback: function () { | ||
106 | + if (edit.validate()) { | ||
107 | + common.util.__ajax({ | ||
108 | + url: url, | ||
109 | + data: Bll.module | ||
110 | + }, function (res) { | ||
111 | + if (res.code == '200') { | ||
112 | + g.reload(); | ||
113 | + d.close(); | ||
114 | + } | ||
115 | + else { | ||
116 | + common.util.__tip(res.message, "warning"); | ||
117 | + } | ||
118 | + }); | ||
119 | + } | ||
120 | + return false; | ||
121 | + }, | ||
122 | + css: "btn-primary" | ||
123 | + }, | ||
124 | + { | ||
125 | + "value": "取消", | ||
126 | + "css": "btn-info" | ||
127 | + } | ||
128 | + ] | ||
129 | + }); | ||
130 | + Bll.__editRender(); | ||
131 | + }, | ||
132 | + renderDialog: function (templater) { | ||
133 | + Bll.__render(".modal-body", templater, Bll.module); | ||
134 | + Bll.__editRender(); | ||
135 | + }, | ||
136 | + __editRender: function () { | ||
137 | + edit.init(); | ||
138 | + | ||
139 | + } | ||
140 | +}; | ||
141 | +/** | ||
142 | + * 监听输入框变化 | ||
143 | + */ | ||
144 | +$(document).on("change", ".observe", function () { | ||
145 | + var $this = $(this); | ||
146 | + var name = $this.data("field"); | ||
147 | + Bll.module = common.util.__buildobj(name, '.', Bll.module, function (obj, name1) { | ||
148 | + obj[name1] = $this.val(); | ||
149 | + }); | ||
150 | +}); | ||
151 | + | ||
152 | +/** | ||
153 | + * 添加--点击事件 | ||
154 | + */ | ||
155 | +$('#addHotBrand').on('click', function () { | ||
156 | + var item = { | ||
157 | + "brandName": "", | ||
158 | + "orderBy": 1, | ||
159 | + "status": 0 | ||
160 | + }; | ||
161 | + Bll.toast("/hotSearchBrand/addHotBrand", item, "添加"); | ||
162 | +}); | ||
163 | + | ||
164 | +/** | ||
165 | + * 编辑--点击事件 | ||
166 | + */ | ||
167 | +$(document).on('click', '.update', function () { | ||
168 | + var item = g.rows[$(this).data("index")]; | ||
169 | + var item1 = { | ||
170 | + id: item.id, | ||
171 | + brandName: item.brandName, | ||
172 | + status: item.status, | ||
173 | + orderBy: item.orderBy | ||
174 | + }; | ||
175 | + Bll.toast('/hotSearchBrand/updateHotBrand', item1, "修改"); | ||
176 | +}); | ||
177 | + | ||
178 | +/** | ||
179 | + * 删除--点击事件 | ||
180 | + */ | ||
181 | +$(document).on('click', '.delete', function () { | ||
182 | + var item = g.rows[$(this).data("index")]; | ||
183 | + common.dialog.confirm("警告", | ||
184 | + "确认删除?", | ||
185 | + function () { | ||
186 | + common.util.__ajax({ | ||
187 | + url: '/hotSearchBrand/delHotBrand', | ||
188 | + data: { | ||
189 | + id: item.id | ||
190 | + } | ||
191 | + }, function () { | ||
192 | + g.reload(); | ||
193 | + }); | ||
194 | + }); | ||
195 | +}); | ||
196 | + | ||
197 | +/** | ||
198 | + * 查询按钮--点击事件 | ||
199 | + */ | ||
200 | +$(document).on('click', '#filter-btn', function () { | ||
201 | + g.reload(1); | ||
202 | +}); |
server/interface/hotBrands.js
0 → 100644
1 | +/** | ||
2 | + * Created by jiangmin on 16/5/11. | ||
3 | + * 热门品牌搜索词 | ||
4 | + */ | ||
5 | + | ||
6 | +//接口主域 | ||
7 | +//exports.domain = require('../config/common.js').domain; | ||
8 | +exports.domain = "http://172.16.6.214:8088/platform"; | ||
9 | +//路由配置 | ||
10 | +exports.res = [ | ||
11 | + { | ||
12 | + //搜索词页面渲染 | ||
13 | + route: '/hotSearchBrand/queryHotBrandList', | ||
14 | + method: 'GET', | ||
15 | + view: 'pages/hotBrands/index', | ||
16 | + src: '/hotBrands/index' | ||
17 | + }, | ||
18 | + //搜索词列表 | ||
19 | + { | ||
20 | + route: '/hotSearchBrand/queryHotBrandList1', | ||
21 | + method: 'POST', | ||
22 | + url: '/hotSearchBrand/queryHotBrandList', | ||
23 | + params: [ | ||
24 | + {name: 'page', type: 'Number', def: '1'}, | ||
25 | + {name: 'size', type: 'Number', def: '10'}, | ||
26 | + {name: 'brandName', type: 'String'}, | ||
27 | + {name: 'status', type: 'Number'} | ||
28 | + ] | ||
29 | + }, | ||
30 | + { | ||
31 | + //添加搜索词 | ||
32 | + route: '/hotSearchBrand/addHotBrand', | ||
33 | + method: 'POST', | ||
34 | + url: '/hotSearchBrand/addHotBrand', | ||
35 | + params: [ | ||
36 | + {name: 'brandName', type: 'String'}, | ||
37 | + {name: 'orderBy', type: 'Number'}, | ||
38 | + {name: 'status', type: 'Number'} | ||
39 | + ] | ||
40 | + }, | ||
41 | + { | ||
42 | + //搜索词修改 | ||
43 | + route: '/hotSearchBrand/updateHotBrand', | ||
44 | + method: 'POST', | ||
45 | + url: '/hotSearchBrand/updateHotBrand', | ||
46 | + params: [ | ||
47 | + {name: 'id', type: 'Number'}, | ||
48 | + {name: 'brandName', type: 'String'}, | ||
49 | + {name: 'orderBy', type: 'Number'}, | ||
50 | + {name: 'status', type: 'Number'} | ||
51 | + | ||
52 | + ] | ||
53 | + }, | ||
54 | + { | ||
55 | + //删除 | ||
56 | + route: '/hotSearchBrand/delHotBrand', | ||
57 | + method: 'POST', | ||
58 | + url: '/hotSearchBrand/delHotBrand', | ||
59 | + params: [ | ||
60 | + {name: 'id', type: 'Number'} | ||
61 | + ] | ||
62 | + }, | ||
63 | + { | ||
64 | + //查询单个 | ||
65 | + route: '/hotSearchBrand/queryHotBrand', | ||
66 | + method: 'POST', | ||
67 | + url: '/hotSearchBrand/queryHotBrand', | ||
68 | + params: [ | ||
69 | + {name: 'id', type: 'Number'} | ||
70 | + ] | ||
71 | + } | ||
72 | +]; |
server/views/pages/hotBrands/index.html
0 → 100644
1 | +<!--反馈管理界面--> | ||
2 | +<div class="pageheader"> | ||
3 | + <div class="media"> | ||
4 | + <div class="pageicon pull-left"> | ||
5 | + <i class="fa fa-th-list"></i> | ||
6 | + </div> | ||
7 | + <div class="media-body"> | ||
8 | + <ul class="breadcrumb"> | ||
9 | + <li><a href=""><i class="glyphicon glyphicon-home"></i></a></li> | ||
10 | + <li><a href="">搜索词管理</a></li> | ||
11 | + <li>品牌热搜词管理</li> | ||
12 | + </ul> | ||
13 | + <div> | ||
14 | + <div style="width: 30%;float: left;"> | ||
15 | + <h4>品牌热搜词列表</h4> | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + </div> | ||
19 | + </div> | ||
20 | +</div> | ||
21 | + | ||
22 | +<div class="contentpanel"> | ||
23 | + <div class="panel panel-default" style="..."> | ||
24 | + <div class="panel-heading"> | ||
25 | + <a id="addHotBrand" class="btn btn-primary">添加</a> | ||
26 | + </div> | ||
27 | + <div class="panel-body"> | ||
28 | + <div class="row"> | ||
29 | + <div class="panel-col2"> | ||
30 | + <input type="text" value="" id="brandName-filter" placeholder="品牌" | ||
31 | + class="form-control"> | ||
32 | + </div> | ||
33 | + | ||
34 | + <div class="panel-col"> | ||
35 | + <select id="status-filter" class="form-control"> | ||
36 | + <option value="-1">选择状态</option> | ||
37 | + <option value="0">不可用</option> | ||
38 | + <option value="1">可用</option> | ||
39 | + </select> | ||
40 | + </div> | ||
41 | + <div class="panel-col"> | ||
42 | + <a id="filter-btn" href="javascript:;" class="btn btn-info">查询</a> | ||
43 | + <a id="filter-all" href="/hotSearchBrand/queryHotBrandList" class="btn btn-info">全部</a> | ||
44 | + </div> | ||
45 | + </div> | ||
46 | + </div> | ||
47 | + </div> | ||
48 | + <div id="content-list"></div> | ||
49 | +</div> | ||
50 | +<!--内容--> | ||
51 | +<script type="text/template" id="template"> | ||
52 | + <div id="content"> | ||
53 | + <div class="form-group"> | ||
54 | + <label for="brandName" class="col-sm-2 control-label"><i class="red">*</i> 品牌名</label> | ||
55 | + | ||
56 | + <div class="col-sm-10"> | ||
57 | + <input type="text" name="" value="[[brandName]]" id="brandName" class="form-control observe" required="required" | ||
58 | + data-field="brandName" placeholder="品牌名"> | ||
59 | + </div> | ||
60 | + </div> | ||
61 | + <div class="form-group"> | ||
62 | + <label for="orderBy" class="col-sm-2 control-label"><i class="red">*</i> 排序</label> | ||
63 | + | ||
64 | + <div class="col-sm-10"> | ||
65 | + <input type="number" name="" value="[[orderBy]]" id="orderBy" data-field="orderBy" class="form-control observe" required="required" | ||
66 | + placeholder="排序"> | ||
67 | + </div> | ||
68 | + </div> | ||
69 | + <div class="form-group"> | ||
70 | + <label class="col-sm-2 control-label"><span class="red">*</span> 状态</label> | ||
71 | + | ||
72 | + <div class="col-sm-8"> | ||
73 | + <label class="radio-inline"> | ||
74 | + <input type="radio" name="status" class="observe" data-field="status" value="1" >可用 | ||
75 | + </label> | ||
76 | + <label class="radio-inline"> | ||
77 | + <input type="radio" name="status" class="observe" data-field="status" value="0">不可用 | ||
78 | + </label> | ||
79 | + </div> | ||
80 | + <input type="hidden" id="status" value="[[status]]" for="radio" required="required" | ||
81 | + class="observe" data-field="status" placeholder="状态"> | ||
82 | + </div> | ||
83 | + </div> | ||
84 | + | ||
85 | +</script> |
-
Please register or login to post a comment