edit.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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="<{$CategoryData.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. <input name="name" type="text" class="form-control" value="<{$CategoryData.name}>">
  39. </div>
  40. <div class="form-group">
  41. <label class="control-label rowlabel">分类图标</label>
  42. <div>
  43. <img id="icon_image_tag" src="<{$CategoryData.icon}>" style="width:30px;" class="img-thumbnail">
  44. <input id="icon_image_input" name='icon' type="hidden" value="<{$CategoryData.icon}>">
  45. <input id="icon_image_upload" type="button" value="选中图片" >
  46. </div>
  47. </div>
  48. <div>
  49. <a id="add_platform_btn" href="javascript:;" class="button button-primary button-small">修改分类</a>
  50. </div>
  51. </div>
  52. </form>
  53. <script>
  54. KISSY.use('node, io', function (S, Node, IO) {
  55. var $ = S.all;
  56. $("#add_platform_btn").on('click', function () {
  57. var name = $("input[name=name]").val();
  58. if (!name) {
  59. alert('请填写名称');
  60. return false;
  61. }
  62. var icon = $("input[name=icon]").val();
  63. if (!icon) {
  64. alert('请选择分类图标');
  65. return false;
  66. }
  67. var data = IO.serialize("#add_platform_form");
  68. new IO({
  69. type: "post"
  70. , url: VG.conf.root_domain + '/?c=Admin_Category_index&a=PageList&a=ReqUp'
  71. , data: data
  72. , success: function (data) {
  73. if (data.ok) { //ok
  74. var url = data.msg;
  75. location.href = VG.conf.root_domain + '/?c=Admin_Category_index&a=PageList';
  76. } else {
  77. alert('操作失败,原因:'+data.msg);
  78. }
  79. return false;
  80. }
  81. , error: function (NULL, textStatus) {
  82. alert("请求服务器失败,原因:"+textStatus);
  83. }
  84. , dataType: "json"
  85. });
  86. });
  87. });
  88. //icon image
  89. KindEditor.ready(function(K) {
  90. var uploadbutton = K.uploadbutton({
  91. button : K('#icon_image_upload')[0],
  92. fieldName : 'imgFile',
  93. url : VG.conf.root_domain + '/?c=kindeditor&a=updateJson&dir=image',
  94. afterUpload : function(data) {
  95. if (data.error === 0) {
  96. var url = K.formatUrl(data.url, 'absolute');
  97. K('#icon_image_input').val(data.url);
  98. K('#icon_image_tag').attr('src', data.url);
  99. } else {
  100. alert(data.message);
  101. }
  102. },
  103. afterError : function(str) {
  104. alert('自定义错误信息: ' + str);
  105. }
  106. });
  107. uploadbutton.fileBox.change(function(e) {
  108. uploadbutton.submit();
  109. });
  110. });
  111. </script>
  112. <{include file="./admin/bottom.html"}>