<?php /* Smarty version 2.6.17, created on 2018-05-26 12:07:42 compiled from admin/activity/interactive_input.html */ ?> <?php $_smarty_tpl_vars = $this->_tpl_vars; $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/header.html", 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars; unset($_smarty_tpl_vars); ?> <?php $_smarty_tpl_vars = $this->_tpl_vars; $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/left.html", 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars; unset($_smarty_tpl_vars); ?> <?php $_smarty_tpl_vars = $this->_tpl_vars; $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/nav.html", 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars; unset($_smarty_tpl_vars); ?> <?php $_smarty_tpl_vars = $this->_tpl_vars; $this->_smarty_include(array('smarty_include_tpl_file' => "get_kindeditor.html", 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars; unset($_smarty_tpl_vars); ?> <style> .set-nav { margin: 0 auto; } .set-nav-hr { background-color: #ddd; height: 1px; position: relative; } .form-group label { font-weight: 600; } .checkbox-inline, .radio-inline { font-weight: 400!important; } .rowlabel { font-weight: 300!important; } .music_play_hide { display:none; } </style> <div id="activity_container"> <form id="activity_form"> <div class="activity_center"> <?php $_smarty_tpl_vars = $this->_tpl_vars; $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_nav.html", 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars; unset($_smarty_tpl_vars); ?> <input name="events_id" type="hidden" value="<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?> "> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title" id="panel-title">设置表单</h3> </div> <div class="panel-body"> <div class="form-group"> <div> <table class="custom_from_table table table-condensed"> <thead> <tr> <th>名称</th> <th>类型</th> <th>最小长度</th> <th>验证规则</th> <th>是否必填</th> </tr> </thead> <tbody> <?php if (! $this->_tpl_vars['events_Data']['events']['forms']): ?> <tr class="not_input"> <td colspan='6' align="center">没有设置表单</td> </tr> <?php else: ?> <?php $_from = $this->_tpl_vars['events_Data']['events']['forms']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)): foreach ($_from as $this->_tpl_vars['form']): ?> <?php if ($this->_tpl_vars['form']['type'] == 'text'): ?> <tr> <td><input name="f[0][name]" type="text" value="<?php echo $this->_tpl_vars['form']['name']; ?> " class="form-control" /></td> <td> <select class="form-control form_select" name="f[0][type]"> <option value="text" selected>单行文本框</option> <option value="textarea">多行文本框</option> <option value="select">下拉菜单</option> </select> </td> <td><input name="f[0][rule][size]" type="text" value="<?php echo $this->_tpl_vars['form']['rule']['size']; ?> " class="form-control" /></td> <td> <select class="form-control" name="f[0][rule][regularid]"> <option value="">无规则</option> <option value="1" <?php if ($this->_tpl_vars['form']['rule']['regularid'] == 1): ?>selected<?php endif; ?>>手机验证</option> <option value="2" <?php if ($this->_tpl_vars['form']['rule']['regularid'] == 2): ?>selected<?php endif; ?>>邮箱验证</option> </select> </td> <td> <input name="f[0][required]" type="checkbox" value="1" <?php if ($this->_tpl_vars['form']['required']): ?>checked<?php endif; ?>/> </td> </tr> <?php endif; ?> <?php if ($this->_tpl_vars['form']['type'] == 'select'): ?> <tr> <td><input name="f[0][name]" type="text" value="<?php echo $this->_tpl_vars['form']['name']; ?> " class="form-control"/></td> <td> <select class="form_select form-control" name="f[0][type]"> <option value="text">单行文本框</option> <option value="textarea">多行文本框</option> <option value="select" selected>下拉菜单</option> </select> </td> <td> <textarea name="f[0][options]" class="form-control" placeholder=""><?php echo $this->_tpl_vars['form']['options']; ?> </textarea> </td> <td>多个选项换行分隔</td> <td><input name="f[0][required]" type="checkbox" value="1" <?php if ($this->_tpl_vars['form']['required']): ?>checked<?php endif; ?>/></td> </tr> <?php endif; ?> <?php if ($this->_tpl_vars['form']['type'] == 'textarea'): ?> <tr> <td><input name="f[0][name]" type="text" value="<?php echo $this->_tpl_vars['form']['name']; ?> " class="form-control"/></td> <td> <select class="form_select form-control" name="f[0][type]"> <option value="text">单行文本框</option> <option value="textarea" selected>多行文本框</option> <option value="select">下拉菜单</option> </select> </td> <td><input name="f[0][rule][size]" type="text" value="<?php echo $this->_tpl_vars['form']['rule']['size']; ?> " class="form-control"/></td> <td> <select name="f[0][rule][regularid]" class="form-control"> <option value="">无规则</option> <option value="1" <?php if ($this->_tpl_vars['form']['rule']['regularid'] == 1): ?>selected<?php endif; ?>>手机验证</option> <option value="2" <?php if ($this->_tpl_vars['form']['rule']['regularid'] == 2): ?>selected<?php endif; ?>>邮箱验证</option> </select> </td> <td><input name="f[0][required]" type="checkbox" value="1" <?php if ($this->_tpl_vars['form']['required']): ?>checked<?php endif; ?>/> </td> </tr> <?php endif; ?> <?php endforeach; endif; unset($_from); ?> <?php endif; ?> </tbody> </table> <a href="javascript:;" class="addRule js_add_prize" data-stat="show"><i class="fa fa-plus"></i> 添加表单字段</a> </div> </div> <a id="activity_submit" href="javascript:;" class="button button-3d button-primary button-rounded"><i class="fa fa-refresh fa-spin" style="display:none;"></i> 保存设置</a> <?php if ($this->_tpl_vars['typ']): ?> <div style="text-align:right;"> <a href="?c=Admin_Activity_SetInteractive&a=PageShow&events_id=<?php echo $this->_tpl_vars['events_Data']['events']['id']; ?> " >返回互动设置</a> </div> <?php endif; ?> </div> </div> </div> <?php $_smarty_tpl_vars = $this->_tpl_vars; $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/activity/common_right.html", 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars; unset($_smarty_tpl_vars); ?> <div style="clear:both;"></div> </form> </div> <div class="form_select_template" style="display:none;"> <table> <tr> <td><input name="f[0][name]" type="text" value="" class="form-control"/></td> <td> <select class="form_select form-control" name="f[0][type]"> <option value="text">单行文本框</option> <option value="textarea">多行文本框</option> <option value="select" selected>下拉菜单</option> </select> </td> <td> <textarea name="f[0][options]" class="form-control" placeholder=""></textarea> </td> <td>多个选项换行分隔</td> <td><input name="f[0][required]" type="checkbox" value="1"/></td> </tr> </table> </div> <div class="form_text_template" style="display:none;"> <table> <tr> <td><input name="f[0][name]" type="text" value="" class="form-control"/></td> <td> <select class="form_select form-control" name="f[0][type]"> <option value="text" selected>单行文本框</option> <option value="textarea">多行文本框</option> <option value="select">下拉菜单</option> </select> </td> <td><input name="f[0][rule][size]" type="text" value="" class="form-control"/></td> <td> <select name="f[0][rule][regularid]" class="form-control"> <option value="">无规则</option> <option value="1">手机验证</option> <option value="2">邮箱验证</option> </select> </td> <td><input name="f[0][required]" type="checkbox" value="1"/></td> </tr> </table> </div> <div class="form_textarea_template" style="display:none;"> <table> <tr> <td><input name="f[0][name]" type="text" value="" class="form-control"/></td> <td> <select class="form_select form-control" name="f[0][type]"> <option value="text">单行文本框</option> <option value="textarea" selected>多行文本框</option> <option value="select">下拉菜单</option> </select> </td> <td><input name="f[0][rule][size]" type="text" value="" class="form-control"/></td> <td> <select name="f[0][rule][regularid]" class="form-control"> <option value="">无规则</option> <option value="1">手机验证</option> <option value="2">邮箱验证</option> </select> </td> <td><input name="f[0][required]" type="checkbox" value="1"/> </td> </tr> </table> </div> <script> KISSY.use('node, io, event, jquery', function (S, Node, IO, Event, jQuery) { var $ = S.all; $('.addRule').on('click', function () { $(".not_input").hide(); var form_text_template = $('.form_text_template table tbody').last().clone(true, true, true); $('.custom_from_table tbody').last().after(form_text_template); }); Event.delegate(document,'change','.form_select',function(e){ var formType = e.target.value; if (formType == 'select') { var form_select_template = $('.form_select_template table tbody').last().clone(true, true, true); $(e.target).parent('tr').replaceWith(form_select_template); } if (formType == 'text') { var form_text_template = $('.form_text_template table tbody').last().clone(true, true, true); $(e.target).parent('tr').replaceWith(form_text_template); } if (formType == 'textarea') { var form_textarea_template = $('.form_textarea_template table tbody').last().clone(true, true, true); $(e.target).parent('tr').replaceWith(form_textarea_template); } }); var activity_submit_status = false; //按钮状态 function submit_button_active() { activity_submit_status = true; $("#activity_submit").addClass('active').all('i').show(); } function submit_button_default() { activity_submit_status = false; $("#activity_submit").removeClass('active').all('i').hide(); } $("#activity_submit").on('click', function () { if (activity_submit_status) { return false; } submit_button_active(); jQuery('.custom_from_table tr').each(function (i, item) { jQuery(item).find('input,select,checkbox,textarea').each(function (j, input) { input.name = input.name.replace(/\[\d+\]/, '['+ i +']'); }); }); formData = IO.serialize("#activity_form"); new IO({ type: "post" , url: VG.conf.root_domain + '/?c=Admin_Activity_SetInteractive&a=ReqUpForm' , data: formData , success: function (data) { if (data.ok) { //ok var url = data.msg; alert('保存成功'); location.reload(); } else { alert('操作失败,原因:'+data.msg); } return false; } , error: function (NULL, textStatus) { alert("请求服务器失败,原因:"+textStatus); } , dataType: "json" }); }); }); </script> <?php $_smarty_tpl_vars = $this->_tpl_vars; $this->_smarty_include(array('smarty_include_tpl_file' => "./admin/bottom.html", 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars; unset($_smarty_tpl_vars); ?>