|
@@ -15,7 +15,7 @@ function bindListPageEvent() { |
|
@@ -15,7 +15,7 @@ function bindListPageEvent() { |
15
|
const $statusSwitch = $('#status-switch');
|
15
|
const $statusSwitch = $('#status-switch');
|
16
|
const $publishForm = $('#publish-form');
|
16
|
const $publishForm = $('#publish-form');
|
17
|
const $noticeModal = $('#notice-modal');
|
17
|
const $noticeModal = $('#notice-modal');
|
18
|
- const $noticeInput = $noticeModal.find('.notice-input');
|
18
|
+ const $noticeForm = $noticeModal.find('#notice-form');
|
19
|
|
19
|
|
20
|
const searchFn = function() {
|
20
|
const searchFn = function() {
|
21
|
let val = $searchKey.val();
|
21
|
let val = $searchKey.val();
|
|
@@ -108,14 +108,41 @@ function bindListPageEvent() { |
|
@@ -108,14 +108,41 @@ function bindListPageEvent() { |
108
|
};
|
108
|
};
|
109
|
|
109
|
|
110
|
const noticeFn = function() {
|
110
|
const noticeFn = function() {
|
111
|
- let noticeVal = $noticeInput.val() || '';
|
111
|
+ let n = $noticeForm.serializeArray();
|
|
|
112
|
+ let notice = {};
|
|
|
113
|
+ let noticeVal = {};
|
|
|
114
|
+
|
|
|
115
|
+ $.each(n, function() {
|
|
|
116
|
+ notice[this.name] = this.value;
|
|
|
117
|
+ });
|
|
|
118
|
+
|
|
|
119
|
+
|
|
|
120
|
+ noticeVal.content = notice.content;
|
|
|
121
|
+
|
|
|
122
|
+ noticeVal.miniappBtnName = notice.miniappbtn;
|
|
|
123
|
+ noticeVal.miniappBtnType = notice.miniapptype;
|
|
|
124
|
+ if (+notice.miniapptype === 1) {
|
|
|
125
|
+ noticeVal.miniappTip = notice.miniapptip;
|
|
|
126
|
+ noticeVal.miniappCopy = notice.miniappcopy;
|
|
|
127
|
+ } else {
|
|
|
128
|
+ noticeVal.miniappLink = notice.miniapplink;
|
|
|
129
|
+ }
|
|
|
130
|
+
|
|
|
131
|
+ noticeVal.h5BtnName = notice.h5btn;
|
|
|
132
|
+ noticeVal.h5BtnType = notice.h5type;
|
|
|
133
|
+ if (+notice.h5type === 1) {
|
|
|
134
|
+ noticeVal.h5Tip = notice.h5tip;
|
|
|
135
|
+ noticeVal.h5Copy = notice.h5copy;
|
|
|
136
|
+ } else {
|
|
|
137
|
+ noticeVal.h5Link = notice.h5link;
|
|
|
138
|
+ }
|
112
|
|
139
|
|
113
|
$.ajax({
|
140
|
$.ajax({
|
114
|
method: 'post',
|
141
|
method: 'post',
|
115
|
url: '/admin/activity/zerobuy/notice',
|
142
|
url: '/admin/activity/zerobuy/notice',
|
116
|
data: {
|
143
|
data: {
|
117
|
id: $noticeModal.data('id'),
|
144
|
id: $noticeModal.data('id'),
|
118
|
- notice: noticeVal
|
145
|
+ notice: JSON.stringify(noticeVal)
|
119
|
}
|
146
|
}
|
120
|
}).then(res => {
|
147
|
}).then(res => {
|
121
|
if (res.code === 200) {
|
148
|
if (res.code === 200) {
|
|
@@ -143,6 +170,17 @@ function bindListPageEvent() { |
|
@@ -143,6 +170,17 @@ function bindListPageEvent() { |
143
|
});
|
170
|
});
|
144
|
};
|
171
|
};
|
145
|
|
172
|
|
|
|
173
|
+ const noticeBtnTypeChangeFn = function() {
|
|
|
174
|
+ let $this = $(this);
|
|
|
175
|
+ let $dom = $this.closest('.form-group').next('.input-switch-group');
|
|
|
176
|
+
|
|
|
177
|
+ if (+$this.val() === 1) {
|
|
|
178
|
+ $dom.removeClass('type-link');
|
|
|
179
|
+ } else {
|
|
|
180
|
+ $dom.addClass('type-link');
|
|
|
181
|
+ }
|
|
|
182
|
+ };
|
|
|
183
|
+
|
146
|
$('#search-btn').on('click', searchFn);
|
184
|
$('#search-btn').on('click', searchFn);
|
147
|
$('.status-switch').on('click', statusFn);
|
185
|
$('.status-switch').on('click', statusFn);
|
148
|
|
186
|
|
|
@@ -156,7 +194,20 @@ function bindListPageEvent() { |
|
@@ -156,7 +194,20 @@ function bindListPageEvent() { |
156
|
$confirm.modal('show');
|
194
|
$confirm.modal('show');
|
157
|
});
|
195
|
});
|
158
|
$('.btn-notice').on('click', function() {
|
196
|
$('.btn-notice').on('click', function() {
|
159
|
- $noticeInput.val($(this).parent().data('notice') || '');
|
197
|
+ let notice = $(this).parent().data('notice') || {};
|
|
|
198
|
+
|
|
|
199
|
+ $('input[name="content"]', $noticeForm).val(notice.content || '');
|
|
|
200
|
+ $('input[name="miniappbtn"]', $noticeForm).val(notice.miniappBtnName || '');
|
|
|
201
|
+ $('select[name="miniapptype"]', $noticeForm).val(notice.miniappBtnType || 1).change();
|
|
|
202
|
+ $('input[name="miniapptip"]', $noticeForm).val(notice.miniappTip || '');
|
|
|
203
|
+ $('input[name="miniappcopy"]', $noticeForm).val(notice.miniappCopy || '');
|
|
|
204
|
+ $('input[name="miniapplink"]', $noticeForm).val(notice.miniappLink || '');
|
|
|
205
|
+ $('input[name="h5btn"]', $noticeForm).val(notice.h5BtnName || '');
|
|
|
206
|
+ $('select[name="h5type"]', $noticeForm).val(notice.h5BtnType || 1).change();
|
|
|
207
|
+ $('input[name="h5tip"]', $noticeForm).val(notice.h5Tip || '');
|
|
|
208
|
+ $('input[name="h5copy"]', $noticeForm).val(notice.h5Copy || '');
|
|
|
209
|
+ $('input[name="h5link"]', $noticeForm).val(notice.h5Link || '');
|
|
|
210
|
+
|
160
|
$noticeModal.data('id', $(this).data('id'));
|
211
|
$noticeModal.data('id', $(this).data('id'));
|
161
|
$noticeModal.modal('show');
|
212
|
$noticeModal.modal('show');
|
162
|
});
|
213
|
});
|
|
@@ -164,6 +215,8 @@ function bindListPageEvent() { |
|
@@ -164,6 +215,8 @@ function bindListPageEvent() { |
164
|
|
215
|
|
165
|
$('.sure-publish-btn').on('click', publishFn);
|
216
|
$('.sure-publish-btn').on('click', publishFn);
|
166
|
$('.sure-notice-btn').on('click', noticeFn);
|
217
|
$('.sure-notice-btn').on('click', noticeFn);
|
|
|
218
|
+
|
|
|
219
|
+ $('.notice-btn-select').change(noticeBtnTypeChangeFn);
|
167
|
}
|
220
|
}
|
168
|
|
221
|
|
169
|
let uploadedFn;
|
222
|
let uploadedFn;
|