qlg.tsgz.moe/static/app/js/share_user_list.js
2019-09-06 23:53:10 +08:00

99 lines
2.9 KiB
JavaScript
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var page = 1;
var userType = 0;
var isjiazai = 1;
function getData(page, userType) {
var data_set = {
page: page ? page : 1,
userType: userType ? userType : 0
}
if(isjiazai == 0) {
return;
} else {
isjiazai = 0;
mui.ajax(hyhUrl('app/users/getShareList'), { 
// headers: { 
// "HYH-Token": token
// },
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.Rows;
var html = '';
if(data == '') {
isjiazai = 0;
$('.con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;padding-top: 9px;">没有更多内容</p>');
return;
}
$.each(data, function() {
var defaultImg = userType==0? 'http://heyuanhui.com.cn/Template/mobile/new/Static/images/user68.png' :'http://heyuanhui.com.cn/Template/mobile/new/Static/images/user68.png';
var userPhoto = this.userPhoto == '' ? defaultImg : hyhImgUrl(this.userPhoto);
html += '<div class="row"><div class="row_top clearfix"><img class="img" src="' + userPhoto + '"/><p>' + this.loginName + '</p><img class="btn" src="../img/xiajiantou.png"/></div><div class="row_hid" style="display: none;"><div class="row_h_r"><p>注册时间:' + this.createTime + '</p></div></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 token = localStorage.getItem('token');
mui('.con').on('tap', '.row_top', function() {
if($(this).children('.btn').hasClass('ani')) {
$(this).children('.btn').removeClass('ani');
$(this).siblings('.row_hid').slideUp(300);
} else {
$(this).children('.btn').addClass('ani');
$(this).siblings('.row_hid').slideDown(300);
}
})
mui('.nav').on('tap','.block',function(){
if($(this).attr('data-userType')=='users'){
userType=0;
}else{
userType=1;
}
if($(this).hasClass('on')){
return;
}else{
$(this).addClass('on').siblings().removeClass('on');
mui('#pullrefresh').scroll().scrollTo(0,0,0);
$('.con').html('');
isjiazai=1;
page=1;
getData(page,userType);
}
})
getData(1, 0);
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if(scroll.y == scroll.maxScrollY&&scroll.y!=0) {
if(isjiazai == 1) {
page++;
getData(page, userType);
}
}
})
})