seo_root_words.hbs
7.02 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
226
227
228
229
230
<style>
.seo-tdk-page ul {
padding: 0;
}
.seo-tdk-page li {
list-style: none;
}
.seo-tdk-page .query-form {
font-size: 0;
}
.seo-tdk-page .query-form .btn-group {
margin-bottom: 0;
}
.seo-tdk-page .query-form .dropdown-toggle {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.seo-tdk-page .query-form .query-submit-btn {
height: 39px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.seo-tdk-page .query-key {
width: 300px;
height: 39px;
font-size: 14px;
vertical-align: middle;
outline: none;
}
</style>
<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="/seo/tdk">{{title}}</a></li>
<li>{{typeName}}</li>
</ul>
<h4>{{title}}</h4>
</div>
</div>
<!-- media -->
</div>
<!-- pageheader -->
<div class="contentpanel seo-tdk-page" style="padding-bottom:0;">
<div class="panel panel-default">
<div class="panel-body">
<label style="margin-right:20px;"><input type="checkbox" id="check-all" style="margin-right:5px;">全选</label>
<a href="/seo/rootwords/add" class="btn btn-default" style="margin-right:10px;">增加</a>
<button class="btn btn-default delete-all" type="submit" id="del-all">删除</button>
<button class="btn btn-default delete-all" type="submit" id="root-to-keywords">词根计入关键词</button>
<div class="input-append pull-right">
<form id="query-form" action="/seo/tdk" class="query-form" method="get">
<div class="btn-group">
<button class="btn 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>
</div>
<input type="hidden" name="type" value="{{type}}">
<input class="span2 query-key" type="text" name="query" value="{{query}}">
<button class="btn query-submit-btn" type="submit">搜索</button>
</form>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
<table id="table-root-words" class="table table-striped table-bordered responsive">
<thead>
<tr>
<th class="text-center" width="60">ID</th>
<th class="text-center" width="160">词根</th>
<th class="text-center">品牌</th>
<th class="text-center">品类</th>
<th class="text-center">过滤词</th>
<th class="text-center">已拓词</th>
<th class="text-center" width="120">操作</th>
</tr>
</thead>
<tbody>
{{#each list}}
<tr data-type="{{../type}}" data-key="{{key}}" data-title="{{title}}" data-keywords="{{keywords}}" data-description="{{description}}">
<td class="text-center"><input type="checkbox" style="margin-right:5px;" value="{{id}}">{{id}}</td>
<td class="text-center">{{keyword}}</td>
<td>{{brand_name}}</td>
<td>{{sort_name}}</td>
<td>{{filter_words}}</td>
<td>{{#if is_expand}}是{{^}}否{{/if}}</td>
<td class="text-center">
<a href="javascript:delRootWords({{id}});" class="del-tdk-btn">删除</a>
</td>
</tr>
{{/each}}
{{#unless list}}
<tr>
<td class="text-center" colspan="6">暂无数据</td>
</tr>
{{/unless}}
</tbody>
</table>
{{# pager}}
<div class="text-right">
{{#if pages}}
<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>
{{/if}}
</div>
{{/ pager}}
</div>
</div>
</div>
<script>
var $checkAll = $('#check-all'),
$wordsCheckbox = $('#table-root-words input:checkbox'),
$delAll= $('#del-all');
$rootToKeywords= $('#root-to-keywords');
// 全选/反选
$checkAll.on('click', function(){
$wordsCheckbox.each(function() {
$(this).trigger('click');
})
})
// 批量删除
$delAll.on('click', function(){
var ids = [];
$wordsCheckbox.each(function() {
if ($(this)[0].checked) {
ids.push($(this).val());
}
})
if (ids.length > 0) {
delRootWords(ids.join(','));
} else {
alert('先选择词根');
}
})
// 删除
function delRootWords(ids) {
confirm('确认删除?');
$.ajax({
url: '/seo/rootwords/delete',
dataType: 'json',
type: 'POST',
data: {
ids: ids
},
success: function(data) {
window.location.reload();
},
error: function(err) {
console.log(err);
}
});
}
// 批量删除
$rootToKeywords.on('click', function(){
var ids = [];
$wordsCheckbox.each(function() {
if ($(this)[0].checked) {
ids.push($(this).val());
}
})
if (ids.length > 0) {
rootToKeywords(ids.join(','));
} else {
alert('先选择词根');
}
})
// 词根计入关键词
function rootToKeywords(ids) {
confirm('确认计入关键词?');
$.ajax({
url: '/seo/rootwords/rootToKeywords',
dataType: 'json',
type: 'POST',
data: {
ids: ids
},
success: function(data) {
window.location.reload();
},
error: function(err) {
console.log(err);
}
});
}
</script>