123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- {include file="public/layout" /}
- <body style="background-color: #FFF; overflow: auto;">
- <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
- <div id="append_parent"></div>
- <div id="ajaxwaitid"></div>
- <div class="page" style="box-shadow:none;">
- <div class="fixed-bar">
- <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-chevron-left"></i></a>
- <div class="subject">
- <h3>编辑参数</h3>
- <h5></h5>
- </div>
- </div>
- </div>
- <form class="form-horizontal" id="post_form" action="{:U('Product/attribute_edit')}" method="post">
- <div class="ncap-form-default">
- <dl class="row">
- <dt class="tit">
- <label for="typeid"><em>*</em>所属栏目</label>
- </dt>
- <dd class="opt">
- <select name="typeid" id="typeid">
- {$arctype_html}
- </select>
- <span class="err" id="err_typeid" style="color:#F00; display:none;"></span>
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="ac_name"><em>*</em>参数名称</label>
- </dt>
- <dd class="opt">
- <input type="text" name="attr_name" value="{$field.attr_name}" id="attr_name" class="input-txt">
- <span class="err" id="err_attr_name" style="color:#F00; display:none;"></span>
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="attr_input_type"><em>*</em>表单类型</label>
- </dt>
- <dd class="opt">
- <label><input type="radio" value="0" name="attr_input_type" {empty name="field.attr_input_type"}checked="checked"{/empty} />单行文本</label>
- <label><input type="radio" value="2" name="attr_input_type" {eq name="field.attr_input_type" value="2"}checked="checked"{/eq} />多行文本</label>
- <label><input type="radio" value="1" name="attr_input_type" {eq name="field.attr_input_type" value="1"}checked="checked"{/eq} />下拉框</label>
- <span class="err" id="err_attr_input_type" style="color:#F00; display:none;"></span>
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row attr_input_type2 {neq name='field.attr_input_type' value='1'}none{/neq}">
- <dt class="tit">
- <label for="attr_values"><em>*</em>可选值列表</label>
- </dt>
- <dd class="opt">
- <textarea rows="10" cols="30" name="attr_values" id="attr_values" class="input-txt" style="height:100px;" placeholder="一行代表一个可选值">{$field.attr_values}</textarea>
- <span id="err_attr_values" class="err" style="color:#F00; display:none;"></span>
- <p class="notic">一行代表一个可选值</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>排序</label>
- </dt>
- <dd class="opt">
- <input type="text" value="{$field.sort_order}" name="sort_order" id="sort_order" class="input-txt">
- <span class="err"></span>
- <p class="notic">越小越靠前</p>
- </dd>
- </dl>
- <div class="bot">
- <input type="hidden" name="attr_id" value="{$field.attr_id}">
- <a href="JavaScript:void(0);" onclick="check_submit('post_form');" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
- </div>
- </form>
- </div>
- <script type="text/javascript">
- $(function(){
- $('input[name=attr_input_type]').click(function(){
- var val = $(this).val();
- if (val == 1) {
- $('.attr_input_type2').show();
- } else {
- $('.attr_input_type2').hide();
- }
- });
- var dftypeid = {$field.typeid|default='0'};
- $('#typeid').change(function(){
- var current_channel = $(this).find('option:selected').data('current_channel');
- if (0 < $(this).val() && {$channeltype} != current_channel) {
- showErrorMsg('请选择对应模型的栏目!');
- $(this).val(dftypeid);
- } else if ({$channeltype} == current_channel) {
- layer.closeAll();
- }
- });
- });
- /**
- * ajax 提交表单 到后台去验证然后回到前台提示错误
- * 验证通过后,再通过 form 自动提交
- */
- function check_submit(form_id)
- {
- if ($('#typeid').val() == 0) {
- showErrorMsg('请选择栏目…!');
- $('#typeid').focus();
- return false;
- }
- if($.trim($('input[name=attr_name]').val()) == ''){
- showErrorMsg('参数名称不能为空!');
- $('input[name=attr_name]').focus();
- return false;
- }
- if ($('input[name=attr_input_type]').is(':checked') == false) {
- showErrorMsg('请选择表单类型!');
- $($('input[name=attr_input_type]')[0]).focus();
- return false;
- }
- if ($('input[name=attr_input_type]:checked').val() == 1 && $.trim($('#attr_values').val()) == '') {
- showErrorMsg('可选值列表不能为空!');
- $('#attr_values').focus();
- return false;
- }
- layer_loading('正在处理');
- $.ajax({
- type : "POST",
- url : "{:url('Product/attribute_edit', ['_ajax'=>1])}",
- data : $('#'+form_id).serialize(),// 你的formid
- dataType: "JSON",
- error: function(request) {
- layer.closeAll();
- layer.alert(ey_unknown_error, {icon: 5, title:false});
- return false;
- },
- success: function(v) {
- layer.closeAll();
- if(v.status == 1)
- {
- if(v.hasOwnProperty('data')){
- if(v.data.hasOwnProperty('url')){
- location.href = v.data.url;
- }else{
- location.href = location.href;
- }
- }else{
- location.href = location.href;
- }
- return true;
- } else {
- showErrorMsg(v.msg);
- return false;
- }
- }
- });
- }
- </script>
- {include file="public/footer" /}
|