-
Notifications
You must be signed in to change notification settings - Fork 0
/
t_shop.html
215 lines (204 loc) · 8.91 KB
/
t_shop.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>礼物</title>
<link href="css/mui.min.css" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="css/mui.min.css">
<!--App自定义的css-->
<link rel="stylesheet" type="text/css" href="css/app.css"/>
<link rel="stylesheet" type="text/css" href="css/iconfont.css"/>
<link rel="stylesheet" type="text/css" href="css/mui-icon-extra.css"/>
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script src="js/mui.min.js"></script>
<script src="js/tool.js"></script>
<script>
var userid = GetUseridCookie().get("userid");
function deletegift(giftid){
mui.ajax('http://'+url+'/jizhibackend/servlet/DeleteGiftServlet',{
data:
{
userid:userid,
giftid:giftid,
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
success: function(data) {
// show();
javascript:window.location.href="t_shop.html";
},
error: function(xhr, type, errorThrown) {
console.log(errorThrown);
console.log(type);
console.log(xhr);
}
});
}
function show(){
mui.ajax('http://'+url+'/jizhibackend/servlet/GetProductServelt',{
data:
{
userid:userid,
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
success: function(data) {
//document.getElementById('content').innerHTML=JSON.stringify(data);
list(data);
},
error: function(xhr, type, errorThrown) {
console.log(errorThrown);
console.log(type);
console.log(xhr);
}
});
function list(data){
var list=document.getElementById('list');
list.innerHTML='';
data1=data.gifts;
jQuery.each(data1,function(index,item){
var li=document.createElement('li');
li.className='mui-table-view-cell mui-media mui-col-xs-6';
li.innerHTML='<img class="mui-media-object" src='+item.dp_url+' style="width:100px;height:100px">'+
'<div style="margin-bottom:3%">'+item.name+'</div>'+
'<div style="height: 20px;">'+
'<div style="width:50%;height:20px;float:left;font-size:12px;text-align: center; " >'+
'所需积分:'+item.price+'  '+
'</div>'+
'<div style="width:50%;height:20px;float:right;font-size:12px;text-align: center;">'+
'剩余数量:'+item.numbers+'    '+
'</div>'+
'</div>'+
' <div style="padding-left: 20px;padding-right: 20px;width:100%;height:50px">'+
' <button style="width:40%;float:left;" onclick=deletegift(\"'+item.gift_id+'\") class="mui-btn mui-btn-royal mui-btn-outlined">删除</button>'+
' <button style="width:40%;float:right;background-color: #FF9224;color:#ffffff;" onclick=javascript:window.location.href="updateproduct.html?giftid='+item.gift_id+'" )>更新</button>'+
' </div>';
list.appendChild(li);
});
}
}
</script>
</head>
<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav " href="t_user.html"></a>
<h1 class="mui-title">礼物</h1>
<a class="mui-icon mui-icon-plus mui-pull-right" href="addproduct.html"></a>
</header>
<div class="mui-content" id='content'>
<!--<div style="margin-top: 3%;margin-bottom:3%;padding-left:5%;background-color: #FFFFFF;padding-top: 2%;padding-bottom: 2%;">
<span class="mui-icon-extra mui-icon-extra-gold "></span>
剩余积分:100
</div>-->
<ul class="mui-table-view mui-grid-view" id="list">
<!--<li class="mui-table-view-cell mui-media mui-col-xs-6">
<img class="mui-media-object" src="images/abc_btn_check_to_on_mtrl_015.png">
<div style="height: 20px;">
<div style="width:50px;height:20px;float:left;font-size:12px; text-align: center;" >
所需积分:5
</div>
<div style="width:50px;height:20px;float:right;font-size:12px;text-align: center;">
剩余数量:5   
</div>
</div>
<div style="padding-left: 20px;padding-right: 20px;width:100%;height:50px">
<button style="width:40%;float:left">兑换</button>
<button style="width:40%;float:right">兑换</button>
</div>
</li>-->
<!--<li class="mui-table-view-cell mui-media mui-col-xs-6">
<img class="mui-media-object" src="images/abc_btn_check_to_on_mtrl_015.png">
<div style="height: 20px;">
<div style="width:50px;height:20px;float:left;font-size:12px" >
所需积分:5
</div>
<div style="width:60px;height:20px;float:right;font-size:12px">
剩余数量:5   
</div>
</div>
<button style="width:50%">兑换</button>
</li>
<li class="mui-table-view-cell mui-media mui-col-xs-6">
<img class="mui-media-object" src="images/abc_btn_check_to_on_mtrl_015.png">
<div style="height: 20px;">
<div style="width:50px;height:20px;float:left;font-size:12px" >
所需积分:5
</div>
<div style="width:50px;height:20px;float:right;font-size:12px">
剩余数量:5   
</div>
</div>
<button style="width:50%">兑换</button>
</li>-->
</ul>
</div>
</body>
<script>
mui.init({
swipeBack:true //启用右滑关闭功能
});
var userid = GetUseridCookie().get("userid");
mui('body').on('tap','a',function(){document.location.href=this.href;});
mui.ajax('http://'+url+'/jizhibackend/servlet/getProductforTeacServlet ',{
data:
{
userid:userid,
},
xhrFields: {
withCredentials: true
},
crossDomain: true,
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
success: function(data) {
//document.getElementById('content').innerHTML=JSON.stringify(data);
list(data);
},
error: function(xhr, type, errorThrown) {
console.log(errorThrown);
console.log(type);
console.log(xhr);
}
});
function list(data){
var list=document.getElementById('list');
data1=data.gifts;
jQuery.each(data1,function(index,item){
var li=document.createElement('li');
li.className='mui-table-view-cell mui-media mui-col-xs-6';
li.innerHTML='<img class="mui-media-object" src='+item.dp_url+' style="width:100px;height:100px">'+
'<div style="margin-bottom:3%">'+item.name+'</div>'+
'<div style="height: 20px;">'+
'<div style="width:50%;height:20px;float:left;font-size:12px;text-align: center; " >'+
'所需积分:'+item.price+
'</div>'+
'<div style="width:50%;height:20px;float:right;font-size:12px;text-align: center;">'+
'剩余数量:'+item.numbers+
'</div>'+
'</div>'+
' <div style="padding-left: 20px;padding-right: 20px;width:100%;height:50px">'+
' <button style="width:40%;float:left;" onclick=deletegift(\"'+item.gift_id+'\") class="mui-btn mui-btn-royal mui-btn-outlined">删除</button>'+
' <button style="width:40%;float:right;background-color: #FF9224;color:#ffffff;" onclick=javascript:window.location.href="updateproduct.html?giftid='+item.gift_id+'" )>修改</button>'+
' </div>';
list.appendChild(li);
});
}
</script>
</html>