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