You've already forked qlg.tsgz.moe
137 lines
5.2 KiB
JavaScript
Executable File
137 lines
5.2 KiB
JavaScript
Executable File
var page = 1;
|
|
var pagesize = 10;
|
|
var condition = 1;
|
|
var isjiazai = 1;
|
|
var desc = 0;
|
|
|
|
function getData(page, pagesize, condition, keyword, desc) {
|
|
var data_set = {
|
|
page: page,
|
|
pagesize: pagesize,
|
|
condition: condition,
|
|
keyword: keyword,
|
|
desc: desc
|
|
}
|
|
mui.ajax(hyhUrl('app/shops/pageQuery'), {
|
|
|
|
data: data_set,
|
|
dataType: 'json', //服务器返回json格式数据
|
|
type: 'post', //HTTP请求类型
|
|
timeout: 10000, //超时时间设置为10秒;
|
|
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
|
// console.log(data.data.goodsFavoritesNum)
|
|
// console.log(data.data.Rows)
|
|
|
|
var data = toJson(data);
|
|
data = data.data;
|
|
var html = '';
|
|
if(data.Rows == '') {
|
|
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多店铺</p>');
|
|
isjiazai = 0;
|
|
return;
|
|
}
|
|
$.each(data.Rows, function() {
|
|
html += '<div class="block"><div class="b_title" data-shopId="' + this.shopId + '"><img class="b_img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="storename">' + this.shopName + '</p><p class="time">' + this.shopCompany + '</p><div class="btn_gz">进店</div></div><div class="b_con clearfix">';
|
|
|
|
$.each(this.goods, function() {
|
|
html += '<div data-goodId="' + this.goodsId + '" class="bc_img"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>¥' + this.shopPrice + '</p></div>';
|
|
});
|
|
html += '</div></div>'
|
|
});
|
|
if(page == 1) {
|
|
$('.con').html(html);
|
|
} else {
|
|
$('.con').append(html);
|
|
}
|
|
isjiazai = 1;
|
|
|
|
},
|
|
error: function(xhr, type, errorThrown) { //异常处理;
|
|
// alert(type);
|
|
}
|
|
});
|
|
|
|
}
|
|
mui.plusReady(function() {
|
|
var self = plus.webview.currentWebview();
|
|
keyword = self.data_keyword;
|
|
getData(page, pagesize, 1, keyword, 0)
|
|
mui('.con').on('tap', '.b_title', function() {
|
|
var shopId = $(this).attr('data-shopId');
|
|
mui.openWindow({
|
|
url: 'storeout.html',
|
|
id: 'storeout.html' + shopId,
|
|
styles: {
|
|
top: '0px', //新页面顶部位置
|
|
bottom: '0px', //新页面底部位置
|
|
width: '100%', //新页面宽度,默认为100%
|
|
height: '100%' //新页面高度,默认为100%
|
|
},
|
|
extras: {
|
|
shopId: shopId
|
|
// ..... //自定义扩展参数,可以用来处理页面间传值
|
|
},
|
|
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
|
// ......
|
|
}
|
|
}
|
|
})
|
|
})
|
|
mui('.con').on('tap', '.bc_img', function() {
|
|
var goodId = $(this).attr('data-goodId');
|
|
mui.openWindow({
|
|
url: 'details.html',
|
|
id: 'details.html' + goodId,
|
|
styles: {
|
|
top: '0px', //新页面顶部位置
|
|
bottom: '0px', //新页面底部位置
|
|
width: '100%', //新页面宽度,默认为100%
|
|
height: '100%' //新页面高度,默认为100%
|
|
},
|
|
extras: {
|
|
data_id: goodId
|
|
// ..... //自定义扩展参数,可以用来处理页面间传值
|
|
},
|
|
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
|
// ......
|
|
}
|
|
}
|
|
})
|
|
})
|
|
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
|
if(scroll.y == scroll.maxScrollY) {
|
|
if(isjiazai == 1) {
|
|
isjiazai = 0;
|
|
page++;
|
|
getData(page, pagesize, 1, keyword, 0)
|
|
}
|
|
|
|
}
|
|
})
|
|
}) |