edit.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. {include file="public/header" /}
  2. <div class="page">
  3. <form id="exppoints_form" method="post" name="form1">
  4. <table class="ds-default-table">
  5. <tbody>
  6. <tr class="noborder">
  7. <td class="required w120"><label class="validation">{$Think.lang.admin_exppoints_membername}:</label></td>
  8. <td class="vatop rowform"><input type="text" name="member_name" id="member_name" class="txt" onchange="javascript:checkmember();">
  9. <input type="hidden" name="member_id" id="member_id" value=''/></td>
  10. <td class="vatop tips"></td>
  11. </tr>
  12. <tr id="tr_memberinfo">
  13. <td colspan="2" style="font-weight:bold;" id="td_memberinfo"></td>
  14. </tr>
  15. <tr class="noborder">
  16. <td class="required"><label>{$Think.lang.admin_exppoints_operatetype}:</label></td>
  17. <td class="vatop rowform">
  18. <select id="exppoints_type" name="exppoints_type">
  19. <option value="1">{$Think.lang.admin_exppoints_operatetype_add}</option>
  20. <option value="2">{$Think.lang.admin_exppoints_operatetype_reduce}</option>
  21. </select>
  22. </td>
  23. <td class="vatop tips"></td>
  24. </tr>
  25. <tr class="noborder">
  26. <td class="required"><label class="validation">{$Think.lang.admin_exppoints_pointsnum}:</label></td>
  27. <td class="vatop rowform"><input type="text" id="exppoints_num" name="exppoints_num" class="txt"></td>
  28. <td class="vatop tips"></td>
  29. </tr>
  30. <tr class="noborder">
  31. <td class="required"><label>{$Think.lang.admin_exppoints_pointsdesc}:</label></td>
  32. <td class="vatop rowform"><textarea name="exppoints_desc" rows="6" class="tarea"></textarea></td>
  33. <td class="vatop tips">{$Think.lang.admin_exppoints_pointsdesc_notice}</td>
  34. </tr>
  35. </tbody>
  36. <tfoot>
  37. <tr class="tfoot">
  38. <td colspan="2" ><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
  39. </tr>
  40. </tfoot>
  41. </table>
  42. </form>
  43. </div>
  44. <script type="text/javascript">
  45. function checkmember() {
  46. var membername = $.trim($("#member_name").val());
  47. if (membername == '') {
  48. $("#member_id").val('');
  49. layer.alert('{$Think.lang.admin_exppoints_addmembername_error}');
  50. return false;
  51. }
  52. $.getJSON("{:url('Exppoints/checkmember')}", {'member_name': membername}, function(data) {
  53. if (data.member_id)
  54. {
  55. $("#tr_memberinfo").show();
  56. var msg = "{$Think.lang.admin_exppoints_member_tip}" + data.member_name + "{$Think.lang.admin_exppoints_member_tip_2}" + data.member_exppoints;
  57. $("#member_name").val(data.member_name);
  58. $("#member_id").val(data.member_id);
  59. $("#td_memberinfo").text(msg);
  60. }
  61. else
  62. {
  63. $("#member_name").val('');
  64. $("#member_id").val('');
  65. layer.alert("{$Think.lang.admin_exppoints_userrecord_error}");
  66. }
  67. });
  68. }
  69. $(function() {
  70. $("#tr_memberinfo").hide();
  71. $('#exppoints_form').validate({
  72. errorPlacement: function(error, element){
  73. error.appendTo(element.parent().parent().find('td:last'));
  74. },
  75. rules: {
  76. member_name: {
  77. required: true
  78. },
  79. member_id: {
  80. required: true,
  81. min: 1
  82. },
  83. exppoints_num: {
  84. required: true,
  85. min: 1
  86. }
  87. },
  88. messages: {
  89. member_name: {
  90. required: '{$Think.lang.admin_exppoints_addmembername_error}'
  91. },
  92. member_id: {
  93. required: '{$Think.lang.admin_exppoints_member_error_again}',
  94. required: '{$Think.lang.admin_exppoints_member_error_again}'
  95. },
  96. exppoints_num: {
  97. required: '{$Think.lang.admin_exppoints_null_error}',
  98. min: '{$Think.lang.admin_exppoints_min_error}'
  99. }
  100. }
  101. });
  102. });
  103. </script>