edit.html 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <extend name="Public:base" />
  2. <block name="content">
  3. <div class="page-header">
  4. <h1>
  5. {$breadcrumb2}
  6. <small>
  7. <i class="icon-double-angle-right"></i>
  8. {$crumbs}
  9. </small>
  10. <button name="send" form="form-blog" type="submit" style="float:right;" class="btn btn-sm btn-primary">提交</button>
  11. </h1>
  12. </div>
  13. <div class="row">
  14. <div class="col-xs-12">
  15. <div class="alert alert-block alert-success">
  16. 1、背景颜色:可不填写。默认白色<br/>
  17. 2、背景图片:可不上传。默认无背景
  18. </div>
  19. </div>
  20. <div class="col-xs-12">
  21. <div class="panel-body">
  22. <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-blog" class="form-horizontal">
  23. <notempty name="Think.get.special_id">
  24. <input name="special_id" type="hidden" value="{$Think.get.special_id}" />
  25. </notempty>
  26. <div class="tab-content">
  27. <!-- 常规 START -->
  28. <div class="tab-pane active" id="tab-general">
  29. <div class="form-group required">
  30. <label class="col-sm-2 control-label" for="input-name2">专题名称:</label>
  31. <div class="col-sm-10">
  32. <input id="input-name2" class="form-control" type="text" placeholder="专题名称" name="special_desc" value="{$special.special_desc|default=''}" />
  33. </div>
  34. </div>
  35. <div class="form-group required">
  36. <label class="col-sm-2 control-label" for="input-name2">背景颜色:</label>
  37. <div class="col-sm-10">
  38. <input id="input-special_bgcolor" class="form-control" type="text" placeholder="背景颜色" name="special_bgcolor" value="{$special.special_bgcolor|default=''}" />
  39. <span class="help-inline ">
  40. <span class="middle red">请填写色值,例如:#fff </span>
  41. </span>
  42. </div>
  43. </div>
  44. <div class="form-group required">
  45. <label class="col-sm-2 control-label" for="input-image">
  46. <span title="" data-toggle="tooltip" data-original-title="平铺页面">背景图片:</span>
  47. </label>
  48. <div class="col-sm-10" id="thumb">
  49. <a href="#" data-toggle="image" class="img-thumbnail">
  50. <img osctype="image" <if condition="!empty($special['special_bgimage'])">
  51. src="__ROOT__<?php echo resize($special['special_bgimage'],100,100); ?>"
  52. <else />
  53. src="__ROOT__/Common/image/no_image_100x100.jpg"
  54. </if> />
  55. </a>
  56. <input osctype="image_input" type="hidden" name="image" value="{$special.special_bgimage|default=''}" id="input-image" />
  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-share_title" class="form-control" type="text" placeholder="分享标题" name="share_title" value="{$special.share_title|default=''}" />
  63. <span class="help-inline ">
  64. <span class="middle red">不填写默认使用主题标题</span>
  65. </span>
  66. </div>
  67. </div>
  68. <div class="form-group required">
  69. <label class="col-sm-2 control-label" for="input-name2">分享描述:</label>
  70. <div class="col-sm-10">
  71. <input id="input-share_descript" class="form-control" type="text" placeholder="分享描述" name="share_descript" value="{$special.share_descript|default=''}" />
  72. <span class="help-inline ">
  73. <span class="middle red"></span>
  74. </span>
  75. </div>
  76. </div>
  77. <div class="form-group" id="goods-image-row7">
  78. <label class="col-sm-2 control-label no-padding-left">分享图片 </label>
  79. <div class="col-sm-10" id="image-row7">
  80. <a href="#" data-toggle="image" class="img-thumbnail" type="goods" id="thumb-image7" num="7">
  81. <img osctype="goods_image7" <if condition="$special['share_image']">
  82. src="__ROOT__/<?php echo resize($special['share_image'],100,100); ?>"
  83. <else />
  84. src="__ROOT__/Common/image/no_image_40x40.jpg"
  85. </if> />
  86. </a>
  87. <input osctype="goods_image_input7" type="hidden" name="share_image" value="{$special.share_image=''}" id="input-image7" />
  88. <span class="help-inline ">
  89. 正方形图片
  90. </span>
  91. </div>
  92. </div>
  93. </div>
  94. <!-- 常规 END -->
  95. </div>
  96. </form>
  97. </div>
  98. </div>
  99. </div>
  100. </block>
  101. <block name="javascript">
  102. <style>
  103. .table thead > tr > td, .table tbody > tr > td {
  104. vertical-align: middle;
  105. }
  106. .table thead td span[data-toggle="tooltip"]:after, label.control-label span:after {
  107. font-family: FontAwesome;
  108. color: #1E91CF;
  109. content: "\f059";
  110. margin-left: 4px;
  111. }
  112. </style>
  113. <script src="__PUBLIC__/fileupload/jquery.ui.widget.js"></script>
  114. <script src="__PUBLIC__/fileupload/jquery.fileupload.js"></script>
  115. <script>
  116. $(function(){
  117. // tooltips on hover button-upload
  118. $('[data-toggle=\'tooltip\']').tooltip({container: 'body', html: true});
  119. // Makes tooltips work on ajax generated content
  120. $(document).ajaxStop(function() {
  121. $('[data-toggle=\'tooltip\']').tooltip({container: 'body'});
  122. });
  123. $(document).delegate('a[data-toggle=\'image\']', 'click', function(e) {
  124. e.preventDefault();
  125. var index=$(this).attr('num');
  126. var type=$(this).attr('type');
  127. //alert(index);
  128. var element = this;
  129. if(index==undefined){
  130. $(element).popover({
  131. html: true,
  132. placement: 'right',
  133. trigger: 'manual',
  134. content: function() {
  135. return '<button type="button" id="thumb-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>';
  136. }
  137. });
  138. }else{
  139. $(element).popover({
  140. html: true,
  141. placement: 'right',
  142. trigger: 'manual',
  143. content: function() {
  144. return '<button type="button" n="'+index+'" t="'+type+'" class="btn btn-primary button-image"><i class="icon-edit"></i></button> ';
  145. }
  146. });
  147. }
  148. $(element).popover('toggle');
  149. //商品图片
  150. $('#thumb-image').on('click', function() {
  151. //alert('333');
  152. $('#modal-image').remove();
  153. $('#form-upload').remove();
  154. $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input osctype="btn_upload_image" type="file" name="file" /></form>');
  155. $('#form-upload input[name=\'file\']').trigger('click');
  156. $(element).popover('hide');
  157. $('[osctype="btn_upload_image"]').fileupload({
  158. dataType: 'json',
  159. url: "{:U('Image/upload_image',array('dir'=>'shop'))}",
  160. add: function(e, data) {
  161. $parent = $('#thumb');
  162. $input = $parent.find('[osctype="image_input"]');
  163. $img = $parent.find('[osctype="image"]');
  164. data.formData = {old_goods_image:$input.val()};
  165. $img.attr('src', "__IMG__/loading.gif");
  166. data.submit();
  167. },
  168. done: function (e,data) {
  169. var image=data.result;
  170. $parent = $('#thumb');
  171. $input = $parent.find('[osctype="image_input"]');
  172. $img = $parent.find('[osctype="image"]');
  173. if(image) {
  174. // $img.prev('i').hide();
  175. $img.attr('src', '__ROOT__'+image.image_thumb);
  176. $img.show();
  177. $input.val(image.image);
  178. } else {
  179. alert('上传失败');
  180. }
  181. }
  182. });
  183. });
  184. $('.button-image').on('click', function() {
  185. $('#modal-image').remove();
  186. $('#form-upload').remove();
  187. var i=$(this).attr('n');
  188. var type=$(this).attr('t');
  189. $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input osctype="btn_upload_image" type="file" name="file" /></form>');
  190. $('#form-upload input[name=\'file\']').trigger('click');
  191. $(element).popover('hide');
  192. $('[osctype="btn_upload_image"]').fileupload({
  193. dataType: 'json',
  194. url: "{:U('Image/upload_image/dir')}"+'/'+type,
  195. add: function(e, data) {
  196. $parent = $('#image-row'+i);
  197. $input = $parent.find('[osctype="'+type+'_image_input'+i+'"]');
  198. $img = $parent.find('[osctype="'+type+'_image'+i+'"]');
  199. var old_name='old_'+type+'_image';
  200. data.formData = {old_name:$input.val()};
  201. $img.attr('src', "__IMG__/loading.gif");
  202. data.submit();
  203. },
  204. done: function (e,data) {
  205. var image=data.result;
  206. $parent = $('#'+type+'-image-row'+i);
  207. $input = $parent.find('[osctype="'+type+'_image_input'+i+'"]');
  208. $img = $parent.find('[osctype="'+type+'_image'+i+'"]');
  209. if(image) {
  210. // $img.prev('i').hide();
  211. $img.attr('src', '__ROOT__/'+image.image_thumb);
  212. $img.show();
  213. $input.val(image.image);
  214. } else {
  215. alert('上传失败');
  216. }
  217. }
  218. });
  219. });
  220. $('#button-clear').on('click', function() {
  221. $(element).find('img').attr('src', $(element).find('img').attr('data-placeholder'));
  222. $(element).parent().find('input').attr('value', '');
  223. $(element).popover('hide');
  224. });
  225. });
  226. });
  227. </script>
  228. </block>