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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
/*
* 全站公共脚本,基于jquery-1.9.1脚本库
*/
var isSettingOn = 0;
$(function() {
//阻止默认行为
document.body.addEventListener(
"touchmove",
function(e) {
e.preventDefault();
},
{ passive: false }
);
//微信分辨率纠错
function is_weixn()
{
var ua = navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i)=="micromessenger") {
return true;
} else {
return false;
}
}
function isIos()
{
var userAgentInfo = navigator.userAgent;
var Agents = new Array("iPhone");
var flag = false;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = true; break; }
}
return flag;
}
var fullHeight = document.documentElement.clientHeight;
if(fullHeight < 960){
$(".jr").css({width:'540px', left:'50px', top:'30px'});
$(".jr4").css({width:'540px', left:'50px', bottom:'10px'});
$(".p6-2").css({top:'30px'});
$(".p6-3").css({top:'90px'});
$(".p6-4").css({top:'730px'});
$(".p6-5").css({top:'730px'});
$(".p7-3").css({top:'830px'});
$(".p7-4").css({top:'830px'});
$(".p7-5").css({top:'830px'});
$(".p7-81").css({width:'440px', left:'100px', top:'50px'});
}
if(fullHeight > 1150){
$(".jr").css({top:'100px'});
$(".p6-3").css({top:'180px'});
$(".p6-4").css({top:'880px'});
$(".p6-5").css({top:'880px'});
$(".p7-81").css({width:'540px', left:'50px', top:'50px'});
$(".p7-82").css({bottom:'100px'});
}
var page = 0;
var swiperH = new Swiper('.swiper-container-h', {
pagination: '.swiper-pagination-h',
paginationClickable: true,
direction: 'vertical',
pagination : 'null',
spaceBetween: 50,
onSlideChangeEnd: function(swiper){
var np = parseInt(swiper.activeIndex);
//$(".mc").html(swiper.activeIndex);
page = np;
np++;
animates(np);
}
});
var html = new Array();
function remove(slide)
{
slide.html(html[page]);
}
function animates(slide)
{
var type = parseInt(slide);
$(".txt").fadeOut(100);
console.log("swip : " + type);
switch ( type )
{
case 1:
page1(slide);
break;
case 2:
page2(slide);
break;
case 3:
page3(slide);
break;
case 4:
page4(slide);
break;
case 5:
page5(slide);
break;
case 6:
page6(slide);
break;
case 7:
page7(slide);
break;
case 8:
page8(slide);
break;
case 9:
page9(slide);
break;
}
}
function page1(slide){
$(".p1-3").fadeIn(1000);
$(".p1-4").delay(1000).fadeIn(1000);
$(".p1-5").delay(2000).fadeIn(1000);
$(".p1-6").delay(3000).fadeIn(1000);
$(".p1-7").delay(4000).fadeIn(1000);
$(".p1-8").delay(5000).fadeIn(1000);
$(".p1-9").delay(6000).fadeIn(1000);
$(".p1-10").delay(7000).fadeIn(1000);
$(".p1-11").delay(8000).fadeIn(1000);
setTimeout(function(){
gun = true;
$(".t1-1").fadeIn(1000);
$(".t1-2").delay(1000).fadeIn(1000);
$(".t1-3").delay(2000).fadeIn(1000);
$(".t1-4").delay(3000).fadeIn(1000);
$(".t1-5").delay(4000).fadeIn(1000);
$(".t1-6").delay(5000).fadeIn(1000);
$(".t1-7").delay(6000).fadeIn(1000);
$(".t1-8").delay(7000).fadeIn(1000);
},10000);
$(".shang").fadeIn();
var nm = 0;
var tm = setInterval(function(){
if(!gun){
return false;
}
nm += 1;
$(".p1-14").scrollTop(nm);
if(nm > 500){
clearInterval(tm);
}
},1000/40);
}
function page2(slide){
$(".shang").delay(1000).fadeIn();
}
function page3(slide){
$(".shang").delay(1000).fadeIn();
}
function page4(slide){
$(".shang").delay(1000).fadeIn();
}
function page5(slide){
$(".shang").delay(1000).fadeIn();
}
function page6(slide){
$(".shang").delay(1000).fadeIn();
}
function page7(slide){
$(".shang").delay(1000).fadeIn();
}
function page8(slide){
$(".shang").delay(1000).fadeIn();
}
$(document).on("tap",".p6-3, .p6-4", function(){
chooseimg();
});
$(document).on("tap",".p6-5", function(){
if(pimg != ""){
wid = parseInt($("#pic").width());
hei = parseInt($("#pic").height());
le = parseInt($("#pic").css("left"));
to = parseInt($("#pic").css("top"));
// $.post("upload2.php",{'url':pimg, 'wid':wid, 'hei':hei, 'le':le, 'to':to}, function(data){
// if(data.msg == "ok"){
var nimg = new Image();
nimg.src = pimg;
nimg.onload = function(){
// pimg = data.url;
$(".temp2").fadeIn();
$(".p6-3 img").attr("src", pimg);
$(".bgimg img").attr("src", pimg);
}
// }else{
// alert(data.tishi);
// }
// },"json");
}else{
chooseimg();
}
});
$(document).on("tap",".p7-83", function(){
$(".p7-83").fadeOut();
});
$(document).on("tap",".p7-3", function(){
$(".p7-3").css({'background':'url(http://mallapp.guoguodz.com/h5_pic/appwww/Assets/Admin/images/btn_bg2.png)'});
if(mo == 1){
/*
$(this).css({'background':'url(images/btn_bg2.png)'});
setTimeout(function(){
$(".p7-3").css({'background':'url(images/btn_bg1.png)'});
},150);
*/
mtxt += 1;
mtxt = mtxt > 9 ? 2 : mtxt;
$(".p7-6 img").attr("src","http://mallapp.guoguodz.com/h5_pic/appwww/Assets/Admin/images/m" + mtxt + '.png');
}else{
mo = 1;
$(".p7-4").css({'background':'url(http://mallapp.guoguodz.com/h5_pic/appwww/Assets/Admin/images/btn_bg1.png)'});
$(".p7-2").fadeOut(100);
$(".p7-6").fadeIn(200);
}
});
$(document).on("tap",".p7-4", function(){
$(".p7-4").css({'background':'url(http://mallapp.guoguodz.com/h5_pic/appwww/Assets/Admin/images/btn_bg2.png)'});
if(mo == 2){
/*
$(this).css({'background':'url(images/btn_bg2.png)'});
setTimeout(function(){
$(".p7-4").css({'background':'url(images/btn_bg1.png)'});
},150);
*/
}else{
mo = 2;
$(".p7-3").css({'background':'url(http://mallapp.guoguodz.com/h5_pic/appwww/Assets/Admin/images/btn_bg1.png)'});
$(".p7-6").fadeOut(100);
$(".p7-2").fadeIn(200);
}
});
$(document).on("tap",".p7-5", function(){
if(mo == 1){
}else{
var txt1 = $(".txt1").val();
var txt2 = $(".txt2").val();
var txt3 = $(".txt3").val();
var txt4 = $(".txt4").val();
if(txt1 == "" && txt2 == "" && txt3 == "" && txt4 == ""){
tishi("请填写文字内容!");
return false;
}
}
$(".p7-9").fadeIn();
$.post("http://mallapp.guoguodz.com/h5_pic/appwww/index.php/Index/upload",{"sign_pic":sign_pic,"mo":mo, "mtxt":mtxt, 'txt1':txt1, 'txt2':txt2, 'txt3':txt3, 'txt4':txt4, 'user':user, 'pimg':pimg}, function(data){
if(data.msg == "ok"){
var nimg = new Image();
nimg.src = data.url;
nimg.onload = function(){
$(".p7-9").fadeOut();
$(".p7-81 img").attr("src", data.url);
$(".p7-8").fadeIn(1000);
}
}else{
alert("网络堵塞了,请稍后再试!");
}
},"json");
});
function page9(slide){
}
document.getElementById("pic").addEventListener('touchstart',touchstart);
document.getElementById("pic").addEventListener('touchmove',touchmove);
document.getElementById("pic").addEventListener('touchend',function(){
dragable = false;
le = parseInt($("#pic").css("left"));
to = parseInt($("#pic").css("top"));
wid = parseInt($("#pic").width());
hei = parseInt($("#pic").height());
var zl = le, zt=to;
if(le > 0){
zl = 0;
}
if(le < (wid - 349) * -1){
zl = (wid - 349) * -1;
}
if(to > 0){
zt = 0;
}
if(to < (hei - 620) * -1){
zt = (hei - 620) * -1;
}
if(wid < 349){
wid = 349;
zl = 0;
}
if(hei < 620){
hei = 620;
zt = 0;
}
//$("#pic").css({left: zl + "px",top:zt + 'px'});
// $("#pic").css({width:wid + 'px', height: hei + 'px', left: zl + "px",top:zt + 'px'});
return false;
});
var x1,x2,y1,y2,le,to,dian1,dian2,wid,hei,ratio,dragable;
function touchstart(e){
e.stopImmediatePropagation();
dragable = true;
le = parseInt($("#pic").css("left"));
to = parseInt($("#pic").css("top"));
wid = parseInt($("#pic").width());
hei = parseInt($("#pic").height());
x1 = e.touches[0].clientX;
y1 = e.touches[0].clientY;
if(typeof(e.touches[1]) != "undefined"){
x2 = e.touches[1].clientX;
y2 = e.touches[1].clientY;
var xdiff = e.touches[1].clientX - e.touches[0].clientX; // 计算两个点的横坐标之差
var ydiff = e.touches[1].clientY - e.touches[0].clientY; // 计算两个点的纵坐标之差
dian1 = Math.pow((xdiff * xdiff + ydiff * ydiff), 0.5);
}
}
function touchmove(e){
e.stopImmediatePropagation();
if(typeof(e.touches[1]) != "undefined"){
x1 = e.touches[0].clientX;
y1 = e.touches[0].clientY;
x2 = e.touches[1].clientX;
y2 = e.touches[1].clientY;
var xdiff = e.touches[1].clientX - e.touches[0].clientX; // 计算两个点的横坐标之差
var ydiff = e.touches[1].clientY - e.touches[0].clientY; // 计算两个点的纵坐标之差
dian2 = Math.pow((xdiff * xdiff + ydiff * ydiff), 0.5);
var zhi = parseInt(dian2 - dian1);
if(zhi > 5){
ratio = 1.01;
}else if(zhi < 5){
ratio = 0.99;
}
wid = parseInt($("#pic").width());
hei = parseInt($("#pic").height());
le = parseInt($("#pic").css("left"));
to = parseInt($("#pic").css("top"));
var vw = wid * ratio;
var vh = hei * ratio;
var vl = (vw - wid) / 2 * -1 + le;
var vt = (vh - hei) / 2 * -1 + to;
// $("#pic").css({width:vw + 'px', height: vh + 'px', left: vl + "px",top:vt + 'px'});
}else{
if (dragable)
{
var x = (e.touches[0].clientX - x1);
var y = (e.touches[0].clientY - y1);
wid = parseInt($("#pic").width());
hei = parseInt($("#pic").height());
var lex = le + x;
var toy = to + y;
var ml = (wid - 349) * -1;
var mt = (hei - 620) * -1
if(lex > 0){
lex = 0;
}
if(le < ml){
lex = ml;
}
if(toy > 0){
toy = 0;
}
if(to < mt){
toy = mt
}
// $("#pic").css({left: lex + "px",top:toy + 'px'});
//document.title = le +'='+ to +'='+ lex +'='+ toy;
}
}
}
//加载成功
window.onload = function()
{
loadImage();
var k = 0, kuan=0;
var timer = setInterval(function(){
k += 1;
kuan += 4.55;
$(".load2").css({width: kuan + 'px'});
if(k == 100){
clearInterval(timer);
loadend();
}
},1000/20);
}
var downImg = 0;//已下载数量
var percent = 0;//百分比
var length = 0;
function loadImage() {
var img = $("body").find("img[loadsrc]");//图片数组
length = img.length;//图片数量
for ( var i=0;i<length;i++ )
{
var imgs = new Image();
var imgDiv = img.eq(i);
var imgsrc = imgDiv.attr("loadsrc");
imgs.src = imgsrc;
if(imgs.complete)
{
imgDiv.attr("src",imgsrc).removeAttr("loadsrc");//有缓存
imgDown();
}
else
{
imgDiv.attr("src",imgsrc).load(function(){
$(this).removeAttr("loadsrc");//无缓存
imgDown();
})
}
}
}
function imgDown()
{
downImg ++;
percent = parseInt(100*downImg/length);
//$(".progress").html(percent + '%');
if ( percent == 100 )
{
}
}
function loadend(){
$(".loading-wrapper").remove();
$("#mySwiper").css({"visibility":"visible",y:fullHeight});
animates(1);
//swiperH.slideTo(5, 600,false);
}
//背景音乐开关
$(".mc").on("tap",function(){
if ( $(this).hasClass("play") )
{
$(this).removeClass("play");
document.getElementById("bgmusic").pause();
$(".yinyue").attr('src',off);
}
else
{
$(this).addClass("play");
document.getElementById("bgmusic").play();
$(".yinyue").attr('src',on);
}
})
function getPar(par){
//获取当前URL
var local_url = document.location.href;
//获取要取得的get参数位置
var get = local_url.indexOf(par +"=");
if(get == -1){
return false;
}
//截取字符串
var get_par = local_url.slice(par.length + get + 1);
//判断截取后的字符串是否还有其他get参数
var nextPar = get_par.indexOf("&");
if(nextPar != -1){
get_par = get_par.slice(0, nextPar);
}
return get_par;
}
})