You've already forked qlg.tsgz.moe
145 lines
6.6 KiB
JavaScript
Executable File
145 lines
6.6 KiB
JavaScript
Executable File
$('.title p').html('');
|
|
mui.plusReady(function() {
|
|
mui.ajax(hyhUrl('addon/hyhdailyupdate-Hyhdailyupdate-getIndex'), {
|
|
data: {
|
|
typeSrc: 0
|
|
},
|
|
dataType: 'json', //服务器返回json格式数据
|
|
type: 'post', //HTTP请求类型
|
|
timeout: 10000, //超时时间设置为10秒;
|
|
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
|
var data = toJson(data);
|
|
data = data.data;
|
|
var html1 = '';
|
|
var html2 = '';
|
|
var html3 = '';
|
|
|
|
$.each(data['1'].list, function() {
|
|
html1 += '<div class="gchh_block" data-goodsId="' + this.goodsId + '"><img class="gchh_b_bg" src="../img/guochan_con_bg.png" /><div class="gchh_b_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>¥' + this.shopPrice + '</p></div></div>'
|
|
});
|
|
$('.gchh').html(html1);
|
|
$('.title').eq(0).children('p').html(data['title_1'].name);
|
|
$.each(data['2'].list, function() {
|
|
html2 += '<div class="zdzb_block" data-goodsId="' + this.goodsId + '"><img src="../img/ac2_zdzb_bg.png" /><div class="zdzb_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>' + this.goodsName + '</p><b>¥</b><span class="cost">' + this.shopPrice + '</span><div class="zdzb_btn">立即购买</div></div><img class="zdzb_zzc" src="../img/ac2_zdzb_zzc.png" /></div>'
|
|
});
|
|
$('.zdzb').html(html2);
|
|
$('.title').eq(1).children('p').html(data['title_2'].name);
|
|
|
|
$.each(data['3'].list, function() {
|
|
html3 += '<div class="zdzb3_block" data-goodsId="' + this.goodsId + '"><img src="../img/ac2_ac3_bg.png" /><div class="zdzb3_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>RMB ' + this.shopPrice + '</p><img class="sanjiao" src="../img/ac2_sanjiao.png" /></div></div>';
|
|
});
|
|
$('.zdzb3').html(html3)
|
|
$('.title').eq(2).children('p').html(data['title_3'].name);
|
|
},
|
|
error: function(xhr, type, errorThrown) { //异常处理;
|
|
// alert(type);
|
|
}
|
|
});
|
|
//跳商品页面
|
|
$('.gchh').on('tap', '.gchh_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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
|
// ......
|
|
}
|
|
}
|
|
})
|
|
})
|
|
//跳商品页面
|
|
$('.zdzb').on('tap', '.zdzb_block', function() {
|
|
var goodsId = $(this).attr('data-goodsId');
|
|
console.log(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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
|
// ......
|
|
}
|
|
}
|
|
})
|
|
})
|
|
//跳商品页面
|
|
$('.zdzb3').on('tap', '.zdzb3_block', function() {
|
|
var goodsId = $(this).attr('data-goodsId');
|
|
console.log(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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
|
// ......
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}) |