123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- {template 'common/header'}
- <ol class="breadcrumb we7-breadcrumb">
- <a href="{php echo url('article/notice/list');}"><i class="wi wi-back-circle"></i> </a>
- <li>
- <a href="{php echo url('article/notice/list');}">公告列表</a>
- </li>
- <li>
- 添加公告
- </li>
- </ol>
- {if $do == 'post'}
- <form action="{php echo url('article/notice/post');}" method="post" class="we7-form" role="form" id="form1">
- <input type="hidden" name="id" value="{$notice['id']}"/>
- <div class="form-group">
- <label class="col-sm-2 control-label">用户组</label>
- <div class="form-controls col-sm-8">
- <span class="users-group-selected">全部</span><span class="btn btn-link color-default" data-toggle="modal" data-target="#users-group">修改</span>
- <span class="help-block">请选择哪些用户组可见,不设置代表全部用户组可见</span>
- </div>
- </div>
-
- {if !empty($user_vice_founder_groups)}
- <div class="form-group">
- <label class="col-sm-2 control-label">副创始人用户组</label>
- <div class="form-controls col-sm-8">
- <span class="vice-founder-group-selected">全部</span><span class="btn btn-link color-default" data-toggle="modal" data-target="#vice-founder-group">修改</span>
- <span class="help-block">请选择哪些副创始人用户组可见,不设置代表全部副创始人用户组可见</span>
- </div>
- </div>
- {/if}
-
- <div class="form-group">
- <label class="col-sm-2 control-label">公告标题</label>
- <div class="form-controls col-sm-8">
- <input type="text" class="form-control" name="title" value="{$notice['title']}" placeholder="公告标题"/>
- <div class="help-block">请填写公告标题</div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">标题颜色</label>
- <div class="form-controls col-sm-8">
- {php echo tpl_form_field_color('style[color]', $notice['style']['color']);}
- <span class="help-block">标题颜色,在列表中显示对应颜色,默认随系统</span>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">标题加粗</label>
- <div class="form-controls col-sm-8">
- <input type="radio" name="style[bold]" id="is_bold-1" value="1" {if $notice['style']['bold'] == 1} checked{/if}>
- <label class="radio-inline" for="is_bold-1">是</label>
- <input type="radio" name="style[bold]" id="is_bold-0" value="0" {if $notice['style']['bold'] == 0} checked{/if}>
- <label class="radio-inline" for="is_bold-0"> 否</label>
- <span class="help-block">标题加粗,在列表中显示,默认不加粗</span>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">公告分类</label>
- <div class="form-controls col-sm-8">
- <select name="cateid" id="cateid" class="form-control">
- <option value="">==请选择公告分类==</option>
- {loop $categorys $category}
- <option value="{$category['id']}" {if $notice['cateid'] == $category['id']}selected{/if}>{$category['title']}</option>
- {/loop}
- </select>
- <div class="help-block">还没有分类,点我 <a href="{php echo url('article/notice/category_post');}" target="_blank"><i class="fa fa-plus-circle"></i> 添加分类</a></div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">内容</label>
- <div class="form-controls col-sm-8">
- {php echo tpl_ueditor('content', $notice['content']);}
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">阅读次数</label>
- <div class="form-controls col-sm-8">
- <input type="text" class="form-control" name="click" value="{$notice['click']}" placeholder="阅读次数"/>
- <div class="help-block">默认为0。您可以设置一个初始值,阅读次数会在该初始值上增加。</div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">排序</label>
- <div class="form-controls col-sm-8">
- <input type="number" class="form-control" name="displayorder" value="{$notice['displayorder']}" placeholder="排序" max="255"/>
- <div class="help-block">数字越大,越靠前,最大255。</div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">是否显示</label>
- <div class="form-controls col-sm-8">
- <input type="radio" id="is_display-1" name="is_display" value="1" {if $notice['is_display'] == 1} checked{/if}>
- <label class="radio-inline" for="is_display-1">显示</label>
- <input type="radio" name="is_display" id="is_display-0" value="0" {if $notice['is_display'] == 0} checked{/if}>
- <label class="radio-inline" for="is_display-0"> 不显示</label>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">显示在首页</label>
- <div class="form-controls col-sm-8">
- <input type="radio" name="is_show_home" id="is_show_home-1" value="1" {if $notice['is_show_home'] == 1} checked{/if}>
- <label class="radio-inline" for="is_show_home-1">是</label>
- <input type="radio" name="is_show_home" id="is_show_home-0" value="0" {if $notice['is_show_home'] == 0} checked{/if}>
- <label class="radio-inline" for="is_show_home-0"> 否</label>
- </div>
- </div>
- <div class="modal" id="users-group">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
- <h3 class="modal-title">选择用户组</h3>
- </div>
- <div class="modal-body we7-form">
- <div class="form-group">
- {if !empty($user_groups)}
- {loop $user_groups $key $group}
- <div class="col-sm-4">
- <div class="checkbox">
- <input id="check-child-{$key}" type="checkbox" value="{$group['id']}" name="group[]" {if in_array($group['id'], $notice['group']['normal'])}checked = "checked"{/if}>
- <label for="check-child-{$key}">{$group['name']}</label>
- </div>
- </div>
- {/loop}
- {else}
- <div class="text-center">暂无数据</div>
- {/if}
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-primary confirm-users-group">确认</button>
- <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal" id="vice-founder-group">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
- <h3 class="modal-title">选择副创始人组</h3>
- </div>
- <div class="modal-body we7-form">
- <div class="form-group">
- {if !empty($user_vice_founder_groups)}
- {loop $user_vice_founder_groups $key $vice_founder_group}
- <div class="col-sm-4">
- <div class="checkbox">
- <input id="check-child-{$key}-{$key}" type="checkbox" value="{$vice_founder_group['id']}" name="vice_founder_group[]" {if in_array($vice_founder_group['id'], $notice['group']['vice_founder'])}checked{/if}>
- <label for="check-child-{$key}-{$key}">{$vice_founder_group['name']}</label>
- </div>
- </div>
- {/loop}
- {else}
- <div class="text-center">暂无数据</div>
- {/if}
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-primary confirm-vice-founder-group">确认</button>
- <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
- </div>
- </div>
- </div>
- </div>
- <div class="col-sm-offset-2">
- <input type="submit" class="btn btn-primary" name="submit" value="提交" />
- <input type="hidden" name="token" value="{$_W['token']}" />
- </div>
- </form>
- {/if}
- <script>
- $(function(){
- var initChecked = function(type) {
- var type = type == 'users-group' ? 'users-group' : 'vice-founder-group';
- var inputtag = $('#' + type).find("input[type='checkbox']");
- var html = '';
- for (i in inputtag) {
- if (inputtag[i].checked) {
- html += '<span class="label label-primary">' + $(inputtag[i]).parent().find('label').text() + '</span> ';
- }
- }
- if (html) {
- $("." + type + '-selected').html(html);
- } else {
- $("." + type + '-selected').html('全部');
- }
- };
- initChecked('users-group');
- initChecked('vice-founder-group');
- $('.confirm-users-group').click(function() {
- initChecked('users-group');
- $('#users-group').modal('hide');
- });
- $('.confirm-vice-founder-group').click(function() {
- initChecked('vice-founder-group');
- $('#vice-founder-group').modal('hide');
- });
- $('#form1').submit(function(){
- if(!$.trim($(':text[name="title"]').val())) {
- util.message('请填写公告标题', '', 'error');
- return false;
- }
- if(!$.trim($('#cateid').val())) {
- util.message('请选择公告分类', '', 'error');
- return false;
- }
- if(!$.trim($('textarea[name="content"]').val())) {
- util.message('请填写公告内容', '', 'error');
- return false;
- }
- return true;
- });
- });
- </script>
- {template 'common/footer'}
|