add.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <extend name="Public:base" />
  2. <block name="content">
  3. <div class="page-header">
  4. <h1>
  5. 新增主题活动
  6. <small>
  7. <i class="icon-double-angle-right"></i>
  8. {$crumbs}
  9. </small>
  10. </h1>
  11. </div>
  12. <div class="row">
  13. <div class="col-xs-12">
  14. <form class="form-horizontal" id="validation-form" method="post" action='{:U("Subject/add")}'>
  15. <div class="form-group required">
  16. <label class="col-sm-2 control-label">主题活动名称:</label>
  17. <div class="col-sm-10">
  18. <input class="form-control" type="text" placeholder="" name="name" value="" />
  19. </div>
  20. </div>
  21. <div class="form-group required">
  22. <label class="col-sm-2 control-label">LOGO:</label>
  23. <div class="col-sm-10" id="p-image-row1">
  24. <a href="#" data-toggle="image" class="img-thumbnail">
  25. <img osctype="p_image1" data-placeholder="__ROOT__/Common/image/no_image_100x100.jpg" src="__ROOT__/Common/image/no_image_100x100.jpg" />
  26. </a>
  27. <button type="button" n="1" t="p" class="btn btn-primary button-image"><i class="icon-edit"></i></button> <button type="button" id="button-clear" class="btn btn-danger"><i class="icon-trash"></i></button>
  28. <input type="hidden" osctype="p_image_input1" name="logo" value="" />
  29. </div>
  30. </div>
  31. <div class="form-group required">
  32. <label class="col-sm-2 control-label">BANNER广告图:</label>
  33. <div class="col-sm-10" id="p-image-row2">
  34. <a href="#" data-toggle="image" class="img-thumbnail">
  35. <img osctype="p_image2" data-placeholder="__ROOT__/Common/image/no_image_100x100.jpg" src="__ROOT__/Common/image/no_image_100x100.jpg" />
  36. </a>
  37. <button type="button" n="2" t="p" class="btn btn-primary button-image"><i class="icon-edit"></i></button> <button type="button" id="button-clear" class="btn btn-danger"><i class="icon-trash"></i></button>
  38. <input type="hidden" osctype="p_image_input2" name="banner" value="" />
  39. </div>
  40. </div>
  41. <div class="form-group required">
  42. <label class="col-sm-2 control-label">主题活动类型:</label>
  43. <div class="col-sm-10">
  44. <select name="type">
  45. <?php foreach($subjecttype as $key => $val){ ?>
  46. <option value="<?php echo $key; ?>"><?php echo $val; ?></option>
  47. <?php } ?>
  48. </select>
  49. </div>
  50. </div>
  51. <div class="form-group required">
  52. <label class="col-sm-2 control-label">统一价格:</label>
  53. <div class="col-sm-10">
  54. <input class="form-control" type="text" placeholder="" name="price" value="-1" />
  55. </div>
  56. <p class="col-sm-2 control-label">&nbsp;</p>
  57. <div class="col-sm-2" ><span class="blue bold">-1为不统一价格</span></div>
  58. </div>
  59. <div class="form-group required">
  60. <label class="col-sm-2 control-label">是否允许申请:</label>
  61. <div class="col-sm-10">
  62. <label><input type="radio" name="can_shenqing" checked value="1" />是</label>
  63. &nbsp;&nbsp;
  64. <label><input type="radio" name="can_shenqing" value="0" />否</label>
  65. </div>
  66. </div>
  67. <div class="form-group required">
  68. <label class="col-sm-2 control-label">开始时间:</label>
  69. <div class="col-sm-10">
  70. <input class="form-control" type="text" id="begin_time" placeholder="开始时间" name="begin_time" value="" />
  71. </div>
  72. </div>
  73. <div class="form-group required">
  74. <label class="col-sm-2 control-label">结束时间:</label>
  75. <div class="col-sm-10">
  76. <input class="form-control" type="text" id="end_time" placeholder="结束时间" name="end_time" value="" />
  77. </div>
  78. </div>
  79. <div class="form-group">
  80. <label class="col-sm-1 control-label no-padding-left"> </label>
  81. <div class="col-sm-11">
  82. <input name="send" type="submit" value="提交" class="btn btn-primary" />
  83. </div>
  84. </div>
  85. </form>
  86. </div>
  87. </div>
  88. </block>
  89. <block name="javascript">
  90. <script src="__PUBLIC__/js/moment/moment.js"></script>
  91. <script src="__PUBLIC__/js/moment/locale/zh-cn.js"></script>
  92. <script src="__PUBLIC__/js/eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js"></script>
  93. <link rel="stylesheet" href="__PUBLIC__/js/bootstrap-timepicker/css/bootstrap-timepicker.css" />
  94. <script src="__PUBLIC__/fileupload/jquery.ui.widget.js"></script>
  95. <script src="__PUBLIC__/fileupload/jquery.fileupload.js"></script>
  96. <script>
  97. $(function(){
  98. //logo banner
  99. $('.button-image').on('click', function() {
  100. $('#modal-image').remove();
  101. $('#form-upload').remove();
  102. var i=$(this).attr('n');
  103. var type=$(this).attr('t');
  104. $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input osctype="btn_upload_image" type="file" name="file" /></form>');
  105. $('#form-upload input[name=\'file\']').trigger('click');
  106. $('[osctype="btn_upload_image"]').fileupload({
  107. dataType: 'json',
  108. url: "{:U('Image/upload_image/dir')}"+'/'+type,
  109. add: function(e, data) {
  110. $parent = $('#image-row'+i);
  111. $input = $parent.find('[osctype="'+type+'_image_input'+i+'"]');
  112. $img = $parent.find('[osctype="'+type+'_image'+i+'"]');
  113. console.log($img);
  114. var old_name='old_'+type+'_image';
  115. data.formData = {old_name:$input.val()};
  116. $img.attr('src', "__IMG__/loading.gif");
  117. data.submit();
  118. },
  119. done: function (e,data) {
  120. var image=data.result;
  121. console.log('#'+type+'-image-row'+i);
  122. $parent = $('#'+type+'-image-row'+i);
  123. $input = $parent.find('[osctype="'+type+'_image_input'+i+'"]');
  124. $img = $parent.find('[osctype="'+type+'_image'+i+'"]');
  125. if(image) {
  126. // $img.prev('i').hide();
  127. $img.attr('src', '__ROOT__/'+image.image_thumb);
  128. $img.show();
  129. $input.val(image.image);
  130. } else {
  131. alert('上传失败');
  132. }
  133. }
  134. });
  135. });
  136. $('#begin_time').datetimepicker({
  137. format: 'YYYY/MM/DD H:mm:ss',//use this option to display seconds
  138. icons: {
  139. time: 'btn btn-lg icon-time',
  140. date: 'btn btn-lg icon-calendar',
  141. up: 'fa icon-chevron-up',
  142. down: 'fa icon-chevron-down',
  143. previous: 'fa icon-chevron-left',
  144. next: 'fa icon-chevron-right',
  145. today: 'fa icon-arrows ',
  146. clear: 'fa icon-trash',
  147. close: 'fa icon-times'
  148. }
  149. }).next().on(ace.click_event, function(){
  150. $(this).prev().focus();
  151. });
  152. $('#end_time').datetimepicker({
  153. format: 'YYYY/MM/DD H:mm:ss',//use this option to display seconds
  154. icons: {
  155. time: 'btn btn-lg icon-time',
  156. date: 'btn btn-lg icon-calendar',
  157. up: 'fa icon-chevron-up',
  158. down: 'fa icon-chevron-down',
  159. previous: 'fa icon-chevron-left',
  160. next: 'fa icon-chevron-right',
  161. today: 'fa icon-arrows ',
  162. clear: 'fa icon-trash',
  163. close: 'fa icon-times'
  164. }
  165. }).next().on(ace.click_event, function(){
  166. $(this).prev().focus();
  167. });
  168. })
  169. </script>
  170. </block>