悬浮弹框显示二维码

弹框

<div class="zyl_zpjLi_3 clearfix" id="zyl_Li3">
                            <span class="share_posibtn">
                                <a href="javascript:void(0);" template-id="${data.id}">分享</a>
                                <div class="share_bbox" style="display: none;">
                                    <!-- <h2 class="share_mobh2 clearfix">
                                        <i class="fr"></i>
                                    </h2> -->
                                    <div class="share_mobimg">
                                        <img id="weixinChart${data.id}" src="" alt="">
                                    </div>
                                    <p class="share_mobp">微信扫一扫查看本模板效果</p>
                                </div>
                            </span>
                            <span style="margin-left:86px;"><a href="javascript:;" onclick="deleteInvitationTemplate(this,'${data.id}','${data.userId}');">删除</a></span>
                        </div>

*悬浮弹框显示二维码
*/
$('.share_posibtn a').hover(function(){
            $('.share_bbox').hide();
            var temidid = $(this).attr('template-id');
            var url = '/invitation/qrCode';
            if(!temidid){
                alert('系统故障,请稍后重试');
                return false;
            }
            var WIDTH = 120;
            var pcid = "#weixinChart"+temidid;
            $(pcid)[0].src = url + '?templetId=' + temidid + '&width=' + WIDTH + '&height=' + WIDTH;
            $(this).siblings('.share_bbox').show();
    },function(){
            $('.share_bbox').hide();
});
/**
     * 生成二维码图片
     * 
     * @param resp
     * @param width
     * @param height
     */
    @RequestMapping("/qrCode")
    public void makeQrCode(HttpServletResponse resp, Integer width, Integer height) {
    resp.setHeader("Cache-Control", "no-store");
    resp.setHeader("Pragma", "no-cache");
    resp.setDateHeader("Expires", 0);
    resp.setContentType("image/png");
    int iWidth = (width == null ? 200 : width);
    int iHeight = (height == null ? 200 : height);
    Map<EncodeHintType, Object> hints = new HashMap<>();
    hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
    hints.put(EncodeHintType.MARGIN, 0);
    SessionUser user = getSessionUser();
    String templetId = request.getParameter("templetId");
    int userId = 0;
    String url = "";
        // 如果为空的话,就取默认模板
    if (null == user) {
        url = weixinUtils.getMoCiApi()+"/invitation/h5?templetId=1&userId=0";
    } else {
        userId = user.getUserId();
        url = weixinUtils.getMoCiApi()+"/invitation/h5?templetId="
            + templetId + "&userId=" + userId;
    }

    BitMatrix bitMatrix = null;
    try {
        bitMatrix = new MultiFormatWriter().encode(url,
            BarcodeFormat.QR_CODE, iWidth, iHeight, hints);
        MatrixToImageWriter.writeToStream(bitMatrix, "png",
            resp.getOutputStream());
    } catch (Exception e) {
            logger.error("生成二维码出错:" + e.getMessage());
    }
    }
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值