add.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <include file="public@header"/>
  2. </head>
  3. <body>
  4. <div class="wrap js-check-wrap">
  5. <ul class="nav nav-tabs">
  6. <li><a href="{:url('NavMenu/index',['nav_id'=>$nav_id])}">导航菜单</a></li>
  7. <li class="active"><a>{:lang('ADMIN_MENU_ADD')}</a></li>
  8. </ul>
  9. <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('NavMenu/addPost')}">
  10. <fieldset>
  11. <div class="form-group">
  12. <label class="col-sm-2 control-label">上级:</label>
  13. <div class="col-md-6 col-sm-10">
  14. <select name="parent_id" class="form-control">
  15. <option value="0">/</option>
  16. {$nav_trees}
  17. </select>
  18. </div>
  19. </div>
  20. <div class="form-group form-inline">
  21. <label class="col-sm-2 control-label"><span class="form-required">*</span>地址:</label>
  22. <div class="col-md-6 col-sm-10">
  23. <input type="radio" id="external-link-radio">
  24. <input type="text" class="form-control" name="href" id="external-link-input">
  25. <input type="radio" id="select-href-radio">
  26. <select name="href" id="select-href" class="form-control">
  27. <option value="{:base64_encode('home')}" data-name="首页">首页</option>
  28. <foreach name="navs" item="vo">
  29. <optgroup label="{$vo.name}">
  30. {$vo.html}
  31. </optgroup>
  32. </foreach>
  33. </select>
  34. </div>
  35. </div>
  36. <div class="form-group">
  37. <label class="col-sm-2 control-label"><span class="form-required">*</span>菜单名称:</label>
  38. <div class="col-md-6 col-sm-10">
  39. <input type="text" class="form-control" name="name" id="name-input">
  40. </div>
  41. </div>
  42. <div class="form-group">
  43. <label class="col-sm-2 control-label">打开方式:</label>
  44. <div class="col-md-6 col-sm-10">
  45. <select class="form-control" name="target">
  46. <option value="">默认方式</option>
  47. <option value="_blank">新窗口打开</option>
  48. </select>
  49. </div>
  50. </div>
  51. <div class="form-group">
  52. <label class="col-sm-2 control-label">图标:</label>
  53. <div class="col-md-6 col-sm-10">
  54. <input type="text" class="form-control" name="icon" value="">
  55. </div>
  56. </div>
  57. <div class="form-group">
  58. <label class="col-sm-2 control-label">显示:</label>
  59. <div class="col-md-6 col-sm-10">
  60. <select name="status" class="form-control">
  61. <option value="1">显示</option>
  62. <option value="0">隐藏</option>
  63. </select>
  64. </div>
  65. </div>
  66. </fieldset>
  67. <div class="col-sm-offset-2 col-sm-10">
  68. <input type="hidden" name="nav_id" value="{$nav_id}"/>
  69. <button type="submit" class="btn btn-primary js-ajax-submit">{:lang("SAVE")}</button>
  70. <a class="btn btn-default" href="{:url('NavMenu/index',['nav_id'=>$nav_id])}">返回</a>
  71. </div>
  72. </form>
  73. </div>
  74. <script src="__STATIC__/js/admin.js"></script>
  75. <script>
  76. $(function () {
  77. $("#select-href,#select-href-radio").click(function () {
  78. checkChange(2);
  79. });
  80. $("#select-href").change(function () {
  81. var $this = $(this);
  82. var label = $this.find("option[value='" + $this.val() + "']").data('name');
  83. $('#name-input').val(label);
  84. });
  85. $("#external-link-input,#external-link-radio").click(function () {
  86. checkChange(1);
  87. });
  88. function checkChange(i) {
  89. if (i == 1) {
  90. //自动输入url
  91. $('#external-link-input').attr('name', 'external_href');
  92. $('#select-href').removeAttr('name');
  93. $('#select-href-radio').prop('checked', false);
  94. $('#external-link-radio').prop('checked', true);
  95. } else {
  96. //选择链接url
  97. $('#select-href').attr('name', 'href');
  98. $('#external-link-input').removeAttr('name');
  99. $('#select-href-radio').prop('checked', true);
  100. $('#external-link-radio').prop('checked', false);
  101. }
  102. }
  103. });
  104. </script>
  105. </body>
  106. </html>