edit.html 5.2 KB

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