288 lines
10 KiB
JavaScript
Executable File
288 lines
10 KiB
JavaScript
Executable File
|
||
function getData(topTypeId,secTypeId,html_){
|
||
mui.ajax(llUrl('addon/shuff-shuff-actGoodsList'), {
|
||
data:{
|
||
topTypeId:topTypeId,
|
||
secTypeId:secTypeId
|
||
},
|
||
dataType: 'json', //服务器返回json格式数据
|
||
type: 'post', //HTTP请求类型
|
||
timeout: 10000, //超时时间设置为10秒;
|
||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||
// var data = toJson(data, 1);
|
||
if(data.status == 1) {
|
||
var html = '';
|
||
var data = data.data;
|
||
$.each(data, function() {
|
||
html += '<div class="accc_block" data-goodsId="'+ this.goodsId +'"><img src="'+ ectImgUrl(this.goodsImg) +'" /><p>'+this.goodsName+'</p><span>'+this.shopPrice+'</span></div>';
|
||
});
|
||
html_.html(html);
|
||
html_.find('img').height(html_.find('img').width())
|
||
|
||
} else {
|
||
// console.log(data.status)
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// alert(errorThrown);
|
||
}
|
||
});
|
||
}
|
||
|
||
mui.plusReady(function() {
|
||
|
||
//双11弹窗
|
||
var lxy_div = '<div class="mui-backdrop lxy_home_zz" style="display: block;background-color: rgba(0,0,0,.7);" id="home_zhezhao"><div class="lxy_zz" style="width:100%"><img src="'+ectImgUrl('static/app2/img/to_coupon2.png')+'" /></div></div>';
|
||
|
||
$('body').append(lxy_div);
|
||
|
||
//点击让遮罩层消失
|
||
mui('body').on('tap', '#home_zhezhao', function() {
|
||
$('#home_zhezhao').css('display', 'none');
|
||
});
|
||
//跳转
|
||
mui('#home_zhezhao').on('tap', '.lxy_zz', function() {
|
||
mui.openWindow({
|
||
url: 'god_ect.html',
|
||
id: 'god_ect.html',
|
||
styles: {
|
||
top: '0px', //新页面顶部位置
|
||
bottom: '0px', //新页面底部位置
|
||
},
|
||
extras: {
|
||
// data_keyword: searchName
|
||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||
},
|
||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||
show: {},
|
||
waiting: {}
|
||
})
|
||
});
|
||
|
||
|
||
|
||
|
||
|
||
|
||
//折扣专区
|
||
mui.ajax(llUrl('addon/shuff-shuff-activityList'), {
|
||
data:{
|
||
topTypeId:105
|
||
},
|
||
dataType: 'json', //服务器返回json格式数据
|
||
type: 'post', //HTTP请求类型
|
||
timeout: 10000, //超时时间设置为10秒;
|
||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||
// var data = toJson(data, 1);
|
||
if(data.status == 1) {
|
||
var html = '';
|
||
var data = data.data;
|
||
$.each(data, function() {
|
||
html += '<div class="acct_block" data-topTypeId="105" data-secTypeId="'+ this.secTypeId +'"><p>'+ this.secTypeName +'</p></div>';
|
||
});
|
||
$('.acc_title').eq(0).html(html);
|
||
$('.acc_title').eq(0).find('.acct_block').eq(0).addClass('on');
|
||
getData(105,$('.acc_title').eq(0).find('.acct_block').eq(0).attr('data-secTypeId'),$('.acc_title').eq(0).siblings())
|
||
|
||
} else {
|
||
// console.log(data.status)
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// alert(errorThrown);
|
||
}
|
||
});
|
||
//11.11专区
|
||
getData(118,119,$('.acc_con').eq(1))
|
||
mui.ajax(llUrl('addon/shuff-shuff-activityList'), {
|
||
data:{
|
||
topTypeId:110
|
||
},
|
||
dataType: 'json', //服务器返回json格式数据
|
||
type: 'post', //HTTP请求类型
|
||
timeout: 10000, //超时时间设置为10秒;
|
||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||
// var data = toJson(data, 1);
|
||
if(data.status == 1) {
|
||
var html = '';
|
||
var data = data.data;
|
||
$.each(data, function() {
|
||
html += '<div class="acct_block" data-topTypeId="110" data-secTypeId="'+ this.secTypeId +'"><p>'+ this.secTypeName +'</p></div>';
|
||
});
|
||
$('.acc_title').eq(1).html(html);
|
||
$('.acc_title').eq(1).find('.acct_block').eq(0).addClass('on');
|
||
getData(110,$('.acc_title').eq(1).find('.acct_block').eq(0).attr('data-secTypeId'),$('.acc_title').eq(1).siblings())
|
||
|
||
} else {
|
||
// console.log(data.status)
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// alert(errorThrown);
|
||
}
|
||
});
|
||
mui.ajax(llUrl('addon/shuff-shuff-activityList'), {
|
||
data:{
|
||
topTypeId:115
|
||
},
|
||
dataType: 'json', //服务器返回json格式数据
|
||
type: 'post', //HTTP请求类型
|
||
timeout: 10000, //超时时间设置为10秒;
|
||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||
// var data = toJson(data, 1);
|
||
if(data.status == 1) {
|
||
var html = '';
|
||
var data = data.data;
|
||
$.each(data, function() {
|
||
html += '<div class="acct_block" data-topTypeId="115" data-secTypeId="'+ this.secTypeId +'"><p>'+ this.secTypeName +'</p></div>';
|
||
});
|
||
$('.acc_title').eq(2).html(html);
|
||
$('.acc_title').eq(2).find('.acct_block').eq(0).addClass('on');
|
||
getData(115,$('.acc_title').eq(2).find('.acct_block').eq(0).attr('data-secTypeId'),$('.acc_title').eq(2).siblings())
|
||
|
||
} else {
|
||
// console.log(data.status)
|
||
}
|
||
},
|
||
error: function(xhr, type, errorThrown) { //异常处理;
|
||
// alert(errorThrown);
|
||
}
|
||
});
|
||
|
||
mui('body').on('tap','.acct_block',function(){
|
||
$(this).addClass('on').siblings().removeClass('on');
|
||
getData($(this).attr('data-topTypeId'),$(this).attr('data-secTypeId'),$(this).parent().siblings())
|
||
})
|
||
mui('body').on('tap','.more',function(){
|
||
|
||
var topTypeId = $(this).attr('data-topTypeId');
|
||
|
||
mui.openWindow({
|
||
url: 'ac1111next.html',
|
||
id: 'ac1111next.html',
|
||
styles: {
|
||
top: '0px', //新页面顶部位置
|
||
bottom: '0px', //新页面底部位置
|
||
},
|
||
extras: {
|
||
topTypeId: topTypeId
|
||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||
},
|
||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||
show: {},
|
||
waiting: {}
|
||
})
|
||
})
|
||
mui('body').on('tap','.accc_block',function(){
|
||
|
||
var data_id = this.attributes["data-goodsId"].nodeValue;
|
||
mui.openWindow({
|
||
url: 'details.html',
|
||
id: 'details.html' + data_id,
|
||
styles: {
|
||
top: '0px', //新页面顶部位置
|
||
bottom: '0px', //新页面底部位置
|
||
},
|
||
extras: {
|
||
data_id: data_id
|
||
},
|
||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||
show: {},
|
||
waiting: {}
|
||
})
|
||
})
|
||
|
||
mui('body').on('tap','.next',function(){
|
||
$('#next').show();
|
||
})
|
||
mui('body').on('tap','#next',function(){
|
||
$('#next').hide();
|
||
})
|
||
$('.header').on('focus', '#keyword', function() {
|
||
$(".search button").css('display', 'block');
|
||
})
|
||
$('.header').on('blur', '#keyword', function() {
|
||
$(".search button").css('display', 'none');
|
||
})
|
||
//店铺搜索
|
||
$(".header").on('keypress', '#keyword', function(e) {
|
||
var keycode = e.keyCode;
|
||
var searchName = $('#keyword').val();
|
||
if(keycode == '13') {
|
||
// e.preventDefault();
|
||
// console.log(searchName)
|
||
//请求搜索接口
|
||
mui.openWindow({
|
||
url: 'ac1111next_.html',
|
||
id: 'ac1111next_.html',
|
||
styles: {
|
||
top: '0px', //新页面顶部位置
|
||
bottom: '0px', //新页面底部位置
|
||
width: '100%', //新页面宽度,默认为100%
|
||
height: '100%' //新页面高度,默认为100%
|
||
},
|
||
extras: {
|
||
data_keyword: searchName
|
||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||
},
|
||
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||
// ......
|
||
}
|
||
}
|
||
})
|
||
|
||
}
|
||
});
|
||
$(".header").on('tap', '.search button', function(e) {
|
||
var searchName = $('#keyword').val();
|
||
// e.preventDefault();
|
||
// console.log(searchName)
|
||
//请求搜索接口
|
||
mui.openWindow({
|
||
url: 'ac1111next_.html',
|
||
id: 'ac1111next_.html',
|
||
styles: {
|
||
top: '0px', //新页面顶部位置
|
||
bottom: '0px', //新页面底部位置
|
||
width: '100%', //新页面宽度,默认为100%
|
||
height: '100%' //新页面高度,默认为100%
|
||
},
|
||
extras: {
|
||
data_keyword: searchName
|
||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||
},
|
||
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||
// ......
|
||
}
|
||
}
|
||
})
|
||
|
||
});
|
||
|
||
}) |