|
|
<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;
|
|
|
}
|
|
|
|
|
|
.seo-tdk-page .text-limit {
|
|
|
max-width: 78px;
|
|
|
display: inline-block;
|
|
|
vertical-align: top;
|
|
|
overflow: hidden;
|
|
|
text-overflow: ellipsis;
|
|
|
white-space: nowrap;
|
|
|
}
|
|
|
|
|
|
.seo-tdk-page .pagination {
|
|
|
margin: 0;
|
|
|
}
|
|
|
|
|
|
.seo-tdk-page #table-tdk th,
|
|
|
.seo-tdk-page #table-tdk td {
|
|
|
height: 36px;
|
|
|
}
|
|
|
|
|
|
.seo-tdk-page #pop{
|
|
|
width:500px;
|
|
|
height: 434px;
|
|
|
background: #fff;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
top: 0;
|
|
|
bottom: 0;
|
|
|
margin:auto;
|
|
|
}
|
|
|
|
|
|
.seo-tdk-page #pop .cover-title {
|
|
|
position: absolute;
|
|
|
background: #fff;
|
|
|
margin-top: -34px;
|
|
|
}
|
|
|
|
|
|
.seo-tdk-page #pop .control-label {
|
|
|
width: 60px;
|
|
|
text-align: right;
|
|
|
}
|
|
|
|
|
|
.seo-tdk-page #pop li {
|
|
|
padding: 6px 0;
|
|
|
}
|
|
|
|
|
|
.seo-tdk-page #pop select,
|
|
|
.seo-tdk-page #pop input {
|
|
|
height: 30px;
|
|
|
width: 200px;
|
|
|
}
|
|
|
|
|
|
.seo-tdk-page #pop textarea {
|
|
|
height: 70px;
|
|
|
vertical-align: text-top;
|
|
|
border-color: #ccc;
|
|
|
resize: none;
|
|
|
}
|
|
|
|
|
|
.seo-tdk-page #pop .full-w {
|
|
|
width: 390px;
|
|
|
}
|
|
|
|
|
|
.seo-tdk-page #pop .controls {
|
|
|
display: inline-block;
|
|
|
}
|
|
|
|
|
|
.seo-tdk-page #pop .err-tip {
|
|
|
color: #a94442;
|
|
|
}
|
|
|
</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 data-toggle="modal" href="/seo/rootwords/add" class="btn btn-default" style="margin-right:10px;">增加</a>
|
|
|
<button class="btn btn-default delete-all" type="submit">删除</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-tdk" 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" width="120">操作</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
{{#each tdkList}}
|
|
|
<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;">{{id}}</td>
|
|
|
<td class="text-center" title="{{typeName}}({{typeLt}}:{{key}})">{{typeName}}({{typeLt}}:<span class="text-limit">{{key}}</span>)</td>
|
|
|
<td>{{title}}</td>
|
|
|
<td>{{keywords}}</td>
|
|
|
<td>{{description}}</td>
|
|
|
<td class="text-center">
|
|
|
<a href="#pop" class="edit-tdk-btn" data-toggle="modal">编辑</a>
|
|
|
<a href="javascript:;" class="del-tdk-btn">删除</a>
|
|
|
</td>
|
|
|
</tr>
|
|
|
{{/each}}
|
|
|
{{#unless tdkList}}
|
|
|
<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 id="pop" class="modal fade in" style="display: none;">
|
|
|
<div class="modal-header">
|
|
|
<a class="close clear-input" data-dismiss="modal">×</a>
|
|
|
<h4>添加TDK</h4>
|
|
|
<h4 class="cover-title"></h4>
|
|
|
</div>
|
|
|
<div class="modal-body">
|
|
|
<ul>
|
|
|
<li>
|
|
|
<label class="control-label" for="select-type">类型:</label>
|
|
|
<div class="controls">
|
|
|
<select id="select-type">
|
|
|
{{# typeList}}
|
|
|
<option value="{{type}}">{{name}}</option>
|
|
|
{{/ typeList}}
|
|
|
</select>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li>
|
|
|
<label class="control-label key-label" for="input-key">SKN:</label>
|
|
|
<div class="controls">
|
|
|
<input type="text" id="input-key">
|
|
|
</div>
|
|
|
</li>
|
|
|
<li>
|
|
|
<label class="control-label" for="input-title">标题:</label>
|
|
|
<div class="controls">
|
|
|
<input type="text" id="input-title" class="full-w">
|
|
|
</div>
|
|
|
</li>
|
|
|
<li>
|
|
|
<label class="control-label" for="input-keywords">关键词:</label>
|
|
|
<div class="controls">
|
|
|
<input type="text" id="input-keywords" class="full-w">
|
|
|
</div>
|
|
|
</li>
|
|
|
<li>
|
|
|
<label class="control-label" for="input-description">描述:</label>
|
|
|
<div class="controls">
|
|
|
<textarea id="input-description" class="full-w"></textarea>
|
|
|
</div>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<div class="modal-footer">
|
|
|
<span class="err-tip"></span>
|
|
|
<a class="btn clear-input close-pop-btn" data-dismiss="modal">关闭</a>
|
|
|
<a class="btn btn-primary sure-btn">确定</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<script>
|
|
|
var pop = {
|
|
|
ltList: {
|
|
|
skn: 'SKN:',
|
|
|
article: 'ID:',
|
|
|
shop: 'ShopId:',
|
|
|
url: 'URL:'
|
|
|
},
|
|
|
init: function() {
|
|
|
var that = this;
|
|
|
|
|
|
this.$base = $('#pop');
|
|
|
this.$popTitle = $('.cover-title', this.$base);
|
|
|
this.$keyLabel = $('.key-label', this.$base);
|
|
|
this.$type = $('#select-type', this.$base);
|
|
|
this.$key = $('#input-key', this.$base);
|
|
|
this.$title = $('#input-title', this.$base);
|
|
|
this.$keywords = $('#input-keywords', this.$base);
|
|
|
this.$description = $('#input-description', this.$base);
|
|
|
|
|
|
this.$closeBtn = $('.close-pop-btn', this.$base);
|
|
|
this.$errTip = $('.err-tip', this.$base);
|
|
|
|
|
|
this.$base.on('change', '#select-type', function() {
|
|
|
that.$keyLabel.text(that.ltList[$(this).val()] || that.ltList.skn);
|
|
|
}).on('click', '.clear-input', function() {
|
|
|
that.clearInput();
|
|
|
}).on('click', '.sure-btn', function() {
|
|
|
var data;
|
|
|
|
|
|
if (that.saving) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
data = that.packReqData();
|
|
|
|
|
|
if (!data) {
|
|
|
that.$errTip.text('请填写完整tdk信息');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
that.saving = true;
|
|
|
|
|
|
$.ajax({
|
|
|
url: that.editInfo ? '/seo/tdk/edit' : '/seo/tdk/add',
|
|
|
type: 'POST',
|
|
|
data: data,
|
|
|
}).done(function(res) {
|
|
|
if (res.code === 200) {
|
|
|
history.go(0);
|
|
|
}
|
|
|
}).always(function() {
|
|
|
that.saving = false;
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
clearInput: function() {
|
|
|
this.editInfo = false;
|
|
|
this.$popTitle.empty();
|
|
|
this.$errTip.empty();
|
|
|
this.$type.val('skn').change();
|
|
|
this.$type.removeAttr('disabled')
|
|
|
this.$key.removeAttr('readonly');
|
|
|
$('input, textarea', this.$base).val('');
|
|
|
},
|
|
|
fillInput(info) {
|
|
|
if (info) {
|
|
|
this.editInfo = info;
|
|
|
this.$popTitle.text('编辑TDK');
|
|
|
this.$type.val(info.type).change().attr('disabled', true);
|
|
|
this.$key.attr('readonly', 'readonly').val(info.key);
|
|
|
this.$title.val(info.title);
|
|
|
this.$keywords.val(info.keywords);
|
|
|
this.$description.val(info.description);
|
|
|
}
|
|
|
this.$base.show();
|
|
|
},
|
|
|
packReqData() {
|
|
|
var data = {
|
|
|
type: this.$type.val(),
|
|
|
key: $.trim(this.$key.val()),
|
|
|
title: $.trim(this.$title.val()),
|
|
|
keywords: $.trim(this.$keywords.val()),
|
|
|
description: $.trim(this.$description.val())
|
|
|
};
|
|
|
var i;
|
|
|
|
|
|
if (this.editInfo) {
|
|
|
data.type = this.editInfo.type;
|
|
|
data.key = this.editInfo.key;
|
|
|
}
|
|
|
|
|
|
for (i in data) {
|
|
|
if (data.hasOwnProperty(i) && !data[i]) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return data;
|
|
|
},
|
|
|
close() {
|
|
|
this.$closeBtn.trigger('click');
|
|
|
}
|
|
|
};
|
|
|
|
|
|
$(function(){
|
|
|
var $checkboxs = $('#table-tdk :checkbox');
|
|
|
var deling;
|
|
|
|
|
|
pop.init();
|
|
|
|
|
|
function delTdk(data) {
|
|
|
deling = true;
|
|
|
|
|
|
$.ajax({
|
|
|
url: '/seo/tdk/delete',
|
|
|
type: 'POST',
|
|
|
data: {list: data},
|
|
|
}).done(function(res) {
|
|
|
if (res.code === 200) {
|
|
|
history.go(0);
|
|
|
}
|
|
|
}).always(function() {
|
|
|
deling = false;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
$('#check-all').click(function() {
|
|
|
if ($(this).attr('checked') === 'checked') {
|
|
|
$checkboxs.attr('checked', 'checked');
|
|
|
} else {
|
|
|
$checkboxs.removeAttr('checked');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$('.delete-all').click(function() {
|
|
|
var arr = [];
|
|
|
|
|
|
$('#table-tdk :checkbox:checked').each(function(){
|
|
|
arr.push($(this).closest('tr').data());
|
|
|
});
|
|
|
arr.length ? delTdk(arr) : false;
|
|
|
});
|
|
|
|
|
|
$('#table-tdk').on('click', '.edit-tdk-btn', function(e) {
|
|
|
pop.fillInput($(e.target).closest('tr').data());
|
|
|
}).on('click', '.del-tdk-btn', function(e) {
|
|
|
var data = $(e.target).closest('tr').data();
|
|
|
|
|
|
delTdk([data]);
|
|
|
});
|
|
|
});
|
|
|
</script> |
...
|
...
|
|