You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
147
static/app2/js/collect_store.js
Executable file
147
static/app2/js/collect_store.js
Executable file
@ -0,0 +1,147 @@
|
||||
mui.plusReady(function() {
|
||||
var page = 1;
|
||||
var isjiazai = 1;
|
||||
|
||||
function getData(page, pagesize) {
|
||||
var setdata = {
|
||||
page: page,
|
||||
pagesize: pagesize
|
||||
}
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
}
|
||||
isjiazai = 0;
|
||||
mui.ajax(hyhUrl('app/favorites/listShopQuery'), {
|
||||
|
||||
data: setdata,
|
||||
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);
|
||||
if(data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '';
|
||||
if(data.Rows == '') {
|
||||
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多</p>');
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="row shadown_wai"><div class="row_title"><img class="img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="s_t" data-shopId="' + this.shopId + '">' + this.shopName + '</p><button class="qxsc" data-favoriteId="' + this.favoriteId + '">取消收藏</button></div></div></div>';
|
||||
});
|
||||
if(page == "1") {
|
||||
$('.con').html(html);
|
||||
} else {
|
||||
$('.con').append(html);
|
||||
}
|
||||
|
||||
isjiazai = 1;
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
getData(page, 10);
|
||||
|
||||
//下拉加载
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
getData(page, 10)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
//店铺跳转
|
||||
mui(".con").on('tap', '.s_t', function() {
|
||||
// var tj = plus.webview.create('search.html');
|
||||
// tj.show();
|
||||
// mui.alert(e.target.attributes["data-id"].nodeValue);
|
||||
var shopId = this.attributes["data-shopId"].nodeValue;
|
||||
// console.log(this.attributes["data-id"].nodeValue);
|
||||
var url = 'storeout.html';
|
||||
if(shopId==1){
|
||||
url='self_shop.html'
|
||||
}
|
||||
mui.openWindow({
|
||||
url: url,
|
||||
id: url+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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
//取消关注
|
||||
$('.con').on('tap', '.qxsc', function() {
|
||||
var favoriteId = $(this).attr('data-favoriteId');
|
||||
var that = $(this);
|
||||
mui.ajax(hyhUrl('app/Favorites/cancel'), {
|
||||
|
||||
data: {
|
||||
id: favoriteId,
|
||||
type : 1
|
||||
},
|
||||
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);
|
||||
if(data.status == 1) {
|
||||
mui.alert(data.msg);
|
||||
location.reload();
|
||||
} else {
|
||||
//console.log(data.status)
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
// mui('.con').on('tap', '.img_btn', function() {
|
||||
//
|
||||
// if($(this).attr('src') == '../img/sanjiaoshang.png') {
|
||||
// $(this).parent().siblings('.row_con').css('display', 'none');
|
||||
// $(this).attr('src', '../img/sanjiaoxia.png')
|
||||
// } else {
|
||||
// $(this).parent().siblings('.row_con').css('display', 'block');
|
||||
// $(this).attr('src', '../img/sanjiaoshang.png')
|
||||
// }
|
||||
//
|
||||
// })
|
||||
|
||||
})
|
Reference in New Issue
Block a user