|
@@ -87,60 +87,41 @@ |
|
@@ -87,60 +87,41 @@ |
87
|
var that = this;
|
87
|
var that = this;
|
88
|
|
88
|
|
89
|
this.$base = $('.contentpanel');
|
89
|
this.$base = $('.contentpanel');
|
90
|
- this.$popTitle = $('.cover-title', this.$base);
|
|
|
91
|
|
90
|
|
|
|
91
|
+ // 单个删除
|
|
|
92
|
+ this.$base.on('click', '.del-btn', function() {
|
|
|
93
|
+ let $tr = $(this).closest('tr');
|
|
|
94
|
+ that.del([$tr.data()]).then(result => {
|
|
|
95
|
+ result && $tr.remove();
|
|
|
96
|
+ });
|
|
|
97
|
+ });
|
92
|
|
98
|
|
93
|
- this.$base.on('change', '#select-type', function() {
|
|
|
94
|
- if ($(this).val() === 'img') {
|
|
|
95
|
- that.$imgLink.removeClass('hide');
|
|
|
96
|
- } else {
|
|
|
97
|
- that.$imgLink.addClass('hide');
|
|
|
98
|
- }
|
|
|
99
|
- }).on('click', '.clear-input', function() {
|
|
|
100
|
- that.clearInput();
|
|
|
101
|
- }).on('click', '.sure-btn', function() {
|
|
|
102
|
- var data;
|
|
|
103
|
-
|
|
|
104
|
- if (that.saving) {
|
|
|
105
|
- return;
|
|
|
106
|
- }
|
|
|
107
|
-
|
|
|
108
|
- data = that.packReqData();
|
|
|
109
|
-
|
|
|
110
|
- if (!data) {
|
|
|
111
|
- that.$errTip.text('请填写完整友链信息');
|
|
|
112
|
- return;
|
|
|
113
|
- }
|
|
|
114
|
-
|
|
|
115
|
- that.saving = true;
|
99
|
+ // 删除全部
|
|
|
100
|
+ this.$base.on('click', '.delete-all', function() {
|
|
|
101
|
+ let arr = [];
|
116
|
|
102
|
|
117
|
- $.ajax({
|
|
|
118
|
- url: that.editInfo ? '/seo/friendlink/edit' : '/seo/friendlink/add',
|
|
|
119
|
- type: 'POST',
|
|
|
120
|
- data: data,
|
|
|
121
|
- }).done(function(res) {
|
|
|
122
|
- if (res.code === 200) {
|
|
|
123
|
- history.go(0);
|
|
|
124
|
- }
|
|
|
125
|
- }).always(function() {
|
|
|
126
|
- that.saving = false;
|
|
|
127
|
- });
|
103
|
+ $('.tab-task input[type=checkbox]:checked').each(function(){
|
|
|
104
|
+ arr.push($(this).closest('tr').data());
|
128
|
});
|
105
|
});
|
129
|
|
106
|
|
130
|
- // 单个删除
|
|
|
131
|
- this.$base.on('click', '.del-btn', function() {
|
|
|
132
|
- let $tr = $(this).closest('tr');
|
|
|
133
|
- that.del($tr.data()).then(() => {
|
|
|
134
|
- $tr.remove();
|
107
|
+ that.del(arr).then(result => {
|
|
|
108
|
+ result && history.go(0);
|
135
|
});
|
109
|
});
|
136
|
});
|
110
|
});
|
137
|
},
|
111
|
},
|
138
|
del: function(data) {
|
112
|
del: function(data) {
|
139
|
- return $.ajax({
|
113
|
+ if (confirm('您确定要删除吗!!!') && data.length) {
|
|
|
114
|
+ return this.ajax({
|
140
|
url: '/seo/task/del',
|
115
|
url: '/seo/task/del',
|
141
|
type: 'POST',
|
116
|
type: 'POST',
|
142
|
- data: data,
|
117
|
+ data: {data: JSON.stringify(data)},
|
143
|
});
|
118
|
});
|
|
|
119
|
+ } else {
|
|
|
120
|
+ return Promise.resolve(false);
|
|
|
121
|
+ }
|
|
|
122
|
+ },
|
|
|
123
|
+ ajax: function(options) {
|
|
|
124
|
+ return Promise.resolve($.ajax(options));
|
144
|
}
|
125
|
}
|
145
|
};
|
126
|
};
|
146
|
|
127
|
|