-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduct_list.php
203 lines (127 loc) · 5.69 KB
/
product_list.php
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
<?php
include('php/identify.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>product_list</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="x-nav">
<span class="layui-breadcrumb">
<a target="_parent" href="index.php">首页</a>
<a href="product_list.php">产品管理</a>
<a>
<cite>产品列表</cite></a>
</span>
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
<i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
<div class="layui-inline" >
<table class="layui-hide" id="LAY_table_user" lay-filter="useruv"></table>
</div>
<script type="text/html" id="barDemo">
<a class="layui-btn layui-btn-xs " onclick="" lay-event="edit"><i class="layui-icon"></i>文字编辑</a>
<button class="layui-btn layui-btn-warm layui-btn-xs" onclick="" lay-event="img"><i class="layui-icon"></i>图片修改</button>
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del"><i class="layui-icon"></i>删除</a>
</script>
<script src="./lib/layui/layui.js"></script>
<script>
layui.use('table', function(){
var table = layui.table,form = layui.form;
//方法级渲染
table.render({
elem: '#LAY_table_user'
,url: 'php/product/product_query.php'
,cols: [[
{field:'product_id', title: '产品ID', sort: true, fixed: false,width:100}
,{field:'product_name', title: '产品名称', sort: false, fixed: false,width:180}
,{field:'product_all', title: '产品介绍', sort: false, fixed: false}
,{field:'product_img_url', title: '产品PC配图', sort: false, fixed: false}
,{field:'product_wap_img_url', title:'产品WAP配图', sort: false, fixed: false}
,{field:'product_class', title:'产品分类', sort: false, fixed: false,width:120}
,{field:'right', title: '操作', width:178,align:'center',toolbar:"#barDemo", fixed: 'right',width:300}
]]
,id: 'testReload'
,page: true
//,height: 600
});
//监听工具条
table.on('tool(useruv)', function(obj){
var data = obj.data;
if(obj.event === 'edit'){
var c='php/product/product_edit.php?product_id='+data.product_id;
x_admin_show('产品文本编辑',c,850,450);
} else if(obj.event === 'del'){
layer.confirm('确定删除这条产品信息?', function(index){
console.log(data);
obj.del();
layer.close(index);
$.ajax({
url: "php/product/product_delete.php",
type: "post",
data:{"product_id":data.product_id},
dataType: "text",
});
});
} else if(obj.event === 'img'){
var c='php/product/product_img_edit.php?product_id='+data.product_id;
x_admin_show('产品图片编辑',c,550,440);
}
});
$('.demoTable .layui-btn').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
function EidtUv(data,value,index,obj) {
$.ajax({
url: "UVServlet",
type: "POST",
data:{"uvid":data.id,"memthodname":"edituv","aid":data.aid,"uv":value},
dataType: "json",
success: function(data){
if(data.state==1){
layer.close(index);
//同步更新表格和缓存对应的值
obj.update({
uv: value
});
layer.msg("修改成功", {icon: 6});
}else{
layer.msg("修改失败", {icon: 5});
}
}
});
}
});
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#search_startdate' //指定元素
});
//执行一个laydate实例
laydate.render({
elem: '#search_enddate' //指定元素
});
});
</script>
</form>
</body>
</html>