edit.html 7.5 KB

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