edit.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. <div class="alert alert-block alert-success">
  15. 注意:如果新增PC首页头部广告有尺寸要求<br/>
  16. PC首页头部广告需要6条广告,按照排序由低到高依次尺寸为:<br/>
  17. 1:&nbsp;290*190 &nbsp;2:&nbsp;470*250&nbsp;3:&nbsp;316*272&nbsp;4:&nbsp;290*270&nbsp;5:&nbsp;470*210&nbsp;6:&nbsp;322*192
  18. <br/><br/>
  19. PC滚动广告参考尺寸:1920*600
  20. <br/><br/>
  21. PC关于我们广告图 参考尺寸:1200*294
  22. </div>
  23. </div>
  24. <div class="col-xs-12">
  25. <form class="form-horizontal" id="validation-form" method="post" action='{$action}'>
  26. <notempty name="Think.get.id">
  27. <input name="slider_id" type="hidden" value="{$Think.get.id}" />
  28. </notempty>
  29. <div class="form-group required">
  30. <label class="col-sm-2 control-label" for="input-image">图片:</label>
  31. <div class="col-sm-10" id="thumb">
  32. <a href="#" id="thumb-image" data-toggle="image" class="img-thumbnail">
  33. <img osctype="image" <if condition="isset($slider['image'])">
  34. src="__ROOT__{$thumb_image}"
  35. <else />
  36. src="__ROOT__/Common/image/no_image_100x100.jpg"
  37. </if> />
  38. </a>
  39. <input osctype="image_input" type="hidden" name="image" value="<?php echo $slider['image']; ?>" id="input-image" />
  40. </div>
  41. </div>
  42. <div class="form-group required">
  43. <label class="col-sm-2 control-label" for="input-slider_name">名称:</label>
  44. <div class="col-sm-10">
  45. <input id="input-nslider_name" class="form-control" type="text" placeholder="名称" name="slider_name" value="{$slider.slider_name|default=''}" />
  46. </div>
  47. </div>
  48. <div class="form-group required">
  49. <label class="col-sm-2 control-label" for="input-name2">链接:</label>
  50. <div class="col-sm-10">
  51. <select name="type">
  52. <option value="">请选择广告位置</option>
  53. <?php foreach($type_config as $key => $val){ ?>
  54. <option value="<?php echo $key;?>" <?php if($slider['type'] == $key ){ ?> selected<?php } ?>><?php echo $val;?></option>
  55. <?php } ?>
  56. </select>
  57. </div>
  58. </div>
  59. <div class="form-group required">
  60. <label class="col-sm-2 control-label" for="input-name2">链接:</label>
  61. <div class="col-sm-10">
  62. <input id="input-name2" class="form-control" type="text" placeholder="链接" name="url" value="{$slider.url|default=''}" />
  63. </div>
  64. </div>
  65. <div class="form-group required">
  66. <label class="col-sm-2 control-label" for="input-name2">排序:</label>
  67. <div class="col-sm-10">
  68. <input id="input-name2" class="form-control" type="text" placeholder="排序" name="sort_order" value="{$slider.sort_order|default=''}" />
  69. </div>
  70. </div>
  71. <div class="form-group">
  72. <label class="col-sm-1 control-label no-padding-left"> </label>
  73. <div class="col-sm-11">
  74. <input name="send" type="submit" value="提交" class="btn btn-primary" />
  75. </div>
  76. </div>
  77. </form>
  78. </div>
  79. </div>
  80. </block>
  81. <block name="jquery">
  82. <script src="__PUBLIC__/js/jquery/jquery-1.10.2.min.js"></script>
  83. </block>
  84. <block name="javascript">
  85. <script src="__PUBLIC__/fileupload/jquery.ui.widget.js"></script>
  86. <script src="__PUBLIC__/fileupload/jquery.fileupload.js"></script>
  87. <script>
  88. $(function(){
  89. // Image Manager
  90. $(document).delegate('a[data-toggle=\'image\']', 'click', function(e) {
  91. e.preventDefault();
  92. var element = this;
  93. $(element).popover({
  94. html: true,
  95. placement: 'right',
  96. trigger: 'manual',
  97. content: function() {
  98. return '<button type="button" id="button-image" class="btn btn-primary"><i class="icon-edit"></i></button> <button type="button" id="button-clear" class="btn btn-danger"><i class="icon-trash"></i></button>';
  99. }
  100. });
  101. $(element).popover('toggle');
  102. $('#button-image').on('click', function() {
  103. $('#modal-image').remove();
  104. $('#form-upload').remove();
  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. $(element).popover('hide');
  108. $('[osctype="btn_upload_image"]').fileupload({
  109. dataType: 'json',
  110. url: "{:U('Image/upload_image',array('dir'=>'slider'))}",
  111. add: function(e, data) {
  112. $parent = $('#thumb');
  113. $input = $parent.find('[osctype="image_input"]');
  114. $img = $parent.find('[osctype="image"]');
  115. data.formData = {old_product_image:$input.val()};
  116. $img.attr('src', "__IMG__/loading.gif");
  117. data.submit();
  118. },
  119. done: function (e,data) {
  120. var image=data.result;
  121. $parent = $('#thumb');
  122. $input = $parent.find('[osctype="image_input"]');
  123. $img = $parent.find('[osctype="image"]');
  124. if(image) {
  125. // $img.prev('i').hide();
  126. $img.attr('src', '__ROOT__'+image.image_thumb);
  127. $img.show();
  128. $input.val(image.image);
  129. } else {
  130. alert('上传失败');
  131. }
  132. }
  133. });
  134. });
  135. $('#button-clear').on('click', function() {
  136. $(element).find('img').attr('src', $(element).find('img').attr('data-placeholder'));
  137. $(element).parent().find('input').attr('value', '');
  138. $(element).popover('hide');
  139. });
  140. });
  141. });
  142. </script>
  143. </block>