edit.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <{include file="./admin/header.html"}>
  2. <{include file="./admin/left.html"}>
  3. <{include file="./admin/nav.html"}>
  4. <{include file="get_kindeditor.html"}>
  5. <script type="text/javascript" src="<{$web_cfg.cdn}>/public/static/js/jquery-1.7.2.min.js"></script>
  6. <link rel="stylesheet" href="<{$web_cfg.cdn}>/public/static/js/jquery.minicolors.css" />
  7. <script type="text/javascript" src="<{$web_cfg.cdn}>/public/static/js/jquery.minicolors.js"></script>
  8. <style>
  9. .set-nav {
  10. margin: 0 auto;
  11. }
  12. .set-nav-hr {
  13. background-color: #ddd;
  14. height: 1px;
  15. position: relative;
  16. }
  17. .form-group label {
  18. font-weight: 600;
  19. }
  20. .checkbox-inline, .radio-inline {
  21. font-weight: 400!important;
  22. }
  23. .rowlabel {
  24. font-weight: 300!important;
  25. }
  26. .music_play_hide {
  27. display:none;
  28. }
  29. </style>
  30. <form id="add_platform_form">
  31. <input name="id" type="hidden" value="<{$focusData.id}>">
  32. <div class="col-md-5" style="padding-left: 30px;">
  33. <div class="form-group">
  34. <label class="control-label">编辑推荐信息</label>
  35. </div>
  36. <div class="form-group">
  37. <label class="control-label rowlabel">选择平台</label>
  38. <select name="platform_id" id="platform_id">
  39. <{foreach from=$platformList item=item}>
  40. <option value="<{$item.id}>" <{if $item.id == $focusData.platform_id}>selected<{/if}>><{$item.name}></option>
  41. </tr>
  42. <{/foreach}>
  43. </select>
  44. </div>
  45. <div class="form-group">
  46. <label class="control-label rowlabel">推荐名称</label>
  47. <input name="name" type="text" class="form-control" value="<{$focusData.name}>">
  48. </div>
  49. <div class="form-group">
  50. <label class="control-label rowlabel">推荐排序-数字越大越靠前</label>
  51. <input name="index" type="text" class="form-control" value="<{$focusData.index}>">
  52. </div>
  53. <div class="form-group">
  54. <label class="control-label rowlabel">推荐链接</label>
  55. <input name="link" type="text" class="form-control" value="<{$focusData.link}>">
  56. </div>
  57. <div class="form-group">
  58. <label class="control-label rowlabel">推荐图片</label>
  59. <div>
  60. <img id="icon_image_tag" src="<{$focusData.pic}>" style="width:30px;" class="img-thumbnail">
  61. <input id="icon_image_input" name='pic' type="hidden" value="<{$focusData.pic}>">
  62. <input id="icon_image_upload" type="button" value="选中图片" >
  63. <span class="note">图片大小:宽度640px,高度自适应</span>
  64. </div>
  65. </div>
  66. <div>
  67. <a id="add_platform_btn" href="javascript:;" class="button button-primary button-small">修改分类</a>
  68. </div>
  69. </div>
  70. </form>
  71. <script>
  72. KISSY.use('node, io', function (S, Node, IO) {
  73. var $ = S.all;
  74. $("#add_platform_btn").on('click', function () {
  75. var name = $("input[name=name]").val();
  76. if (!name) {
  77. alert('请填写名称');
  78. return false;
  79. }
  80. var index = $("input[name=index]").val();
  81. if (!index) {
  82. alert('请填写排序');
  83. return false;
  84. }
  85. var platform_id = $("select[name=platform_id]").val();
  86. if (!platform_id) {
  87. alert('请选择平台');
  88. return false;
  89. }
  90. var link = $("input[name=link]").val();
  91. if (!link) {
  92. alert('请填写链接');
  93. return false;
  94. }
  95. var pic = $("input[name=pic]").val();
  96. if (!pic) {
  97. alert('请选择推荐图片');
  98. return false;
  99. }
  100. var data = IO.serialize("#add_platform_form");
  101. new IO({
  102. type: "post"
  103. , url: VG.conf.root_domain + '/?c=Admin_Focus_index&a=PageList&a=ReqUp'
  104. , data: data
  105. , success: function (data) {
  106. if (data.ok) { //ok
  107. var url = data.msg;
  108. location.href = VG.conf.root_domain + '/?c=Admin_Focus_index&a=PageList';
  109. } else {
  110. alert('操作失败,原因:'+data.msg);
  111. }
  112. return false;
  113. }
  114. , error: function (NULL, textStatus) {
  115. alert("请求服务器失败,原因:"+textStatus);
  116. }
  117. , dataType: "json"
  118. });
  119. });
  120. });
  121. //icon image
  122. KindEditor.ready(function(K) {
  123. var uploadbutton = K.uploadbutton({
  124. button : K('#icon_image_upload')[0],
  125. fieldName : 'imgFile',
  126. url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=image',
  127. afterUpload : function(data) {
  128. if (data.error === 0) {
  129. var url = K.formatUrl(data.url, 'absolute');
  130. K('#icon_image_input').val(data.url);
  131. K('#icon_image_tag').attr('src', data.url);
  132. } else {
  133. alert(data.message);
  134. }
  135. },
  136. afterError : function(str) {
  137. alert('自定义错误信息: ' + str);
  138. }
  139. });
  140. uploadbutton.fileBox.change(function(e) {
  141. uploadbutton.submit();
  142. });
  143. });
  144. </script>
  145. <{include file="./admin/bottom.html"}>