Authored by yyq

notice

@@ -159,7 +159,82 @@ @@ -159,7 +159,82 @@
159 <h3>编辑悬浮内容</h3> 159 <h3>编辑悬浮内容</h3>
160 </div> 160 </div>
161 <div class="modal-body"> 161 <div class="modal-body">
162 - <input type="text" class="form-control notice-input" placeholder="悬浮内容"> 162 + <form class="form-horizontal" id="notice-form">
  163 + <div class="form-group">
  164 + <span class="control-label col-md-2 col-xs-12">悬浮内容</span>
  165 + <div class="col-md-9 col-sm-6 col-xs-12">
  166 + <input type="text" class="form-control" name="content" placeholder="请输入悬浮内容">
  167 + </div>
  168 + </div>
  169 +
  170 + <div class="form-group">
  171 + <span class="control-label col-md-2 col-xs-12">小程序按钮</span>
  172 + <div class="col-md-5 col-sm-6 col-xs-12">
  173 + <input type="text" class="form-control col-md-4" name="miniappbtn" placeholder="请输入按钮名称">
  174 + </div>
  175 + <div class="col-md-4 col-sm-6 col-xs-12">
  176 + <select class="form-control col-md-4 notice-btn-select" name="miniapptype">
  177 + <option value="1">关注</option>
  178 + <option value="2">跳转</option>
  179 + </select>
  180 + </div>
  181 + </div>
  182 +
  183 + <div class="input-switch-group">
  184 + <div class="form-group tip-group">
  185 + <span class="control-label col-md-2 col-xs-12"></span>
  186 + <div class="col-md-9 col-sm-6 col-xs-12">
  187 + <input type="text" class="form-control" name="miniapptip" placeholder="请输入弹窗内容">
  188 + </div>
  189 + </div>
  190 + <div class="form-group tip-group">
  191 + <span class="control-label col-md-2 col-xs-12"></span>
  192 + <div class="col-md-9 col-sm-6 col-xs-12">
  193 + <input type="text" class="form-control" name="miniappcopy" placeholder="请输入点击复制内容">
  194 + </div>
  195 + </div>
  196 + <div class="form-group link-group">
  197 + <span class="control-label col-md-2 col-xs-12"></span>
  198 + <div class="col-md-9 col-sm-6 col-xs-12">
  199 + <input type="text" class="form-control" name="miniapplink" placeholder="请输入跳转链接">
  200 + </div>
  201 + </div>
  202 + </div>
  203 +
  204 + <div class="form-group">
  205 + <span class="control-label col-md-2 col-xs-12">H5按钮</span>
  206 + <div class="col-md-5 col-sm-6 col-xs-12">
  207 + <input type="text" class="form-control" name="h5btn" placeholder="请输入按钮名称">
  208 + </div>
  209 + <div class="col-md-4 col-sm-6 col-xs-12">
  210 + <select class="form-control notice-btn-select" name="h5type">
  211 + <option value="1">关注</option>
  212 + <option value="2">跳转</option>
  213 + </select>
  214 + </div>
  215 + </div>
  216 +
  217 + <div class="input-switch-group">
  218 + <div class="form-group tip-group">
  219 + <span class="control-label col-md-2 col-xs-12"></span>
  220 + <div class="col-md-9 col-sm-6 col-xs-12">
  221 + <input type="text" class="form-control" name="h5tip" placeholder="请输入弹窗内容">
  222 + </div>
  223 + </div>
  224 + <div class="form-group tip-group">
  225 + <span class="control-label col-md-2 col-xs-12"></span>
  226 + <div class="col-md-9 col-sm-6 col-xs-12">
  227 + <input type="text" class="form-control" name="h5copy" placeholder="请输入点击复制内容">
  228 + </div>
  229 + </div>
  230 + <div class="form-group link-group">
  231 + <span class="control-label col-md-2 col-xs-12"></span>
  232 + <div class="col-md-9 col-sm-6 col-xs-12">
  233 + <input type="text" class="form-control" name="h5link" placeholder="请输入跳转链接">
  234 + </div>
  235 + </div>
  236 + </div>
  237 + </form>
163 </div> 238 </div>
164 <div class="modal-footer"> 239 <div class="modal-footer">
165 <a class="btn btn-success" data-dismiss="modal">取消</a> 240 <a class="btn btn-success" data-dismiss="modal">取消</a>
@@ -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;
@@ -80,3 +80,15 @@ @@ -80,3 +80,15 @@
80 .floor-item:hover .del-item-btn { 80 .floor-item:hover .del-item-btn {
81 display: block; 81 display: block;
82 } 82 }
  83 +
  84 +.input-switch-group .link-group{
  85 + display: none;
  86 +}
  87 +
  88 +.input-switch-group.type-link .tip-group{
  89 + display: none;
  90 +}
  91 +
  92 +.input-switch-group.type-link .link-group{
  93 + display: block;
  94 +}