$('.jggcj').css('display','none');
$('.time').css('display','none');
$('.title').eq(0).css('display','none');
mui.plusReady(function() {
var token = localStorage.getItem('token');
mui.ajax(hyhUrl('addon/hyhdailyupdate-Hyhdailyupdate-getIndex'), {
data: {
typeSrc: 1
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
var data = toJson(data);
data = data.data;
var html1 = '';
var html2 = '';
$.each(data['4'].list, function() {
html1 += '

 + ')
' + this.goodsName + '
¥' + this.shopPrice + '
';
});
$('#list1').html(html1);
$.each(data['5'].list, function() {
html2 += '
 + ')
' + this.goodsName + '
¥' + this.shopPrice + '
';
});
$('#list2').html(html2);
},
error: function(xhr, type, errorThrown) { //异常处理;
// alert(type);
}
});
mui.ajax(hyhUrl('addon/hyhlucky-Hyhlucky-getLuckyPrize'), {
data: {
draw_id: 1
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
var data = toJson(data);
data = data.data;
var html = ''
$('.cj_con').html(html);
$('.num .number').html(data.max_num)
$('.content').height($('.content').width() * 123 / 165 + 'px')
$(window).resize(function() {
$('.content').height($('.content').width() + 'px')
})
},
error: function(xhr, type, errorThrown) { //异常处理;
// alert(type);
}
});
// $('.content').height($('.content').width() * 123 / 165 + 'px')
// $(window).resize(function() {
// $('.content').height($('.content').width() + 'px')
// })
function time(a) {
return function() {
if(a > 8) {
a = parseInt(a % 8)
if(a == 0) {
a = 8;
}
}
$('.content').removeClass('active');
$('.content-' + a).addClass('active');
$('.zz_img').toggleClass('on');
}
}
// 在旋转的时候不能再次被点击
var t = true
$('.cj_con').on('tap', '.content-click', function() {
console.log(token)
if(t) {
t = false;
// 产生随机数
var prize;
var msg = '';
mui.ajax(hyhUrl('addon/hyhlucky-Hyhlucky-luckyDraw'), {
headers: {
"HYH-Token": token
},
data: {
draw_id: 1
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
var data = toJson(data);
console.log(data.msg)
if(data.status == 1) {
if($('.number').html() > 0) {
data = data.data;
prize = data.v;
msg = data.yes;
$('.number').html($('.number').html() - 1)
// 默认先转3圈
prize += 32
for(var i = 1; i <= prize; i++) {
setTimeout(time(i), 6 * i * i);
}
setTimeout(function() {
t = true;
alert(msg);
}, 6 * prize * prize)
} else {
alert('您没有抽奖机会了');
}
}
},
error: function(xhr, type, errorThrown) { //异常处理;
// alert(type);
}
});
}
})
//跳商品页面
$('.list').on('tap', '.list_block', function() {
var goodsId = $(this).attr('data-goodsId');
mui.openWindow({
url: 'details.html',
id: 'details.html'+goodsId,
styles: {
top: '0px', //新页面顶部位置
bottom: '0px', //新页面底部位置
width: '100%', //新页面宽度,默认为100%
height: '100%' //新页面高度,默认为100%
},
extras: {
data_id: goodsId
// ..... //自定义扩展参数,可以用来处理页面间传值
},
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
show: {
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
// extras: {} //窗口动画是否使用图片加速
},
waiting: {
autoShow: true, //自动显示等待框,默认为true
title: '正在加载...', //等待对话框上显示的提示内容
options: {
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
// ......
}
}
})
})
})