首页 技术 正文
技术 2022年11月7日
0 收藏 303 点赞 1,043 浏览 3671 个字
<input type="hidden" class="total_num" id="total" value="{$total}">
<div class="diy-richtext messagebox" style="padding-top:10px;">
{loop $messagelist $k $v}
<div class="message" rel='{$k}'>
<p class="message_icon"><img width="21" alt="" height="20" style="width: 20px; height: 20px;" src="../addons/ewei_shopv2/static/img/icon{$v['cateid']}.png" data-lazyloaded="true"></p>
<p class="message_cate" >&nbsp;&nbsp;{$v['cate_name']}</p>
<p class="message_title" >{$v['title']}
<span class="message_time" >{php echo date('Y-m-d H:i:s',$v['createtime']);}</span><br>
<p >{$v['detail']}<br>
</p><p><br>
</p>
</div>
{/loop}
</div><div class="fui-picturew row-4" onclick="getmore()" >加载更多..</div>
   $(function() {       $(window).scroll(function(){
var scrollTop = $(this).scrollTop(); //滚动条距离顶部的高度
var scrollHeight = $(document).height(); //当前页面的总高度
var clientHeight = $(this).height(); //当前可视的页面高度 if(scrollTop + clientHeight >= scrollHeight){ //距离顶部+当前高度 >=文档总高度 即代表滑动到底部 count++; //每次滑动count加1
// filterData(serviceTypeId,industryId,cityId,count); //调用筛选方法,count为当前分页数
getmore();
}
}); }); function getmore(){ var total = $('#total').val()
FoxUI.loader.show('mini');
var data = {'classid': "{$classitem['id']}", 'merchid': "{$item['id']}", 'k': total};
$.ajax({
url: "{php echo mobileUrl('shop/category/getmoreMessage')}",
data: data,
cache: false
}).done(function (result) {
var data = jQuery.parseJSON(result);
FoxUI.loader.hide();
if (data.status == 1) {
if(data.result.code == 1){
$('.messagebox').append(data.result.html);
$('#total').val(data.result.total);
}else if(data.result.code == 2){
FoxUI.toast.show ('暂无更多')
} } else {
alert("微信接口繁忙,请稍后再试!"); }
});
}
    public function main()//显示页面
{
global $_W; $total = 6;//默认加载条数
$limit = " limit 0,$total";
$messagelist = pdo_fetchall('SELECT * FROM ' . tablename('ewei_shop_merch_message').'where displayorder = :displayorder order by id desc'.$limit, array(':displayorder'=>0)); // var_dump($messagelist);exit;
include $this->template();
}
public function getmoreMessage()//ajax下拉页面
{
global $_W;
global $_GPC; $rel = isset($_GPC['k'])?$_GPC['k']:0;
$where = "1" ;
$offset = $rel;
$offnum = 4;
$where .= " order by id desc" ;
$where .= " limit $offset,$offnum" ;
$total = $offset + $offnum;
$list = pdo_fetchall('SELECT * FROM ' . tablename('ewei_shop_merch_message') . ' WHERE '.$where);
$html = '';
foreach ($list as $k => $v) {
$cateid = $v['cateid'];
$html.='<div class="message" rel="'.$k.'">
<p class="message_icon"><img width="21" alt="" height="20" style="width: 20px; height: 20px;" src="../addons/ewei_shopv2/static/img/icon'.$cateid.'.png" data-lazyloaded="true"></p>
<p class="message_cate" >&nbsp;&nbsp;'.$v['cate_name'].'</p>
<p class="message_title" >'.$v['title'].'
<span class="message_time" >'.date('Y-m-d H:i:s',$v['createtime']).'</span><br>
<p >'.$v['detail'].'<br>
</p><p><br>
</p>
</div>';
} if($list){
$arr = array('code' => 1, 'msg' => '','html'=>$html,'total'=>$total);
show_json(1, $arr);
}else{
$arr = array('code' => 2, 'msg' => '暂无更多.',);
show_json(1, $arr);
}
}

public function getmoreMessage()//ajax下拉页面
{
global $_W;
global $_GPC;

$rel = isset($_GPC[‘k’])?$_GPC[‘k’]:0;
$where = “1” ;
$offset = $rel;
$offnum = 4;
$where .= ” order by id desc” ;
$where .= ” limit $offset,$offnum” ;
$total = $offset + $offnum;
$list = pdo_fetchall(‘SELECT * FROM ‘ . tablename(‘ewei_shop_merch_message’) . ‘ WHERE ‘.$where);
$html = ”;
foreach ($list as $k => $v) {
$cateid = $v[‘cateid’];
$html.='<div class=”message” rel=”‘.$k.'”>
<p class=”message_icon”><img width=”21″ alt=”” height=”20″ style=”width: 20px; height: 20px;” src=”../addons/ewei_shopv2/static/img/icon’.$cateid.’.png” data-lazyloaded=”true”></p>
<p class=”message_cate” >&nbsp;&nbsp;’.$v[‘cate_name’].'</p>
<p class=”message_title” >’.$v[‘title’].’
<span class=”message_time” >’.date(‘Y-m-d H:i:s’,$v[‘createtime’]).'</span><br>
<p >’.$v[‘detail’].'<br>
</p><p><br>
</p>
</div>’;
}

if($list){
$arr = array(‘code’ => 1, ‘msg’ => ”,’html’=>$html,’total’=>$total);
show_json(1, $arr);
}else{
$arr = array(‘code’ => 2, ‘msg’ => ‘暂无更多.’,);
show_json(1, $arr);
}
}

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,564
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,412
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,185
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905