questionedit.html
8.7 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<include file="public@header" />
</head>
<body>
<div class="wrap">
<ul class="nav nav-tabs">
<li><a href="{:url('Question/question')}">评分题目列表</a></li>
<li class="active"><a href="#">编辑评分题目</a></li>
</ul>
<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Question/questionEditPost')}">
<input type="hidden" name="id" value="{$edit.id}">
<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">
<select class="form-control" name="parent_id" id="parent_id">
<option value="0">作为一级菜单</option>
<foreach name="select" item="vo">
<option value="{$vo.id}" <eq name="$parent_id" value="$vo['id']">selected</eq>>{$vo.title}</option>
</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">
<textarea rows="10" class="form-control" name="title" required>{$edit.title}</textarea>
</div>
</div>
<div id="fen" 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="radio" id="thistype" name="type" value="0" <eq name="$edit.type" value="0">checked</eq> >不开启
<input type="radio" name="type" value="1" <eq name="$edit.type" value="1">checked</eq> >开启
</div>
</div>
<div id="fen1" class="form-group <eq name="$edit.type" value="0">hidden</eq> ">
<label class="col-sm-2 control-label"><span class="form-required">*</span>单独评分分数区间</label>
<div class="col-md-6 col-sm-10">
</span><input type="number" class="form-control" style="width: 100px; float: left" name="min" placeholder="最低分" value="{$edit.min}">
<span style="float: left; margin-left: 5px; margin-top: 5px">——</span>
<input type="number" class="form-control" style="width: 100px; float: left; margin-left: 10px" name="max" placeholder="最高分" value="{$edit.max}">
</div>
</div>
<div id="fen2" class="form-group <eq name="$edit.type" value="0">hidden</eq> ">
<label class="col-sm-2 control-label"><span class="form-required">*</span>单独评分内容</label>
<div class="col-md-6 col-sm-10">
<textarea rows="10" type="text" class="form-control" name="content">{$edit.content}</textarea>
</div>
</div>
<div id="ti" 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="radio" id="thishint" name="hint_type" value="0" <eq name="$edit.hint_type" value="0">checked</eq> >无提示信息
<input type="radio" name="hint_type" value="1" <eq name="$edit.hint_type" value="1">checked</eq> >有提示信息
</div>
</div>
<div id="ti3" class="form-group <eq name="$edit.hint_type" value="0">hidden</eq> ">
<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="hint_text" value="{$edit.hint_text}">
</div>
</div>
<div id="ti1" class="form-group <eq name="$edit.hint_type" value="0">hidden</eq> ">
<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="hint_title" value="{$edit.hint_title}">
</div>
</div>
<div id="ti2" class="form-group <eq name="$edit.hint_type" value="0">hidden</eq> ">
<label class="col-sm-2 control-label"><span class="form-required">*</span>提示信息内容</label>
<div class="col-md-6 col-sm-10">
<textarea rows="10" class="form-control" name="hint_content">{$edit.hint_content}</textarea>
</div>
</div>
<div id="xuan" 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="number" class="form-control" name="score" value="{$edit.score}">
</div>
</div>
<div id="xuan1" 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="number" class="form-control" name="order_id" value="{$edit.order_id}">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
</div>
</div>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
$(function () {
//按默认parent_id显示页面信息
var question_type = $('#parent_id').val();
if(question_type == 0){
$('#xuan').attr('class','form-group hidden');
$('#xuan1').attr('class','form-group hidden');
$('#fen').attr('class','form-group');
$('#ti').attr('class','form-group');
} else {
$('#xuan').attr('class','form-group');
$('#xuan1').attr('class','form-group');
$('#fen').attr('class','form-group hidden');
$('#fen1').attr('class','form-group hidden');
$('#fen2').attr('class','form-group hidden');
$('#ti').attr('class','form-group hidden');
$('#ti1').attr('class','form-group hidden');
$('#ti2').attr('class','form-group hidden');
$('#ti3').attr('class','form-group hidden');
}
//动态改变页面信息
$('#parent_id').on('change',function () {
var question_type = $('#parent_id').val();
if(question_type == 0){
$('#xuan').attr('class','form-group hidden');
$('#xuan1').attr('class','form-group hidden');
$('#fen').attr('class','form-group');
$('#ti').attr('class','form-group');
$('input[type=radio]').removeAttr('checked');
$('#thishint').prop('checked',true);
$('#thistype').prop('checked',true);
} else {
$('#xuan').attr('class','form-group');
$('#xuan1').attr('class','form-group');
$('#fen').attr('class','form-group hidden');
$('#fen1').attr('class','form-group hidden');
$('#fen2').attr('class','form-group hidden');
$('#ti').attr('class','form-group hidden');
$('#ti1').attr('class','form-group hidden');
$('#ti2').attr('class','form-group hidden');
$('#ti3').attr('class','form-group hidden');
$('input[type=radio]').removeAttr('checked');
$('#thishint').prop('checked',true);
$('#thistype').prop('checked',true);
}
});
//动态显示单独评分组信息
$('input[name=type]').on('click',function(){
var fen = $('input[name=type]:checked').val();
console.log(fen)
if(fen == 0){
$('#fen1').attr('class','form-group hidden');
$('#fen2').attr('class','form-group hidden');
} else {
$('#fen1').attr('class','form-group');
$('#fen2').attr('class','form-group');
}
});
//动态显示提示组信息
$('input[name=hint_type]').on('click',function(){
var ti = $('input[name=hint_type]:checked').val();
console.log(fen)
if(ti == 0){
$('#ti1').attr('class','form-group hidden');
$('#ti2').attr('class','form-group hidden');
$('#ti3').attr('class','form-group hidden');
} else {
$('#ti1').attr('class','form-group');
$('#ti2').attr('class','form-group');
$('#ti3').attr('class','form-group');
}
})
})
</script>
</body>
</html>