v_group.html
6.67 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<style>
#pop_group{ display: none; width: 60%; position: fixed; left: 20%; top: 5%; height:80%;background:#fff; z-index: 666; box-shadow: 0px 0px 5px #888888; }
#pop_group .title{ height: 40px; line-height: 40px; font-size: 15px; padding: 0 20px; border-bottom: 1px solid gainsboro; position: relative}
#pop_group .title .close_g{ position: absolute; right: 10px; bottom: 0;font-size: 30px;}
.new_grp{ width: 70px; height: 27px; border: 1px solid gainsboro; position: relative;top:1px;
text-align: center; line-height: 27px;display: inline-block}
#return_ajax{padding: 0 10px; margin-top: 20px}
.mlayerbox{
display: none; width: 100%;text-align: center; margin-top:20px ;
}
.input_btn{
vertical-align: top;
letter-spacing: normal;
display: inline-block;
*display: inline;
padding-right: 8px;
margin-left: 8px;
margin-right: -1px;
*zoom: 1;
cursor: pointer;
}
.input_btn div {
font-size: 12px;
line-height: 24px;
color: #ff3c3c;
background-color: #FFFFFF;
height: 24px;
padding: 2px 7px;
border: solid 1px #ff3c3c;
border-radius: 4px;
}
</style>
<!--------分组管理弹出框-------->
<div id="pop_group">
<div class="title">视频分组<span class="close_g">×</span></div>
<!--按钮搜索层-->
<div class="sear_div">
<div class="flexigrid" style="text-align: right; padding-right: 10px">
<div class="new_grp" >
<span onclick="add_new_group()"><i class="fa fa-plus"></i>新增分组</span>
</div>
<div class="sDiv2">
<input size="30" name="keywords" value="{$keywords}"class="qsbox" id="keywords" placeholder="搜索视频" type="text">
<input id="submitBtn" class="btn" value="搜索" type="submit" onclick="search_video1()">
</div>
</div>
</div>
<div id="return_ajax"></div>
</div>
<!--- 新增商品分组 ---->
<div id="laybox" class="mlayerbox" >
名称:<input id="grp_name" type="text"><div class="input_btn" onclick="add_video_group()"> <div><span>确定</span></div></div>
</div>
<script>
var g_cur_page=1;
//--------商品管理--------
function group_marnger() {
$("#pop_group").show();
ajax_get_table(1);
}
$(".close_g").click(function () {
$("#pop_group").hide();
var op=layer.msg('加载中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '100px', time:0}) ;
//--- 关闭分组,就要重新刷新分组列表---
$.ajax({
url: "/index.php?m=Admin&c=Uploadify&a=get_group",
success: function (v) {
if(v.code==0){
layer.close(op);
var arr=v.data;
var html="<option value=\"\">选择分组</option>";
for(var ind in arr){
html+="<option value='"+arr[ind].id+"'>"+arr[ind].gpname+"</option>";
}
$("#group_id").html(html);
}
}
});
});
//ajax获取列表
function ajax_get_table(p) {
var keywords=$("#keywords").val();
var op=layer.msg('加载中...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: '100px', time:0}) ;
$.ajax({
url: "/index.php?m=Admin&c=Uploadify&a=ajax_video_group&p=" + p,
data:{keywords:keywords},
success: function (v) {
if(v!=""){
$("#return_ajax").html(v);
layer.close(op);
}
}
});
}
var ly_index=0;
var g_id=0;
//--新增分组--
function add_new_group() {
//--弹起新增分组--
ly_index= layer.open({
type: 1,
title: ["新增分组", 'font-size:14px;'],
skin: 'layui-layer-rim', //加上边框
area: ['350px', '120px'], //宽高
content: $('.mlayerbox'),
end : function() {
g_id=0;
$("#grp_name").val("");
}
});
}
//--删除分组--
function edit_g(ob) {
g_id=$(ob).attr("g_id");
var gname=$(ob).attr("g_name");
ly_index= layer.open({
type: 1,
title: ["新增分组", 'font-size:14px;'],
skin: 'layui-layer-rim', //加上边框
area: ['350px', '120px'], //宽高
content: $('.mlayerbox'),
end : function() {
g_id=0;
$("#grp_name").val("");
},
});
$("#grp_name").val(gname);
}
//--编辑分组--
function del_g(ob) {
var g_id=$(ob).attr("g_id");
if(confirm("确定后原有视频有该分组的会自动清除,您确定要删除嘛?")){
var url="/index.php?m=Admin&c=Uploadify&a=del_video_group&gid=" + g_id;
$.ajax({
url: url,
data:{},
dataType:'json',
success: function (data) {
if(data.code==0){
layer.msg('删除成功');
setTimeout(function () {
ajax_get_table(1);
layer.close(ly_index)
},1000)
}else{
layer.msg(data.msg, {icon: 1});
}
}
});
}
}
//--确定新增分组--
function add_video_group() {
var grp_name=$("#grp_name").val();
var url="/index.php?m=Admin&c=Uploadify&a=add_video_group&name=" + grp_name;
if(g_id>0) url+="&gid="+g_id;
$.ajax({
url: url,
data:{},
dataType:'json',
success: function (data) {
var text="添加成功";
if(g_id>0) text="编辑成功";
g_id=0;
$("#grp_name").val("");
if(data.code==0){
layer.msg(text);
setTimeout(function () {
ajax_get_table(1);
layer.close(ly_index)
},1000)
}else{
layer.msg(data.msg, {icon: 1});
}
}
});
}
//搜索视频
function search_video1() {
g_cur_page=1;
ajax_get_table(g_cur_page);
}
// 点击分页触发的事件
$(".pagination a").click(function () {
g_cur_page = $(this).data('p');
ajax_get_table(g_cur_page);
});
</script>