123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- {include file="public/header" /}
- <div class="page">
- <div class="fixed-bar">
- <div class="item-title">
- <div class="subject">
- <h3>{$Think.lang.ds_membergrade}</h3>
- <h5></h5>
- </div>
- {include file="public/admin_items" /}
- </div>
- </div>
- <div class="explanation" id="explanation">
- <div class="title" id="checkZoom">
- <h4 title="{$Think.lang.ds_explanation_tip}">{$Think.lang.ds_explanation}</h4>
- <span id="explanationZoom" title="{$Think.lang.ds_explanation_close}" class="arrow"></span>
- </div>
- <ul>
- <li class="tips">{$Think.lang.membergrade_index_help1}</li>
- <li class="tips">{$Think.lang.membergrade_index_help2}</li>
- </ul>
- </div>
- <form method="post" id="mg_form" name="mg_form" enctype="multipart/form-data">
- <table class="ds-default-table">
- <thead>
- <tr class="thead">
- <th class="align-center">{$Think.lang.membergrade_level_name}</th>
- <th class="align-left">{$Think.lang.membergrade_exppoints}</th>
- <th class="align-left">{$Think.lang.ds_handle}</th>
- </tr>
- </thead>
- <tbody id="mg_tbody">
- {notempty name="membergrade_list"}
- {foreach name="membergrade_list" item="membergrade" key="k" }
- <tr>
- <td><input type="text" ds_type="verify" name="mg[{$membergrade.level}][level_name]" value="{$membergrade.level_name}" class="w120" /></td>
- <td><input type="text" ds_type="verify" name="mg[{$membergrade.level}][exppoints]" value="{$membergrade.exppoints}" class="w60" {if $membergrade.level eq 1}readonly{/if}/></td>
- <td>{if $membergrade.level neq 1}<a onclick="remove_tr($(this));" href="JavaScript:void(0);">{$Think.lang.ds_del}</a>{/if}</td>
- </tr>
- {/foreach}
- {else /}
- {/notempty}
- </tbody>
- <tbody>
- <tr>
- <td colspan="3">
- <a id="add_membergrade" class="btn-add-nofloat marginleft" href="JavaScript:void(0);"> <span>{$Think.lang.membergrade_add}</span> </a>
- </td>
- </tr>
- </tbody>
- <tfoot>
- <tr>
- <td colspan="3"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span>{$Think.lang.ds_submit}</span></a></td>
- </tr>
- </tfoot>
- </table>
- </form>
- <script type="text/javascript">
- $(function () {
- var i = {$maxlevel};
- var mg_tbody = '<tr>' +
- '<td><input type="text" ds_type="verify" name="mg[key][level_name]" value="" class="w120" /></td>' +
- '<td><input type="text" ds_type="verify" name="mg[key][exppoints]" value="" class="w60" /></td>' +
- '<td><a onclick="remove_tr($(this));" href="JavaScript:void(0);">{$Think.lang.membergrade_remove}</a></td>' +
- '</tr>';
- $("#add_membergrade").click(function () {
- $('#mg_tbody > tr:last').after(mg_tbody.replace(/key/g, i));
- i++;
- });
- $('#submitBtn').click(function () {
- var result = true;
- var error = new Array();
- $("#mg_tbody").find("[ds_type='verify']").each(function () {
- if (result) {
- data = $(this).val();
- if (!data) {
- result = false;
- //error.push('请将信息填写完整');
- error = '{$Think.lang.please_complete_info}';
- }
- //验证类型
- if (result) {
- var data_str = $(this).attr('data-param');
- if (data_str) {
- eval("data_str = " + data_str);
- switch (data_str.type) {
- case 'int':
- result = (data = parseInt(data)) > 0 ? true : false;
- error = (result == false) ? (data_str.name + '{$Think.lang.should_be_integer}') : '';
- }
- }
- }
- }
- });
- if (result) {
- $('#mg_form').submit();
- } else {
- layer.alert(error);
- }
- });
- })
- function remove_tr(o) {
- o.parents('tr:first').remove();
- }
- </script>
- </div>
|