{{include file="public/header" /}}

<!-- right content start  -->
<div class="content-right">
	<div class="content">
		<!-- form start -->
		<form class="am-form form-validation view-save" action="{{:MyUrl('admin/article/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/article/index', $params)}}">
			<legend>
				<span class="fs-16">
					{{if empty($data['id'])}}
						文章添加
					{{else /}}
						文章编辑
					{{/if}}
				</span>
				<a href="{{:MyUrl('admin/article/index', $params)}}" class="fr fs-14 m-t-5 am-icon-mail-reply"> 返回</a>
			</legend>
			<div class="am-form-group">
				<label>标题</label>
				<div class="am-input-group am-input-group-sm">
					<input type="hidden" name="title_color" value="{{if !empty($data['title_color'])}}{{$data.title_color}}{{/if}}" />
					<input type="text" name="title" placeholder="标题" minlength="2" maxlength="60" data-validation-message="标题长度 2~60 个字符" class="am-form-field am-radius" {{if !empty($data)}} value="{{$data.title}}" {{/if}} {{if !empty($data['title_color'])}} style="color:{{$data.title_color}};" {{/if}} required />
					<span class="am-input-group-btn">
						<button class="am-btn am-btn-default colorpicker-submit" type="button" data-input-tag="input[name='title']" data-color-tag="input[name='title_color']">
							<img src="{{$attachment_host}}/static/common/images/colorpicker.png" />
						</button>
					</span>
				</div>
			</div>
			<div class="am-form-group">
				<label>文章分类</label>
				<select name="article_category_id" class="am-radius c-p chosen-select" data-placeholder="可选择..." data-validation-message="请选择文章分类" required>
					<option value="">可选择...</option>
					{{foreach $article_category_list as $v}}
						<option value="{{$v.id}}" {{if isset($data['article_category_id']) and $data['article_category_id'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
					{{/foreach}}
				</select>
			</div>
			<div class="am-form-group">
				<label>跳转url地址<span class="fs-12 fw-100 cr-999">（带http://或https://）</span></label>
				<input type="url" name="jump_url" placeholder="跳转url地址" data-validation-message="跳转url地址格式有误" class="am-radius" {{if !empty($data)}} value="{{$data.jump_url}}"{{/if}} />
			</div>
			<div class="am-form-group">
			    <label class="block">是否启用</label>
			    <input name="is_enable" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if !empty($data) and $data['is_enable'] eq 1}}checked="true"{{/if}} />
			</div>
			<div class="am-form-group">
			    <label class="block">首页推荐</label>
			    <input name="is_home_recommended" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch {{if !empty($data) and $data['is_home_recommended'] eq 1}}checked="true"{{/if}} />
			</div>
			<div class="am-form-group">
				<label>内容</label>
				<textarea class="am-radius am-validate" name="content" rows="5" minlength="50" maxlength="105000" {{if !IsMobile()}}id="editor-tag" data-url="{{:MyUrl('admin/ueditor/index', ['path_type'=>'article'])}}" placeholder="内容长度最少 10~105000 个字符" {{else /}} placeholder="内容长度最少 10~105000 个字符更多编辑功能请使用电脑访问" {{/if}} data-validation-message="内容长度最少 10~105000 个字符" required>{{if !empty($data)}}{{$data.content}}{{/if}}</textarea>
			</div>
			<div class="am-form-group">
				<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
				<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100" data-am-loading="{loadingText:'处理中...'}">保存</button>
			</div>
		</form>
        <!-- form end -->
	</div>
</div>
<!-- right content end  -->

<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->