list.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. <div class="panel panel-default col-md-7">
  31. <div class="panel-body">
  32. <table class="table">
  33. <thead>
  34. <tr>
  35. <th>排序</th>
  36. <th>平台</th>
  37. <th>名称</th>
  38. <th>图片</th>
  39. <th>编辑</th>
  40. </tr>
  41. </thead>
  42. <tbody>
  43. <{if !$focusData}>
  44. <tr><td colspan="5" align="center">暂无信息</td></tr>
  45. <{/if}>
  46. <{foreach from=$focusData item=item}>
  47. <tr>
  48. <td><{$item.index}></td>
  49. <td><{$platformList[$item.platform_id].name}></td>
  50. <td><{$item.name}></td>
  51. <td><img src="<{$item.pic}>" width="100" /><br /><{$item.link}></td>
  52. <td><a href="<{$web_cfg.domain}>/?c=Admin_Focus_index&a=PageShow&id=<{$item.id}>">编辑</a> <a href="javascript:;" class="deleteItem" data-id="<{$item.id}>">删除</a></td>
  53. </tr>
  54. <{/foreach}>
  55. </tbody>
  56. </table>
  57. <div class="page"><{$page_html}></div>
  58. </div>
  59. </div>
  60. <form id="add_focus_form">
  61. <div class="col-md-5" style="padding-left: 30px;">
  62. <div class="form-group">
  63. <label class="control-label">添加一个相关推荐</label>
  64. </div>
  65. <div class="form-group">
  66. <label class="control-label rowlabel">选择平台</label>
  67. <select name="platform_id" id="platform_id">
  68. <{foreach from=$platformList item=item}>
  69. <option value="<{$item.id}>"><{$item.name}></option>
  70. </tr>
  71. <{/foreach}>
  72. </select>
  73. </div>
  74. <div class="form-group">
  75. <label class="control-label rowlabel">推荐名称</label>
  76. <input name="name" type="text" class="form-control" >
  77. </div>
  78. <div class="form-group">
  79. <label class="control-label rowlabel">推荐排序-数字越大越靠前</label>
  80. <input name="index" type="text" class="form-control" value="1">
  81. </div>
  82. <div class="form-group">
  83. <label class="control-label rowlabel">推荐地址</label>
  84. <input name="link" type="text" class="form-control" >
  85. </div>
  86. <div class="form-group">
  87. <label class="control-label rowlabel">推荐图片</label>
  88. <div>
  89. <img id="icon_image_tag" src="http://placehold.it/36&text=36x36" style="width:30px;" class="img-thumbnail">
  90. <input id="icon_image_input" name='pic' type="hidden" value="">
  91. <input id="icon_image_upload" type="button" value="默认图片" >
  92. <span class="note">图片大小:高度为128px</span>
  93. </div>
  94. </div>
  95. <div>
  96. <a id="add_focus_btn" href="javascript:;" class="button button-primary button-small">添加</a>
  97. </div>
  98. </div>
  99. </form>
  100. <script>
  101. KISSY.use('node, io', function (S, Node, IO) {
  102. var $ = S.all;
  103. $(".deleteItem").on('click', function () {
  104. var id = $(this).attr('data-id');
  105. if (!id) {
  106. alert('无效id');
  107. return false;
  108. }
  109. if (!confirm('确定要删除这项数据?')) {
  110. return false;
  111. }
  112. new IO({
  113. type: "post"
  114. , url: VG.conf.root_domain + '/?c=Admin_Focus_index&a=Delete'
  115. , data: {'id':id}
  116. , success: function (data) {
  117. if (data.ok) { //ok
  118. alert('操作成功');
  119. location.reload();
  120. } else {
  121. alert('操作失败,原因:'+data.msg);
  122. }
  123. return false;
  124. }
  125. , error: function (NULL, textStatus) {
  126. alert("请求服务器失败,原因:"+textStatus);
  127. }
  128. , dataType: "json"
  129. });
  130. });
  131. $("#add_focus_btn").on('click', function () {
  132. var name = $("input[name=name]").val();
  133. if (!name) {
  134. alert('请填写名称');
  135. return false;
  136. }
  137. var index = $("input[name=index]").val();
  138. if (!index) {
  139. alert('请填写排序');
  140. return false;
  141. }
  142. var platform_id = $("select[name=platform_id]").val();
  143. if (!platform_id) {
  144. alert('请选择平台');
  145. return false;
  146. }
  147. var link = $("input[name=link]").val();
  148. if (!link) {
  149. alert('请填写链接');
  150. return false;
  151. }
  152. var pic = $("input[name=pic]").val();
  153. if (!pic) {
  154. alert('请选择推荐图片');
  155. return false;
  156. }
  157. var data = IO.serialize("#add_focus_form");
  158. new IO({
  159. type: "post"
  160. , url: VG.conf.root_domain + '/?c=Admin_Focus_index&a=PageList&a=ReqCreate'
  161. , data: data
  162. , success: function (data) {
  163. if (data.ok) { //ok
  164. var url = data.msg;
  165. location.href = VG.conf.url;
  166. } else {
  167. alert('操作失败,原因:'+data.msg);
  168. }
  169. return false;
  170. }
  171. , error: function (NULL, textStatus) {
  172. alert("请求服务器失败,原因:"+textStatus);
  173. }
  174. , dataType: "json"
  175. });
  176. });
  177. });
  178. //icon image
  179. KindEditor.ready(function(K) {
  180. var uploadbutton = K.uploadbutton({
  181. button : K('#icon_image_upload')[0],
  182. fieldName : 'imgFile',
  183. url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=image',
  184. afterUpload : function(data) {
  185. if (data.error === 0) {
  186. var url = K.formatUrl(data.url, 'absolute');
  187. K('#icon_image_input').val(data.url);
  188. K('#icon_image_tag').attr('src', data.url);
  189. } else {
  190. alert(data.message);
  191. }
  192. },
  193. afterError : function(str) {
  194. alert('自定义错误信息: ' + str);
  195. }
  196. });
  197. uploadbutton.fileBox.change(function(e) {
  198. uploadbutton.submit();
  199. });
  200. });
  201. </script>
  202. <{include file="./admin/bottom.html"}>