-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
312 lines (286 loc) · 9.48 KB
/
index.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="utf-8">
<!-- SEO -->
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="author" content="" />
<!-- 苹果专用 -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="blank" />
<meta name="format-detection" content="telephone=no" />
<!-- 简单移动端适配 -->
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<!-- 图标 -->
<link rel="shortcut icon" href="">
<title>蘑菇街</title>
<link rel="stylesheet" href="./css/index.css">
<link rel="stylesheet" href="./css/goods.css" />
<link rel="stylesheet" href="./css/swiper-3.4.0.min.css">
<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript" src="js/angular-route.min.js"></script>
<script src="./swiper/zepto.min.js"></script>
<script src="./swiper/swiper-3.4.0.jquery.min.js"></script>
<script src="./iscroll/iscroll.js"></script>
<!--<script src="js/app.js"></script>-->
<!--<script src="./js/scroll.js"></script>-->
<style>
#barcode {
position: absolute;
left: 80%;
top: 2.2rem;
background-color: red;
width: .50rem;
height: .5rem;
background: url(./img/barcode.png) no-repeat;
background-size: 100% 100%;
border: none 0;
outline: none;
}
#con {
overflow: hidden;
flex: 1;
margin-bottom: -.04rem;
}
</style>
</head>
<body ng-controller="mainCtrl">
<div class="container">
<header id="header">
<div class="top">
<a href="javascript:;">
<img src="./img/0.jpg">
</a>
</div>
</header>
<div class="form" id="form">
<a href="javascript:;" class="wei"></a>
<form action="javascript:;" class="search">
<input type="text" placeholder="简约百搭欧美大牌短靴">
</form>
<a href="javascript:;" class="cart"></a>
</div>
<div ng-view id="con">
</div>
<footer>
<a href="#/tmp/homePage" class="active">
<img src="./img/index.png">
<span>首页</span>
</a>
<a href="#/tmp/goodsPage">
<img src="./img/kind.png">
<span>良品</span>
</a>
<a href="#/tmp/listPage">
<img src="./img/good.png" id="btn">
<span>分类</span>
</a>
<a href="#/tmp/myShowPage">
<img src="./img/my.png">
<span>我的</span>
</a>
</footer>
</div>
<script type="text/javascript">
var oHeader = document.getElementById("header");
var oForm = document.getElementById("form");
var myApp = angular.module('myApp', ['ngRoute']);
myApp.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/tmp/homePage', {
templateUrl: 'tmp/homePage.html',
controller: 'homeCtrl',
controllerAs: 'home'
}, function() {
alert("你好!");
})
.when('/tmp/listPage', {
templateUrl: 'tmp/listPage.html',
controller: 'listCtrl',
controllerAs: 'ls'
})
.when('/tmp/goodsPage', {
templateUrl: 'tmp/goodsPage.html',
controller: 'goodsCtrl',
})
.when('/tmp/myShowPage', {
templateUrl: 'tmp/myShowPage.html',
controller: 'myShowCtrl',
})
.otherwise({
//重定向到url上只是url里面字符串改变
redirectTo: '/tmp/homePage',
})
}])
myApp.controller('mainCtrl', ['$scope', '$location', "$window", '$timeout', function($scope, $location, $window, $timeout) {
console.log("mainCtrl");
oHeader.style.display = "block";
oHeader.style.height = 2 + "rem";
oForm.style.display = "flex";
oForm.style.height = 0.92 + "rem";
}])
/*首页*/
myApp.controller('homeCtrl', ['$location', function($location) {
oHeader.style.display = "block";
oHeader.style.height = 2 + "rem";
oForm.style.display = "flex";
oForm.style.height = 0.92 + "rem";
//console.log(oHeader.style.height);
var mySwiper = new Swiper("#banner", {
loop: true,
pagination: '.swiper-pagination',
autoplay: 2000,
autoplayDisableOnInteraction: false,
observer: true
});
var oPullUp = $("#pull-up"),
oScroll = null;
oScroll = new iScroll("con", {
hScrollbar: false,
vScrollbar: false,
onScrollMove: function() {
console.log(this.y)
console.log(this.maxScrollY);
if(this.y < this.maxScrollY && !oPullUp.hasClass("up")) {
oPullUp.addClass("up").html('放开手加载数据 ');
} else if(this.y >= this.maxScrollY && oPullUp.hasClass("up")) {
oPullUp.removeClass("up").html('上拉加载');
} else if(this.y < -10) {
$('header').css({
display: 'none'
});
} else if(this.y > -10) {
$('header').css({
display: 'block'
});
}
},
onScrollEnd: function() {
if(oPullUp.hasClass('up')) {
oPullUp.html('Loading');
pullUpData();
}
},
onRefresh: function() {
if(oPullUp.hasClass("up")) {
oPullUp.removeClass("up").html("上拉加载");
}
},
});
function pullUpData() {
$.ajax({
type: 'get',
url: 'http://list.mogujie.com/search?cKey=h5-shopping&fcid=&pid=9750&searchTag=&sort=pop&page=2&ratio=3%3A4&_version=1&_=1478610876280&callback=?',
async: true,
dataType: 'JSONP',
jsonp: 'callback',
success: function(data) {
console.log(data);
var arr = data.result.wall.docs;
console.log(arr);
$.each(arr, function(k, v) {
$(".list").append('<a href="javascript:;" class="goods-item fl"><div class="goods-img"><img src=' + arr[k].img + ' class="con-icon"></div><div class="goods-info"><div class="name-box"><p class="goods-name">' + arr[k].title + '</p></div><div class="bot-box"><p class="p-price fl">¥' + arr[k].price + '</p><p class="p-feed fr">' + arr[k].cfav + '</p></div></div></a>')
});
oScroll.refresh();
}
})
}
}])
/*良品*/
myApp.controller('goodsCtrl', ['$scope', '$location', function($scope, $location) {
console.log("goodsCtrl");
oHeader.style.display = "none";
oHeader.style.height = 0;
oForm.style.display = "none";
//oForm.style.height = 0;
var mySwiper = new Swiper("#goods", {
loop: true,
pagination: '.swiper-pagination',
autoplay: 2000,
autoplayDisableOnInteraction: false,
observer: true
});
var mySwiper1 = new Swiper('#goods-wrap', {
slidesPerView: 3,
slidesPerGroup: 1
});
var oPullUp = $("#pull-up"),
oScroll = null;
oScroll1 = new iScroll("con", {
hScrollbar: false,
vScrollbar: false,
onScrollMove: function() {
console.log(this.y);
console.log(this.maxScrollY);
if(this.y < this.maxScrollY && !oPullUp.hasClass("up")) {
oPullUp.addClass("up").html('放开手加载数据 ');
} else if(this.y >= this.maxScrollY && oPullUp.hasClass("up")) {
oPullUp.removeClass("up").html('上拉加载');
}
},
onScrollEnd: function() {
if(oPullUp.hasClass('up')) {
oPullUp.html('Loading');
pullUpData();
}
},
onRefresh: function() {
if(oPullUp.hasClass("up")) {
oPullUp.removeClass("up").html("上拉加载");
}
},
});
function pullUpData() {
$.ajax({
type: 'get',
url: 'http://list.mogujie.com/search?cKey=h5-shopping&fcid=&pid=9750&searchTag=&sort=pop&page=2&ratio=3%3A4&_version=1&_=1478610876280&callback=?',
async: true,
dataType: 'JSONP',
jsonp: 'callback',
success: function(data) {
console.log(data);
var arr = data.result.wall.docs;
console.log(arr);
$.each(arr, function(k, v) {
$(".list").append('<a href="javascript:;" class="goods-item fl"><div class="goods-img"><img src=' + arr[k].img + ' class="con-icon"></div><div class="goods-info"><div class="name-box"><p class="goods-name">' + arr[k].title + '</p></div><div class="bot-box"><p class="p-price fl">¥' + arr[k].price + '</p><p class="p-feed fr">' + arr[k].cfav + '</p></div></div></a>')
});
oScroll1.refresh();
}
})
};
var interval = 1000;
function ShowCountDown(year, month, day, divname) {
var now = new Date();
var endDate = new Date(year, month - 1, day);
var leftTime = endDate.getTime() - now.getTime();
var leftsecond = parseInt(leftTime / 1000);
//var day1=parseInt(leftsecond/(24*60*60*6));
var day1 = Math.floor(leftsecond / (60 * 60 * 24));
var hour = Math.floor((leftsecond - day1 * 24 * 60 * 60) / 3600);
var minute = Math.floor((leftsecond - day1 * 24 * 60 * 60 - hour * 3600) / 60);
var second = Math.floor(leftsecond - day1 * 24 * 60 * 60 - hour * 3600 - minute * 60);
var cc = document.getElementById(divname);
cc.innerHTML = '<span class="count-h">'+hour+'</span>:<span class="count-s">'+second+'</span>:<span class="count-m">'+minute+'</span>';
}
window.setInterval(function() {
ShowCountDown(2016, 11, 19, 'time');
}, interval);
}]) /*列表页*/
myApp.controller('listCtrl', ['$location', function($location) {
oHeader.style.display = "none";
oHeader.style.height = 0;
oForm.style.display = "flex";
//oForm.style.height = .92rem;
}]);
/*我的*/
myApp.controller('myShowCtrl', ['$scope', function($scope) {
console.log("myShowCtrl");
oHeader.style.display = "none";
oHeader.style.height = 0;
oForm.style.display = "none";
oForm.style.height = 0;
}])
</script>
</body>
</html>