adv_form.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. {include file="public/header" /}
  2. <div class="page">
  3. <form id="adv_form" enctype="multipart/form-data" method="post" name="advForm">
  4. <table class="ds-default-table">
  5. <tbody>
  6. <tr class="noborder">
  7. <td class="required w120"><label class="validation" for="adv_name">{$Think.lang.adv_name}:</label></td>
  8. <td class="vatop rowform"><input type="text" name="adv_name" id="adv_name" class="txt" value="{$adv.adv_title|default=''}"></td>
  9. <td class="vatop tips"></td>
  10. </tr>
  11. <tr class="noborder">
  12. <td class="required"><label>{$Think.lang.adv_ap_id}:</label></td>
  13. <td class="vatop rowform">
  14. <select name="ap_id" id="ap_id">
  15. {foreach name="ap_list" item="ap" key="ap_k" }
  16. <option value='{$ap.ap_id}' {if condition="$Request.param.ap_id eq $ap.ap_id || $adv.ap_id eq $ap.ap_id"}selected{/if}>{$ap.ap_name}[{$ap.ap_width}X{$ap.ap_height}]</option>
  17. {/foreach}
  18. </select>
  19. </td>
  20. <td class="vatop tips"></td>
  21. </tr>
  22. <tr class="noborder">
  23. <td class="required"><label for="adv_startdate">{$Think.lang.ds_start_time}:</label></td>
  24. <td class="vatop rowform"><input type="text" name="adv_startdate" id="adv_startdate" class="txt date" value="{:date('Y-m-d',$adv.adv_startdate)}"></td>
  25. <td class="vatop tips"></td>
  26. </tr>
  27. <tr class="noborder">
  28. <td class="required"><label for="adv_startdate">{$Think.lang.adv_sort}:</label></td>
  29. <td class="vatop rowform"><input type="text" name="adv_sort" id="adv_sort" class="txt" value="{$adv.adv_sort|default='255'}"></td>
  30. <td class="vatop tips">{$Think.lang.adv_sort_role}</td>
  31. </tr>
  32. <tr class="noborder">
  33. <td class="required"><label for="adv_startdate">{$Think.lang.adv_enabled}:</label></td>
  34. <td class="vatop rowform">
  35. <div class="onoff">
  36. <label for="adv_enabled1" class="cb-enable {if condition="$adv.adv_enabled eq 1"}selected{/if}">{$Think.lang.ds_open}</label>
  37. <label for="adv_enabled0" class="cb-disable {if condition="$adv.adv_enabled eq 0"}selected{/if}">{$Think.lang.ds_close}</label>
  38. <input id="adv_enabled1" name="adv_enabled" value="1" type="radio" {if condition="$adv.adv_enabled eq 1"} checked="checked"{/if}>
  39. <input id="adv_enabled0" name="adv_enabled" value="0" type="radio" {if condition="$adv.adv_enabled eq 0"} checked="checked"{/if}>
  40. </div>
  41. </td>
  42. <td class="vatop tips"></td>
  43. </tr>
  44. <tr class="noborder">
  45. <td class="required"><label for="adv_enddate">{$Think.lang.ds_end_time}:</label></td>
  46. <td class="vatop rowform"><input type="text" name="adv_enddate" id="adv_enddate" class="txt date" value="{:date('Y-m-d',$adv.adv_enddate)}"></td>
  47. <td class="vatop tips"></td>
  48. </tr>
  49. <tr class="noborder" id="adv_code">
  50. <input type="hidden" name="mark" value="0">
  51. <td class="required"><label for="file_adv_code">{$Think.lang.adv_img_upload}:</label></td>
  52. <td class="vatop rowform">
  53. {notempty name="$adv.adv_code"}
  54. <span class="type-file-show"><img class="show_image" src="{$Think.ADMIN_SITE_ROOT}/images/preview.png">
  55. <div class="type-file-preview"><img src="{:ds_get_pic(ATTACH_APPADV,$adv.adv_code)}"></div>
  56. </span>
  57. {/notempty}
  58. <span class="type-file-box">
  59. <input type='text' name='textfield' id='textfield1' class='type-file-text' />
  60. <input type='button' name='button' id='button1' value='上传' class='type-file-button' />
  61. <input name="adv_code" id="file_adv_code" type="file" class="type-file-file" id="site_logo" size="30" hidefocus="true">
  62. </span>
  63. </td>
  64. <td class="vatop tips">{$Think.lang.adv_edit_support}gif,jpg,jpeg,png </td>
  65. </tr>
  66. <tr class="noborder">
  67. <td class="required"><label for="adv_link">{$Think.lang.adv_link}:</label></td>
  68. <td class="vatop rowform">
  69. <input type="hidden" name="adv_typedate" value="{$adv.adv_typedate|default=''}" />
  70. <div style="cursor:pointer;" onclick="dsLayerOpen('{:url('Dashboard/h5_link')}','{$Think.lang.ds_link}','700px','450px')"><span id="link_url" style="color:#3297ff">{$adv.adv_typedate|default=$Think.lang.ds_please_choose}</span><span class="iconfont" style="font-size:12px">&#xe687;</span></div>
  71. </td>
  72. </tr>
  73. </tbody>
  74. <tfoot>
  75. <tr class="tfoot">
  76. <td colspan="15"><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
  77. </tr>
  78. </tfoot>
  79. </table>
  80. </form>
  81. </div>
  82. <script type="text/javascript">
  83. $(function(){
  84. $('#adv_startdate').datepicker({dateFormat: 'yy-mm-dd'});
  85. $('#adv_enddate').datepicker({dateFormat: 'yy-mm-dd'});
  86. $('#adv_type').on('change', function() {
  87. change_image_type_desc($(this).val());
  88. });
  89. $("#file_adv_code").change(function () {
  90. $("#textfield1").val($("#file_adv_code").val());
  91. });
  92. function change_image_type_desc(type) {
  93. var desc_array = {};
  94. desc_array['goods'] = '{$Think.lang.appadv_adv_form_goods_type}';
  95. desc_array['store'] = '{$Think.lang.appadv_adv_form_store_type}';
  96. desc_array['article'] = '{$Think.lang.appadv_adv_form_article_type}';
  97. desc_array['url'] = '{$Think.lang.appadv_adv_form_url_type}';
  98. $('.adv_type_desc').text(desc_array[type]);
  99. }
  100. });
  101. </script>
  102. <script>
  103. $(document).ready(function () {
  104. $('#adv_form').validate({
  105. errorPlacement: function (error, element) {
  106. error.appendTo(element.parent().parent().find('td:last'));
  107. },
  108. rules: {
  109. adv_name : {
  110. required: true
  111. },
  112. adv_sort : {
  113. number:true,
  114. range:[0,255]
  115. }
  116. },
  117. messages: {
  118. adv_name : {
  119. required : '{$Think.lang.adv_can_not_null}'
  120. },
  121. adv_sort : {
  122. number:'{$Think.lang.ds_sort_number}',
  123. range:'{$Think.lang.ds_range_0_255}'
  124. }
  125. }
  126. });
  127. });
  128. function setLink(path){
  129. $('input[name="adv_typedate"]').val(path)
  130. $('#link_url').text(path)
  131. }
  132. </script>