123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- {include file="public/layout" /}
-
- <body class="bodystyle" style="overflow: auto;min-width: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 min-hg-c-i" style="min-width: auto;box-shadow:none;padding-bottom: 0px;">
- <form class="form-horizontal" id="post_form" action="{:url('Member/attr_add')}" method="post">
- <div class="ncap-form-default tab_div_1">
- <dl class="row">
- <dt class="tit">
- <label for="name"><em>*</em>字段标题</label>
- </dt>
- <dd class="opt" style="width: auto;">
- <input type="text" name="title" id="name" class="input-txt" autocomplete="off">
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label for="dtype"><em>*</em>字段类型</label>
- </dt>
- <dd class="opt" style="width: auto;">
- <!--<select name="dtype" id="dtype">-->
- <!--{volist name='$field' id='vo'}-->
- <!--<option value="{$vo.name}" data-ifoption="{$vo.ifoption|default=0}">-->
- <!--{$vo.title}-->
- <!--</option>-->
- <!--{/volist}-->
- <!--</select>-->
-
- {volist name='$field' id='vo'}
- <div style="width: 150px; float: left;">
- <label><input type="radio" name="dtype" value="{$vo.name}" data-ifoption="{$vo.ifoption|default=0}" {eq name='$i' value='1'} checked="checked" {/eq} data-text="{$vo.title}">{$vo.title}</label>
- </div>
- {if condition="$i % 4 == 0"}<br/>{/if}
- {/volist}
-
- <span class="err"></span>
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row" id="dl_dfvalue">
- <dt class="tit">
- <label id="label_dfvalue">默认值</label>
- </dt>
- <dd class="opt" style="width: auto;">
- <textarea rows="5" cols="60" id="dfvalue" name="dfvalue" placeholder="前端将默认显示输入的内容" style="height:60px;"></textarea>
- <span class="err"></span>
- <p class="notic">如字段类型为下拉框、单选项、多选项时,需要填写默认值。</p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>字段状态</label>
- </dt>
- <dd class="opt" style="width: auto;">
- <label class="curpoin">
- <input type="radio" name="is_hidden" value="0" checked="checked"/>开启
- </label>
-
- <label class="curpoin">
- <input type="radio" name="is_hidden" value="1"/>关闭
- </label>
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>字段必填</label>
- </dt>
- <dd class="opt" style="width: auto;">
- <label class="curpoin">
- <input type="radio" name="is_required" value="1"/>是
- </label>
-
- <label class="curpoin">
- <input type="radio" name="is_required" value="0" checked="checked"/>否
- </label>
- <p class="notic"></p>
- </dd>
- </dl>
- <dl class="row">
- <dt class="tit">
- <label>注册显示</label>
- </dt>
- <dd class="opt" style="width: auto;">
- <label class="curpoin">
- <input type="radio" name="is_reg" value="1"/>是
- </label>
-
- <label class="curpoin">
- <input type="radio" name="is_reg" value="0" checked="checked"/>否
- </label>
- <p class="notic">只针对前台的会员属性有效。</p>
- </dd>
- </dl>
- </div>
- <!-- 常规选项 -->
- <div class="ncap-form-default">
- <div class="bot">
- <a href="JavaScript:void(0);" onclick="check_submit();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
- </div>
- </div>
- </form>
- </div>
-
- <script type="text/javascript">
- $(function(){
- dtype_change($('#dtype'));
- $('input[name=dtype]').click(function(){
- dtype_change(this);
- });
-
- function dtype_change(obj){
- var dtype = $(obj).val()
- var ifoption = $(obj).data('ifoption');
- if (0 <= $.inArray(dtype, ['datetime','switch','img','imgs','file'])) {
- $('#dl_dfvalue').hide();
- } else {
- if (1 == ifoption) {
- $('#label_dfvalue').html('<em>*</em>默认值');
- } else {
- $('#label_dfvalue').html('默认值');
- }
- $('#dl_dfvalue').show();
- }
-
- if (0 <= $.inArray(dtype, ['text','multitext'])) {
- $('#dfvalue').attr('placeholder', '前端将默认显示输入的内容');
- } else if (0 <= $.inArray(dtype, ['checkbox','radio','select'])) {
- $('#dfvalue').attr('placeholder', '此处填写被选择的项目(用“,”分开,如“男,女”)。');
- } else {
- $('#dfvalue').attr('placeholder', '前端将默认显示输入的内容');
- }
- }
- });
-
- var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
-
- function check_submit(){
- if($('input[name="name"]').val() == ''){
- showErrorMsg('属性标题不能为空!');
- $('input[name=name]').focus();
- return false;
- }
- if($('#dtype').val() == ''){
- showErrorMsg('请选择属性类型!');
- $('input[name=dtype]').focus();
- return false;
- } else {
- var ifoption = $('#dtype').find('option:selected').data('ifoption');
- if (1 == ifoption) {
- if ($.trim($('#dfvalue').val()) == '') {
- showErrorMsg('默认值不能为空!');
- $('#dfvalue').focus();
- return false;
- }
- }
- }
- if($('#dtype').val() == 'radio' || $('#dtype').val() == 'checkbox' || $('#dtype').val() == 'select'){
- var data = $.trim($('#dfvalue').val());
- data = data.split(',');
- for(var i = 0;i < data.length ;i++) {
- for(var j = i+1;j < data.length;j++) {
- if ($.trim(data[i]) == $.trim(data [j])){
- showErrorMsg('默认值不能含有相同的值!');
- $('textarea[name=dfvalue]').focus();
- return false;
- }
- }
- }
- }
- layer_loading('正在处理');
- $.ajax({
- type : 'post',
- url : "{:url('Member/attr_add', ['_ajax'=>1])}",
- data : $('#post_form').serialize(),
- dataType : 'json',
- success : function(res){
- layer.closeAll();
- if(res.code == 1){
- var _parent = parent;
- _parent.layer.close(parentObj);
- _parent.layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
- _parent.window.location.reload();
- });
- }else{
- showErrorMsg(res.msg);
- }
- },
- error: function(e){
- layer.closeAll();
- layer.alert(e.responseText, {icon: 5, title:false});
- }
- });
- }
- </script>
-
- {include file="public/footer" /}
|