Thinkphp项目结合JS消息提醒

Thinkphp项目结合JS消息提醒

这里简略贴下项目目录结构,请根据实际情况应用

项目结构简图

案例链接下载https://pan.baidu.com/s/1kVcsmQ7

接下来就是项目实际应用代码

  • index.html
<iframe name="right" id="rightMain" src="" frameborder="false" scrolling="auto" style="overflow-x:hidden;border:none;" width="100%" height="auto" allowtransparency="true" class="111"></iframe>
    <div class="tipfloat">
        <h2 class="tiphead"><strong>消息提示框</strong><span title="关闭" class="close"><img src="__PUBLIC__/admin/yuyue_manage/error.png"/></span></h2>
        <div class="ranklist">
            <ol id="ranklist">
                <li class="top"></li>
            </ol>
            <div style="display: none;">
                <audio id="im_ring" src="__PUBLIC__/admin/yuyue_manage/ring.mp3"></audio>
                <input type="hidden" id="opentip_num" value="on" />
            </div>
        </div>
    </div>
  • msg_tip.js
checkmsg();
function checkmsg() {
    var url = "index.php?s=/Admin/public/ajax_box.html";
    $.ajax({
        type: "GET",
        url: url,
        dataType: "json",
        success: function(msg) {
            var num = msg;
            var opentip_num = $('#opentip_num').val();
            if (num != opentip_num) {
                html = '';
                $.each(msg, function(i, data) {
                    html += '<li class="top"><p>' + data + '</p></li>';
                })
                opentipwindow(num, html);
            }
        }
    });
    setTimeout(function() {
        checkmsg();
    }, 10000);
}
function opentipwindow(num, str) {
    document.getElementById('im_ring').play();
    $('#ranklist').html(str);
    var titHeight = $("tiphead").height();
    $(".tipfloat").show();
    // $(".tipfloat").css('height',196);
    $(".tipfloat").css('height', 150);
    $(".close").click(function() {
        $(".tipfloat").animate({ height: titHeight - 50 }, 1000, function() {
            $(".tipfloat").hide();
        });
    });
}
function openwindowleft(targetUrl) {
    $('#loading').show();
    var titHeight = $("tiphead").height();
    $(".tipfloat").animate({ height: titHeight - 50 }, 1000, function() {
        $(".tipfloat").hide();
    });
    $("#rightMain").attr('src', targetUrl);
}

  • yuyue_manage下就是图片啦

  • PublicController.class.php

	public function ajax_box() {
		$info = I('ex');
		$id = session('admin_id');
		$map['status'] = 1;
		$count = M('OrderInfo')->where($map)->count();
		$where_g['status'] = 0;
		$goods = M('Goods')->where($where_g)->count();
		$where_sh['status'] = 0;
		$shops = M('Shops')->where($where_sh)->count();
		//$where_jie['money_status'] = 0;
		$where_jie['status'] = array('GT', 0);
		// pe($where_jie);
		$order = M('OrderInfo')->where($where_jie)->count();
		$data['count'] = '<a onclick="openwindowleft(\'' . U('OrderInfo/index') . '\')">新订单' . $count . '个</a>';
		$data['goods'] = '<a onclick="openwindowleft(\'' . U('Audit/goods') . '\')">未审核商品' . $goods . '个</a>';
		$data['shops'] = '<a onclick="openwindowleft(\'' . U('Audit/index') . '\')">未审核店铺' . $shops . '个</a>';
		$data['order'] = '<a onclick="openwindowleft(\'' . U('OrderInfo/index') . '\')">订单列表' . $order . '个</a>';
		$this->ajaxReturn($data);
	}

转载于:https://my.oschina.net/yeahlife/blog/666224

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值