wxprogram.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. </small>
  9. </h1>
  10. </div>
  11. <div class="row">
  12. <div class="col-xs-12 search-row">
  13. <div class="panel-body">
  14. <ul class="nav nav-tabs">
  15. <li <?php if($type == 1){ ?>class="active" <?php } ?>><a href="{:U('settings/wxprogram')}">参数配置</a></li>
  16. <li <?php if($type == 2){ ?>class="active" <?php } ?>><a href="{:U('settings/wxprogram_template')}">模板消息配置</a></li>
  17. </ul>
  18. </div>
  19. </div>
  20. <div class="col-xs-12">
  21. <form class="form-horizontal" id="form" method="post" action="{:U('Settings/save')}">
  22. <div class="col-xs-12 top">
  23. <div class="col-sm-2 ">微信小程序APPID:</div>
  24. <div class="col-sm-6">
  25. <input type="text" value="{$site.weprogram_appid.value|default=''}" id="weprogram_appid" name="weprogram_appid" class="form-control" placeholder="">
  26. </div>
  27. </div>
  28. <div class="col-xs-12 top">
  29. <div class="col-sm-2 ">微信小程序appscret:</div>
  30. <div class="col-sm-6">
  31. <input type="text" value="{$site.weprogram_appscret.value|default=''}" id="weprogram_appscret" name="weprogram_appscret" class="form-control" placeholder="">
  32. </div>
  33. </div>
  34. <div class="col-xs-12 top">
  35. <div class="col-sm-2 ">微信小程序支付KEY:</div>
  36. <div class="col-sm-6">
  37. <input type="text" value="{$site.weprogram_pay_key.value|default=''}" id="weprogram_pay_key" name="weprogram_pay_key" class="form-control" placeholder="">
  38. </div>
  39. </div>
  40. <div class="col-xs-12 top">
  41. <div class="col-sm-2 ">微信小程序商户id:</div>
  42. <div class="col-sm-6">
  43. <input type="text" value="{$site.weprogram_mch_id.value|default=''}" id="weprogram_mch_id" name="weprogram_mch_id" class="form-control" placeholder="">
  44. </div>
  45. </div>
  46. </form>
  47. <div class="form-group">
  48. <label class="col-sm-1 control-label no-padding-left"> </label>
  49. <div class="col-sm-11">
  50. <button form="form" type="submit" class="btn btn-sm btn-primary">提交</button>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </block>
  56. <block name="javascript">
  57. <style>
  58. .top, .buttom {
  59. margin-top: 15px;
  60. }
  61. </style>
  62. <script src="__PUBLIC__/fileupload/jquery.ui.widget.js"></script>
  63. <script src="__PUBLIC__/fileupload/jquery.fileupload.js"></script>
  64. <script>
  65. $(function(){
  66. // tooltips on hover button-upload
  67. $('[data-toggle=\'tooltip\']').tooltip({container: 'body', html: true});
  68. // Makes tooltips work on ajax generated content
  69. $(document).ajaxStop(function() {
  70. $('[data-toggle=\'tooltip\']').tooltip({container: 'body'});
  71. });
  72. $(document).delegate('a[data-toggle=\'image\']', 'click', function(e) {
  73. e.preventDefault();
  74. var index=$(this).attr('num');
  75. //alert(index);
  76. var element = this;
  77. if(index==undefined){
  78. $(element).popover({
  79. html: true,
  80. placement: 'right',
  81. trigger: 'manual',
  82. content: function() {
  83. 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>';
  84. }
  85. });
  86. }
  87. $(element).popover('toggle');
  88. //商品图片
  89. $('#thumb-image').on('click', function() {
  90. //alert('333');
  91. $('#modal-image').remove();
  92. $('#form-upload').remove();
  93. $('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input osctype="btn_upload_image" type="file" name="file" /></form>');
  94. $('#form-upload input[name=\'file\']').trigger('click');
  95. $(element).popover('hide');
  96. $('[osctype="btn_upload_image"]').fileupload({
  97. dataType: 'json',
  98. url: "{:U('Image/upload_image',array('dir'=>'shop'))}",
  99. add: function(e, data) {
  100. $parent = $('#thumb');
  101. $input = $parent.find('[osctype="image_input"]');
  102. $img = $parent.find('[osctype="image"]');
  103. data.formData = {old_goods_image:$input.val()};
  104. $img.attr('src', "__IMG__/loading.gif");
  105. data.submit();
  106. },
  107. done: function (e,data) {
  108. var image=data.result;
  109. $parent = $('#thumb');
  110. $input = $parent.find('[osctype="image_input"]');
  111. $img = $parent.find('[osctype="image"]');
  112. if(image) {
  113. // $img.prev('i').hide();
  114. $img.attr('src', '__ROOT__'+image.image_thumb);
  115. $img.show();
  116. $input.val(image.image);
  117. } else {
  118. alert('上传失败');
  119. }
  120. }
  121. });
  122. });
  123. $('#button-clear').on('click', function() {
  124. $(element).find('img').attr('src', $(element).find('img').attr('data-placeholder'));
  125. $(element).parent().find('input').attr('value', '');
  126. $(element).popover('hide');
  127. });
  128. });
  129. });
  130. </script>
  131. </block>