edit.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <!-- 头部 -->
  2. <include file="Public/top" />
  3. <div class="wrapper row-offcanvas row-offcanvas-left">
  4. <!-- Left side column. contains the logo and sidebar -->
  5. <aside class="left-side sidebar-offcanvas">
  6. <!-- 左边 -->
  7. <include file="Public/left" />
  8. </aside>
  9. <!-- Right side column. Contains the navbar and content of the page -->
  10. <aside class="right-side">
  11. <!-- Content Header (Page header) -->
  12. <!-- bar -->
  13. <include file="Public/bar" />
  14. <!-- 右侧 -->
  15. <div class="col-md-12">
  16. <form method="post">
  17. <div class="box box-primary">
  18. <div class="box-header">
  19. <h3 class="box-title">编辑活动</h3>
  20. </div><!-- /.box-header -->
  21. <!-- form start -->
  22. <div class="box-body">
  23. <div class="form-group">
  24. <div class="input-group margin col-xs-6">
  25. <div class="input-group-btn">
  26. <button class="btn btn-danger" type="button">活动名称:</button>
  27. </div>
  28. <input type="text" name="act_title" value="<{$info['act_title']}>" class="form-control"/>
  29. </div>
  30. </div>
  31. <div class="form-group">
  32. <div class="input-group margin col-xs-6">
  33. <div class="input-group-btn">
  34. <button class="btn btn-danger" type="button">出品方:</button>
  35. </div>
  36. <input type="text" name="act_name" value="<{$info['act_name']}>" class="form-control"/>
  37. </div>
  38. </div>
  39. <div class="form-group">
  40. <div class="input-group margin col-xs-6">
  41. <div class="input-group-btn">
  42. <button class="btn btn-primary" type="button">显示顺序:</button>
  43. </div><!-- /btn-group -->
  44. <input type="text" name="act_sort" value="<{$info['act_sort']}>" class="form-control"/>
  45. </div>
  46. </div>
  47. <div class="form-group">
  48. <div class="input-group margin col-xs-6">
  49. <div class="input-group-btn">
  50. <button class="btn btn-danger" type="button">Banner图片:</button>
  51. </div><!-- /btn-group -->
  52. <div class="col-xs-10">
  53. <input name="act_pic" type="hidden" id="act_pic" value="<{$info['act_pic']}>">
  54. <input id="upload" name="image" accept="image/*" type="file" style="display: none"/>
  55. <img id="headPic" src="<empty name="info['act_pic']">__PUBLIC__/img/banner.jpg<else /><{$info['act_pic']}></empty>" height="150px" style="padding: 5px">
  56. <button id="submit_btn" type="button" class="btn btn-primary" style="display: none;">确定修改</button>
  57. <label >点击图片即可修改<br/>建议上传尺寸:420x320 px</label><br>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="form-group">
  62. <div class="input-group margin col-xs-6">
  63. <div class="input-group-btn">
  64. <button class="btn btn-danger" type="button">活动详情:</button>
  65. </div>
  66. <textarea rows="15" id="container" name="act_content" width:500px;height:500px><{$info['act_content']}></textarea>
  67. </div>
  68. </div>
  69. </div><!-- /.box-body -->
  70. <div class="box-footer">
  71. <input type="hidden" name="step" id="step" value="2" />
  72. <input type="hidden" name="act_id" id="act_id" value="<{$info['act_id']}>" />
  73. <button class="btn btn-primary" name="submit1" type="submit">提交</button>
  74. <button class="btn btn-primary" name="submit2" type="reset">重置</button>
  75. <a href="javascript:history.go(-1)" class="btn btn-primary">返回</a>
  76. </div>
  77. </div>
  78. </form>
  79. <!-- /.box -->
  80. </div>
  81. <!-- 右侧 -->
  82. </aside>
  83. <!-- /.content -->
  84. </div>
  85. <!-- /.content-wrapper -->
  86. <!-- Main Footer -->
  87. <!-- 底部 -->
  88. <script src="__PUBLIC__/js/ajaxfileupload.js" type="text/javascript"></script>
  89. <js href="__PUBLIC__/ueditor/ueditor.config.js" />
  90. <js href="__PUBLIC__/ueditor/ueditor.all.min.js" />
  91. <script type="text/javascript">
  92. <!--
  93. $(function() {
  94. var url='<{:U('Admin/Ueditor/Index')}>';
  95. var ue = UE.getEditor('container',{
  96. initialFrameHeight: 600,
  97. serverUrl :url,
  98. UEDITOR_HOME_URL:'__PUBLIC__/ueditor/',
  99. });
  100. ue.ready(function(){
  101. ue.execCommand('serverparam', {
  102. 'userid': '1',
  103. 'username': 'admin',
  104. });
  105. });
  106. //头像预览
  107. $("#headPic").click(function () {
  108. $("#upload").click(); //隐藏了input:file样式后,点击头像就可以本地上传
  109. $("#upload").on("change",function(){
  110. var objUrl = getObjectURL(this.files[0]) ; //获取图片的路径,该路径不是图片在本地的路径
  111. if (objUrl) {
  112. $("#headPic").attr("src", objUrl) ; //将图片路径存入src中,显示出图片
  113. }
  114. // 如果确认已经选择了一张图片, 则进行上传操作
  115. if ($.trim($(this).val())) {
  116. $("#submit_btn").trigger('click');
  117. }
  118. });
  119. });
  120. //图片上传
  121. $("#submit_btn").click(function () {
  122. var imgurl = document.getElementById("upload").value;
  123. $.ajaxFileUpload({
  124. url:"/admin/slider/upload?dir=ad",
  125. fileElementId: "upload", //文件上传域的ID,这里是input的ID,而不是img的
  126. dataType: 'json', //返回值类型 一般设置为json
  127. contentType: "application/x-www-form-urlencoded; charset=utf-8",
  128. success: function (data) {
  129. if (data.code==0){
  130. $("#imag").attr("src","/images/loading.gif");
  131. //将图片换成默认的+图片
  132. $("#imag").attr('src',data.path);
  133. $('#act_pic').val(data.path);
  134. }else{
  135. alert(data.info);
  136. }
  137. }
  138. });
  139. });
  140. });
  141. //建立一個可存取到該file的url
  142. function getObjectURL(file) {
  143. var url = null ;
  144. if (window.createObjectURL!=undefined) { // basic
  145. url = window.createObjectURL(file) ;
  146. } else if (window.URL!=undefined) { // mozilla(firefox)
  147. url = window.URL.createObjectURL(file) ;
  148. } else if (window.webkitURL!=undefined) { // webkit or chrome
  149. url = window.webkitURL.createObjectURL(file) ;
  150. }
  151. return url ;
  152. }
  153. //-->
  154. </script>
  155. <!-- 底部 -->
  156. </body>
  157. </html>