123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <{include file="./admin/header.html"}>
- <{include file="./admin/left.html"}>
- <{include file="./admin/nav.html"}>
- <{include file="get_kindeditor.html"}>
- <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">
- <{include file="./admin/activity/common_nav.html"}>
- <input name="events_id" type="hidden" value="<{$events_Data.events.id}>">
-
- <div class="panel panel-default">
- <div class="panel-body">
- <div class="form-group">
- <label>券名称:</label>
- <input name="code_name" type="text" class="form-control" value="<{$events_Data.events.code_name}>">
- </div>
- <div class="form-group">
- <label>券图片:</label>
- <div>
- <img id="img_url_tag" src="<{if $events_Data.events.code_img_url}><{$events_Data.events.code_img_url}><{else}>http://placehold.it/100&text=100x100<{/if}>" style="width:100px;" class="img-thumbnail">
- <input id="img_url_input" name="code_img_url" type="hidden" value="<{$events_Data.events.code_img_url}>">
- <input id="image_upload" type="button" value="选择图片" >
- </div>
- </div>
- <div class="form-group">
- <label>券数量:</label>
- <div>
- <{assign var=num value=$codeDataNum-$useCodeDataNum}>
- 总数: <{$codeDataNum}> 已发放: <{$useCodeDataNum}> 剩余: <{$num}>
- <a href="<{$web_cfg.domain}>/?c=Admin_Activity_SetInteractive&a=ReqShowEventCode&events_id=<{$events_Data.events.id}>">查看</a>
- </div>
- </div>
- <div class="form-group">
- <label>添加新券: <small class="text-danger">每次不超过200条,换行分割</small></label>
- <div>
- <textarea name="code_data" rows="2" class="form-control" style="width:220px;"></textarea>
- </div>
- </div>
-
- <div class="form-group">
- <label>设置表单:</label>
- <div>
- <table class="custom_from_table table table-condensed">
- <thead>
- <tr>
- <th>名称</th>
- <th>类型</th>
- <th>最小长度</th>
- <th>验证规则</th>
- <th>是否必填</th>
- </tr>
- </thead>
- <tbody>
- <{if !$events_Data.events.forms}>
- <tr class="not_input">
- <td colspan='6' align="center">没有设置表单</td>
- </tr>
- <{else}>
- <{foreach from=$events_Data.events.forms item=form}>
- <{if $form.type == 'text'}>
- <tr>
- <td><input name="f[0][name]" type="text" value="<{$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="<{$form.rule.size}>" class="form-control" /></td>
- <td>
- <select class="form-control" name="f[0][rule][regularid]">
- <option value="">无规则</option>
- <option value="1" <{if $form.rule.regularid == 1}>selected<{/if}>>手机验证</option>
- <option value="2" <{if $form.rule.regularid == 2}>selected<{/if}>>邮箱验证</option>
- </select>
- </td>
- <td>
- <input name="f[0][required]" type="checkbox" value="1" <{if $form.required}>checked<{/if}>/>
- </td>
- </tr>
- <{/if}>
- <{if $form.type == 'select'}>
- <tr>
- <td><input name="f[0][name]" type="text" value="<{$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=""><{$form.options}></textarea>
- </td>
- <td>多个选项换行分隔</td>
- <td><input name="f[0][required]" type="checkbox" value="1" <{if $form.required}>checked<{/if}>/></td>
- </tr>
- <{/if}>
- <{if $form.type == 'textarea'}>
- <tr>
- <td><input name="f[0][name]" type="text" value="<{$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="<{$form.rule.size}>" class="form-control"/></td>
- <td>
- <select name="f[0][rule][regularid]" class="form-control">
- <option value="">无规则</option>
- <option value="1" <{if $form.rule.regularid == 1}>selected<{/if}>>手机验证</option>
- <option value="2" <{if $form.rule.regularid == 2}>selected<{/if}>>邮箱验证</option>
- </select>
- </td>
- <td><input name="f[0][required]" type="checkbox" value="1" <{if $form.required}>checked<{/if}>/> </td>
- </tr>
- <{/if}>
- <{/foreach}>
- <{/if}>
- </tbody>
- </table>
- <a href="javascript:;" class="addRule js_add_prize" data-stat="show"><i class="fa fa-plus"></i> 添加表单字段</a>
- </div>
- </div>
- </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>
- </div>
- <{include file="./admin/activity/common_right.html"}>
- <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=ReqUpCode'
- , data: formData
- , success: function (data) {
- if (data.ok) { //ok
- location.href = location.href;
- } else {
- alert('操作失败,原因:'+data.msg);
- location.href = location.href;
- }
- return false;
- }
- , error: function (NULL, textStatus) {
- alert("请求服务器失败,原因:"+textStatus);
- }
- , dataType: "json"
- });
- });
- });
- //列表默认图
- KindEditor.ready(function(K) {
- var uploadbutton = K.uploadbutton({
- button : K('#image_upload')[0],
- fieldName : 'imgFile',
- url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=image',
- afterUpload : function(data) {
- if (data.error === 0) {
- var url = K.formatUrl(data.url, 'absolute');
- K('#img_url_input').val(data.url);
- K('#img_url_tag').attr('src', data.url);
- } else {
- alert(data.message);
- }
- },
- afterError : function(str) {
- alert('自定义错误信息: ' + str);
- }
- });
- uploadbutton.fileBox.change(function(e) {
- uploadbutton.submit();
- });
- });
- </script>
- <{include file="./admin/bottom.html"}>
|