Authored by yyq

notice

... ... @@ -159,7 +159,82 @@
<h3>编辑悬浮内容</h3>
</div>
<div class="modal-body">
<input type="text" class="form-control notice-input" placeholder="悬浮内容">
<form class="form-horizontal" id="notice-form">
<div class="form-group">
<span class="control-label col-md-2 col-xs-12">悬浮内容</span>
<div class="col-md-9 col-sm-6 col-xs-12">
<input type="text" class="form-control" name="content" placeholder="请输入悬浮内容">
</div>
</div>
<div class="form-group">
<span class="control-label col-md-2 col-xs-12">小程序按钮</span>
<div class="col-md-5 col-sm-6 col-xs-12">
<input type="text" class="form-control col-md-4" name="miniappbtn" placeholder="请输入按钮名称">
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<select class="form-control col-md-4 notice-btn-select" name="miniapptype">
<option value="1">关注</option>
<option value="2">跳转</option>
</select>
</div>
</div>
<div class="input-switch-group">
<div class="form-group tip-group">
<span class="control-label col-md-2 col-xs-12"></span>
<div class="col-md-9 col-sm-6 col-xs-12">
<input type="text" class="form-control" name="miniapptip" placeholder="请输入弹窗内容">
</div>
</div>
<div class="form-group tip-group">
<span class="control-label col-md-2 col-xs-12"></span>
<div class="col-md-9 col-sm-6 col-xs-12">
<input type="text" class="form-control" name="miniappcopy" placeholder="请输入点击复制内容">
</div>
</div>
<div class="form-group link-group">
<span class="control-label col-md-2 col-xs-12"></span>
<div class="col-md-9 col-sm-6 col-xs-12">
<input type="text" class="form-control" name="miniapplink" placeholder="请输入跳转链接">
</div>
</div>
</div>
<div class="form-group">
<span class="control-label col-md-2 col-xs-12">H5按钮</span>
<div class="col-md-5 col-sm-6 col-xs-12">
<input type="text" class="form-control" name="h5btn" placeholder="请输入按钮名称">
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<select class="form-control notice-btn-select" name="h5type">
<option value="1">关注</option>
<option value="2">跳转</option>
</select>
</div>
</div>
<div class="input-switch-group">
<div class="form-group tip-group">
<span class="control-label col-md-2 col-xs-12"></span>
<div class="col-md-9 col-sm-6 col-xs-12">
<input type="text" class="form-control" name="h5tip" placeholder="请输入弹窗内容">
</div>
</div>
<div class="form-group tip-group">
<span class="control-label col-md-2 col-xs-12"></span>
<div class="col-md-9 col-sm-6 col-xs-12">
<input type="text" class="form-control" name="h5copy" placeholder="请输入点击复制内容">
</div>
</div>
<div class="form-group link-group">
<span class="control-label col-md-2 col-xs-12"></span>
<div class="col-md-9 col-sm-6 col-xs-12">
<input type="text" class="form-control" name="h5link" placeholder="请输入跳转链接">
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<a class="btn btn-success" data-dismiss="modal">取消</a>
... ...
... ... @@ -15,7 +15,7 @@ function bindListPageEvent() {
const $statusSwitch = $('#status-switch');
const $publishForm = $('#publish-form');
const $noticeModal = $('#notice-modal');
const $noticeInput = $noticeModal.find('.notice-input');
const $noticeForm = $noticeModal.find('#notice-form');
const searchFn = function() {
let val = $searchKey.val();
... ... @@ -108,14 +108,41 @@ function bindListPageEvent() {
};
const noticeFn = function() {
let noticeVal = $noticeInput.val() || '';
let n = $noticeForm.serializeArray();
let notice = {};
let noticeVal = {};
$.each(n, function() {
notice[this.name] = this.value;
});
noticeVal.content = notice.content;
noticeVal.miniappBtnName = notice.miniappbtn;
noticeVal.miniappBtnType = notice.miniapptype;
if (+notice.miniapptype === 1) {
noticeVal.miniappTip = notice.miniapptip;
noticeVal.miniappCopy = notice.miniappcopy;
} else {
noticeVal.miniappLink = notice.miniapplink;
}
noticeVal.h5BtnName = notice.h5btn;
noticeVal.h5BtnType = notice.h5type;
if (+notice.h5type === 1) {
noticeVal.h5Tip = notice.h5tip;
noticeVal.h5Copy = notice.h5copy;
} else {
noticeVal.h5Link = notice.h5link;
}
$.ajax({
method: 'post',
url: '/admin/activity/zerobuy/notice',
data: {
id: $noticeModal.data('id'),
notice: noticeVal
notice: JSON.stringify(noticeVal)
}
}).then(res => {
if (res.code === 200) {
... ... @@ -143,6 +170,17 @@ function bindListPageEvent() {
});
};
const noticeBtnTypeChangeFn = function() {
let $this = $(this);
let $dom = $this.closest('.form-group').next('.input-switch-group');
if (+$this.val() === 1) {
$dom.removeClass('type-link');
} else {
$dom.addClass('type-link');
}
};
$('#search-btn').on('click', searchFn);
$('.status-switch').on('click', statusFn);
... ... @@ -156,7 +194,20 @@ function bindListPageEvent() {
$confirm.modal('show');
});
$('.btn-notice').on('click', function() {
$noticeInput.val($(this).parent().data('notice') || '');
let notice = $(this).parent().data('notice') || {};
$('input[name="content"]', $noticeForm).val(notice.content || '');
$('input[name="miniappbtn"]', $noticeForm).val(notice.miniappBtnName || '');
$('select[name="miniapptype"]', $noticeForm).val(notice.miniappBtnType || 1).change();
$('input[name="miniapptip"]', $noticeForm).val(notice.miniappTip || '');
$('input[name="miniappcopy"]', $noticeForm).val(notice.miniappCopy || '');
$('input[name="miniapplink"]', $noticeForm).val(notice.miniappLink || '');
$('input[name="h5btn"]', $noticeForm).val(notice.h5BtnName || '');
$('select[name="h5type"]', $noticeForm).val(notice.h5BtnType || 1).change();
$('input[name="h5tip"]', $noticeForm).val(notice.h5Tip || '');
$('input[name="h5copy"]', $noticeForm).val(notice.h5Copy || '');
$('input[name="h5link"]', $noticeForm).val(notice.h5Link || '');
$noticeModal.data('id', $(this).data('id'));
$noticeModal.modal('show');
});
... ... @@ -164,6 +215,8 @@ function bindListPageEvent() {
$('.sure-publish-btn').on('click', publishFn);
$('.sure-notice-btn').on('click', noticeFn);
$('.notice-btn-select').change(noticeBtnTypeChangeFn);
}
let uploadedFn;
... ...
... ... @@ -80,3 +80,15 @@
.floor-item:hover .del-item-btn {
display: block;
}
.input-switch-group .link-group{
display: none;
}
.input-switch-group.type-link .tip-group{
display: none;
}
.input-switch-group.type-link .link-group{
display: block;
}
... ...