Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

attr_edit.htm 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. {include file="public/layout" /}
  2. <body class="bodystyle" style="overflow: auto;min-width:auto;">
  3. <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
  4. <div id="append_parent"></div>
  5. <div id="ajaxwaitid"></div>
  6. <div class="page min-hg-c-i" style="min-width: auto;box-shadow:none;padding-bottom: 0px;">
  7. <form class="form-horizontal" id="post_form" action="{:url('Member/attr_edit')}" method="post">
  8. <!-- 常规选项 -->
  9. <div class="ncap-form-default tab_div_1">
  10. <dl class="row">
  11. <dt class="tit">
  12. <label for="name"><em>*</em>字段标题</label>
  13. </dt>
  14. <dd class="opt">
  15. <input type="text" value="{$info.title|default=''}" name="title" id="title" class="input-txt" autocomplete="off">
  16. <p class="notic"></p>
  17. </dd>
  18. </dl>
  19. <dl class="row">
  20. <dt class="tit">
  21. <label for="dtype"><em>*</em>字段类型</label>
  22. </dt>
  23. <dd class="opt">
  24. {in name="$info.dtype" value="mobile,email"}
  25. {$info.title}
  26. <input type="hidden" name="dtype" value="{$info.dtype}">
  27. {else /}
  28. {volist name='$field' id='vo'}
  29. <div style="width: 150px; float: left;">
  30. <label><input type="radio" name="dtype" value="{$vo.name}" data-ifoption="{$vo.ifoption|default=0}" {eq name="$info.dtype" value="$vo.name"} checked="checked" {/eq} data-text="{$vo.title}">{$vo.title}</label>&nbsp;
  31. </div>
  32. {if condition="$i % 4 == 0"}<br/>{/if}
  33. {/volist}
  34. {/in}
  35. <span class="err"></span>
  36. <p class="notic"></p>
  37. </dd>
  38. </dl>
  39. <dl class="row" id="dl_dfvalue">
  40. <dt class="tit">
  41. <label id="label_dfvalue">默认值</label>
  42. </dt>
  43. <dd class="opt">
  44. <textarea rows="5" cols="60" id="dfvalue" name="dfvalue" placeholder="前端将默认显示输入的默认值" style="height:60px;">{$info.dfvalue|default=''}</textarea>
  45. <span class="err"></span>
  46. <p class="notic">如字段类型为下拉框、单选项、多选项时,需要填写默认值。</p>
  47. </dd>
  48. </dl>
  49. <dl class="row">
  50. <dt class="tit">
  51. <label>字段状态</label>
  52. </dt>
  53. <dd class="opt">
  54. <label class="curpoin">
  55. <input type="radio" name="is_hidden" value="0" {if condition="empty($info.is_hidden)"} checked="checked"{/if}/>开启
  56. </label>
  57. &nbsp;&nbsp;&nbsp;
  58. <label class="curpoin">
  59. <input type="radio" name="is_hidden" value="1" {if condition="!empty($info.is_hidden)"} checked="checked"{/if}/>关闭
  60. </label>
  61. <p class="notic"></p>
  62. </dd>
  63. </dl>
  64. <dl class="row">
  65. <dt class="tit">
  66. <label>字段必填</label>
  67. </dt>
  68. <dd class="opt">
  69. <label class="curpoin">
  70. <input type="radio" name="is_required" value="1" {if condition="!empty($info.is_required)"} checked="checked"{/if}/>是
  71. </label>
  72. &nbsp;&nbsp;&nbsp;
  73. <label class="curpoin">
  74. <input type="radio" name="is_required" value="0" {if condition="empty($info.is_required)"} checked="checked"{/if}/>否
  75. </label>
  76. <p class="notic">只针对前台的会员属性有效。</p>
  77. </dd>
  78. </dl>
  79. <dl class="row">
  80. <dt class="tit">
  81. <label>注册显示</label>
  82. </dt>
  83. <dd class="opt">
  84. <label class="curpoin">
  85. <input type="radio" name="is_reg" value="1" {if condition="!empty($info.is_reg)"} checked="checked"{/if}/>是
  86. </label>
  87. &nbsp;&nbsp;&nbsp;
  88. <label class="curpoin">
  89. <input type="radio" name="is_reg" value="0" {if condition="empty($info.is_reg)"} checked="checked"{/if}/>否
  90. </label>
  91. <p class="notic">只针对前台的会员属性有效。</p>
  92. </dd>
  93. </dl>
  94. </div>
  95. <!-- 常规选项 -->
  96. <div class="ncap-form-default">
  97. <div class="bot">
  98. <input type="hidden" name="id" id="id" value="{$info.para_id|default=''}">
  99. <a href="JavaScript:void(0);" onclick="check_submit();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
  100. </div>
  101. </div>
  102. </form>
  103. </div>
  104. <script type="text/javascript">
  105. $(function(){
  106. dtype_change($('#dtype'));
  107. $('input[name=dtype]').click(function(){
  108. dtype_change(this);
  109. });
  110. dtype_change($('input[name=dtype]:checked'));
  111. function dtype_change(obj){
  112. var dtype = $(obj).val();
  113. var ifoption = $(obj).data('ifoption');
  114. if (0 <= $.inArray(dtype, ['datetime','switch','img','imgs','file','media'])) {
  115. $('#dl_dfvalue').hide();
  116. ClearAreaData();
  117. }
  118. if (1 == ifoption) {
  119. $('#label_dfvalue').html('<em>*</em>默认值');
  120. } else {
  121. $('#label_dfvalue').html('默认值');
  122. }
  123. var dtype = $(obj).val()
  124. var ifoption = $(obj).data('ifoption');
  125. if (0 <= $.inArray(dtype, ['datetime','switch','img','imgs','file'])) {
  126. $('#dl_dfvalue').hide();
  127. ClearAreaData();
  128. } else {
  129. if (1 == ifoption) {
  130. $('#label_dfvalue').html('<em>*</em>默认值');
  131. } else {
  132. $('#label_dfvalue').html('默认值');
  133. }
  134. $('#dl_dfvalue').show();
  135. }
  136. if (0 <= $.inArray(dtype, ['text','multitext'])) {
  137. $('#dfvalue').attr('placeholder', '前端将默认显示输入的默认值');
  138. } else if (0 <= $.inArray(dtype, ['checkbox','radio','select'])) {
  139. $('#dfvalue').attr('placeholder', '此处填写被选择的项目(用“,”分开,如“男,女”)。');
  140. } else {
  141. $('#dfvalue').attr('placeholder', '前端将默认显示输入的默认值');
  142. }
  143. }
  144. });
  145. var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  146. function check_submit(){
  147. if($('input[name="title"]').val() == ''){
  148. showErrorMsg('属性标题不能为空!');
  149. $('input[name=title]').focus();
  150. return false;
  151. }
  152. if($('#dtype').val() == ''){
  153. showErrorMsg('请选择属性类型!');
  154. $('input[name=dtype]').focus();
  155. return false;
  156. } else {
  157. var ifoption = $('#dtype').find('option:selected').data('ifoption');
  158. if (1 == ifoption) {
  159. if ($.trim($('#dfvalue').val()) == '') {
  160. showErrorMsg('默认值不能为空!');
  161. $('#dfvalue').focus();
  162. return false;
  163. }
  164. }
  165. }
  166. if($('#dtype').val() == 'radio' || $('#dtype').val() == 'checkbox' || $('#dtype').val() == 'select'){
  167. var data = $.trim($('#dfvalue').val());
  168. data = data.split(',');
  169. for(var i = 0;i < data.length ;i++) {
  170. for(var j = i+1;j < data.length;j++) {
  171. if ($.trim(data[i]) == $.trim(data [j])){
  172. showErrorMsg('默认值不能含有相同的值!');
  173. $('textarea[name=dfvalue]').focus();
  174. return false;
  175. }
  176. }
  177. }
  178. }
  179. layer_loading('正在处理');
  180. $.ajax({
  181. type : 'post',
  182. url : "{:url('Member/attr_edit', ['_ajax'=>1])}",
  183. data : $('#post_form').serialize(),
  184. dataType : 'json',
  185. success : function(res){
  186. layer.closeAll();
  187. if(res.code == 1){
  188. var _parent = parent;
  189. _parent.layer.close(parentObj);
  190. _parent.layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
  191. _parent.window.location.reload();
  192. });
  193. }else{
  194. showErrorMsg(res.msg);
  195. }
  196. },
  197. error: function(e){
  198. layer.closeAll();
  199. layer.alert(e.responseText, {icon: 5, title:false});
  200. }
  201. });
  202. }
  203. </script>
  204. {include file="public/footer" /}