...
|
...
|
@@ -87,60 +87,41 @@ |
|
|
var that = this;
|
|
|
|
|
|
this.$base = $('.contentpanel');
|
|
|
this.$popTitle = $('.cover-title', this.$base);
|
|
|
|
|
|
|
|
|
this.$base.on('change', '#select-type', function() {
|
|
|
if ($(this).val() === 'img') {
|
|
|
that.$imgLink.removeClass('hide');
|
|
|
} else {
|
|
|
that.$imgLink.addClass('hide');
|
|
|
}
|
|
|
}).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('请填写完整友链信息');
|
|
|
return;
|
|
|
}
|
|
|
// 单个删除
|
|
|
this.$base.on('click', '.del-btn', function() {
|
|
|
let $tr = $(this).closest('tr');
|
|
|
that.del([$tr.data()]).then(result => {
|
|
|
result && $tr.remove();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
that.saving = true;
|
|
|
// 删除全部
|
|
|
this.$base.on('click', '.delete-all', function() {
|
|
|
let arr = [];
|
|
|
|
|
|
$.ajax({
|
|
|
url: that.editInfo ? '/seo/friendlink/edit' : '/seo/friendlink/add',
|
|
|
type: 'POST',
|
|
|
data: data,
|
|
|
}).done(function(res) {
|
|
|
if (res.code === 200) {
|
|
|
history.go(0);
|
|
|
}
|
|
|
}).always(function() {
|
|
|
that.saving = false;
|
|
|
$('.tab-task input[type=checkbox]:checked').each(function(){
|
|
|
arr.push($(this).closest('tr').data());
|
|
|
});
|
|
|
});
|
|
|
|
|
|
// 单个删除
|
|
|
this.$base.on('click', '.del-btn', function() {
|
|
|
let $tr = $(this).closest('tr');
|
|
|
that.del($tr.data()).then(() => {
|
|
|
$tr.remove();
|
|
|
that.del(arr).then(result => {
|
|
|
result && history.go(0);
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
del: function(data) {
|
|
|
return $.ajax({
|
|
|
url: '/seo/task/del',
|
|
|
type: 'POST',
|
|
|
data: data,
|
|
|
});
|
|
|
if (confirm('您确定要删除吗!!!') && data.length) {
|
|
|
return this.ajax({
|
|
|
url: '/seo/task/del',
|
|
|
type: 'POST',
|
|
|
data: {data: JSON.stringify(data)},
|
|
|
});
|
|
|
} else {
|
|
|
return Promise.resolve(false);
|
|
|
}
|
|
|
},
|
|
|
ajax: function(options) {
|
|
|
return Promise.resolve($.ajax(options));
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
|