www.lightcourse.com/app/admin/view/membergrade/index.html

113 lines
4.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{include file="public/header" /}
<div class="page">
<div class="fixed-bar">
<div class="item-title">
<div class="subject">
<h3>会员等级</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">“会员级别设置”提交后,当会员符合某个级别后将自动升至该级别,请谨慎设置会员级别</li>
<li class="tips">建议一、级别应该是逐层递增例如“级别2”所需经验值高于“级别1”二、设置的第一个级别所需经验值应为0三、信息应填写完整</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">级别名称</th>
<th class="align-left">经验值</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);">删除</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>新增等级</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);">移除</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 = '请将信息填写完整';
}
//验证类型
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 + '应为整数') : '';
}
}
}
}
});
if (result) {
$('#mg_form').submit();
} else {
layer.alert(error);
}
});
})
function remove_tr(o) {
o.parents('tr:first').remove();
}
</script>
</div>