expand.hbs
7.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<div class="pageheader">
<div class="media">
<div class="pageicon pull-left">
<i class="fa fa-th-list"></i>
</div>
<div class="media-body">
<ul class="breadcrumb">
<li><a href="/"><i class="glyphicon glyphicon-home"></i></a></li>
<li><a href="/keywords/expand">关键词管理</a></li>
</ul>
<h4>关键词管理</h4>
</div>
</div>
<!-- media -->
</div>
<div class="contentpanel project-index-page" style="padding-bottom:0;">
<div class="panel panel-default">
<div class="panel-body">
<label style="margin-right:20px;"><input id="allSelected" type="checkbox" style="margin-right:5px;">全选</label>
<a class="btn btn-default deleteAll">删除</a>
<div class="input-append pull-right">
<form id="query-form" action="/keywords/expand" class="query-form" method="get">
<div class="btn-group">
<button class="btn" type="button">
品牌
</button>
<input class="span2 query-key" type="text" name="brand" value="{{brand}}">
<ul class="dropdown-menu brand-menu"></ul>
</div>
<div class="btn-group">
<button class="btn" type="button">
品类
</button>
<input class="span2 query-key" type="text" name="sort" value="{{brand}}">
<ul class="dropdown-menu sort-menu"></ul>
</div>
<div class="btn-group">
<button class="btn tn-default dropdown-toggle" data-toggle="dropdown">
{{typeName}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{{# typeList}}
<li><a href="?type={{type}}">{{name}}</a></li>
{{/ typeList}}
</ul>
<input class="span2 query-key" type="text" name="query" value="{{query}}">
</div>
<input type="hidden" name="type" value="{{type}}">
<button class="btn query-submit-btn" type="submit">搜索</button>
</form>
</div>
</div>
</div>
</div>
<div class="contentpanel project-index-page" style="padding-top:0;">
<div class="panel panel-default">
<div class="panel-body">
<table id="table-oper-log" class="table table-striped table-bordered building-table">
<thead>
<tr>
<th>ID</th>
<th>关键词</th>
<th>词根</th>
<th>品牌</th>
<th>品类</th>
<th>商品数</th>
<th>是否推送</th>
<th>添加时间</th>
<th>操作</th>
</tr>
</thead>
{{# tabs}}
<tr>
<td>
<label><input type="checkbox" data-id={{id}} >{{id}}</label>
</td>
<td>
{{keyword}}
</td>
<td>
{{root}}
</td>
<td>
{{brand}}
</td>
<td>
{{sort}}
</td>
<td>
{{yoho_goods_num}}
</td>
<td>
{{is_push}}
</td>
<td>
{{add_time}}
</td>
<td>
<button class="btn btn-default nostyle delete">删除</button>
</td>
</tr>
{{/ tabs}}
</table>
</div>
</div>
</div>
{{# pager}}
<div class="text-right">
<ul class="pagination">
{{# prePage}}
<li><a href="{{url}}">上一页</a></li>
{{/ prePage}}
{{# pages}}
<li class="{{#unless url}}disabled {{/unless}}{{#if cur}}active{{/if}}">
<a {{#if url}}href="{{url}}"{{^}}href="javascript:;"{{/if}}>{{num}}</a>
</li>
{{/ pages}}
{{# nextPage}}
<li><a href="{{url}}">下一页</a></li>
{{/ nextPage}}
</ul>
</div>
{{/ pager}}
<style>
.nostyle{
background: transparent;
}
input[type=checkbox]{
vertical-align: sub;
margin-right: 5px;
}
input[disabled]{
background: transparent;
border: none;
}
.text-right{
float: right;
margin-right: 20px;
margin-top:0;
}
.pages{
cursor: pointer;
}
.query-form .btn-group {
margin-bottom: 0;
margin-right: 5px;
}
.query-form .dropdown-toggle {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.query-form .query-key {
width: 300px;
height: 39px;
font-size: 14px;
vertical-align: middle;
outline: none;
}
.query-form .query-submit-btn {
height: 39px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.query-form .brand-menu,
.query-form .sort-menu {
right: 0px;
left: 59px;
}
</style>
<script>
var currentPage=1,pageCount=10,pageTotal;
var tabHead='<thead><tr><th>ID</th><th>关键词</th><th>操作</th></tr></thead>';
//删除
$(document).on('click', '.delete', function(){
var trDom = $(this).closest('tr');
var id = trDom.find('input[type="checkbox"]').data('id');
$.post('/keywords/expand/del', {ids:JSON.stringify([id])}, function(data){
if(data.code===200){
trDom.remove();
}
});
});
//全选
$('#allSelected').on('click', function(){
var check=false;
if($(this).attr('checked')){
check=true;
}
$("table :checkbox").attr("checked", check);
});
$('.deleteAll').on('click',function(){
let arr = [];
$("table :checkbox:checked").each(function(item){
arr.push($(this).data('id'));
});
if(!arr.length)return;
$.post('/keywords/expand/del', {ids:JSON.stringify(arr)}, function(data){
if(data.code===200){
location.reload();
}
});
});
$('.query-form .query-key').keydown(function(e){
if(e.keyCode === 13){
$('.query-form').submit(); //处理事件
return false;
}
});
</script>